dmester / pdftosvg.net

Fully managed .NET library for converting PDF files to SVG.
https://pdftosvg.net
Other
61 stars 13 forks source link

Exact font-family name not provided #20

Closed thomas-karthe closed 11 months ago

thomas-karthe commented 12 months ago

If a PDF includes fonts, that are not on the target machine, the used font-family name is documented in the PDF but not reflecting in the SVG.

In Acrobat reader the correct font name can be seen: image In the SVG it appears like this : .tx3KyHh{font-family:monospace;font-weight:bold;font-size:14.3px;}

The reported font-family is expected to be the correct one. This will make it easier to use the font if installed or to select a suitable substitution font.

dmester commented 11 months ago

You can expose the PDF font name by implementing a custom FontResolver. The PDF font name is available from the SourceFont passed to the font resolver. You can find an example how to implement a font resolver here:

https://pdftosvg.net/api/T_PdfToSvg_FontResolver

Be aware that this will often not be useful, since the name of the PDF font will often be different from the desired font family name.