Use custom fonts in docio on server

Hi,

We have a program that creates a word document from scratch on a web server, converts the document to a PDF and sends it to the user for download. Syncfusion works really well for this task, as we never have to store the document or any templates on the server.

The client has asked that we produce the report using their corporate fonts, and I can't currently see a way to do this. We can't install the font on the web server as we don't have permissions, but the file can be included in our program, but I can't see a way to reference this font in the document?

For example, we currently set the formatting using:
 WCharacterFormat arial = SetCharFormat(wordDocument, "Arial", fontSize, false);
but I think SetCharFormat accepts string fontname rather than a font object. Is there a way to use a custom font in DocIO without installing?

Once the font is used in the word document I assume that setting the embed fonts to true will mean they are used in the PDF too like below:
DocToPDFConverter converter = new DocToPDFConverter();
//Sets true to embed TrueType fonts
converter.Settings.EmbedFonts = true;

Thanks for your help,

Rob

1 Reply 1 reply marked as answer

MR Manikandan Ravichandran Syncfusion Team July 30, 2020 12:49 PM UTC

Hi Rob,

Thank you for contacting Syncfusion support

The Word to PDF conversion in our Essential DocIO library uses the fonts which is installed in the System. If suppose, the font used in the Word document is not installed in the system, it will use the alternate equivalent font installed in the machine. If you face difficulties to install the font, by having list of fonts in some folder, we can use font substitution event to set the fonts for which is missing in our system. For this case, we have prepared the sample and it can be downloaded from the below link.

https://www.syncfusion.com/downloads/support/forum/156484/ze/FontSubtitution_(2)-1910467906

To know more about font substitution, please refer our UG documentation link from the below link.
https://help.syncfusion.com/file-formats/docio/word-to-pdf#font-substitution

Please let us know if you have any other questions.

Regards,
Manikandan Ravichandran
 


Marked as answer
Loader.
Up arrow icon