We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Set correct fonts to converted PDF files

Hello,

I would like to ask if there are any correct way to set the correct fonts to the content of exported/converted PDF file from Document Editor component?

My initial Document's font is set to Impact (in Document Editor component) to its whole content and then when I call the backend service which converts the content of SFDT file to PDF file using the following sample code is not working:

DocIORenderer renderer = new DocIORenderer();
renderer.Settings.PdfConformanceLevel = PdfConformanceLevel.Pdf_A1B;
renderer.Settings.EmbedFonts = true;
renderer.Settings.EmbedCompleteFonts = true;
PdfDocument pdfDocument = renderer.ConvertToPDF(document);

Even though, I have set the DocIORenderer's settings of EmbedFonts and EmbedCompleteFonts to true, it is no help at all and the final converted PDF file ends up having a title in Times New Roman and the rest in Arial fonts.

I have also attached the sample screenshots and the list of fonts which I have installed in my Docker container running in Linux.

Best regards,

Ignacy Mielniczek


Attachment: DocumentEditor_fonts_issue_7a091245.7z


12 Replies

KM Kavitha Muralitharan Syncfusion Team January 20, 2023 09:45 AM UTC

Hi Ignacy,


We suspect that the reported problems might be due to the contents of the input Word document used at your end. We need to investigate the contents of your input Word document to reproduce the exact problem at our end. So, could you please provide us the input Word document that was used at your end? Thereby, we will analyze further and provide you the appropriate solution at the earliest.



Regards,

Kavitha M




IM Ignacy Mielniczek January 20, 2023 02:53 PM UTC

Hello Kavitha M,


I have attached a sample SFDT file which is stored in our DB and on user request opened in DocumentEditor, then sent to ASP.NET Core backend service to be converted to PDF file.

By the way, we are using:

  • Syncfusion components v. 20.3.56 on Front-End Angular side
  • Syncfusion libaries v. 20.3.0.60 on backend side

Best regards,

Ignacy Mielniczek



Attachment: sample_sfdt_b8ca8d28.7z


KM Kavitha Muralitharan Syncfusion Team January 24, 2023 03:25 PM UTC

Ignacy, We tried to reproduce the reported issue by converting the Word document (that is converted from the SFDT) to PDF in a Linux Docker container on our end. But it works properly on our end. We have attached the sample that we used to try to reproduce the issue.

Note: Please find the input document "sample.docx" and output PDF "WordToPDF_SyncfusionDocker.pdf" generated in our end

We suspect that the issue is due to the docker commands that you used in your docker file. We have attached the sample, which contains the docker file. Please compare your docker commands with our docker commands and try to resolve the issue.

Please refer the below UG documentation to know about installing necessary fonts in Linux containers
https://help.syncfusion.com/file-formats/docio/faq#how-to-install-necessary-fonts-in-linux-containers

Please see the UG documentation below to learn more about Word to PDF conversion in Linux.
https://help.syncfusion.com/file-formats/docio/word-to-pdf#word-to-pdf-conversion-in-linux-os

You can also use the SubstituteFont event. You can identify the missing font during Word to PDF conversion. Please refer here for more information about this.

If you have a list of fonts in some folder and are having trouble installing the font in Docker, we recommend using the font substitution event to set the fonts that are missing in our system.
To learn more about font substitution, please refer to our documentation at the below link.
https://help.syncfusion.com/file-formats/docio/word-to-pdf#font-substitution
https://www.syncfusion.com/kb/8485/how-to-perform-font-substitution-in-word-to-pdf-conversion


Attachment: Docker_dd6cb52a.zip


IM Ignacy Mielniczek January 24, 2023 04:14 PM UTC

Hi Kavitha,


Thank you very much for a quick response. I will check them and will let you know if the problem has been resolved.


Best regards,

Ignacy Mielniczek





KM Kavitha Muralitharan Syncfusion Team January 25, 2023 04:44 AM UTC

You are welcome, Ignacy



IM Ignacy Mielniczek January 27, 2023 04:59 PM UTC

Hello Kavitha,

Even though, our project's Dockerfile looks identical to Dockerfile which you have sent me earlier, it is still no use. 

I am sending a SampleController.txt and the JSON.txt which is received by the DownloadSfdtAsPdf endpoint as attachment.

Best regards,
Ignacy Mielniczek


Attachment: DocumentEditor_Font_problem_part3_c3203623.7z


KM Kavitha Muralitharan Syncfusion Team January 30, 2023 02:33 PM UTC

Ignacy, Currently, we are checking the reported issue  and will update details by January 31, 2023.



KM Kavitha Muralitharan Syncfusion Team February 6, 2023 10:21 AM UTC

Hi Ignacy


Apologies for the delay.

we can reproduce the reported case. Currently, we are validating and will update you the details by February 7,2023.


Regards,

Kavitha M



KM Kavitha Muralitharan Syncfusion Team February 7, 2023 02:05 PM UTC

Ignacy, we have confirmed the reported issue as a defect and logged a defect report. We will fix this issue in our upcoming EJ2 patch release which is scheduled on end of February.


You can track the status of the bug through the below feedback link:

https://www.syncfusion.com/feedback/40924/resolve-the-font-family-mismatch-while-converting-sfdt-to-pdf

Disclaimer: “Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.”



RT Ragu Thanigasalam Syncfusion Team March 1, 2023 08:12 AM UTC

Ignacy, We are glad to announce that our patch release (v20.4.52) has been rolled out successfully. In this release, we have added the fix for the reported issue in "Set correct fonts to converted PDF files".

Please upgrade to the latest version packages to resolve this issue:

NPM links:

https://cdn.syncfusion.com/ej2/20.4.52/dist/ej2.min.js  


NuGet links:

https://www.nuget.org/packages/Syncfusion.Ej2.Wordeditor.ASPNet.Core/ 

https://www.nuget.org/packages/Syncfusion.Ej2.Wordeditor.ASPNet.MVC5/

Feedback link: https://www.syncfusion.com/feedback/40924/resolve-the-font-family-mismatch-while-converting-sfdt-to-pdf

Please let us know if you need any further assistance.



IM Ignacy Mielniczek March 28, 2023 05:07 PM UTC

Hello Ragu,


Thank you very much for the update. I will let you know if everything is all right.


Best re



SM Suriya Murugan Syncfusion Team replied to Ignacy Mielniczek April 5, 2023 07:04 AM UTC

Thanks for your update


Loader.
Up arrow icon