Articles in this section
Category / Section

How to use custom fonts in PDF?

1 min read

You can have custom fonts in the PDF by using the PdfTrueTypeFont class available under the namespace, Syncfusion.Pdf.Graphics. You have to initialize the PdfTrueTypefont with input font file. Refer to the following code example.


//Creating the PDF document.
PdfDocument document = new PdfDocument();
//Adding the page.
PdfPage page = document.Pages.Add();
//Loading the custom TTF font.
PdfFont font = new PdfTrueTypeFont(Server.MapPath("/App_Data/ARIALUNI.ttf"), 24);
//Drawing the Unicode string.
page.Graphics.DrawString("Hello PDF Sample", font, PdfBrushes.Black, 100, 100);
//Saving the document.
document.Save("Sample.pdf", Response, HttpReadType.Save);
//Closing the document.

Sample Link:

Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment