How to Load custom fonts with Pdfium in Blazor PDF Viewer
14 Aug 20261 minute to read
The Blazor SfPdfViewer uses Pdfium to extract text and render pages as images. Pdfium includes a limited set of built-in fonts. Use CustomFonts to supply additional fonts when the required fonts are not available.
To use CustomFonts, follow these steps:
-
Add the font files (TTF, TTC, or OTF) to the
wwwrootfolder so they are available as static assets at runtime. -
Reference the exact paths to these font files in the customFonts list. Ensure the paths resolve correctly when the app is running.

The following example shows how to load custom fonts into the PDF Viewer.
<SfPdfViewer2 DocumentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
Height="100%"
Width="100%"
CustomFonts="@customFonts">
</SfPdfViewer2>
@code {
private List<string> customFonts = new List<string> { "wwwroot/SIMSUN.TTC", "wwwroot/SIMSUNB.TTF"};
}The following example shows how to load a custom font using a CDN link.
<SfPdfViewer2 DocumentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
Height="100%"
Width="100%"
CustomFonts="@customFonts">
</SfPdfViewer2>
@code {
private List<string> customFonts = new List<string> { "https://cdn.jsdelivr.net/npm/[email protected]/fonts/arial-geo-bold-webfont.ttf" };
}View the custom fonts sample on GitHub.