IRONSOFTWAREHOME
Custom Fonts in HTML to PDF

import com.ironsoftware.ironpdf.PdfDocument;
import com.ironsoftware.ironpdf.render.ChromePdfRenderOptions;

import java.io.IOException;
import java.nio.file.Paths;

String htmlWithFont = "<link href=\"https://fonts.googleapis.com/css?family=Lobster\"rel=\"stylesheet\"><p style=\"font-family: 'Lobster', serif; font-size:30px;\"> Hello Google Fonts</p>";
ChromePdfRenderOptions renderOptions = new ChromePdfRenderOptions();
renderOptions.setWaitFor(new WaitFor(500));

PdfDocument doc = PdfDocument.renderHtmlAsPdf(htmlWithFont, renderOptions);

// Save the PDF
try {
    doc.saveAs(Paths.get("assets/font.pdf"));
} catch (IOException exception) {
    String.format("Failed to save the PDF to the filesystem: %s", exception.getMessage());
    exception.printStackTrace();
}
mvn install
Custom Fonts in HTML to PDF

Custom Fonts in HTML to PDF

IronPDF's pixel-perfect rendering of PDF documents from HTML documents also includes the accurate rendering of custom web fonts, including font icons provided by libraries such as Font Awesome and Bootstrap Components.

IronPDF supports custom WOFF and SVG CSS font packages. This includes custom web fonts provided by online type foundries such as Google Fonts.

To convert a web page containing one or more custom fonts into a PDF properly, developers must set a PDF rendering delay on IronPdf's HTML-to-PDF rendering engine. This can be achieved by setting the renderDelay property of a ChromePdfRenderOptions instance to a proper value using its setRenderDelay method, as demonstrated in the example below. A minimum value of 500 milliseconds (or half a second) will suffice in most cases to ensure that all custom font/icon assets fully load before IronPdf converts all of the web page content into a PDF.

Please note, however, that web fonts do not work on Windows Apps hosted by Azure due to security reasons.

Learn to Set PDF Render Delay with IronPDF
View on GitHub

Ready to Get Started?

Version:2026.8just released

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

OR
bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried Iron Suite
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required
Java Maven Library for PDF
Install with Maven

Version: 2026.8

<dependency>
   <groupId>com.ironsoftware</groupId>
   <artifactId>ironpdf</artifactId>
   <version>2026.8.2</version>
</dependency>
https://central.sonatype.com/artifact/com.ironsoftware/ironpdf/2026.8.2
or
Java PDF JAR
Download JAR

Version: 2026.8

Manually install into your project