Package org.apache.pdfbox.pdmodel
Class PDDocumentCatalog
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.PDDocumentCatalog
-
- All Implemented Interfaces:
COSObjectable
public class PDDocumentCatalog extends java.lang.Object implements COSObjectable
This class represents the acroform of a PDF document.- Version:
- $Revision: 1.21 $
- Author:
- Ben Litchfield
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PAGE_LAYOUT_ONE_COLUMN
Display the pages in one column.static java.lang.String
PAGE_LAYOUT_SINGLE_PAGE
Display one page at a time.static java.lang.String
PAGE_LAYOUT_TWO_COLUMN_LEFT
Display the pages in two columns, with odd numbered pagse on the left.static java.lang.String
PAGE_LAYOUT_TWO_COLUMN_RIGHT
Display the pages in two columns, with odd numbered pagse on the right.static java.lang.String
PAGE_LAYOUT_TWO_PAGE_LEFT
Display the pages two at a time, with odd-numbered pages on the left.static java.lang.String
PAGE_LAYOUT_TWO_PAGE_RIGHT
Display the pages two at a time, with odd-numbered pages on the right.static java.lang.String
PAGE_MODE_FULL_SCREEN
Full screen mode with no menu bar, window controls.static java.lang.String
PAGE_MODE_USE_ATTACHMENTS
Attachments panel is visible.static java.lang.String
PAGE_MODE_USE_NONE
Page mode where neither the outline nor the thumbnails are displayed.static java.lang.String
PAGE_MODE_USE_OPTIONAL_CONTENT
Optional content group panel is visible when opened.static java.lang.String
PAGE_MODE_USE_OUTLINES
Show bookmarks when pdf is opened.static java.lang.String
PAGE_MODE_USE_THUMBS
Show thumbnails when pdf is opened.
-
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 void
addOutputIntent(PDOutputIntent outputIntent)
Add an OutputIntent to the list.PDAcroForm
getAcroForm()
This will get the documents acroform.PDDocumentCatalogAdditionalActions
getActions()
java.util.List
getAllPages()
The PDF document contains a hierarchical structure of PDPageNode and PDPages, which is mostly just a way to store this information.COSDictionary
getCOSDictionary()
Convert this standard java object to a COS object.COSBase
getCOSObject()
Convert this standard java object to a COS object.PDDocumentNameDestinationDictionary
getDests()
PDDocumentOutline
getDocumentOutline()
Get the outline associated with this document or null if it does not exist.java.lang.String
getLanguage()
The language for the document.PDMarkInfo
getMarkInfo()
Get info about doc's usage of tagged features.PDMetadata
getMetadata()
Get the metadata that is part of the document catalog.PDDocumentNameDictionary
getNames()
PDOptionalContentProperties
getOCProperties()
Get the optional content properties dictionary associated with this document.PDDestinationOrAction
getOpenAction()
Get the Document Open Action for this object.java.util.List<PDOutputIntent>
getOutputIntent()
Get the list of OutputIntents defined in the document.PDPageLabels
getPageLabels()
Returns the page labels descriptor of the document.java.lang.String
getPageLayout()
Set the page layout, see the PAGE_LAYOUT_XXX constants.java.lang.String
getPageMode()
Set the page display mode, see the PAGE_MODE_XXX constants.PDPageNode
getPages()
This will get the root node for the pages.PDStructureTreeRoot
getStructureTreeRoot()
Get the document's structure tree root.java.util.List
getThreads()
Get the list threads for this pdf document.PDURIDictionary
getURI()
Document level information in the URI.java.lang.String
getVersion()
Returns the PDF specification version this document conforms to.PDViewerPreferences
getViewerPreferences()
Get the viewer preferences associated with this document or null if they do not exist.void
setAcroForm(PDAcroForm acro)
Set the acro form for this catalog.void
setActions(PDDocumentCatalogAdditionalActions actions)
Set the additional actions for the document.void
setDocumentOutline(PDDocumentOutline outlines)
Set the document outlines.void
setLanguage(java.lang.String language)
Set the Language for the document.void
setMarkInfo(PDMarkInfo markInfo)
Set information about the doc's usage of tagged features.void
setMetadata(PDMetadata meta)
Set the metadata for this object.void
setNames(PDDocumentNameDictionary names)
Set the names dictionary for the document.void
setOCProperties(PDOptionalContentProperties ocProperties)
Set the optional content properties dictionary.void
setOpenAction(PDDestinationOrAction action)
Set the Document Open Action for this object.void
setOutputIntents(java.util.List<PDOutputIntent> outputIntents)
Replace the list of OutputIntents of the document.void
setPageLabels(PDPageLabels labels)
Set the page label descriptor for the document.void
setPageLayout(java.lang.String layout)
Set the page layout.void
setPageMode(java.lang.String mode)
Set the page mode.void
setStructureTreeRoot(PDStructureTreeRoot treeRoot)
Set the document's structure tree root.void
setThreads(java.util.List threads)
Set the list of threads for this pdf document.void
setURI(PDURIDictionary uri)
Set the document level uri.void
setVersion(java.lang.String version)
Sets the PDF specification version this document conforms to.void
setViewerPreferences(PDViewerPreferences prefs)
Set the viewer preferences.
-
-
-
Field Detail
-
PAGE_MODE_USE_NONE
public static final java.lang.String PAGE_MODE_USE_NONE
Page mode where neither the outline nor the thumbnails are displayed.- See Also:
- Constant Field Values
-
PAGE_MODE_USE_OUTLINES
public static final java.lang.String PAGE_MODE_USE_OUTLINES
Show bookmarks when pdf is opened.- See Also:
- Constant Field Values
-
PAGE_MODE_USE_THUMBS
public static final java.lang.String PAGE_MODE_USE_THUMBS
Show thumbnails when pdf is opened.- See Also:
- Constant Field Values
-
PAGE_MODE_FULL_SCREEN
public static final java.lang.String PAGE_MODE_FULL_SCREEN
Full screen mode with no menu bar, window controls.- See Also:
- Constant Field Values
-
PAGE_MODE_USE_OPTIONAL_CONTENT
public static final java.lang.String PAGE_MODE_USE_OPTIONAL_CONTENT
Optional content group panel is visible when opened.- See Also:
- Constant Field Values
-
PAGE_MODE_USE_ATTACHMENTS
public static final java.lang.String PAGE_MODE_USE_ATTACHMENTS
Attachments panel is visible.- See Also:
- Constant Field Values
-
PAGE_LAYOUT_SINGLE_PAGE
public static final java.lang.String PAGE_LAYOUT_SINGLE_PAGE
Display one page at a time.- See Also:
- Constant Field Values
-
PAGE_LAYOUT_ONE_COLUMN
public static final java.lang.String PAGE_LAYOUT_ONE_COLUMN
Display the pages in one column.- See Also:
- Constant Field Values
-
PAGE_LAYOUT_TWO_COLUMN_LEFT
public static final java.lang.String PAGE_LAYOUT_TWO_COLUMN_LEFT
Display the pages in two columns, with odd numbered pagse on the left.- See Also:
- Constant Field Values
-
PAGE_LAYOUT_TWO_COLUMN_RIGHT
public static final java.lang.String PAGE_LAYOUT_TWO_COLUMN_RIGHT
Display the pages in two columns, with odd numbered pagse on the right.- See Also:
- Constant Field Values
-
PAGE_LAYOUT_TWO_PAGE_LEFT
public static final java.lang.String PAGE_LAYOUT_TWO_PAGE_LEFT
Display the pages two at a time, with odd-numbered pages on the left.- Since:
- PDF Version 1.5
- See Also:
- Constant Field Values
-
PAGE_LAYOUT_TWO_PAGE_RIGHT
public static final java.lang.String PAGE_LAYOUT_TWO_PAGE_RIGHT
Display the pages two at a time, with odd-numbered pages on the right.- Since:
- PDF Version 1.5
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PDDocumentCatalog
public PDDocumentCatalog(PDDocument doc)
Constructor.- Parameters:
doc
- The document that this catalog is part of.
-
PDDocumentCatalog
public PDDocumentCatalog(PDDocument doc, COSDictionary rootDictionary)
Constructor.- Parameters:
doc
- The document that this catalog is part of.rootDictionary
- The root dictionary that this object wraps.
-
-
Method Detail
-
getCOSObject
public COSBase getCOSObject()
Convert this standard java object to a COS object.- Specified by:
getCOSObject
in interfaceCOSObjectable
- Returns:
- The cos object that matches this Java object.
-
getCOSDictionary
public COSDictionary getCOSDictionary()
Convert this standard java object to a COS object.- Returns:
- The cos object that matches this Java object.
-
getAcroForm
public PDAcroForm getAcroForm()
This will get the documents acroform. This will return null if no acroform is part of the document.- Returns:
- The documents acroform.
-
setAcroForm
public void setAcroForm(PDAcroForm acro)
Set the acro form for this catalog.- Parameters:
acro
- The new acro form.
-
getPages
public PDPageNode getPages()
This will get the root node for the pages.- Returns:
- The parent page node.
-
getAllPages
public java.util.List getAllPages()
The PDF document contains a hierarchical structure of PDPageNode and PDPages, which is mostly just a way to store this information. This method will return a flat list of all PDPage objects in this document.- Returns:
- A list of PDPage objects.
-
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)
Set 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)
Set the document outlines.- Parameters:
outlines
- The new document outlines.
-
getThreads
public java.util.List getThreads()
Get the list threads for this pdf document.- Returns:
- A list of PDThread objects.
-
setThreads
public void setThreads(java.util.List threads)
Set 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)
Set the metadata for this object. This can be null.- Parameters:
meta
- The meta data for this object.
-
setOpenAction
public void setOpenAction(PDDestinationOrAction action)
Set 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.
-
getActions
public PDDocumentCatalogAdditionalActions getActions()
- Returns:
- The Additional Actions for this Document
-
setActions
public void setActions(PDDocumentCatalogAdditionalActions actions)
Set 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.
-
setNames
public void setNames(PDDocumentNameDictionary names)
Set 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.
-
getOutputIntent
public java.util.List<PDOutputIntent> getOutputIntent()
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 java.lang.String getPageMode()
Set the page display mode, see the PAGE_MODE_XXX constants.- Returns:
- A string representing the page mode.
-
setPageMode
public void setPageMode(java.lang.String mode)
Set the page mode. See the PAGE_MODE_XXX constants for valid values.- Parameters:
mode
- The new page mode.
-
getPageLayout
public java.lang.String getPageLayout()
Set the page layout, see the PAGE_LAYOUT_XXX constants.- Returns:
- A string representing the page layout.
-
setPageLayout
public void setPageLayout(java.lang.String layout)
Set the page layout. See the PAGE_LAYOUT_XXX constants for valid values.- Parameters:
layout
- The new page layout.
-
getURI
public PDURIDictionary getURI()
Document level information in the URI.- Returns:
- Document level URI.
-
setURI
public void setURI(PDURIDictionary uri)
Set the document level uri.- Parameters:
uri
- The new document level uri.
-
getStructureTreeRoot
public PDStructureTreeRoot getStructureTreeRoot()
Get the document's structure tree root.- Returns:
- The document's structure tree root or null if none exists.
-
setStructureTreeRoot
public void setStructureTreeRoot(PDStructureTreeRoot treeRoot)
Set the document's structure tree root.- Parameters:
treeRoot
- The new structure tree.
-
getLanguage
public java.lang.String getLanguage()
The language for the document.- Returns:
- The language for the document.
-
setLanguage
public void setLanguage(java.lang.String language)
Set 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.
-
setVersion
public void setVersion(java.lang.String version)
Sets the PDF specification version this document conforms to.- Parameters:
version
- the PDF version (ex. "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)
Set 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
- Since:
- PDF 1.5
-
setOCProperties
public void setOCProperties(PDOptionalContentProperties ocProperties)
Set the optional content properties dictionary.- Parameters:
ocProperties
- the optional properties dictionary- Since:
- PDF 1.5
-
-