Re: Localized fonts in PDF export

WinForms

ComponentOne's WinForms controls

Localized fonts in PDF export

  • rated by 0 users
  • This post has 11 Replies |
  • 2 Followers
  • I have a C1PrintDocument with Croatian characters and I need to export it to PDF. While using the C1.C1Preview.Export.PdfExporter I get garbage letters when exporting for standard Eastern-European letters like ČčĆ抚ĐđŽž. Printing works fine.

    Using the alternate method - printing to PDFCreator I got an acceptable document, however using PDFCreator is not an option for me due to the limitations I have on the server.

    While the ComponentOne guys fix this I am looking for an alternate way, which doesen't include any external programs. Any help greatly appriciated.

    Report version: 2.6.20092.52106 

    The code snippet I am using:

                C1.C1Preview.Export.PdfExporter exp = new C1.C1Preview.Export.PdfExporter();
                C1.C1Preview.Export.PdfExportProvider nes = new C1.C1Preview.Export.PdfExportProvider();
                exp.Document = printDoc;
                exp.DocumentInfo.Title = FileName;
                exp.ShowOptions = false;
                exp.Export(@"C:\TEMP\" + FileName);


  • I could not reproduce the issue on my system (Vista 64) using your sample string in a RenderText.

    Please, download this build and try your program with it - and let me know whether it helps.

    If the problem remains - please post a complete sample that I can build and run, plus let me know which OS (incl. 32 or 64 bits) you're using.

    Cheers, Dima.
  • SlanjeStetePDF.rar

    I am using WinXP 32 bit.

    After further testing on my own, I found out there is a problem with exporting fonts to pdf. Export works fine for Excel or HTML. Unfortunately I cannot just change the font I am using as it is prescribed by our  honorable marketing team. I already posted the request for font change, in the meanwhile I'm stuck.

    I'm sending you the entire solution, with fonts I used for testing (using the dlls you sent). As I said, exports to Excel and HTML are fine. When an unknown font is used export works for all cases.

    Hope to hear from you soon,

    Regards

    Vladimir

  • Testing.zip

    Running your sample I could not repro the issue. Please check out the attachment - it contains the resulting PDF file and a screenshot of it viewed on my system, with File | Properties | Fonts dialog shown - please verify whether you see a similar picture, does the PDF looks ok to you, and also please post the PDF that you get on your own system, plus that fonts info dialog.

    So far my guess is that this issue is somehow related to the locale you're running on (I'm assuming it is not US/English) - so please:

    1. Let me know which locale are you using,
    2. If you have access to a system with the default US locale - or if you could change the locale on your own system for the test - please try running your test on such a system and see whether anything changes.
    3. The fonts that you include in your sample - are they any different from similar standard fonts?
    4. Finally, on your regular system, please try setting PdfExporter.EmbedTrueTypeFonts to FALSE (it is true by default) and see if that improves the result.
    Thanks.
    Cheers, Dima.
  • Testing.rar

    Thank you for your quick reply.

    However,  the file you sent is unusable. Only the Arial, Times New Roman and Arial Rounded MT Bold fonts are correctly displayed, the rest are not recognized. As they are not recognised they are displayed in default font (Calibri or something similar from the looks of it).

    If you could look more closely at the example I sent you, there are fonts included in the base directory. Notice also that I made the example export to HTML and Xls documents - in both of which fonts are exported properly. My guess is that something goes wrong in the code for pdf exporting with specific true type fonts.

    Just to be on the safe side, I also tried your recommendations, changing the locale and using EmbedTrueTypeFonts false but to no avail.

    I'm sending you the pdf with fonts displaying correctly for reference.

     

    Regards,

     Vladimir

  • That PDF file that you sent me - does it show all fonts and local chars correctly? If so - how did you obtain that file (I'm assuming it could not be with C1Reports as the bug we're discussing would've prevented that)? Please clarify.
    Cheers, Dima.
  • Hi again,

    We found the problem. There was an error in code analyzing whether a font was allowed to be embedded, as the result the fonts that caused the problem (which ARE marked as embeddable) were not embedded in the resulting PDF.

    Please let me know whether this issue is time-critical for you. If yes, I will try to redrop a 2009 v2 build with just this fix, otherwise the fix will be included in the coming 2010 v3 release.

    Cheers, Dima.
  • We need this functionality ASAP as we're already over the time limit for the project. I hope you can include the fix in v2 build.

    Hope to hear good news from you soon.

    Regards,
    Vladimir

     

    UPDATE: To answer your question in the last post, I used PDFCreator for the printer.

     

  • Sure, I'll try to make a v2 build within the next few days.
    Cheers, Dima.
  • Here's the build with the fix:

    download3.componentone.com/pub/Net/c1report/misc/C1Report.2_2.6.20092.52111.zip

    Let me know whether it fixes the issues. Thanks.

    Cheers, Dima.
  • Tested it with all reports, works beautifully, thank you for your quick response.

    Regards,
    Vladimir

  • Great, thanks for letting me know.
    Cheers, Dima.
Page 1 of 1 (12 items)