Package com.evopdf

Class PdfFont

java.lang.Object
com.evopdf.PdfFont

public class PdfFont extends Object
This class represents a font in the PDF document that can be used by the text elements
  • Constructor Summary

    Constructors
    Constructor
    Description
    PdfFont(byte[] fontData, float fontSizePoints)
    Creates a PDF font from font data
    PdfFont(StandardCJKFont standardCJK, float fontSizePoints)
    Creates a CJK font
    PdfFont(StdFontBaseFamily standardFamily, float fontSizePoints)
    Creates a standard PDF font
    PdfFont(String fontFilePath, float fontSizePoints)
    Creates a PDF font from a font file
    PdfFont(String familyName, float fontSizePoints, boolean embedFont)
    Creates a PDF font for a font family name.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Gets the flag indicating if the font is bold
    boolean
    Gets the flag indicating if the font should be embedded in PDF document.
    byte[]
    Gets the font data
    Gets the name of the font family of this PDF font
    boolean
    Gets the flag indicating if the font is italic
    void
    setBold(boolean bold)
    Sets the flag indicating if the font is bold
    void
    setEmbedFont(boolean embedFont)
    Sets the flag indicating if the font should be embedded in PDF document.
    void
    setFontData(byte[] fontData)
    Sets the font data
    void
    setFontFamily(String familyName)
    Sets the name of the font family of this PDF font
    void
    setItalic(boolean italic)
    Sets the flag indicating if the font is italic
    void
    setSize(float fontSizePoints)
    Sets the PDF font size in points
    void
    Sets the predefined CJK font
    void
    Sets the predefined family name of this PDF font
    void
    setStrikeout(boolean strikeout)
    Sets the flag indicating if the font is strikeout
    void
    setUnderline(boolean underline)
    Sets the flag indicating if the font is underline
    float
    Gets the PDF font size in points
    Gets the predefined CJK font
    Gets the predefined family name of this PDF font
    boolean
    Gets the flag indicating if the font is strikeout
    boolean
    Gets the flag indicating if the font is underline

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PdfFont

      public PdfFont(String familyName, float fontSizePoints, boolean embedFont)
      Creates a PDF font for a font family name. The font must be installed on the server
      Parameters:
      familyName - the font family name
      fontSizePoints - the font size in points
      embedFont - a flag indicating if the font will be embedded in PDF. A TextElement using this font can override this option
    • PdfFont

      public PdfFont(StdFontBaseFamily standardFamily, float fontSizePoints)
      Creates a standard PDF font
      Parameters:
      standardFamily - the standard PDF font family
      fontSizePoints - the standard font size in points
    • PdfFont

      public PdfFont(StandardCJKFont standardCJK, float fontSizePoints)
      Creates a CJK font
      Parameters:
      standardCJK - the CJK font
      fontSizePoints - the standard font size in points
    • PdfFont

      public PdfFont(String fontFilePath, float fontSizePoints) throws Exception
      Creates a PDF font from a font file
      Parameters:
      fontFilePath - the font file full path
      fontSizePoints - 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 data
      fontSizePoints - the font size in points
  • Method Details

    • fontFamily

      public String fontFamily()
      Gets the name of the font family of this PDF font
      Returns:
      the name of the font family
    • setFontFamily

      public void setFontFamily(String familyName)
      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 by TextElement options
      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 by TextElement options. Default value is true
      Parameters:
      embedFont - the flag value to set
    • standardFamily

      public StdFontBaseFamily standardFamily()
      Gets the predefined family name of this PDF font
      Returns:
      the predefined family name of this PDF font
    • setStandardFamily

      public void setStandardFamily(StdFontBaseFamily standardFamily)
      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

      public StandardCJKFont standardCJK()
      Gets the predefined CJK font
      Returns:
      the predefined CJK font
    • setStandardCJK

      public void setStandardCJK(StandardCJKFont standardCJK)
      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