RadFlowDocument to PDF - ArialNarrow font issues

3 posts, 1 answers
  1. Tom
    Tom avatar
    3 posts
    Member since:
    Aug 2015

    Posted 03 Nov 2015 Link to this post

    Hello,

    I have a RadFlowDocument that I am exporting to PDF via the standard flow PDFFormatProvider. If the document has some text that used the Arial Narrow font that is either bold, italicized or both the PDF output is always showing just plain Arial Narrow. This seems to be the only font that is having this problem.

    Has anyone else encountered this or have any suggestions on how to fix it?

    Thanks,

    -Tom

  2. Answer
    Deyan
    Admin
    Deyan avatar
    135 posts

    Posted 06 Nov 2015 Link to this post

    Hello Tom,

    Thank you for contacting us about this issue.

    PdfProcessing uses internally Typeface.TryGetGlyphTypeface method in order to access font files installed on the machine. However, while debugging the issue I have noticed that there is a bug in this method and it always returns the normal "Arial Narrow" font file path even when we require the bold or italic version of this font. A similar issue with this font is discussed in this MSDN forum post.

    You can easily workaround this issue by simply register the correct font files before doing the PDF export. I am attaching a demo project that shows how exactly this can be achieved. A few words about this demo:
    • It is a console application.
    • Before exporting the PDF the RegisterWrongFontPaths method is executed. This method basically gets the bytes of the correct font files and registers them for the corresponding font properties.
    • Alternatively, you can embed the font files in you project and access the embedded font file bytes. This way you will not access the fonts from the file system and the program will be working even on machines where the "Arial Narrow" font files are not installed. 
    • When the demo program finishes, it opens the exported PDF file, so that you can view the result.

    I hope this information is helpful. If you have any other questions or concerns please do not hesitate to contact us again.

    Regards,
    Deyan
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Tom
    Tom avatar
    3 posts
    Member since:
    Aug 2015

    Posted 06 Nov 2015 Link to this post

    Hi Deyan,

     Thank you for your reply. This approach works perfectly. Thanks!

    -Tom

Back to Top