This class provides helpful methods for creating fonts ready to be used in a
iText.Kernel.Pdf.PdfDocument
This class provides helpful methods for creating fonts ready to be used in a
iText.Kernel.Pdf.PdfDocument
Note, just created
PdfFont
is almost empty until it will be flushed, because it is impossible to fulfill font data until flush.
◆
EmbeddingStrategy
FORCE_EMBEDDED
Force embedding fonts.
Force embedding fonts. It expected to get an exception if the font cannot be embedded.
FORCE_NOT_EMBEDDED
Force not embedding fonts.
Force not embedding fonts. It is expected to get an exception if the font cannot be not embedded.
PREFER_EMBEDDED
Embedding fonts if possible.
PREFER_NOT_EMBEDDED
Not embedding fonts if possible.
Creates a new instance of default font, namely
iText.IO.Font.Constants.StandardFonts.HELVETICA
standard font with
iText.IO.Font.PdfEncodings.WINANSI
encoding.
Creates a new instance of default font, namely
iText.IO.Font.Constants.StandardFonts.HELVETICA
standard font with
iText.IO.Font.PdfEncodings.WINANSI
encoding. Note, if you want to reuse the same instance of default font, you may use
iText.Kernel.Pdf.PdfDocument.GetDefaultFont()
.
Returns
created font
embeddingStrategy
the
EmbeddingStrategy
which will define whether the font will be embedded
cached
indicates whether the font will be cached
Created a
PdfFont
instance given the given underlying
iText.IO.Font.FontProgram
instance.
Parameters
Created a
PdfFont
instance given the given underlying
iText.IO.Font.FontProgram
instance.
Parameters
Created a
PdfFont
instance given the given underlying
iText.IO.Font.FontProgram
instance.
Parameters
Creates a
PdfFont
by already existing font dictionary.
Creates a
PdfFont
by already existing font dictionary.
Note, the font won't be added to any document, until you add it to
iText.Kernel.Pdf.Canvas.PdfCanvas
. While adding to
iText.Kernel.Pdf.Canvas.PdfCanvas
, or to
iText.Kernel.Pdf.PdfResources
the font will be made indirect implicitly.
iText.Kernel.Pdf.PdfDocument.GetFont(iText.Kernel.Pdf.PdfDictionary)
method is strongly recommended if you want to get
PdfFont
by both existing font dictionary, or just created and hasn't flushed yet.
Parameters
Creates a
PdfFont
instance by the path of the font program file and given encoding and place it inside the
iText.Kernel.Pdf.PdfDocument
.
Creates a
PdfFont
instance by the path of the font program file and given encoding and place it inside the
iText.Kernel.Pdf.PdfDocument
. If such
PdfFont
has already been created and placed inside the
iText.Kernel.Pdf.PdfDocument
, then retries its instance instead of creating.
EmbeddingStrategy.PREFER_EMBEDDED
will be used as embedding strategy.
Parameters
embeddingStrategy
the
EmbeddingStrategy
which will define whether the font will be embedded
cached
indicates whether the font will be cached
Creates a
PdfFont
instance by the path of the font program file and given encoding and place it inside the
iText.Kernel.Pdf.PdfDocument
.
Creates a
PdfFont
instance by the path of the font program file and given encoding and place it inside the
iText.Kernel.Pdf.PdfDocument
. If such
PdfFont
has already been created and placed inside the
iText.Kernel.Pdf.PdfDocument
, then retries its instance instead of creating.
Parameters
embeddingStrategy
the
EmbeddingStrategy
which will define whether the font will be embedded
cacheTo
the
iText.Kernel.Pdf.PdfDocument
to cache the font
Creates
PdfFont
based on registered
iText.IO.Font.FontProgram
's.
Creates
PdfFont
based on registered
iText.IO.Font.FontProgram
's. Required font program is expected to be previously registered by one of the register method from
PdfFontFactory
.
Parameters
Creates
PdfFont
based on registered
iText.IO.Font.FontProgram
's.
Creates
PdfFont
based on registered
iText.IO.Font.FontProgram
's. Required font program is expected to be previously registered by one of the register method from
PdfFontFactory
.
Parameters
Creates
PdfFont
based on registered
iText.IO.Font.FontProgram
's.
Creates
PdfFont
based on registered
iText.IO.Font.FontProgram
's. Required font program is expected to be previously registered by one of the register method from
PdfFontFactory
.
Parameters
Creates
PdfFont
based on registered
iText.IO.Font.FontProgram
's.
Creates
PdfFont
based on registered
iText.IO.Font.FontProgram
's. Required font program is expected to be previously registered by one of the register method from
PdfFontFactory
.
Parameters
embeddingStrategy
the
EmbeddingStrategy
which will define whether the font will be embedded. Note, standard font won't be embedded in any case.
cached
If true font will be cached for another PdfDocument
Creates
PdfFont
based on registered
iText.IO.Font.FontProgram
's.
Creates
PdfFont
based on registered
iText.IO.Font.FontProgram
's. Required font program is expected to be previously registered by one of the register method from
PdfFontFactory
.
Parameters
embeddingStrategy
the
EmbeddingStrategy
which will define whether the font will be embedded. Note, standard font won't be embedded in any case.
style
Font
style from
iText.IO.Font.Constants.FontStyles
.
Creates
PdfFont
based on registered
iText.IO.Font.FontProgram
's.
Creates
PdfFont
based on registered
iText.IO.Font.FontProgram
's. Required font program is expected to be previously registered by one of the register method from
PdfFontFactory
.
Parameters
embeddingStrategy
the
EmbeddingStrategy
which will define whether the font will be embedded. Note, standard font won't be embedded in any case.
style
Font
style from
iText.IO.Font.Constants.FontStyles
.
cached
If true font will be cached for another PdfDocument
Creates a
PdfFont
instance from the TrueType Collection represented by its byte contents.
Parameters
embeddingStrategy
the
EmbeddingStrategy
which will define whether the font will be embedded
cached
indicates whether the font will be cached
Creates a
PdfFont
instance from the TrueType Collection given by the path to the .ttc file.
Parameters
embeddingStrategy
the
EmbeddingStrategy
which will define whether the font will be embedded
cached
indicates whether the font will be cached
Registers a .ttf, .otf, .afm, .pfm, or a .ttc font file.
Registers a .ttf, .otf, .afm, .pfm, or a .ttc font file. In case if TrueType Collection (.ttc), an additional parameter may be specified defining the index of the font to be registered, e.g. "path/to/font/collection.ttc,0". The index is zero-based.
Parameters
Register fonts in some probable directories.
Register fonts in some probable directories. It usually works in Windows, Linux and Solaris.
Returns
the number of fonts registered