 |
PdfFontCreateFromFile Method |
Loads a TrueType (.ttf) or OpenType (.otf) font from a file path and creates a
PdfFont. The font is subset-embedded into the output document — the
subset only contains glyphs that are actually used, keeping file size small.
This is the path to use for PDF/A and PDF/X output from scratch.
Namespace: SelectPdf.UniversalAssembly: SelectPdf.HtmlToPdf.Universal (in SelectPdf.HtmlToPdf.Universal.dll) Version: 26.4
Syntaxpublic static PdfFont CreateFromFile(
string fontFile,
float size
)
Public Shared Function CreateFromFile (
fontFile As String,
size As Single
) As PdfFont
Parameters
- fontFile String
- Absolute or relative path to a .ttf / .otf file.
- size Single
- The font size in points.
Return Value
PdfFontA new
PdfFont backed by the embedded TrueType font.
Exceptions| Exception | Condition |
|---|
| PdfDocumentException | Thrown when the file cannot be loaded as a TrueType / OpenType font. |
ExamplePdfFont body = PdfFont.CreateFromFile(@"C:\Windows\Fonts\arial.ttf", 11f);
Dim body As PdfFont = PdfFont.CreateFromFile("C:\Windows\Fonts\arial.ttf", 11.0F)
See Also