Click or drag to resize
Pdf Library for .NET

PdfFont Methods

The PdfFont type exposes the following members.

Methods
 NameDescription
Public methodClone Creates a clone of this font, associated with the specified pdf document.
Public methodStatic memberCode exampleCreateCJKFont Creates a PdfFont from a standard Korean / Japanese / Chinese (CJK) font family. Like CreateStandardFont(PdfStandardFont, Single), these fonts are referenced by name (not embedded) — they ship with PDF/A-compliant readers, so the output is expected to render on any conforming viewer.
Public methodStatic memberCreateFromBytes Loads a TrueType / OpenType font from an in-memory byte array and creates a PdfFont. Convenience wrapper around CreateFromStream(Stream, Single); the font is subset-embedded into the output.
Public methodStatic memberCode exampleCreateFromFile 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.
Public methodStatic memberCreateFromStream Loads a TrueType / OpenType font from a Stream and creates a PdfFont. The stream must be positioned at the start of the font data and is read synchronously in full. The font is subset-embedded into the output.
Public methodStatic memberCreateFromSystemFont(PdfSystemFont) Resolves the system font described by systemFont and creates a PdfFont. Equivalent to CreateFromSystemFont(String, Single, PdfFontStyle) with the descriptor's family / size / style.
Public methodStatic memberCode exampleCreateFromSystemFont(String, Single) Resolves a font installed on the host system by family name and creates a PdfFont. Loads the actual TrueType / OpenType file via PdfSystemFonts and subset-embeds it into the output document.
Public methodStatic memberCreateFromSystemFont(String, Single, PdfFontStyle) Resolves a system font by family name + style and creates a PdfFont. The font is subset-embedded into the output document.
Public methodStatic memberCode exampleCreateStandardFont Creates a PdfFont from a standard PDF font family and size.
Public methodGetCharWidth Gets the width of the specified character in points.
Public methodCode exampleGetSystemFont Gets the system font this font was created from, or null when it did not come from one.
Public methodGetTextSize Gets the size (width and height) in points of the specified string when rendered with this font.
Public methodGetTextWidth Gets the width in points of the specified string.
Top
See Also