public class PdfCatalog extends PdfObjectWrapper<PdfDictionary>
Modifier and Type | Field and Description |
---|---|
protected Map<PdfName,PdfNameTree> |
nameTrees |
protected PdfOCProperties |
ocProperties |
protected PdfNumTree |
pageLabels |
Modifier | Constructor and Description |
---|---|
protected |
PdfCatalog(PdfDictionary pdfObject) |
protected |
PdfCatalog(PdfDocument pdfDocument) |
Modifier and Type | Method and Description |
---|---|
void |
addDeveloperExtension(PdfDeveloperExtension extension) |
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() |
PdfString |
getLang() |
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() |
PdfName |
getPageMode() |
PdfViewerPreferences |
getViewerPreferences() |
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) |
PdfCatalog |
remove(PdfName key) |
PdfCatalog |
setAdditionalAction(PdfName key, PdfAction action) |
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) |
PdfCatalog |
setOpenAction(PdfDestination destination) |
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
protected PdfNumTree pageLabels
protected PdfOCProperties ocProperties
protected PdfCatalog(PdfDictionary pdfObject)
protected PdfCatalog(PdfDocument pdfDocument)
public PdfOCProperties getOCProperties(boolean createIfNotExists)
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()
public void flush()
flush
in class PdfObjectWrapper<PdfDictionary>
public PdfCatalog setOpenAction(PdfDestination destination)
public PdfCatalog setOpenAction(PdfAction action)
public PdfCatalog setAdditionalAction(PdfName key, PdfAction action)
public PdfCatalog setPageMode(PdfName pageMode)
PdfName.UseNone
, PdfName.UseOutlines
, PdfName.UseThumbs
, PdfName.FullScreen
, PdfName.UseOC
, PdfName.UseAttachments
.
pageMode
- page mode.
public PdfName getPageMode()
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)
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)
public PdfCatalog remove(PdfName key)
protected boolean isWrappedObjectMustBeIndirect()
PdfObjectWrapper
isWrappedObjectMustBeIndirect
in class PdfObjectWrapper<PdfDictionary>
protected boolean isOCPropertiesMayHaveChanged()
Copyright © 1998–2020 iText Group NV. All rights reserved.