Custom fonts not working on converting html to pdf

Custom fonts are not rendering while converting html to pdf.css is rendered while fonts are not rendered in pdf generated. Is it supported to use custom fonts in pdf body while generating pdf? 


2 Replies

AM Arumugam Muppidathi Syncfusion Team January 19, 2026 12:30 PM UTC

Hi Abhay,


We have checked the reported issue on our end. Upon further analysis, we were able to replicate the issue, and the custom font is not rendering in the output PDF document when using our HtmlConverter library on the Windows platform. Currently, we are working on this, and we will provide further updates on January 21st, 2026.


In the meantime, we kindly request you to share your environment details, Syncfusion package name and version, .NET version, input HTML document, and complete code snippet. This will be helpful for us to analyze the issue and provide you with a prompt solution.


Regards,
Arumugam M



AM Arumugam Muppidathi Syncfusion Team January 21, 2026 12:52 PM UTC

Hi Abhay,

Thank you for your patience.
 
We have investigated the reported issue on our end. After further analysis, we found that when using custom fonts during HTML-to-PDF conversion, it is essential to specify the base URL as an argument in the Convert() method. The base URL represents the folder path where the resources used in the HTML such as images, style sheets, scripts, and font files are located.
 
For additional details, please refer to the documentation below:
HTML to PDF converter features in .NET PDF Library | Syncfusion
 
Below is the updated code snippet:
//Initialize the HTML to PDF converter.
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter();
BlinkConverterSettings settings = new BlinkConverterSettings();
settings.Scale = 1.0f; 
htmlConverter.ConverterSettings = settings;
string html = System.IO.File.ReadAllText("../../index.html");
string baseUrl = Path.GetFullPath("../../"); //use base path to load local resources like fonts
PdfDocument document = htmlConverter.Convert(html, baseUrl);
//Save and close the PDF document.
document.Save("Output.pdf");
//Close the document
document.Close(true);
 
This approach ensures that custom fonts are correctly preserved and embedded in the output PDF.
Please refer to the screenshot below, which confirms that the "Inter" font is successfully embedded as a TrueType font.
 
 
We used the Inter font as the custom font and placed it inside the fonts folder, which is located in the same directory as the .csproj file.
 
We have also attached the sample project along with the output PDF for your reference.
 
Please review this information and let us know your results. If you continue to experience any issues, we kindly request you to share the following details to help us analyze the problem more effectively:
 
  • Modified sample or project
  • Complete code snippet
  • Input HTML file
  • Syncfusion package name and version
  • .NET Framework/.NET Core version
 
This information will help us provide a quicker and more accurate solution.

Regards,
Arumugam M

Attachment: HTMLtoPDFFrameworkSample_f22431b6.zip

Loader.
Up arrow icon