Class PdfSaveOptions

java.lang.Object
com.independentsoft.office.pdf.PdfSaveOptions

public class PdfSaveOptions extends Object
Options that control PDF export.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    A registered font source.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addFontDirectory​(String directory)
    Adds a directory searched for TrueType fonts to embed.
    Gets the author written to the PDF Info dictionary, overriding the document property.
    Gets the creator written to the PDF Info dictionary.
    Gets additional directories searched for TrueType fonts to embed.
    Gets the keywords written to the PDF Info dictionary, overriding the document property.
    Gets the registered fonts.
    Gets the subject written to the PDF Info dictionary, overriding the document property.
    Gets the document title written to the PDF Info dictionary, overriding the document property.
    boolean
    Gets whether page content streams are compressed with Flate.
    boolean
    Gets whether hyperlinks are exported as clickable link annotations.
    boolean
    Gets whether a document outline (bookmarks) is created from headings.
    boolean
    Gets whether TrueType fonts are embedded.
    boolean
    Gets whether the operating system font directories are searched for fonts to embed.
    void
    registerFont​(String fontFamily, boolean bold, boolean italic, byte[] fontData)
    Registers TrueType font data used when embedding fonts.
    void
    registerFont​(String fontFamily, boolean bold, boolean italic, String filePath)
    Registers a TrueType font file used when embedding fonts.
    void
    setAuthor​(String author)
    Sets the author written to the PDF Info dictionary.
    void
    setCompressContent​(boolean compressContent)
    Sets whether page content streams are compressed with Flate.
    void
    setCreateHyperlinks​(boolean createHyperlinks)
    Sets whether hyperlinks are exported as clickable link annotations.
    void
    setCreateOutlines​(boolean createOutlines)
    Sets whether a document outline (bookmarks) is created from headings.
    void
    setCreator​(String creator)
    Sets the creator written to the PDF Info dictionary.
    void
    setEmbedFonts​(boolean embedFonts)
    Sets whether TrueType fonts are embedded.
    void
    setKeywords​(String keywords)
    Sets the keywords written to the PDF Info dictionary.
    void
    setSubject​(String subject)
    Sets the subject written to the PDF Info dictionary.
    void
    setTitle​(String title)
    Sets the document title written to the PDF Info dictionary.
    void
    setUseSystemFonts​(boolean useSystemFonts)
    Sets whether the operating system font directories are searched for fonts to embed.

    Methods inherited from class java.lang.Object

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

    • PdfSaveOptions

      public PdfSaveOptions()
  • Method Details

    • isCompressContent

      public boolean isCompressContent()
      Gets whether page content streams are compressed with Flate. Default is true.
      Returns:
      true if compression is enabled
    • setCompressContent

      public void setCompressContent(boolean compressContent)
      Sets whether page content streams are compressed with Flate.
      Parameters:
      compressContent - true to compress page content streams
    • isCreateHyperlinks

      public boolean isCreateHyperlinks()
      Gets whether hyperlinks are exported as clickable link annotations. Default is true.
      Returns:
      true if link annotations are created
    • setCreateHyperlinks

      public void setCreateHyperlinks(boolean createHyperlinks)
      Sets whether hyperlinks are exported as clickable link annotations.
      Parameters:
      createHyperlinks - true to create link annotations
    • isCreateOutlines

      public boolean isCreateOutlines()
      Gets whether a document outline (bookmarks) is created from headings. Default is true.
      Returns:
      true if an outline is created
    • setCreateOutlines

      public void setCreateOutlines(boolean createOutlines)
      Sets whether a document outline (bookmarks) is created from headings.
      Parameters:
      createOutlines - true to create an outline
    • isEmbedFonts

      public boolean isEmbedFonts()
      Gets whether TrueType fonts are embedded. When enabled, text is written with embedded Unicode fonts so characters outside the Latin-1 range are preserved. Default is false.
      Returns:
      true if fonts are embedded
    • setEmbedFonts

      public void setEmbedFonts(boolean embedFonts)
      Sets whether TrueType fonts are embedded.
      Parameters:
      embedFonts - true to embed fonts
    • isUseSystemFonts

      public boolean isUseSystemFonts()
      Gets whether the operating system font directories are searched for fonts to embed. Default is true.
      Returns:
      true if system font directories are searched
    • setUseSystemFonts

      public void setUseSystemFonts(boolean useSystemFonts)
      Sets whether the operating system font directories are searched for fonts to embed.
      Parameters:
      useSystemFonts - true to search system font directories
    • getFontDirectories

      public List<String> getFontDirectories()
      Gets additional directories searched for TrueType fonts to embed.
      Returns:
      the font directories
    • addFontDirectory

      public void addFontDirectory(String directory)
      Adds a directory searched for TrueType fonts to embed.
      Parameters:
      directory - the directory path
    • registerFont

      public void registerFont(String fontFamily, boolean bold, boolean italic, String filePath)
      Registers a TrueType font file used when embedding fonts.
      Parameters:
      fontFamily - the font family name as used in the document
      bold - true if the file contains the bold variant
      italic - true if the file contains the italic variant
      filePath - path of the .ttf/.ttc file
    • registerFont

      public void registerFont(String fontFamily, boolean bold, boolean italic, byte[] fontData)
      Registers TrueType font data used when embedding fonts.
      Parameters:
      fontFamily - the font family name as used in the document
      bold - true if the data contains the bold variant
      italic - true if the data contains the italic variant
      fontData - the raw bytes of a .ttf/.ttc file
    • getRegisteredFonts

      public List<PdfSaveOptions.FontSource> getRegisteredFonts()
      Gets the registered fonts.
      Returns:
      the registered fonts
    • getTitle

      public String getTitle()
      Gets the document title written to the PDF Info dictionary, overriding the document property.
      Returns:
      the title or null
    • setTitle

      public void setTitle(String title)
      Sets the document title written to the PDF Info dictionary.
      Parameters:
      title - the title
    • getAuthor

      public String getAuthor()
      Gets the author written to the PDF Info dictionary, overriding the document property.
      Returns:
      the author or null
    • setAuthor

      public void setAuthor(String author)
      Sets the author written to the PDF Info dictionary.
      Parameters:
      author - the author
    • getSubject

      public String getSubject()
      Gets the subject written to the PDF Info dictionary, overriding the document property.
      Returns:
      the subject or null
    • setSubject

      public void setSubject(String subject)
      Sets the subject written to the PDF Info dictionary.
      Parameters:
      subject - the subject
    • getKeywords

      public String getKeywords()
      Gets the keywords written to the PDF Info dictionary, overriding the document property.
      Returns:
      the keywords or null
    • setKeywords

      public void setKeywords(String keywords)
      Sets the keywords written to the PDF Info dictionary.
      Parameters:
      keywords - the keywords
    • getCreator

      public String getCreator()
      Gets the creator written to the PDF Info dictionary.
      Returns:
      the creator or null
    • setCreator

      public void setCreator(String creator)
      Sets the creator written to the PDF Info dictionary.
      Parameters:
      creator - the creator