Table of Contents

Class PdfCatalog

Namespace
iText.Kernel.Pdf
Assembly
itext.kernel.dll

The root of a document’s object hierarchy.

public class PdfCatalog : PdfObjectWrapper<PdfDictionary>
Inheritance
PdfCatalog
Inherited Members

Constructors

PdfCatalog(PdfDictionary)

Create PdfCatalog dictionary.

protected PdfCatalog(PdfDictionary pdfObject)

Parameters

pdfObject PdfDictionary

the dictionary to be wrapped

PdfCatalog(PdfDocument)

protected PdfCatalog(PdfDocument pdfDocument)

Parameters

pdfDocument PdfDocument

A PdfDocument object representing the document to which redaction applies

Fields

nameTrees

Map of the PdfNameTree.

protected IDictionary<PdfName, PdfNameTree> nameTrees

Field Value

IDictionary<PdfName, PdfNameTree>

Remarks

Map of the PdfNameTree . Used for creation name tree dictionary.

ocProperties

The document’s optional content properties dictionary.

protected PdfOCProperties ocProperties

Field Value

PdfOCProperties

pageLabels

Defining the page labelling for the document.

protected PdfNumTree pageLabels

Field Value

PdfNumTree

Methods

AddDeveloperExtension(PdfDeveloperExtension)

Add an extensions dictionary containing developer prefix identification and version numbers for developer extensions that occur in this document.

public virtual void AddDeveloperExtension(PdfDeveloperExtension extension)

Parameters

extension PdfDeveloperExtension

enables developers to identify their own extension relative to a base version of PDF

Remarks

Add an extensions dictionary containing developer prefix identification and version numbers for developer extensions that occur in this document. See ISO 32000-1, Table 28 – Entries in the catalog dictionary.

Flush()

PdfCatalog will be flushed in PdfDocument.close().

public override void Flush()

Remarks

PdfCatalog will be flushed in PdfDocument.close(). User mustn't flush PdfCatalog!

GetCollection()

Gets collection dictionary that a conforming reader shall use to enhance the presentation of file attachments stored in the PDF document.

public virtual PdfCollection GetCollection()

Returns

PdfCollection

PdfCollection wrapper of collection dictionary.

GetDocument()

Get PdfDocument with indirect reference associated with the object.

public virtual PdfDocument GetDocument()

Returns

PdfDocument

the resultant dictionary

GetLang()

Get natural language.

public virtual PdfString GetLang()

Returns

PdfString

natural language

GetNameTree(PdfName)

This method gets Names tree from the catalog.

public virtual PdfNameTree GetNameTree(PdfName treeType)

Parameters

treeType PdfName

type of the tree (Dests, AP, EmbeddedFiles etc).

Returns

PdfNameTree

returns PdfNameTree

GetOCProperties(bool)

Use this method to get the Optional Content Properties Dictionary.

public virtual PdfOCProperties GetOCProperties(bool createIfNotExists)

Parameters

createIfNotExists bool

true to create new /OCProperties entry in catalog if not exists, false to return null if /OCProperties entry in catalog is not present.

Returns

PdfOCProperties

the Optional Content Properties Dictionary

Remarks

Use this method to get the Optional Content Properties Dictionary. Note that if you call this method, then the 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.

GetPageLabelsTree(bool)

This method returns the NumberTree of Page Labels

public virtual PdfNumTree GetPageLabelsTree(bool createIfNotExists)

Parameters

createIfNotExists bool

defines whether the NumberTree of Page Labels should be created if it didn't exist before

Returns

PdfNumTree

returns PdfNumTree

GetPageLayout()

Get page layout of the document.

public virtual PdfName GetPageLayout()

Returns

PdfName

name object of page layout that shall be used when document is opened

GetPageMode()

Get page mode of the document.

public virtual PdfName GetPageMode()

Returns

PdfName

current instance of PdfCatalog

GetViewerPreferences()

Get viewer preferences of the document.

public virtual PdfViewerPreferences GetViewerPreferences()

Returns

PdfViewerPreferences

dictionary of viewer preferences

IsOCPropertiesMayHaveChanged()

True indicates that getOCProperties() was called, may have been modified, and thus its dictionary needs to be reconstructed.

protected virtual bool IsOCPropertiesMayHaveChanged()

Returns

bool

boolean indicating if the dictionary needs to be reconstructed

IsWrappedObjectMustBeIndirect()

protected override bool IsWrappedObjectMustBeIndirect()

Returns

bool

NameTreeContainsKey(PdfName)

This method checks Names tree for specified tree type.

public virtual bool NameTreeContainsKey(PdfName treeType)

Parameters

treeType PdfName

type of tree which existence should be checked

Returns

bool

true if such tree exists, false otherwise

Put(PdfName, PdfObject)

Add key and value to PdfCatalog dictionary.

public virtual PdfCatalog Put(PdfName key, PdfObject value)

Parameters

key PdfName

the dictionary key corresponding with the PDF object

value PdfObject

the value of key

Returns

PdfCatalog

the key and value

Remove(PdfName)

Remove key from catalog dictionary.

public virtual PdfCatalog Remove(PdfName key)

Parameters

key PdfName

the dictionary key corresponding with the PDF object

Returns

PdfCatalog

the key

SetAdditionalAction(PdfName, PdfAction)

The actions that shall be taken in response to various trigger events affecting the document as a whole.

public virtual PdfCatalog SetAdditionalAction(PdfName key, PdfAction action)

Parameters

key PdfName

the key of which the associated value needs to be returned

action PdfAction

instance of PdfAction.

Returns

PdfCatalog

additional action

Remarks

The actions that shall be taken in response to various trigger events affecting the document as a whole. See ISO 32000-1, Table 28 – Entries in the catalog dictionary.

SetCollection(PdfCollection)

Sets collection dictionary that a conforming reader shall use to enhance the presentation of file attachments stored in the PDF document.

public virtual PdfCatalog SetCollection(PdfCollection collection)

Parameters

collection PdfCollection

dictionary

Returns

PdfCatalog

PdfCatalog instance with applied collection dictionary

SetLang(PdfString)

An entry specifying the natural language, and optionally locale.

public virtual void SetLang(PdfString lang)

Parameters

lang PdfString

language to be set

Remarks

An entry specifying the natural language, and optionally locale. Use this to specify the Language attribute on a Tagged Pdf element. For the content usage dictionary, use PdfName.Language

SetOpenAction(PdfAction)

A value specifying an action that shall be performed when the document is opened.

public virtual PdfCatalog SetOpenAction(PdfAction action)

Parameters

action PdfAction

instance of PdfAction.

Returns

PdfCatalog

action

Remarks

A value specifying an action that shall be performed when the document is opened. See ISO 32000-1, Table 28 – Entries in the catalog dictionary.

SetOpenAction(PdfDestination)

A value specifying a destination that shall be displayed when the document is opened.

public virtual PdfCatalog SetOpenAction(PdfDestination destination)

Parameters

destination PdfDestination

instance of PdfDestination.

Returns

PdfCatalog

destination

Remarks

A value specifying a destination that shall be displayed when the document is opened. See ISO 32000-1, Table 28 – Entries in the catalog dictionary.

SetPageLayout(PdfName)

This method sets a page layout of the document

public virtual PdfCatalog SetPageLayout(PdfName pageLayout)

Parameters

pageLayout PdfName

page layout of the document

Returns

PdfCatalog

PdfCatalog instance with applied page layout

SetPageMode(PdfName)

This method sets a page mode of the document.

public virtual PdfCatalog SetPageMode(PdfName pageMode)

Parameters

pageMode PdfName

page mode.

Returns

PdfCatalog

current instance of PdfCatalog

Remarks

This method sets a page mode of the document.
Valid values are: PdfName.UseNone , PdfName.UseOutlines , PdfName.UseThumbs , PdfName.FullScreen , PdfName.UseOC , PdfName.UseAttachments.

SetViewerPreferences(PdfViewerPreferences)

This method sets the document viewer preferences, specifying the way the document shall be displayed on the screen

public virtual PdfCatalog SetViewerPreferences(PdfViewerPreferences preferences)

Parameters

preferences PdfViewerPreferences

document's viewer preferences

Returns

PdfCatalog

PdfCatalog instance with applied viewer preferences