converting html to pdf

0 Answers 30 Views
PdfProcessing WordsProcessing
Sanja Tolo
Top achievements
Rank 1
Iron
Iron
Sanja Tolo asked on 09 Feb 2024, 09:58 AM
Hello! I'm currently attempting to transform an HTML body into a PDF using HtmlFormatProvider, RadFlowDocument, and PdfFormatProvider.

Everything functions good when generating a PDF with standard characters. However, when incorporating characters such as "ćšđž," these specific characters seem to be missing.

Could you kindly provide guidance on resolving this issue?
Yoan
Telerik team
commented on 13 Feb 2024, 10:46 AM

Hello Sanja,

I tried to reproduce the described results on my end as well and I am able to achieve that behavior only in the NET Standard environment. Please correct me if I am wrong but if that is the case then the cause for these unusual results are the limitations of the PdfProcessing in NetStandard.

Unlike NET Framework, the NET Standard version of PdfProcessing does not offer a default mechanism to read fonts and requires a manual custom implementation. You can read more about this topic and find examples in the Cross-Platform Fonts and How to implement FontsProvider articles.

I am attaching for your disposal an implementation of the above-mentioned functionality that seems to resolve the issue at hand. Feel free to examine it, test it, and use it for your own purposes, and don't hesitate to ask questions if you have any. 

Note: The default HTML font is Times New Roman which is why it is the one being used in the attached implementation. You can add or change the fonts in the FontsProvider implementation depending on the fonts used in the initial document you will be importing.

If this approach happens to be insufficient please feel free to share any resources you can that can help me get more context regarding this case (sample HTML content, code snippets, projects, etc). However, keep in mind that this is a Q&A Form and everything will be visible and accessible to the public so make sure any sensitive data is removed or replaced with dummy data.

Let me know how it goes.

Regards,

Yoan

 

No answers yet. Maybe you can help?

Tags
PdfProcessing WordsProcessing
Asked by
Sanja Tolo
Top achievements
Rank 1
Iron
Iron
Share this question
or