Top Description Fields Constructors Methods
org.apache.pdfbox.pdmodel

public Class PDDocumentCatalog

extends Object
implements COSObjectable
Class Inheritance
All Implemented Interfaces
org.apache.pdfbox.pdmodel.common.COSObjectable
Imports
java.io.IOException, java.util.ArrayList, .List, org.apache.commons.logging.Log, .LogFactory, org.apache.pdfbox.cos.COSArray, .COSBase, .COSDictionary, .COSName, .COSObject, .COSStream, org.apache.pdfbox.pdmodel.common.COSArrayList, .COSObjectable, .PDDestinationOrAction, .PDMetadata, .PDPageLabels, org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure.PDMarkInfo, .PDStructureTreeRoot, org.apache.pdfbox.pdmodel.fixup.AcroFormDefaultFixup, .PDDocumentFixup, org.apache.pdfbox.pdmodel.graphics.color.PDOutputIntent, org.apache.pdfbox.pdmodel.graphics.optionalcontent.PDOptionalContentProperties, org.apache.pdfbox.pdmodel.interactive.action.PDActionFactory, .PDDocumentCatalogAdditionalActions, .PDURIDictionary, org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination.PDDestination, .PDNamedDestination, .PDPageDestination, org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDDocumentOutline, org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm, org.apache.pdfbox.pdmodel.interactive.pagenavigation.PDThread, org.apache.pdfbox.pdmodel.interactive.viewerpreferences.PDViewerPreferences

The Document Catalog of a PDF.
Author
Ben Litchfield

Field Summary

Modifier and TypeField and Description
private PDDocumentFixup
private PDAcroForm
private final PDDocument
private static final Log
private final COSDictionary

Constructor Summary

AccessConstructor and Description
protected
PDDocumentCatalog(PDDocument
The document that this catalog is part of.
doc
)

Constructor.

protected
PDDocumentCatalog(PDDocument
The document that this catalog is part of.
doc
,
COSDictionary
The root dictionary that this object wraps.
rootDictionary
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
public void
addOutputIntent(PDOutputIntent
the OutputIntent to add.
outputIntent
)

Add an OutputIntent to the list.

public PDPageDestination

Returns:

a PDPageDestination object or null if not found.
findNamedDestinationPage
(PDNamedDestination
the named destination.
namedDest
)

Find the page destination from a named destination.

public PDAcroForm

Returns:

The document's AcroForm.
getAcroForm
()

Get the documents AcroForm.

public PDAcroForm

Returns:

The document's AcroForm.
getAcroForm
(PDDocumentFixup
the fix up action or null
acroFormFixup
)

Get the documents AcroForm.

public PDDocumentCatalogAdditionalActions

Returns:

The Additional Actions for this Document
getActions
()

public COSDictionary

Returns:

The cos object that matches this Java object.
getCOSObject
()

Implements org.apache.pdfbox.pdmodel.common.COSObjectable.getCOSObject.

Convert this standard java object to a COS object.

public PDDocumentNameDestinationDictionary

Returns:

The named destinations dictionary for this document or null if none exists.
getDests
()

public PDDocumentOutline

Returns:

The document's outline.
getDocumentOutline
()

Get the outline associated with this document or null if it does not exist.

public String

Returns:

the language of the document if present, otherwise null
getLanguage
()

Returns the language for the document, or null.

public PDMarkInfo

Returns:

The new mark info.
getMarkInfo
()

Get info about doc's usage of tagged features.

public PDMetadata

Returns:

The metadata for this object.
getMetadata
()

Get the metadata that is part of the document catalog.

public PDDocumentNameDictionary

Returns:

The names dictionary for this document or null if none exist.
getNames
()

public PDOptionalContentProperties

Returns:

the optional properties dictionary or null if it is not present
getOCProperties
()

Get the optional content properties dictionary associated with this document.

public PDDestinationOrAction

Returns:

The action to perform when the document is opened.
getOpenAction
()

Get the Document Open Action for this object.

public List<PDOutputIntent>

Returns:

The list of PDOutputIntent, never null.
getOutputIntents
()

Get the list of OutputIntents defined in the document.

public PDPageLabels

Returns:

the page labels descriptor of the document.
getPageLabels
()

Returns the page labels descriptor of the document.

public PageLayout

Returns:

the PageLayout of the document, if not present PageLayout.SINGLE_PAGE is returned
getPageLayout
()

Returns the page layout.

public PageMode

Returns:

the PageMode of the document, if not present PageMode.USE_NONE is returned
getPageMode
()

Returns the page display mode.

public PDPageTree

Returns:

PDPageTree providing all pages of the document
getPages
()

Returns all pages in the document, as a page tree.

public PDStructureTreeRoot

Returns:

the structure tree root if present, otherwise null
getStructureTreeRoot
()

Get the document's structure tree root, or null if none exists.

public List<PDThread>

Returns:

a list of all threads of the document
getThreads
()

Returns the document's article threads.

public PDURIDictionary

Returns:

the document level URI if present, otherwise null
getURI
()

Returns the document-level URI.

public String

Returns:

the PDF version (e.g. "1.4")
getVersion
()

Returns the PDF specification version this document conforms to.

public PDViewerPreferences

Returns:

The document's viewer preferences.
getViewerPreferences
()

Get the viewer preferences associated with this document or null if they do not exist.

public void
setAcroForm(PDAcroForm
The new AcroForm.
acroForm
)

Sets the AcroForm for this catalog.

public void
setActions(PDDocumentCatalogAdditionalActions
The actions that are associated with this document.
actions
)

Sets the additional actions for the document.

public void
setDocumentOutline(PDDocumentOutline
The new document outlines.
outlines
)

Sets the document outlines.

public void
setLanguage(String
The new document language.
language
)

Sets the Language for the document.

public void
setMarkInfo(PDMarkInfo
The new MarkInfo data.
markInfo
)

Set information about the doc's usage of tagged features.

public void
setMetadata(PDMetadata
The meta data for this object.
meta
)

Sets the metadata for this object.

public void
setNames(PDDocumentNameDictionary
The names dictionary that is associated with this document.
names
)

Sets the names dictionary for the document.

public void
setOCProperties(PDOptionalContentProperties
the optional properties dictionary
ocProperties
)

Sets the optional content properties dictionary.

public void
setOpenAction(PDDestinationOrAction
The action you want to perform.
action
)

Sets the Document Open Action for this object.

public void
setOutputIntents(List<PDOutputIntent>
the list of OutputIntents, if the list is empty all OutputIntents are removed.
outputIntents
)

Replace the list of OutputIntents of the document.

public void
setPageLabels(PDPageLabels
the new page label descriptor to set.
labels
)

Sets the page label descriptor for the document.

public void
setPageLayout(PageLayout
The new page layout.
layout
)

Sets the page layout.

public void
setPageMode(PageMode
The new page mode.
mode
)

Sets the page mode.

public void
setStructureTreeRoot(PDStructureTreeRoot
The new structure tree.
treeRoot
)

Sets the document's structure tree root.

public void
setThreads(List<PDThread>
The list of threads, or null to clear it.
threads
)

Sets the list of threads for this pdf document.

public void
setURI(PDURIDictionary
The new document level URI.
uri
)

Sets the document level URI.

public void
setVersion(String
the PDF version (e.g. "1.4")
version
)

Sets the PDF specification version this document conforms to.

public void
setViewerPreferences(PDViewerPreferences
The new viewer preferences.
prefs
)

Sets the viewer preferences.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

acroFormFixupAppliedback to summary
private PDDocumentFixup acroFormFixupApplied
cachedAcroFormback to summary
private PDAcroForm cachedAcroForm
documentback to summary
private final PDDocument document
LOGback to summary
private static final Log LOG
rootback to summary
private final COSDictionary root

Constructor Detail

PDDocumentCatalogback to summary
protected PDDocumentCatalog(PDDocument doc)

Constructor. Internal PDFBox use only! If you need to get the document catalog, call PDDocument#getDocumentCatalog().

Parameters
doc:PDDocument

The document that this catalog is part of.

PDDocumentCatalogback to summary
protected PDDocumentCatalog(PDDocument doc, COSDictionary rootDictionary)

Constructor. Internal PDFBox use only! If you need to get the document catalog, call PDDocument#getDocumentCatalog().

Parameters
doc:PDDocument

The document that this catalog is part of.

rootDictionary:COSDictionary

The root dictionary that this object wraps.

Method Detail

addOutputIntentback to summary
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:PDOutputIntent

the OutputIntent to add.

findNamedDestinationPageback to summary
public PDPageDestination findNamedDestinationPage(PDNamedDestination namedDest) throws IOException

Find the page destination from a named destination.

Parameters
namedDest:PDNamedDestination

the named destination.

Returns:PDPageDestination

a PDPageDestination object or null if not found.

Exceptions
IOException:
if there is an error creating the PDPageDestination object.
getAcroFormback to summary
public PDAcroForm getAcroForm()

Get the documents AcroForm. This will return null if no AcroForm is part of the document.

Returns:PDAcroForm

The document's AcroForm.

getAcroFormback to summary
public PDAcroForm getAcroForm(PDDocumentFixup acroFormFixup)

Get the documents AcroForm. This will return null if no AcroForm is part of the document. Dependent on setting acroFormFixup some fixing/changes will be done to the AcroForm. If you need to ensure that there are no fixes applied call getAcroForm with null. Using getAcroForm(PDDocumentFixup acroFormFixup) might change the original content and subsequent calls with getAcroForm(null) will return the changed content.

Parameters
acroFormFixup:PDDocumentFixup

the fix up action or null

Returns:PDAcroForm

The document's AcroForm.

getActionsback to summary
public PDDocumentCatalogAdditionalActions getActions()
Returns:PDDocumentCatalogAdditionalActions

The Additional Actions for this Document

getCOSObjectback to summary
public COSDictionary getCOSObject()

Implements org.apache.pdfbox.pdmodel.common.COSObjectable.getCOSObject.

Convert this standard java object to a COS object.

Returns:COSDictionary

The cos object that matches this Java object.

Annotations
@Override
getDestsback to summary
public PDDocumentNameDestinationDictionary getDests()
Returns:PDDocumentNameDestinationDictionary

The named destinations dictionary for this document or null if none exists.

getDocumentOutlineback to summary
public PDDocumentOutline getDocumentOutline()

Get the outline associated with this document or null if it does not exist.

Returns:PDDocumentOutline

The document's outline.

getLanguageback to summary
public String getLanguage()

Returns the language for the document, or null.

Returns:String

the language of the document if present, otherwise null

getMarkInfoback to summary
public PDMarkInfo getMarkInfo()

Get info about doc's usage of tagged features. This will return null if there is no information.

Returns:PDMarkInfo

The new mark info.

getMetadataback to summary
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:PDMetadata

The metadata for this object.

getNamesback to summary
public PDDocumentNameDictionary getNames()
Returns:PDDocumentNameDictionary

The names dictionary for this document or null if none exist.

getOCPropertiesback to summary
public PDOptionalContentProperties getOCProperties()

Get the optional content properties dictionary associated with this document.

Returns:PDOptionalContentProperties

the optional properties dictionary or null if it is not present

getOpenActionback to summary
public PDDestinationOrAction getOpenAction() throws IOException

Get the Document Open Action for this object.

Returns:PDDestinationOrAction

The action to perform when the document is opened.

Exceptions
IOException:
If there is an error creating the destination or action.
getOutputIntentsback to summary
public List<PDOutputIntent> getOutputIntents()

Get the list of OutputIntents defined in the document.

Returns:List<PDOutputIntent>

The list of PDOutputIntent, never null.

getPageLabelsback to summary
public PDPageLabels getPageLabels() throws IOException

Returns the page labels descriptor of the document.

Returns:PDPageLabels

the page labels descriptor of the document.

Exceptions
IOException:
If there is a problem retrieving the page labels.
getPageLayoutback to summary
public PageLayout getPageLayout()

Returns the page layout.

Returns:PageLayout

the PageLayout of the document, if not present PageLayout.SINGLE_PAGE is returned

getPageModeback to summary
public PageMode getPageMode()

Returns the page display mode.

Returns:PageMode

the PageMode of the document, if not present PageMode.USE_NONE is returned

getPagesback to summary
public PDPageTree getPages()

Returns all pages in the document, as a page tree.

Returns:PDPageTree

PDPageTree providing all pages of the document

getStructureTreeRootback to summary
public PDStructureTreeRoot getStructureTreeRoot()

Get the document's structure tree root, or null if none exists.

Returns:PDStructureTreeRoot

the structure tree root if present, otherwise null

getThreadsback to summary
public List<PDThread> getThreads()

Returns the document's article threads.

Returns:List<PDThread>

a list of all threads of the document

getURIback to summary
public PDURIDictionary getURI()

Returns the document-level URI.

Returns:PDURIDictionary

the document level URI if present, otherwise null

getVersionback to summary
public String getVersion()

Returns the PDF specification version this document conforms to.

Returns:String

the PDF version (e.g. "1.4")

getViewerPreferencesback to summary
public PDViewerPreferences getViewerPreferences()

Get the viewer preferences associated with this document or null if they do not exist.

Returns:PDViewerPreferences

The document's viewer preferences.

setAcroFormback to summary
public void setAcroForm(PDAcroForm acroForm)

Sets the AcroForm for this catalog.

Parameters
acroForm:PDAcroForm

The new AcroForm.

setActionsback to summary
public void setActions(PDDocumentCatalogAdditionalActions actions)

Sets the additional actions for the document.

Parameters
actions:PDDocumentCatalogAdditionalActions

The actions that are associated with this document.

setDocumentOutlineback to summary
public void setDocumentOutline(PDDocumentOutline outlines)

Sets the document outlines.

Parameters
outlines:PDDocumentOutline

The new document outlines.

setLanguageback to summary
public void setLanguage(String language)

Sets the Language for the document.

Parameters
language:String

The new document language.

setMarkInfoback to summary
public void setMarkInfo(PDMarkInfo markInfo)

Set information about the doc's usage of tagged features.

Parameters
markInfo:PDMarkInfo

The new MarkInfo data.

setMetadataback to summary
public void setMetadata(PDMetadata meta)

Sets the metadata for this object. This can be null.

Parameters
meta:PDMetadata

The meta data for this object.

setNamesback to summary
public void setNames(PDDocumentNameDictionary names)

Sets the names dictionary for the document.

Parameters
names:PDDocumentNameDictionary

The names dictionary that is associated with this document.

setOCPropertiesback to summary
public void setOCProperties(PDOptionalContentProperties ocProperties)

Sets the optional content properties dictionary. The document version is incremented to 1.5 if lower.

Parameters
ocProperties:PDOptionalContentProperties

the optional properties dictionary

setOpenActionback to summary
public void setOpenAction(PDDestinationOrAction action)

Sets the Document Open Action for this object.

Parameters
action:PDDestinationOrAction

The action you want to perform.

setOutputIntentsback to summary
public void setOutputIntents(List<PDOutputIntent> outputIntents)

Replace the list of OutputIntents of the document.

Parameters
outputIntents:List<PDOutputIntent>

the list of OutputIntents, if the list is empty all OutputIntents are removed.

setPageLabelsback to summary
public void setPageLabels(PDPageLabels labels)

Sets the page label descriptor for the document.

Parameters
labels:PDPageLabels

the new page label descriptor to set.

setPageLayoutback to summary
public void setPageLayout(PageLayout layout)

Sets the page layout.

Parameters
layout:PageLayout

The new page layout.

setPageModeback to summary
public void setPageMode(PageMode mode)

Sets the page mode.

Parameters
mode:PageMode

The new page mode.

setStructureTreeRootback to summary
public void setStructureTreeRoot(PDStructureTreeRoot treeRoot)

Sets the document's structure tree root.

Parameters
treeRoot:PDStructureTreeRoot

The new structure tree.

setThreadsback to summary
public void setThreads(List<PDThread> threads)

Sets the list of threads for this pdf document.

Parameters
threads:List<PDThread>

The list of threads, or null to clear it.

setURIback to summary
public void setURI(PDURIDictionary uri)

Sets the document level URI.

Parameters
uri:PDURIDictionary

The new document level URI.

setVersionback to summary
public void setVersion(String version)

Sets the PDF specification version this document conforms to.

Parameters
version:String

the PDF version (e.g. "1.4")

setViewerPreferencesback to summary
public void setViewerPreferences(PDViewerPreferences prefs)

Sets the viewer preferences.

Parameters
prefs:PDViewerPreferences

The new viewer preferences.