C1.C1Report.4 not rendering RTF to PDF the same on a server

Posted by: toburnett on 23 January 2019, 8:24 pm EST

    • Post Options:
    • Link

    Posted 23 January 2019, 8:24 pm EST

    I have an RTF template that includes two images that I am loading into a C1PrintDocument using RenderRichText objects.

    When I export the document on my my web server it never seems to contain the image data, but on my local machine and any other developer machine it seems to work as expected.

    Is there any dependencies required for C1.C1Report.4 that I might be missing?

  • Posted 23 January 2019, 8:55 pm EST

    Here is a sample I used to test from a console app to verify its not just my application.

    I will attach both result locally that contains the images, and the version from the server that does not.

    
    //read in the RTF
    var rtfText = File.ReadAllText("sample.rtf");
    
    //create print doc
    var printDoc = new C1PrintDocument();
    printDoc.AllowNonReflowableDocs = true;
    printDoc.TagOpenParen = "[@@";
    printDoc.TagCloseParen = "@@]";
    
    //start dock
    printDoc.StartDoc();
    
    //add rtf containing img to renderer
    var obj = new RenderRichText(printDoc);
    obj.Rtf = rtfText;
    
    //Add renderer to body
    printDoc.Body.Children.Add(obj);
    
    //ask to render
    printDoc.RenderBlockRichText(obj.Rtf);
    
    //end doc
    printDoc.EndDoc();
    
    //Save to file
    printDoc.Export($"{ConfigurationManager.AppSettings["OutPath"]}sample.pdf", false);
    
    Console.WriteLine("Finished, hit any key to exit.");
    Console.ReadKey();
    
    
  • Posted 23 January 2019, 8:59 pm EST

    In the zip file there are the two PDFs generated as well as the sample rtf

    Docs.zip

  • Posted 24 January 2019, 9:50 am EST

    Hello,

    We are sorry, we are unable to replicate the issue at our end. We are successfully export file with images.

    For reference, please find the attached sample for reference.

    ~Manish

    C1ReportViewer_readRTFFile.zip

  • Posted 24 January 2019, 11:00 am EST

    I was able to figure it out, the images were too large for the page width, on windows 10 it seems something in windows was allowing that to be adjusted or handled on the server it was not, once I resized the images or removed the one outside the page width it rendered them as expected.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels