FontResolver.EmbedOpenType Property

Font resolver converting fonts in the PDF to OpenType (.otf) format and embedding them in the output SVG. If the font cannot be converted, the resolver in first hand tries to inline the glyphs. If this is not possible, the resolver falls back to the LocalFonts resolver.

public static FontResolver EmbedOpenType { get; }
PdfToSvg.NET (since v0.8.0)

Property Value



PDF documents store text encoded as character codes, and provide mappings from character codes to font glyphs and Unicode characters. Some documents map multiple character codes to the same Unicode character, giving PdfToSvg.NET a choice. Exporting both character codes as the same Unicode character results in good text representation but potentially visually inaccurate SVG’s. Remapping one of the character codes to another Unicode character ensures visually accurate SVG’s at the cost of inaccurate text representation if text is exported from the SVG.

When exporting text using an OpenType font, the library will remap duplicate character codes to characters in the Private Use Areas, making sure the exported SVG’s are visually accurate, but text might appear as a series of question marks, ������, in the SVG markup. If you intend to extract text from the SVG, consider exporting the SVG using FontResolver.LocalFonts instead.


The following example will embed fonts in the exported SVG as OpenType fonts.

Export fonts as OpenType fonts
var conversionOptions = new SvgConversionOptions
    FontResolver = FontResolver.EmbedOpenType,

using (var doc = PdfDocument.Open("input.pdf"))
    var pageNo = 1;

    foreach (var page in doc.Pages)
        page.SaveAsSvg($"output-{pageNo++}.svg", conversionOptions);

See Also

FontResolver Class
PdfToSvg Namespace