How can I ensure consistent font rendering in PDF generation with Syncfusion DocIO in a .NET MAUI app?

I’m using the Syncfusion DocIO library to generate Word documents in the context of a .NET MAUI application. After generating the Word document, I convert it to a PDF. However, the fonts don’t render correctly in the PDF, and I’m unclear where Syncfusion retrieves the fonts used in the PDF conversion.

Does it pull fonts from the local system (e.g., the platform on which the MAUI app is running, such as Android, iOS, macOS, or Windows)?

To ensure the PDF report is generated consistently and identically across all platforms, I’d like to embed specific fonts directly into my project and reference them in the report generation class. How can I achieve this?


1 Reply

SA Sivakumar Alagusundharam Syncfusion Team January 23, 2025 04:57 PM UTC

Hi Malik,

Regarding your question: "Does it pull fonts from the local system (e.g., the platform on which the MAUI app is running, such as Android, iOS, macOS, or Windows)?":
When performing Word-to-PDF conversion, the Syncfusion DocIO library uses the fonts installed in the environment to measure and render the content of the Word document during the conversion process. If a specific font is not available in the environment, an alternate font will be used. This may result in differences in the output PDF, such as missing text or variations in font sizes.

Regarding your inquiry: "I’d like to embed specific fonts directly into my project and reference them in the report generation class. How can I achieve this?":
We have an event called SubstituteFont which allows you to substitute alternate fonts when the necessary fonts are not available in the production environment during the Word-to-PDF conversion.
For your reference, I have attached a sample application demonstrating this functionality.

Please refer to the links below to learn more about font substitution
UG documentation of font substitution
How to resolve font problems during Word to PDF or image conversion?

Note: Kindly place the required fonts in the ‘Assets’ folder before running the application.


Regards,
Sivakumar A.



Attachment: sample_f8fd10fe.zip

Loader.
Up arrow icon