Class PDDocumentCatalog

  • All Implemented Interfaces:
    COSObjectable

    public class PDDocumentCatalog
    extends java.lang.Object
    implements COSObjectable
    The Document Catalog of a PDF.
    Author:
    Ben Litchfield
    • Constructor Detail

      • PDDocumentCatalog

        public PDDocumentCatalog​(PDDocument doc)
        Constructor. Internal PDFBox use only! If you need to get the document catalog, call PDDocument.getDocumentCatalog().
        Parameters:
        doc - The document that this catalog is part of.
      • PDDocumentCatalog

        public PDDocumentCatalog​(PDDocument doc,
                                 COSDictionary rootDictionary)
        Constructor. Internal PDFBox use only! If you need to get the document catalog, call PDDocument.getDocumentCatalog().
        Parameters:
        doc - The document that this catalog is part of.
        rootDictionary - The root dictionary that this object wraps.
    • Method Detail

      • getCOSObject

        public COSDictionary getCOSObject()
        Convert this standard java object to a COS object.
        Specified by:
        getCOSObject in interface COSObjectable
        Returns:
        The cos object that matches this Java object.
      • getAcroForm

        public PDAcroForm getAcroForm()
        Get the documents AcroForm. This will return null if no AcroForm is part of the document.
        Returns:
        The document's AcroForm.
      • setAcroForm

        public void setAcroForm​(PDAcroForm acroForm)
        Sets the AcroForm for this catalog.
        Parameters:
        acroForm - The new AcroForm.
      • getPages

        public PDPageTree getPages()
        Returns all pages in the document, as a page tree.
        Returns:
        the page tree of all pages
      • getViewerPreferences

        public PDViewerPreferences getViewerPreferences()
        Get the viewer preferences associated with this document or null if they do not exist.
        Returns:
        The document's viewer preferences.
      • setViewerPreferences

        public void setViewerPreferences​(PDViewerPreferences prefs)
        Sets the viewer preferences.
        Parameters:
        prefs - The new viewer preferences.
      • getDocumentOutline

        public PDDocumentOutline getDocumentOutline()
        Get the outline associated with this document or null if it does not exist.
        Returns:
        The document's outline.
      • setDocumentOutline

        public void setDocumentOutline​(PDDocumentOutline outlines)
        Sets the document outlines.
        Parameters:
        outlines - The new document outlines.
      • getThreads

        public java.util.List<PDThread> getThreads()
        Returns the document's article threads.
        Returns:
        a list containing all article threads.
      • setThreads

        public void setThreads​(java.util.List<PDThread> threads)
        Sets the list of threads for this pdf document.
        Parameters:
        threads - The list of threads, or null to clear it.
      • getMetadata

        public PDMetadata getMetadata()
        Get the metadata that is part of the document catalog. This will return null if there is no meta data for this object.
        Returns:
        The metadata for this object.
      • setMetadata

        public void setMetadata​(PDMetadata meta)
        Sets the metadata for this object. This can be null.
        Parameters:
        meta - The meta data for this object.
      • setOpenAction

        public void setOpenAction​(PDDestinationOrAction action)
        Sets the Document Open Action for this object.
        Parameters:
        action - The action you want to perform.
      • getOpenAction

        public PDDestinationOrAction getOpenAction()
                                            throws java.io.IOException
        Get the Document Open Action for this object.
        Returns:
        The action to perform when the document is opened.
        Throws:
        java.io.IOException - If there is an error creating the destination or action.
      • setActions

        public void setActions​(PDDocumentCatalogAdditionalActions actions)
        Sets the additional actions for the document.
        Parameters:
        actions - The actions that are associated with this document.
      • getNames

        public PDDocumentNameDictionary getNames()
        Returns:
        The names dictionary for this document or null if none exist.
      • findNamedDestinationPage

        public PDPageDestination findNamedDestinationPage​(PDNamedDestination namedDest)
                                                   throws java.io.IOException
        Find the page destination from a named destination.
        Parameters:
        namedDest - the named destination.
        Returns:
        a PDPageDestination object or null if not found.
        Throws:
        java.io.IOException - if there is an error creating the PDPageDestination object.
      • setNames

        public void setNames​(PDDocumentNameDictionary names)
        Sets the names dictionary for the document.
        Parameters:
        names - The names dictionary that is associated with this document.
      • getMarkInfo

        public PDMarkInfo getMarkInfo()
        Get info about doc's usage of tagged features. This will return null if there is no information.
        Returns:
        The new mark info.
      • setMarkInfo

        public void setMarkInfo​(PDMarkInfo markInfo)
        Set information about the doc's usage of tagged features.
        Parameters:
        markInfo - The new MarkInfo data.
      • getOutputIntents

        public java.util.List<PDOutputIntent> getOutputIntents()
        Get the list of OutputIntents defined in the document.
        Returns:
        The list of PDOutputIntent
      • addOutputIntent

        public void addOutputIntent​(PDOutputIntent outputIntent)
        Add an OutputIntent to the list. If there is not OutputIntent, the list is created and the first element added.
        Parameters:
        outputIntent - the OutputIntent to add.
      • setOutputIntents

        public void setOutputIntents​(java.util.List<PDOutputIntent> outputIntents)
        Replace the list of OutputIntents of the document.
        Parameters:
        outputIntents - the list of OutputIntents, if the list is empty all OutputIntents are removed.
      • getPageMode

        public PageMode getPageMode()
        Returns the page display mode.
        Returns:
        the page mode.
      • setPageMode

        public void setPageMode​(PageMode mode)
        Sets the page mode.
        Parameters:
        mode - The new page mode.
      • getPageLayout

        public PageLayout getPageLayout()
        Returns the page layout.
        Returns:
        the page layout.
      • setPageLayout

        public void setPageLayout​(PageLayout layout)
        Sets the page layout.
        Parameters:
        layout - The new page layout.
      • getURI

        public PDURIDictionary getURI()
        Returns the document-level URI.
        Returns:
        the document-level URI
      • setURI

        public void setURI​(PDURIDictionary uri)
        Sets the document level URI.
        Parameters:
        uri - The new document level URI.
      • getStructureTreeRoot

        public PDStructureTreeRoot getStructureTreeRoot()
        Get the document's structure tree root, or null if none exists.
        Returns:
        the structure tree root.
      • setStructureTreeRoot

        public void setStructureTreeRoot​(PDStructureTreeRoot treeRoot)
        Sets the document's structure tree root.
        Parameters:
        treeRoot - The new structure tree.
      • getLanguage

        public java.lang.String getLanguage()
        Returns the language for the document, or null.
        Returns:
        the language or null.
      • setLanguage

        public void setLanguage​(java.lang.String language)
        Sets the Language for the document.
        Parameters:
        language - The new document language.
      • getVersion

        public java.lang.String getVersion()
        Returns the PDF specification version this document conforms to.
        Returns:
        the PDF version (e.g. "1.4")
      • setVersion

        public void setVersion​(java.lang.String version)
        Sets the PDF specification version this document conforms to.
        Parameters:
        version - the PDF version (e.g. "1.4")
      • getPageLabels

        public PDPageLabels getPageLabels()
                                   throws java.io.IOException
        Returns the page labels descriptor of the document.
        Returns:
        the page labels descriptor of the document.
        Throws:
        java.io.IOException - If there is a problem retrieving the page labels.
      • setPageLabels

        public void setPageLabels​(PDPageLabels labels)
        Sets the page label descriptor for the document.
        Parameters:
        labels - the new page label descriptor to set.
      • getOCProperties

        public PDOptionalContentProperties getOCProperties()
        Get the optional content properties dictionary associated with this document.
        Returns:
        the optional properties dictionary or null if it is not present
      • setOCProperties

        public void setOCProperties​(PDOptionalContentProperties ocProperties)
        Sets the optional content properties dictionary. The document version is incremented to 1.5 if lower.
        Parameters:
        ocProperties - the optional properties dictionary