public class PdfCatalog extends PdfObjectWrapper<PdfDictionary>
Modifier and Type | Field and Description |
---|---|
protected Map<PdfName,PdfNameTree> |
nameTrees
Map of the PdfNameTree .
|
protected PdfOCProperties |
ocProperties
The document’s optional content properties dictionary.
|
protected PdfNumTree |
pageLabels
Defining the page labelling for the document.
|
Modifier | Constructor and Description |
---|---|
protected |
PdfCatalog(PdfDictionary pdfObject)
Create PdfCatalog dictionary.
|
protected |
PdfCatalog(PdfDocument pdfDocument)
Create PdfCatalog to PdfDocument .
|
Modifier and Type | Method and Description |
---|---|
void |
addDeveloperExtension(PdfDeveloperExtension extension)
Add an extensions dictionary containing developer prefix identification and version numbers for developer extensions that occur in this document.
|
void |
flush()
PdfCatalog will be flushed in PdfDocument.close().
|
PdfCollection |
getCollection()
Gets collection dictionary that a conforming reader shall use to enhance the presentation of file attachments stored in the PDF document.
|
PdfDocument |
getDocument()
Get PdfDocument with indirect reference associated with the object.
|
PdfString |
getLang()
Get natural language.
|
PdfNameTree |
getNameTree(PdfName treeType)
This method gets Names tree from the catalog.
|
PdfOCProperties |
getOCProperties(boolean createIfNotExists)
Use this method to get the Optional Content Properties Dictionary.
|
PdfNumTree |
getPageLabelsTree(boolean createIfNotExists)
This method returns the NumberTree of Page Labels
|
PdfName |
getPageLayout()
Get page layout of the document.
|
PdfName |
getPageMode()
Get page mode of the document.
|
PdfViewerPreferences |
getViewerPreferences()
Get viewer preferences of the document.
|
protected boolean |
isOCPropertiesMayHaveChanged()
True indicates that getOCProperties() was called, may have been modified, and thus its dictionary needs to be reconstructed.
|
protected boolean |
isWrappedObjectMustBeIndirect()
Defines if the object behind this wrapper must be an indirect object in the resultant document.
|
PdfCatalog |
put(PdfName key, PdfObject value)
Add key and value to PdfCatalog dictionary.
|
PdfCatalog |
remove(PdfName key)
Remove key from catalog dictionary.
|
PdfCatalog |
setAdditionalAction(PdfName key, PdfAction action)
The actions that shall be taken in response to various trigger events affecting the document as a whole.
|
PdfCatalog |
setCollection(PdfCollection collection)
Sets collection dictionary that a conforming reader shall use to enhance the presentation of file attachments stored in the PDF document.
|
void |
setLang(PdfString lang)
An entry specifying the natural language, and optionally locale.
|
PdfCatalog |
setOpenAction(PdfAction action)
A value specifying an action that shall be performed when the document is opened.
|
PdfCatalog |
setOpenAction(PdfDestination destination)
A value specifying a destination that shall be displayed when the document is opened.
|
PdfCatalog |
setPageLayout(PdfName pageLayout)
This method sets a page layout of the document
|
PdfCatalog |
setPageMode(PdfName pageMode)
This method sets a page mode of the document.
|
PdfCatalog |
setViewerPreferences(PdfViewerPreferences preferences)
This method sets the document viewer preferences, specifying the way the document shall be displayed on the screen
|
ensureObjectIsAddedToDocument, ensureUnderlyingObjectHasIndirectReference, getPdfObject, isFlushed, makeIndirect, makeIndirect, markObjectAsIndirect, setForbidRelease, setModified, setPdfObject, unsetForbidRelease
protected Map<PdfName,PdfNameTree> nameTrees
PdfNameTree
. Used for creation name tree
dictionary.
protected PdfNumTree pageLabels
protected PdfOCProperties ocProperties
protected PdfCatalog(PdfDictionary pdfObject)
PdfCatalog
dictionary.
pdfObject
- the dictionary to be wrapped
protected PdfCatalog(PdfDocument pdfDocument)
PdfCatalog
to PdfDocument
.
pdfDocument
- A PdfDocument
object representing the document to which redaction applies
public PdfOCProperties getOCProperties(boolean createIfNotExists)
PdfDictionary
with OCProperties will be generated from PdfOCProperties
object right before closing the PdfDocument
, so if you want to make low-level changes in Pdf structures themselves (PdfArray
, PdfDictionary
, etc), then you should address directly those objects, e.g.: PdfCatalog pdfCatalog = pdfDoc.getCatalog(); PdfDictionary ocProps = pdfCatalog.getAsDictionary(PdfName.OCProperties); // manipulate with ocProps.
Also note that this method is implicitly called when creating a new PdfLayer instance, so you should either use hi-level logic of operating with layers, or manipulate low-level Pdf objects by yourself.
createIfNotExists
- true to create new /OCProperties entry in catalog if not exists, false to return null if /OCProperties entry in catalog is not present.
public PdfDocument getDocument()
PdfDocument
with indirect reference associated with the object.
public void flush()
flush
in class PdfObjectWrapper<PdfDictionary>
public PdfCatalog setOpenAction(PdfDestination destination)
destination
- instance of PdfDestination
.
public PdfCatalog setOpenAction(PdfAction action)
action
- instance of PdfAction
.
public PdfCatalog setAdditionalAction(PdfName key, PdfAction action)
key
- the key of which the associated value needs to be returned
action
- instance of PdfAction
.
public PdfCatalog setPageMode(PdfName pageMode)
PdfName.UseNone
, PdfName.UseOutlines
, PdfName.UseThumbs
, PdfName.FullScreen
, PdfName.UseOC
, PdfName.UseAttachments
.
pageMode
- page mode.
public PdfName getPageMode()
PdfCatalog
public PdfCatalog setPageLayout(PdfName pageLayout)
pageLayout
- page layout of the document
PdfCatalog
instance with applied page layout
public PdfName getPageLayout()
public PdfCatalog setViewerPreferences(PdfViewerPreferences preferences)
preferences
- document's viewer preferences
PdfCatalog
instance with applied viewer preferences
public PdfViewerPreferences getViewerPreferences()
public PdfNameTree getNameTree(PdfName treeType)
treeType
- type of the tree (Dests, AP, EmbeddedFiles etc).
PdfNameTree
public PdfNumTree getPageLabelsTree(boolean createIfNotExists)
createIfNotExists
- defines whether the NumberTree of Page Labels should be created if it didn't exist before
PdfNumTree
public void setLang(PdfString lang)
lang
- language
to be set
public PdfString getLang()
public void addDeveloperExtension(PdfDeveloperExtension extension)
extension
- enables developers to identify their own extension relative to a base version of PDF
public PdfCollection getCollection()
PdfCollection
wrapper of collection dictionary.
public PdfCatalog setCollection(PdfCollection collection)
collection
- dictionary
PdfCatalog
instance with applied collection dictionary
public PdfCatalog put(PdfName key, PdfObject value)
PdfCatalog
dictionary.
key
- the dictionary key corresponding with the PDF object
value
- the value of key
public PdfCatalog remove(PdfName key)
key
- the dictionary key corresponding with the PDF object
protected boolean isWrappedObjectMustBeIndirect()
PdfObjectWrapper
isWrappedObjectMustBeIndirect
in class PdfObjectWrapper<PdfDictionary>
protected boolean isOCPropertiesMayHaveChanged()
Copyright © 1998–2021 iText Group NV. All rights reserved.