Font Distortion on Conversion from Word to PDF

Dear Sir/Madam

In my attached files; when I convert my original word document to pdf through the pdf converter in my code sample attached, I get a totally different format (font style, size e.t.c) from what my actual word document contains.

How can I get the output pdf document to match exactly the converted word document.


Thank You


Attachment: Ticket_bed2549f.rar

3 Replies

DA Dharanitharan Ayyasamy Syncfusion Team November 11, 2024 10:15 AM UTC

Hi Ssekamatte James,

We suspect that you are using Blazor WASM application. To convert Word to PDF, it is necessary to access the font stream internally. Because, accessing the font stream cannot be done automatically in a Blazor WASM application, even though Word to PDF conversion works in a WASM app.

Refer to the below GitHub sample to access the font in the stream internally in sample:
https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Word-to-PDF-Conversion/Use-alternate-font-without-installing/Blazor/WASM-app


Steps to be followed before running the sample using your document:
1. Keep the required fonts for converting your document in the "wwwroot" folder.

2. Implement the FontSettings_SubstituteFont according to your fonts.

3. Now, right click the font file in the solution explorer and click "Properties" in the sample and set the below two properties (Build Action and Copy to Output) as highlighted in the screenshot (Embedded resource and copy if newer respectively).


4. Now convert the Word document to PDF and the fonts will get preserved properly.

If you are facing any problems after using the above steps, kindly attach the below things.
1. Modified issue reproducible sample.
2. Working environment details.


Regards,
Dharanitharan A.


Attachment: Sample_dd63cdde.pdf


IB IBS November 11, 2024 10:33 AM UTC

Can you share with me the ARIALN.TTF you have used because on my side the process in not working still.



DA Dharanitharan Ayyasamy Syncfusion Team November 12, 2024 08:00 AM UTC

Ssekamatte James, we have found that a support ticket has been created for the same query from your account in our Syncfusion support portal. As it contains more details like, code snippet, font files, etc., find follow the same ticket for more details regarding this query.


Loader.
Up arrow icon