Package org.apache.pdfbox.pdmodel
Class PDDocumentCatalog
java.lang.Object
org.apache.pdfbox.pdmodel.PDDocumentCatalog
- All Implemented Interfaces:
COSObjectable
The Document Catalog of a PDF.
- Author:
- Ben Litchfield
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor.PDDocumentCatalog
(PDDocument doc, COSDictionary rootDictionary) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addOutputIntent
(PDOutputIntent outputIntent) Add an OutputIntent to the list.findNamedDestinationPage
(PDNamedDestination namedDest) Find the page destination from a named destination.Get the documents AcroForm.getAcroForm
(PDDocumentFixup acroFormFixup) Get the documents AcroForm.Convert this standard java object to a COS object.getDests()
Get the outline associated with this document or null if it does not exist.Returns the language for the document, or null.Get info about doc's usage of tagged features.Get the metadata that is part of the document catalog.getNames()
Get the optional content properties dictionary associated with this document.Get the Document Open Action for this object.Get the list of OutputIntents defined in the document.Returns the page labels descriptor of the document.Returns the page layout.Returns the page display mode.getPages()
Returns all pages in the document, as a page tree.Get the document's structure tree root, or null if none exists.Returns the document's article threads.getURI()
Returns the document-level URI.Returns the PDF specification version this document conforms to.Get the viewer preferences associated with this document or null if they do not exist.void
setAcroForm
(PDAcroForm acroForm) Sets the AcroForm for this catalog.void
Sets the additional actions for the document.void
setDocumentOutline
(PDDocumentOutline outlines) Sets the document outlines.void
setLanguage
(String language) Sets the Language for the document.void
setMarkInfo
(PDMarkInfo markInfo) Set information about the doc's usage of tagged features.void
setMetadata
(PDMetadata meta) Sets the metadata for this object.void
setNames
(PDDocumentNameDictionary names) Sets the names dictionary for the document.void
setOCProperties
(PDOptionalContentProperties ocProperties) Sets the optional content properties dictionary.void
setOpenAction
(PDDestinationOrAction action) Sets the Document Open Action for this object.void
setOutputIntents
(List<PDOutputIntent> outputIntents) Replace the list of OutputIntents of the document.void
setPageLabels
(PDPageLabels labels) Sets the page label descriptor for the document.void
setPageLayout
(PageLayout layout) Sets the page layout.void
setPageMode
(PageMode mode) Sets the page mode.void
setStructureTreeRoot
(PDStructureTreeRoot treeRoot) Sets the document's structure tree root.void
setThreads
(List<PDThread> threads) Sets the list of threads for this pdf document.void
setURI
(PDURIDictionary uri) Sets the document level URI.void
setVersion
(String version) Sets the PDF specification version this document conforms to.void
Sets the viewer preferences.
-
Constructor Details
-
PDDocumentCatalog
Constructor. Internal PDFBox use only! If you need to get the document catalog, callPDDocument.getDocumentCatalog()
.- Parameters:
doc
- The document that this catalog is part of.
-
PDDocumentCatalog
Constructor. Internal PDFBox use only! If you need to get the document catalog, callPDDocument.getDocumentCatalog()
.- Parameters:
doc
- The document that this catalog is part of.rootDictionary
- The root dictionary that this object wraps.
-
-
Method Details
-
getCOSObject
Convert this standard java object to a COS object.- Specified by:
getCOSObject
in interfaceCOSObjectable
- Returns:
- The cos object that matches this Java object.
-
getAcroForm
Get the documents AcroForm. This will return null if no AcroForm is part of the document.- Returns:
- The document's AcroForm.
-
getAcroForm
Get the documents AcroForm. This will return null if no AcroForm is part of the document. Dependent on settingacroFormFixup
some fixing/changes will be done to the AcroForm. If you need to ensure that there are no fixes applied callgetAcroForm
withnull
. UsinggetAcroForm(PDDocumentFixup acroFormFixup)
might change the original content and subsequent calls withgetAcroForm(null)
will return the changed content.- Parameters:
acroFormFixup
- the fix up action or null- Returns:
- The document's AcroForm.
-
setAcroForm
Sets the AcroForm for this catalog.- Parameters:
acroForm
- The new AcroForm.
-
getPages
Returns all pages in the document, as a page tree.- Returns:
- the page tree of all pages
-
getViewerPreferences
Get the viewer preferences associated with this document or null if they do not exist.- Returns:
- The document's viewer preferences.
-
setViewerPreferences
Sets the viewer preferences.- Parameters:
prefs
- The new viewer preferences.
-
getDocumentOutline
Get the outline associated with this document or null if it does not exist.- Returns:
- The document's outline.
-
getThreads
Returns the document's article threads.- Returns:
- a list containing all article threads.
-
setThreads
Sets the list of threads for this pdf document.- Parameters:
threads
- The list of threads, or null to clear it.
-
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
Sets the metadata for this object. This can be null.- Parameters:
meta
- The meta data for this object.
-
setOpenAction
Sets the Document Open Action for this object.- Parameters:
action
- The action you want to perform.
-
getOpenAction
Get the Document Open Action for this object.- Returns:
- The action to perform when the document is opened.
- Throws:
IOException
- If there is an error creating the destination or action.
-
getActions
- Returns:
- The Additional Actions for this Document
-
setActions
Sets the additional actions for the document.- Parameters:
actions
- The actions that are associated with this document.
-
getNames
- Returns:
- The names dictionary for this document or null if none exist.
-
getDests
- Returns:
- The named destinations dictionary for this document or null if none exists.
-
setNames
Sets the names dictionary for the document.- Parameters:
names
- The names dictionary that is associated with this document.
-
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
Set information about the doc's usage of tagged features.- Parameters:
markInfo
- The new MarkInfo data.
-
getOutputIntents
Get the list of OutputIntents defined in the document.- Returns:
- The list of PDOutputIntent
-
addOutputIntent
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
Replace the list of OutputIntents of the document.- Parameters:
outputIntents
- the list of OutputIntents, if the list is empty all OutputIntents are removed.
-
getPageMode
Returns the page display mode.- Returns:
- the page mode.
-
setPageMode
Sets the page mode.- Parameters:
mode
- The new page mode.
-
getPageLayout
Returns the page layout.- Returns:
- the page layout.
-
setPageLayout
Sets the page layout.- Parameters:
layout
- The new page layout.
-
getURI
Returns the document-level URI.- Returns:
- the document-level URI
-
setURI
Sets the document level URI.- Parameters:
uri
- The new document level URI.
-
getStructureTreeRoot
Get the document's structure tree root, or null if none exists.- Returns:
- the structure tree root.
-
setStructureTreeRoot
Sets the document's structure tree root.- Parameters:
treeRoot
- The new structure tree.
-
getLanguage
Returns the language for the document, or null.- Returns:
- the language or null.
-
setLanguage
Sets the Language for the document.- Parameters:
language
- The new document language.
-
getVersion
Returns the PDF specification version this document conforms to.- Returns:
- the PDF version (e.g. "1.4")
-
setVersion
Sets the PDF specification version this document conforms to.- Parameters:
version
- the PDF version (e.g. "1.4")
-
getPageLabels
Returns the page labels descriptor of the document.- Returns:
- the page labels descriptor of the document.
- Throws:
IOException
- If there is a problem retrieving the page labels.
-
setPageLabels
Sets the page label descriptor for the document.- Parameters:
labels
- the new page label descriptor to set.
-
getOCProperties
Get the optional content properties dictionary associated with this document.- Returns:
- the optional properties dictionary or null if it is not present
-
setOCProperties
Sets the optional content properties dictionary. The document version is incremented to 1.5 if lower.- Parameters:
ocProperties
- the optional properties dictionary
-