PDF .NET Library Logo

How to set the active font in PDF

The following code creates a PDF with sample text using the ARIAL font style.

C# sample:

PDFDocument doc = new PDFDocument("sample.pdf");

doc.CurrentPage.Body.SetActiveFont("Arial", PDFFontStyles.Regular, 12);

doc.CurrentPage.Body.AddText("Sample text.");

doc.Save();

Back to PDF Code Library