Package com.tom_roush.pdfbox.pdmodel
Class PDDocumentCatalog
- java.lang.Object
-
- com.tom_roush.pdfbox.pdmodel.PDDocumentCatalog
-
- All Implemented Interfaces:
COSObjectable
public class PDDocumentCatalog extends Object implements COSObjectable
The Document Catalog of a PDF.
-
-
Constructor Summary
Constructors Constructor Description PDDocumentCatalog(PDDocument doc)Constructor.PDDocumentCatalog(PDDocument doc, COSDictionary rootDictionary)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddOutputIntent(PDOutputIntent outputIntent)Add an OutputIntent to the list.PDPageDestinationfindNamedDestinationPage(PDNamedDestination namedDest)Find the page destination from a named destination.PDAcroFormgetAcroForm()Get the documents AcroForm.PDAcroFormgetAcroForm(PDDocumentFixup acroFormFixup)Get the documents AcroForm.PDDocumentCatalogAdditionalActionsgetActions()COSDictionarygetCOSObject()Convert this standard java object to a COS object.PDDocumentNameDestinationDictionarygetDests()PDDocumentOutlinegetDocumentOutline()Get the outline associated with this document or null if it does not exist.StringgetLanguage()Returns the language for the document, or null.PDMarkInfogetMarkInfo()Get info about doc's usage of tagged features.PDMetadatagetMetadata()Get the metadata that is part of the document catalog.PDDocumentNameDictionarygetNames()PDOptionalContentPropertiesgetOCProperties()Get the optional content properties dictionary associated with this document.PDDestinationOrActiongetOpenAction()Get the Document Open Action for this object.List<PDOutputIntent>getOutputIntents()Get the list of OutputIntents defined in the document.PDPageLabelsgetPageLabels()Returns the page labels descriptor of the document.PageLayoutgetPageLayout()Returns the page layout.PageModegetPageMode()Returns the page display mode.PDPageTreegetPages()Returns all pages in the document, as a page tree.PDStructureTreeRootgetStructureTreeRoot()Get the document's structure tree root, or null if none exists.List<PDThread>getThreads()Returns the document's article threads.PDURIDictionarygetURI()Returns the document-level URI.StringgetVersion()Returns the PDF specification version this document conforms to.PDViewerPreferencesgetViewerPreferences()Get the viewer preferences associated with this document or null if they do not exist.voidsetAcroForm(PDAcroForm acroForm)Sets the AcroForm for this catalog.voidsetActions(PDDocumentCatalogAdditionalActions actions)Sets the additional actions for the document.voidsetDocumentOutline(PDDocumentOutline outlines)Sets the document outlines.voidsetLanguage(String language)Sets the Language for the document.voidsetMarkInfo(PDMarkInfo markInfo)Set information about the doc's usage of tagged features.voidsetMetadata(PDMetadata meta)Sets the metadata for this object.voidsetNames(PDDocumentNameDictionary names)Sets the names dictionary for the document.voidsetOCProperties(PDOptionalContentProperties ocProperties)Sets the optional content properties dictionary.voidsetOpenAction(PDDestinationOrAction action)Sets the Document Open Action for this object.voidsetOutputIntents(List<PDOutputIntent> outputIntents)Replace the list of OutputIntents of the document.voidsetPageLabels(PDPageLabels labels)Sets the page label descriptor for the document.voidsetPageLayout(PageLayout layout)Sets the page layout.voidsetPageMode(PageMode mode)Sets the page mode.voidsetStructureTreeRoot(PDStructureTreeRoot treeRoot)Sets the document's structure tree root.voidsetThreads(List<PDThread> threads)Sets the list of threads for this pdf document.voidsetURI(PDURIDictionary uri)Sets the document level URI.voidsetVersion(String version)Sets the PDF specification version this document conforms to.voidsetViewerPreferences(PDViewerPreferences prefs)Sets the viewer preferences.
-
-
-
Constructor Detail
-
PDDocumentCatalog
public PDDocumentCatalog(PDDocument doc)
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
public PDDocumentCatalog(PDDocument doc, COSDictionary rootDictionary)
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 Detail
-
getCOSObject
public COSDictionary getCOSObject()
Convert this standard java object to a COS object.- Specified by:
getCOSObjectin interfaceCOSObjectable- 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.
-
getAcroForm
public PDAcroForm getAcroForm(PDDocumentFixup acroFormFixup)
Get the documents AcroForm. This will return null if no AcroForm is part of the document. Dependent on settingacroFormFixupsome fixing/changes will be done to the AcroForm. If you need to ensure that there are no fixes applied callgetAcroFormwithnull. 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
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 List<PDThread> getThreads()
Returns the document's article threads.- Returns:
- a list containing all article threads.
-
setThreads
public void setThreads(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 IOException
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
public PDDocumentCatalogAdditionalActions getActions()
- Returns:
- The Additional Actions for this Document
-
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.
-
getDests
public PDDocumentNameDestinationDictionary getDests()
- Returns:
- The named destinations dictionary for this document or null if none exists.
-
findNamedDestinationPage
public PDPageDestination findNamedDestinationPage(PDNamedDestination namedDest) throws IOException
Find the page destination from a named destination.- Parameters:
namedDest- the named destination.- Returns:
- a PDPageDestination object or null if not found.
- Throws:
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 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(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 String getLanguage()
Returns the language for the document, or null.- Returns:
- the language or null.
-
setLanguage
public void setLanguage(String language)
Sets the Language for the document.- Parameters:
language- The new document language.
-
getVersion
public String getVersion()
Returns the PDF specification version this document conforms to.- Returns:
- the PDF version (e.g. "1.4")
-
setVersion
public void setVersion(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 IOException
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
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
-
-