Text truncated when a report is exported to PDF format

Posted by: egrzesk on 17 June 2024, 9:34 am EST

    • Post Options:
    • Link

    Posted 17 June 2024, 9:34 am EST

    Problem:

    Text truncated from right when a report is exported to PDF format.

    PDF document generated by Active Reports truncates some text.

    The problem occurs when the control contains a longer string of characters without spaces, so that the text is split into two or more lines.

    I attached sample testing application ARExport2PDF that creates AR report which consists of 3 controls with the same text, but different width. On the preview the text is displayed correctly, but on exported PDF report we see that for first and second control text extends beyond the control area and for the third control (this is the worst behavior) text is truncated.

    I have tested it in AR11 and AR15 with the same results.

    See attached screenshots.

    Attachments:

    1. TEXT_CUTTING.rtf – input file with sample text
    2. TEXT_CUTTING.pdf – output file - report exported to PDF (here is the problem)
    3. ARExport2PDF.png – screenshot: report on preview vs report in pdf
    4. ARExport2PDF.7z – source code of test application

    TEXTCUTTING.7zARExport2PDF.7z

  • Posted 18 June 2024, 11:38 pm EST

    Hi Greg,

    Thanks for reaching out to us. We could observe this behavior in the latest version, i.e., ActiveReports v18.0.1, too. We have escalated the same to our development team for their insights [internal tracking ID: AR-33704]. Please note that if this turns out to be a bug, it’s fix will be provided in the latest version, and you’d have to upgrade to the same.

    Thanks for your patience!

  • Posted 20 June 2024, 8:01 am EST

    Hi Greg,

    As per our development team, the solution to this would be to migrate to the CrossPlatform compatibility mode and use HTML text instead of RTF, as RTF text is not supported in the RichTextBox control when using the CrossPlatform compatibility mode. Since the RTF to HTML conversion is not always 100% WYSIWYG, it is a design-time feature, and we do not convert the RTFs to HTML at runtime. As a workaround, the RTF to HTML at runtime by using any third-party library, such as RtfPipe and pass it to the Html property of the RichTextBox using proper HTML tags. Please refer to the attached sample implementing the same.

    You can also set the following properties for the RichTextBox controls to render RTF as an image. Using this, you can use GDI mode and RTF text, but this will make the quality of the text in the exported PDF a bit low.

    rtb.RtfRenderingType = RichTextRenderingType.TransparentPNG;
    rtb.RenderRtfAsContinuousImage = false;
    

    We hope this helps!

    Attachment:HTMLTextUsingRTFPipe.zip

Need extra support?

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

Learn More

Forum Channels