Custom Fonts
Adding custom fonts is as easy as providing the path to the TTF file within your TypoScript settings.
The name of the font is automatically generated by TCPDF using the font file name. Only the characters a-z
, 0-9
and _
are allowed and words like
bold
, oblique
, italic
or regular
are replaced by b
, o
, i
or [empty]
.
Example: ROBOTObold.ttf
becomes robotob
Please note that the TypoScript key you use is not the font name, the font name is generated only based on the font file name!
TypoScript
plugin.tx_pdfviewhelpers.settings.config.fonts {
addTTFFont {
roboto {
path = EXT:pdfviewhelpers/Resources/Public/Examples/FullFeatureShowCase/Roboto.ttf
# Font type. Leave empty for autodetect mode. Valid values are: TrueTypeUnicode, TrueType, Type1, CID0JP = CID-0 Japanese, CID0KR = CID-0 Korean, CID0CS = CID-0 Chinese Simplified, CID0CT = CID-0 Chinese Traditional.
# type = TrueTypeUnicode
# Name of the encoding table to use. Leave empty for default mode. Omit this parameter for TrueType Unicode and symbolic fonts like Symbol or ZapfDingBats.
# enc =
# Unsigned 32-bit integer containing flags specifying various characteristics of the font (PDF32000:2008 - 9.8.2 Font Descriptor Flags): +1 for fixed font; +4 for symbol or +32 for non-symbol; +64 for italic. Fixed and Italic mode are generally autodetected so you have to set it to 32 = non-symbolic font (default) or 4 = symbolic font.
# flags =
}
opensans {
path = EXT:pdfviewhelpers/Resources/Public/Examples/FullFeatureShowCase/OpenSans.ttf
}
}
}
TCPDF fonts
TCPDF comes already with the following fonts installed: courier
, helvetica
, symbol
, times
and zapfdingbats
Limitations
TCPDF does not support OpenType
fonts with CFF data. If your font can not be added, please try to convert it to TTF
, there are a couple of free online converters available.