 |
PdfFontCollection Class |
Inheritance HierarchySystemObject
SelectPdf.UniversalPdfFontCollection
Namespace: SelectPdf.UniversalAssembly: SelectPdf.Universal (in SelectPdf.Universal.dll) Version: 26.4
Syntaxpublic class PdfFontCollection : IEnumerable<PdfFont>,
IEnumerable
Public Class PdfFontCollection
Implements IEnumerable(Of PdfFont), IEnumerable
The PdfFontCollection type exposes the following members.
Properties| | Name | Description |
|---|
 | Count | Gets the number of fonts in the collection. |
 | Document | Gets the parent PDF document. |
 | Item | Gets the font at the specified zero-based index. |
Top
Methods| | Name | Description |
|---|
 | Add(Byte) |
Adds a TrueType / OpenType font loaded from an in-memory byte array. Convenience
overload that avoids needing a temporary file.
|
 | Add(PdfFont) |
Adds an already-constructed PdfFont to the collection. Useful when
you want to track a font that was created with an explicit size via
CreateStandardFont(PdfStandardFont, Single) etc.
|
 | Add(PdfFont) | Adds an array of fonts to the collection. |
 | Add(PdfStandardCJKFont) |
Adds a standard CJK font to the collection. Like PdfStandardFont,
these are referenced by name (not embedded) — but CJK readers ship the glyphs, so
output is expected to render on PDF/A-capable viewers.
|
 | Add(PdfStandardFont) |
Adds a standard PDF font (one of the 14 built-in font names) to the collection and
returns the PdfFont wrapper. Standard fonts are referenced by name,
not embedded — rejected under PDF/A and PDF/X conformance.
|
 | Add(PdfSystemFont) |
Resolves the system font described by systemFont to its
installed TrueType / OpenType file, subset-embeds it into the document, and returns
the resulting PdfFont.
|
 | Add(Stream) |
Adds a TrueType / OpenType font loaded from a Stream. The stream is
read synchronously from its current position to end.
|
 | Add(String) |
Adds a TrueType / OpenType font loaded from a file. The font is subset-embedded
into the output document — use this path for PDF/A / PDF/X output from scratch.
|
 | Add(PdfSystemFont, Boolean) |
Resolves the system font described by systemFont and adds it to
the collection.
|
 | Contains | Returns true if the specified font is in the collection. |
 | GetEnumerator | Returns an enumerator over the fonts in insertion order. |
 | IndexOf | Returns the zero-based index of the specified font, or -1 if not found. |
 | Insert | Inserts a font at the specified zero-based index. |
 | Remove | Removes the specified font from the collection. |
Top
Remarks
Adding a font returns a
PdfFont that can be retained and reused with any
PdfTextElement on the document. Adding the exact same font twice returns
two distinct registry entries — duplicate detection is left to the caller.
ExamplePdfDocument document = new PdfDocument();
PdfFont helvetica = document.Fonts.Add(PdfStandardFont.Helvetica);
PdfFont arial = document.Fonts.Add(@"C:\Windows\Fonts\arial.ttf");
int count = document.Fonts.Count;
Dim document As New PdfDocument()
Dim helvetica As PdfFont = document.Fonts.Add(PdfStandardFont.Helvetica)
Dim arial As PdfFont = document.Fonts.Add("C:\Windows\Fonts\arial.ttf")
Dim count As Integer = document.Fonts.Count
See Also