Package com.evopdf
Class PdfFont
java.lang.Object
com.evopdf.PdfFont
This class represents a font in the PDF document that can be used by the text
elements
-
Constructor Summary
ConstructorsConstructorDescriptionPdfFont(byte[] fontData, float fontSizePoints) Creates a PDF font from font dataPdfFont(StandardCJKFont standardCJK, float fontSizePoints) Creates a CJK fontPdfFont(StdFontBaseFamily standardFamily, float fontSizePoints) Creates a standard PDF fontCreates a PDF font from a font fileCreates a PDF font for a font family name. -
Method Summary
Modifier and TypeMethodDescriptionbooleanbold()Gets the flag indicating if the font is boldbooleanGets the flag indicating if the font should be embedded in PDF document.byte[]fontData()Gets the font dataGets the name of the font family of this PDF fontbooleanitalic()Gets the flag indicating if the font is italicvoidsetBold(boolean bold) Sets the flag indicating if the font is boldvoidsetEmbedFont(boolean embedFont) Sets the flag indicating if the font should be embedded in PDF document.voidsetFontData(byte[] fontData) Sets the font datavoidsetFontFamily(String familyName) Sets the name of the font family of this PDF fontvoidsetItalic(boolean italic) Sets the flag indicating if the font is italicvoidsetSize(float fontSizePoints) Sets the PDF font size in pointsvoidsetStandardCJK(StandardCJKFont standardCJK) Sets the predefined CJK fontvoidsetStandardFamily(StdFontBaseFamily standardFamily) Sets the predefined family name of this PDF fontvoidsetStrikeout(boolean strikeout) Sets the flag indicating if the font is strikeoutvoidsetUnderline(boolean underline) Sets the flag indicating if the font is underlinefloatsize()Gets the PDF font size in pointsGets the predefined CJK fontGets the predefined family name of this PDF fontbooleanGets the flag indicating if the font is strikeoutbooleanGets the flag indicating if the font is underline
-
Constructor Details
-
PdfFont
Creates a PDF font for a font family name. The font must be installed on the server- Parameters:
familyName- the font family namefontSizePoints- the font size in pointsembedFont- a flag indicating if the font will be embedded in PDF. ATextElementusing this font can override this option
-
PdfFont
Creates a standard PDF font- Parameters:
standardFamily- the standard PDF font familyfontSizePoints- the standard font size in points
-
PdfFont
Creates a CJK font- Parameters:
standardCJK- the CJK fontfontSizePoints- the standard font size in points
-
PdfFont
Creates a PDF font from a font file- Parameters:
fontFilePath- the font file full pathfontSizePoints- the font size in points- Throws:
Exception- an exception is thrown if the font cannot be created
-
PdfFont
public PdfFont(byte[] fontData, float fontSizePoints) Creates a PDF font from font data- Parameters:
fontData- the font datafontSizePoints- the font size in points
-
-
Method Details
-
fontFamily
Gets the name of the font family of this PDF font- Returns:
- the name of the font family
-
setFontFamily
Sets the name of the font family of this PDF font- Parameters:
familyName- the name of the font family to set
-
embedFont
public boolean embedFont()Gets the flag indicating if the font should be embedded in PDF document. This is flag is used when the font is constructed with font family name and can be overridden byTextElementoptions- Returns:
- the flag value
-
setEmbedFont
public void setEmbedFont(boolean embedFont) Sets the flag indicating if the font should be embedded in PDF document. This is flag is used when the font is constructed with font family name and can be overridden byTextElementoptions. Default value is true- Parameters:
embedFont- the flag value to set
-
standardFamily
Gets the predefined family name of this PDF font- Returns:
- the predefined family name of this PDF font
-
setStandardFamily
Sets the predefined family name of this PDF font- Parameters:
standardFamily- the predefined family name to set
-
fontData
public byte[] fontData()Gets the font data- Returns:
- the font data
-
setFontData
public void setFontData(byte[] fontData) Sets the font data- Parameters:
fontData- the font data to set
-
standardCJK
Gets the predefined CJK font- Returns:
- the predefined CJK font
-
setStandardCJK
Sets the predefined CJK font- Parameters:
standardCJK- the predefined CJK font to set
-
size
public float size()Gets the PDF font size in points- Returns:
- the PDF font size in points
-
setSize
public void setSize(float fontSizePoints) Sets the PDF font size in points- Parameters:
fontSizePoints- the PDF font size in points to set
-
bold
public boolean bold()Gets the flag indicating if the font is bold- Returns:
- the flag value
-
setBold
public void setBold(boolean bold) Sets the flag indicating if the font is bold- Parameters:
bold- the flag value to set
-
italic
public boolean italic()Gets the flag indicating if the font is italic- Returns:
- the flag value
-
setItalic
public void setItalic(boolean italic) Sets the flag indicating if the font is italic- Parameters:
italic- the flag value to set
-
underline
public boolean underline()Gets the flag indicating if the font is underline- Returns:
- the flag value
-
setUnderline
public void setUnderline(boolean underline) Sets the flag indicating if the font is underline- Parameters:
underline- the flag value to set
-
strikeout
public boolean strikeout()Gets the flag indicating if the font is strikeout- Returns:
- the flag value
-
setStrikeout
public void setStrikeout(boolean strikeout) Sets the flag indicating if the font is strikeout- Parameters:
strikeout- the flag value to set
-