iText 7 7.1.9 API
iText.Kernel.Pdf.PdfDocument Class Reference

Main enter point to work with PDF document. More...

Inheritance diagram for iText.Kernel.Pdf.PdfDocument:
iText.Kernel.Events.IEventDispatcher iText.Pdfa.PdfADocument

Classes

class  IndirectRefDescription
 A structure storing documentId, object number and generation number.
 

Public Member Functions

 PdfDocument (PdfReader reader)
 Open PDF document in reading mode. More...
 
 PdfDocument (PdfReader reader, DocumentProperties properties)
 Open PDF document in reading mode. More...
 
 PdfDocument (PdfWriter writer)
 Open PDF document in writing mode. More...
 
 PdfDocument (PdfWriter writer, DocumentProperties properties)
 Open PDF document in writing mode. More...
 
 PdfDocument (PdfReader reader, PdfWriter writer)
 Opens PDF document in the stamping mode. More...
 
 PdfDocument (PdfReader reader, PdfWriter writer, StampingProperties properties)
 Open PDF document in stamping mode. More...
 
virtual void SetXmpMetadata (XMPMeta xmpMeta, SerializeOptions serializeOptions)
 
virtual void SetXmpMetadata (XMPMeta xmpMeta)
 
virtual byte[] GetXmpMetadata ()
 Gets XMPMetadata. More...
 
virtual byte[] GetXmpMetadata (bool createNew)
 Gets XMPMetadata or create a new one. More...
 
virtual PdfObject GetPdfObject (int objNum)
 Gets PdfObject by object number. More...
 
virtual int GetNumberOfPdfObjects ()
 Get number of indirect objects in the document. More...
 
virtual PdfPage GetPage (int pageNum)
 Gets the page by page number. More...
 
virtual PdfPage GetPage (PdfDictionary pageDictionary)
 Gets the PdfPage instance by PdfDictionary. More...
 
virtual PdfPage GetFirstPage ()
 Get the first page of the document. More...
 
virtual PdfPage GetLastPage ()
 Gets the last page of the document. More...
 
virtual PdfPage AddNewPage ()
 Creates and adds new page to the end of document. More...
 
virtual PdfPage AddNewPage (PageSize pageSize)
 Creates and adds new page with the specified page size. More...
 
virtual PdfPage AddNewPage (int index)
 Creates and inserts new page to the document. More...
 
virtual PdfPage AddNewPage (int index, PageSize pageSize)
 Creates and inserts new page to the document. More...
 
virtual PdfPage AddPage (PdfPage page)
 Adds page to the end of document. More...
 
virtual PdfPage AddPage (int index, PdfPage page)
 Inserts page to the document. More...
 
virtual int GetNumberOfPages ()
 Gets number of pages of the document. More...
 
virtual int GetPageNumber (PdfPage page)
 Gets page number by page. More...
 
virtual int GetPageNumber (PdfDictionary pageDictionary)
 Gets page number by PdfDictionary. More...
 
virtual bool MovePage (PdfPage page, int insertBefore)
 Moves page to new place in same document with all it tag structure More...
 
virtual void MovePage (int pageNumber, int insertBefore)
 Moves page to new place in same document with all it tag structure More...
 
virtual bool RemovePage (PdfPage page)
 Removes the first occurrence of the specified page from this document, if it is present. More...
 
virtual void RemovePage (int pageNum)
 Removes page from the document by page number. More...
 
virtual PdfDocumentInfo GetDocumentInfo ()
 Gets document information dictionary. More...
 
virtual PdfString GetOriginalDocumentId ()
 Gets original document id In order to set originalDocumentId WriterProperties.SetInitialDocumentId(PdfString) should be used More...
 
virtual PdfString GetModifiedDocumentId ()
 Gets modified document id In order to set modifiedDocumentId WriterProperties.SetModifiedDocumentId(PdfString) should be used More...
 
virtual PageSize GetDefaultPageSize ()
 Gets default page size. More...
 
virtual void SetDefaultPageSize (PageSize pageSize)
 Sets default page size. More...
 
virtual void AddEventHandler (String type, IEventHandler handler)
 Adds new event handler. More...
 
virtual void DispatchEvent (Event @event)
 Dispatches an event. More...
 
virtual void DispatchEvent (Event @event, bool delayed)
 Dispatches a delayed event. More...
 
virtual bool HasEventHandler (String type)
 Checks if event dispatcher as an event handler assigned for a certain event type. More...
 
virtual void RemoveEventHandler (String type, IEventHandler handler)
 Removes event handler. More...
 
virtual void RemoveAllHandlers ()
 Remove all event handlers. More...
 
virtual PdfWriter GetWriter ()
 Gets PdfWriter associated with the document. More...
 
virtual PdfReader GetReader ()
 Gets PdfReader associated with the document. More...
 
virtual bool IsAppendMode ()
 Returns true if the document is opened in append mode, and false otherwise. More...
 
virtual PdfIndirectReference CreateNextIndirectReference ()
 Creates next available indirect reference. More...
 
virtual PdfVersion GetPdfVersion ()
 Gets PDF version. More...
 
virtual PdfCatalog GetCatalog ()
 Gets PDF catalog. More...
 
virtual void Close ()
 Close PDF document. More...
 
virtual bool IsClosed ()
 Gets close status of the document. More...
 
virtual bool IsTagged ()
 Gets tagged status of the document. More...
 
virtual iText.Kernel.Pdf.PdfDocument SetTagged ()
 Specifies that document shall contain tag structure. More...
 
virtual PdfStructTreeRoot GetStructTreeRoot ()
 Gets iText.Kernel.Pdf.Tagging.PdfStructTreeRoot of tagged document. More...
 
virtual int GetNextStructParentIndex ()
 Gets next parent index of tagged document. More...
 
virtual TagStructureContext GetTagStructureContext ()
 Gets document TagStructureContext. More...
 
virtual IList< PdfPageCopyPagesTo (int pageFrom, int pageTo, iText.Kernel.Pdf.PdfDocument toDocument, int insertBeforePage)
 Copies a range of pages from current document to toDocument . More...
 
virtual IList< PdfPageCopyPagesTo (int pageFrom, int pageTo, iText.Kernel.Pdf.PdfDocument toDocument, int insertBeforePage, IPdfPageExtraCopier copier)
 Copies a range of pages from current document to toDocument . More...
 
virtual IList< PdfPageCopyPagesTo (int pageFrom, int pageTo, iText.Kernel.Pdf.PdfDocument toDocument)
 Copies a range of pages from current document to toDocument appending copied pages to the end. More...
 
virtual IList< PdfPageCopyPagesTo (int pageFrom, int pageTo, iText.Kernel.Pdf.PdfDocument toDocument, IPdfPageExtraCopier copier)
 Copies a range of pages from current document to toDocument appending copied pages to the end. More...
 
virtual IList< PdfPageCopyPagesTo (IList< int > pagesToCopy, iText.Kernel.Pdf.PdfDocument toDocument, int insertBeforePage)
 Copies a range of pages from current document to toDocument . More...
 
virtual IList< PdfPageCopyPagesTo (IList< int > pagesToCopy, iText.Kernel.Pdf.PdfDocument toDocument, int insertBeforePage, IPdfPageExtraCopier copier)
 Copies a range of pages from current document to toDocument . More...
 
virtual IList< PdfPageCopyPagesTo (IList< int > pagesToCopy, iText.Kernel.Pdf.PdfDocument toDocument)
 Copies a range of pages from current document to toDocument appending copied pages to the end. More...
 
virtual IList< PdfPageCopyPagesTo (IList< int > pagesToCopy, iText.Kernel.Pdf.PdfDocument toDocument, IPdfPageExtraCopier copier)
 Copies a range of pages from current document to toDocument appending copied pages to the end. More...
 
virtual void FlushCopiedObjects (iText.Kernel.Pdf.PdfDocument sourceDoc)
 Flush all copied objects and remove them from copied cache. More...
 
virtual bool IsCloseReader ()
 Checks, whether Close() method will close associated PdfReader. More...
 
virtual void SetCloseReader (bool closeReader)
 Sets, whether Close() method shall close associated PdfReader. More...
 
virtual bool IsCloseWriter ()
 Checks, whether Close() method will close associated PdfWriter. More...
 
virtual void SetCloseWriter (bool closeWriter)
 Sets, whether Close() method shall close associated PdfWriter. More...
 
virtual bool IsFlushUnusedObjects ()
 Checks, whether Close() will flush unused objects, e.g. unreachable from PDF Catalog. More...
 
virtual void SetFlushUnusedObjects (bool flushUnusedObjects)
 Sets, whether Close() shall flush unused objects, e.g. unreachable from PDF Catalog. More...
 
virtual PdfOutline GetOutlines (bool updateOutlines)
 This method returns a complete outline tree of the whole document. More...
 
virtual void InitializeOutlines ()
 This method initializes an outline tree of the document and sets outline mode to true. More...
 
virtual void AddNamedDestination (String key, PdfObject value)
 This methods adds new name in the Dests NameTree. More...
 
virtual IList< PdfIndirectReferenceListIndirectReferences ()
 Gets static copy of cross reference table. More...
 
virtual PdfDictionary GetTrailer ()
 Gets document trailer. More...
 
virtual void AddOutputIntent (PdfOutputIntent outputIntent)
 Adds PdfOutputIntent that shall specify the colour characteristics of output devices on which the document might be rendered. More...
 
virtual void CheckIsoConformance (Object obj, IsoKey key)
 Checks whether PDF document conforms a specific standard. More...
 
virtual void CheckIsoConformance (Object obj, IsoKey key, PdfResources resources)
 Checks whether PDF document conforms a specific standard. More...
 
virtual void CheckIsoConformance (Object obj, IsoKey key, PdfResources resources, PdfStream contentStream)
 Checks whether PDF document conforms a specific standard. More...
 
virtual void CheckShowTextIsoConformance (CanvasGraphicsState gState, PdfResources resources)
 Checks whether PDF document conforms a specific standard. More...
 
virtual void AddFileAttachment (String key, PdfFileSpec fs)
 Adds file attachment at document level. More...
 
virtual void AddAssociatedFile (String description, PdfFileSpec fs)
 Adds file associated with PDF document as a whole and identifies the relationship between them. More...
 
virtual PdfArray GetAssociatedFiles ()
 Returns files associated with PDF document. More...
 
virtual PdfEncryptedPayloadDocument GetEncryptedPayloadDocument ()
 Gets the encrypted payload of this document, or returns null if this document isn't an unencrypted wrapper document. More...
 
virtual void SetEncryptedPayload (PdfFileSpec fs)
 Sets an encrypted payload, making this document an unencrypted wrapper document. More...
 
virtual String[] GetPageLabels ()
 This method retrieves the page labels from a document as an array of String objects. More...
 
virtual bool HasOutlines ()
 Indicates if the document has any outlines More...
 
virtual void SetUserProperties (bool userProperties)
 Sets the flag indicating the presence of structure elements that contain user properties attributes. More...
 
virtual PdfFont GetFont (PdfDictionary dictionary)
 Create a new instance of iText.Kernel.Font.PdfFont or load already created one. More...
 
virtual PdfFont GetDefaultFont ()
 Gets default font for the document: Helvetica, WinAnsi. More...
 
virtual PdfFont AddFont (PdfFont font)
 Adds a iText.Kernel.Font.PdfFont instance to this document so that this font is flushed automatically on document close. More...
 
virtual bool RegisterProduct (ProductInfo productInfo)
 Registers a product for debugging purposes. More...
 
virtual FingerPrint GetFingerPrint ()
 Returns the object containing the registered products. More...
 
virtual PdfFont FindFont (String fontProgram, String encoding)
 

Detailed Description

Main enter point to work with PDF document.

Constructor & Destructor Documentation

◆ PdfDocument() [1/6]

iText.Kernel.Pdf.PdfDocument.PdfDocument ( PdfReader  reader)
inline

Open PDF document in reading mode.

Parameters
readerPDF reader.

◆ PdfDocument() [2/6]

iText.Kernel.Pdf.PdfDocument.PdfDocument ( PdfReader  reader,
DocumentProperties  properties 
)
inline

Open PDF document in reading mode.

Parameters
readerPDF reader.
propertiesdocument properties

◆ PdfDocument() [3/6]

iText.Kernel.Pdf.PdfDocument.PdfDocument ( PdfWriter  writer)
inline

Open PDF document in writing mode.

Open PDF document in writing mode. Document has no pages when initialized.

Parameters
writerPDF writer

◆ PdfDocument() [4/6]

iText.Kernel.Pdf.PdfDocument.PdfDocument ( PdfWriter  writer,
DocumentProperties  properties 
)
inline

Open PDF document in writing mode.

Open PDF document in writing mode. Document has no pages when initialized.

Parameters
writerPDF writer
propertiesdocument properties

◆ PdfDocument() [5/6]

iText.Kernel.Pdf.PdfDocument.PdfDocument ( PdfReader  reader,
PdfWriter  writer 
)
inline

Opens PDF document in the stamping mode.

Opens PDF document in the stamping mode.

Parameters
readerPDF reader.
writerPDF writer.

◆ PdfDocument() [6/6]

iText.Kernel.Pdf.PdfDocument.PdfDocument ( PdfReader  reader,
PdfWriter  writer,
StampingProperties  properties 
)
inline

Open PDF document in stamping mode.

Parameters
readerPDF reader.
writerPDF writer.
propertiesproperties of the stamping process

Member Function Documentation

◆ AddAssociatedFile()

virtual void iText.Kernel.Pdf.PdfDocument.AddAssociatedFile ( String  description,
PdfFileSpec  fs 
)
inlinevirtual

Adds file associated with PDF document as a whole and identifies the relationship between them.

Adds file associated with PDF document as a whole and identifies the relationship between them.

Associated files may be used in Pdf/A-3 and Pdf 2.0 documents. The method is very similar to AddFileAttachment(System.String, iText.Kernel.Pdf.Filespec.PdfFileSpec). However, besides adding file description to Names tree, it adds file to array value of the AF key in the document catalog.

For associated files their associated file specification dictionaries shall include the AFRelationship key

Parameters
descriptionthe file description
fsfile specification dictionary of associated file
See also
AddFileAttachment(System.String, iText.Kernel.Pdf.Filespec.PdfFileSpec)

◆ AddEventHandler()

virtual void iText.Kernel.Pdf.PdfDocument.AddEventHandler ( String  type,
IEventHandler  handler 
)
inlinevirtual

Adds new event handler.

Implements iText.Kernel.Events.IEventDispatcher.

◆ AddFileAttachment()

virtual void iText.Kernel.Pdf.PdfDocument.AddFileAttachment ( String  key,
PdfFileSpec  fs 
)
inlinevirtual

Adds file attachment at document level.

Parameters
keyname of the destination.
fs

iText.Kernel.Pdf.Filespec.PdfFileSpec object.

◆ AddFont()

virtual PdfFont iText.Kernel.Pdf.PdfDocument.AddFont ( PdfFont  font)
inlinevirtual

Adds a iText.Kernel.Font.PdfFont instance to this document so that this font is flushed automatically on document close.

Adds a iText.Kernel.Font.PdfFont instance to this document so that this font is flushed automatically on document close. As a side effect, the underlying font dictionary is made indirect if it wasn't the case yet

Returns
the same PdfFont instance.

◆ AddNamedDestination()

virtual void iText.Kernel.Pdf.PdfDocument.AddNamedDestination ( String  key,
PdfObject  value 
)
inlinevirtual

This methods adds new name in the Dests NameTree.

This methods adds new name in the Dests NameTree. It throws an exception, if the name already exists.

Parameters
keyName of the destination.
valueAn object destination refers to. Must be an array or a dictionary with key /D and array. See ISO 32000-1 12.3.2.3 for more info.

◆ AddNewPage() [1/4]

virtual PdfPage iText.Kernel.Pdf.PdfDocument.AddNewPage ( )
inlinevirtual

Creates and adds new page to the end of document.

Returns
added page

◆ AddNewPage() [2/4]

virtual PdfPage iText.Kernel.Pdf.PdfDocument.AddNewPage ( int  index)
inlinevirtual

Creates and inserts new page to the document.

Parameters
indexposition to addPage page to
Returns
inserted page

◆ AddNewPage() [3/4]

virtual PdfPage iText.Kernel.Pdf.PdfDocument.AddNewPage ( int  index,
PageSize  pageSize 
)
inlinevirtual

Creates and inserts new page to the document.

Parameters
indexposition to addPage page to
pageSizepage size of the new page
Returns
inserted page

◆ AddNewPage() [4/4]

virtual PdfPage iText.Kernel.Pdf.PdfDocument.AddNewPage ( PageSize  pageSize)
inlinevirtual

Creates and adds new page with the specified page size.

Parameters
pageSizepage size of the new page
Returns
added page

◆ AddOutputIntent()

virtual void iText.Kernel.Pdf.PdfDocument.AddOutputIntent ( PdfOutputIntent  outputIntent)
inlinevirtual

Adds PdfOutputIntent that shall specify the colour characteristics of output devices on which the document might be rendered.

Parameters
outputIntent

PdfOutputIntent to add.

See also
PdfOutputIntent

◆ AddPage() [1/2]

virtual PdfPage iText.Kernel.Pdf.PdfDocument.AddPage ( int  index,
PdfPage  page 
)
inlinevirtual

Inserts page to the document.

Parameters
indexposition to addPage page to
pagepage to addPage
Returns
inserted page

◆ AddPage() [2/2]

virtual PdfPage iText.Kernel.Pdf.PdfDocument.AddPage ( PdfPage  page)
inlinevirtual

Adds page to the end of document.

Parameters
pagepage to add.
Returns
added page.

◆ CheckIsoConformance() [1/3]

virtual void iText.Kernel.Pdf.PdfDocument.CheckIsoConformance ( Object  obj,
IsoKey  key 
)
inlinevirtual

Checks whether PDF document conforms a specific standard.

Checks whether PDF document conforms a specific standard. Shall be override.

Parameters
objAn object to conform.
keytype of object to conform.

Reimplemented in iText.Pdfa.PdfADocument.

◆ CheckIsoConformance() [2/3]

virtual void iText.Kernel.Pdf.PdfDocument.CheckIsoConformance ( Object  obj,
IsoKey  key,
PdfResources  resources 
)
inlinevirtual

Checks whether PDF document conforms a specific standard.

Checks whether PDF document conforms a specific standard. Shall be override.

Parameters
objan object to conform.
keytype of object to conform.
resources

PdfResources associated with an object to check.

Reimplemented in iText.Pdfa.PdfADocument.

◆ CheckIsoConformance() [3/3]

virtual void iText.Kernel.Pdf.PdfDocument.CheckIsoConformance ( Object  obj,
IsoKey  key,
PdfResources  resources,
PdfStream  contentStream 
)
inlinevirtual

Checks whether PDF document conforms a specific standard.

Checks whether PDF document conforms a specific standard. Shall be override.

Parameters
objan object to conform.
keytype of object to conform.
resources

PdfResources associated with an object to check.

Parameters
contentStreamcurrent content stream

Reimplemented in iText.Pdfa.PdfADocument.

◆ CheckShowTextIsoConformance()

virtual void iText.Kernel.Pdf.PdfDocument.CheckShowTextIsoConformance ( CanvasGraphicsState  gState,
PdfResources  resources 
)
inlinevirtual

Checks whether PDF document conforms a specific standard.

Checks whether PDF document conforms a specific standard. Shall be override.

Parameters
gStatea iText.Kernel.Pdf.Canvas.CanvasGraphicsState object to conform.
resources

PdfResources associated with an object to check.

◆ Close()

virtual void iText.Kernel.Pdf.PdfDocument.Close ( )
inlinevirtual

Close PDF document.

◆ CopyPagesTo() [1/8]

virtual IList<PdfPage> iText.Kernel.Pdf.PdfDocument.CopyPagesTo ( IList< int >  pagesToCopy,
iText.Kernel.Pdf.PdfDocument  toDocument 
)
inlinevirtual

Copies a range of pages from current document to toDocument appending copied pages to the end.

Copies a range of pages from current document to toDocument appending copied pages to the end. Use this method if you want to copy pages across tagged documents. This will keep resultant PDF structure consistent.

Parameters
pagesToCopylist of pages to be copied.
toDocumenta document to copy pages to.
Returns
list of copied pages

◆ CopyPagesTo() [2/8]

virtual IList<PdfPage> iText.Kernel.Pdf.PdfDocument.CopyPagesTo ( IList< int >  pagesToCopy,
iText.Kernel.Pdf.PdfDocument  toDocument,
int  insertBeforePage 
)
inlinevirtual

Copies a range of pages from current document to toDocument .

Copies a range of pages from current document to toDocument . Use this method if you want to copy pages across tagged documents. This will keep resultant PDF structure consistent.

Parameters
pagesToCopylist of pages to be copied.
toDocumenta document to copy pages to.
insertBeforePagea position where to insert copied pages.
Returns
list of new copied pages

◆ CopyPagesTo() [3/8]

virtual IList<PdfPage> iText.Kernel.Pdf.PdfDocument.CopyPagesTo ( IList< int >  pagesToCopy,
iText.Kernel.Pdf.PdfDocument  toDocument,
int  insertBeforePage,
IPdfPageExtraCopier  copier 
)
inlinevirtual

Copies a range of pages from current document to toDocument .

Copies a range of pages from current document to toDocument . Use this method if you want to copy pages across tagged documents. This will keep resultant PDF structure consistent.

Parameters
pagesToCopylist of pages to be copied.
toDocumenta document to copy pages to.
insertBeforePagea position where to insert copied pages.
copiera copier which bears a special copy logic. May be null. It is recommended to use the same instance of IPdfPageExtraCopier for the same output document.
Returns
list of new copied pages

◆ CopyPagesTo() [4/8]

virtual IList<PdfPage> iText.Kernel.Pdf.PdfDocument.CopyPagesTo ( IList< int >  pagesToCopy,
iText.Kernel.Pdf.PdfDocument  toDocument,
IPdfPageExtraCopier  copier 
)
inlinevirtual

Copies a range of pages from current document to toDocument appending copied pages to the end.

Copies a range of pages from current document to toDocument appending copied pages to the end. Use this method if you want to copy pages across tagged documents. This will keep resultant PDF structure consistent.

Parameters
pagesToCopylist of pages to be copied.
toDocumenta document to copy pages to.
copiera copier which bears a special copy logic. May be null. It is recommended to use the same instance of IPdfPageExtraCopier for the same output document.
Returns
list of copied pages

◆ CopyPagesTo() [5/8]

virtual IList<PdfPage> iText.Kernel.Pdf.PdfDocument.CopyPagesTo ( int  pageFrom,
int  pageTo,
iText.Kernel.Pdf.PdfDocument  toDocument 
)
inlinevirtual

Copies a range of pages from current document to toDocument appending copied pages to the end.

Copies a range of pages from current document to toDocument appending copied pages to the end. This range is inclusive, both page and pageTo are included in list of copied pages. Use this method if you want to copy pages across tagged documents. This will keep resultant PDF structure consistent.

Parameters
pageFrom1-based start of the range of pages to be copied.
pageTo1-based end (inclusive) of the range of pages to be copied. This page is included in list of copied pages.
toDocumenta document to copy pages to.
Returns
list of new copied pages

◆ CopyPagesTo() [6/8]

virtual IList<PdfPage> iText.Kernel.Pdf.PdfDocument.CopyPagesTo ( int  pageFrom,
int  pageTo,
iText.Kernel.Pdf.PdfDocument  toDocument,
int  insertBeforePage 
)
inlinevirtual

Copies a range of pages from current document to toDocument .

Copies a range of pages from current document to toDocument . Use this method if you want to copy pages across tagged documents. This will keep resultant PDF structure consistent.

Parameters
pageFromstart of the range of pages to be copied.
pageToend of the range of pages to be copied.
toDocumenta document to copy pages to.
insertBeforePagea position where to insert copied pages.
Returns
list of copied pages

◆ CopyPagesTo() [7/8]

virtual IList<PdfPage> iText.Kernel.Pdf.PdfDocument.CopyPagesTo ( int  pageFrom,
int  pageTo,
iText.Kernel.Pdf.PdfDocument  toDocument,
int  insertBeforePage,
IPdfPageExtraCopier  copier 
)
inlinevirtual

Copies a range of pages from current document to toDocument .

Copies a range of pages from current document to toDocument . This range is inclusive, both page and pageTo are included in list of copied pages. Use this method if you want to copy pages across tagged documents. This will keep resultant PDF structure consistent.

Parameters
pageFrom1-based start of the range of pages to be copied.
pageTo1-based end (inclusive) of the range of pages to be copied. This page is included in list of copied pages.
toDocumenta document to copy pages to.
insertBeforePagea position where to insert copied pages.
copiera copier which bears a special copy logic. May be null. It is recommended to use the same instance of IPdfPageExtraCopier for the same output document.
Returns
list of new copied pages

◆ CopyPagesTo() [8/8]

virtual IList<PdfPage> iText.Kernel.Pdf.PdfDocument.CopyPagesTo ( int  pageFrom,
int  pageTo,
iText.Kernel.Pdf.PdfDocument  toDocument,
IPdfPageExtraCopier  copier 
)
inlinevirtual

Copies a range of pages from current document to toDocument appending copied pages to the end.

Copies a range of pages from current document to toDocument appending copied pages to the end. This range is inclusive, both page and pageTo are included in list of copied pages. Use this method if you want to copy pages across tagged documents. This will keep resultant PDF structure consistent.

Parameters
pageFrom1-based start of the range of pages to be copied.
pageTo1-based end (inclusive) of the range of pages to be copied. This page is included in list of copied pages.
toDocumenta document to copy pages to.
copiera copier which bears a special copy logic. May be null. It is recommended to use the same instance of IPdfPageExtraCopier for the same output document.
Returns
list of new copied pages.

◆ CreateNextIndirectReference()

virtual PdfIndirectReference iText.Kernel.Pdf.PdfDocument.CreateNextIndirectReference ( )
inlinevirtual

Creates next available indirect reference.

Returns
created indirect reference.

◆ DispatchEvent() [1/2]

virtual void iText.Kernel.Pdf.PdfDocument.DispatchEvent ( Event event)
inlinevirtual

Dispatches an event.

Implements iText.Kernel.Events.IEventDispatcher.

◆ DispatchEvent() [2/2]

virtual void iText.Kernel.Pdf.PdfDocument.DispatchEvent ( Event event,
bool  delayed 
)
inlinevirtual

Dispatches a delayed event.

Implements iText.Kernel.Events.IEventDispatcher.

◆ FlushCopiedObjects()

virtual void iText.Kernel.Pdf.PdfDocument.FlushCopiedObjects ( iText.Kernel.Pdf.PdfDocument  sourceDoc)
inlinevirtual

Flush all copied objects and remove them from copied cache.

Flush all copied objects and remove them from copied cache.

Note, if you will copy objects from the same document, duplicated objects will be created. That's why usually this method is meant to be used when all copying from source document is finished. For other cases one can also consider other flushing mechanisms, e.g. pages-based flushing.

Parameters
sourceDocsource document

◆ GetAssociatedFiles()

virtual PdfArray iText.Kernel.Pdf.PdfDocument.GetAssociatedFiles ( )
inlinevirtual

Returns files associated with PDF document.

Returns
associated files array.

◆ GetCatalog()

virtual PdfCatalog iText.Kernel.Pdf.PdfDocument.GetCatalog ( )
inlinevirtual

Gets PDF catalog.

Returns
PDF catalog.

◆ GetDefaultFont()

virtual PdfFont iText.Kernel.Pdf.PdfDocument.GetDefaultFont ( )
inlinevirtual

Gets default font for the document: Helvetica, WinAnsi.

Gets default font for the document: Helvetica, WinAnsi. One instance per document.

Returns
instance of iText.Kernel.Font.PdfFont or null on error.

◆ GetDefaultPageSize()

virtual PageSize iText.Kernel.Pdf.PdfDocument.GetDefaultPageSize ( )
inlinevirtual

Gets default page size.

Returns
default page size.

◆ GetDocumentInfo()

virtual PdfDocumentInfo iText.Kernel.Pdf.PdfDocument.GetDocumentInfo ( )
inlinevirtual

Gets document information dictionary.

Returns
document information dictionary.

◆ GetEncryptedPayloadDocument()

virtual PdfEncryptedPayloadDocument iText.Kernel.Pdf.PdfDocument.GetEncryptedPayloadDocument ( )
inlinevirtual

Gets the encrypted payload of this document, or returns null if this document isn't an unencrypted wrapper document.

Returns
encrypted payload of this document.

◆ GetFingerPrint()

virtual FingerPrint iText.Kernel.Pdf.PdfDocument.GetFingerPrint ( )
inlinevirtual

Returns the object containing the registered products.

Returns
fingerprint object

◆ GetFirstPage()

virtual PdfPage iText.Kernel.Pdf.PdfDocument.GetFirstPage ( )
inlinevirtual

Get the first page of the document.

Returns
first page of the document.

◆ GetFont()

virtual PdfFont iText.Kernel.Pdf.PdfDocument.GetFont ( PdfDictionary  dictionary)
inlinevirtual

Create a new instance of iText.Kernel.Font.PdfFont or load already created one.

Create a new instance of iText.Kernel.Font.PdfFont or load already created one.

Note, PdfFont which created with iText.Kernel.Font.PdfFontFactory.CreateFont(PdfDictionary) won't be cached until it will be added to iText.Kernel.Pdf.Canvas.PdfCanvas or PdfResources.

◆ GetLastPage()

virtual PdfPage iText.Kernel.Pdf.PdfDocument.GetLastPage ( )
inlinevirtual

Gets the last page of the document.

Returns
last page.

◆ GetModifiedDocumentId()

virtual PdfString iText.Kernel.Pdf.PdfDocument.GetModifiedDocumentId ( )
inlinevirtual

Gets modified document id In order to set modifiedDocumentId WriterProperties.SetModifiedDocumentId(PdfString) should be used

Returns
modified document id

◆ GetNextStructParentIndex()

virtual int iText.Kernel.Pdf.PdfDocument.GetNextStructParentIndex ( )
inlinevirtual

Gets next parent index of tagged document.

Returns
-1 if document is not tagged, or >= 0 if tagged.
See also
IsTagged(), GetNextStructParentIndex()

◆ GetNumberOfPages()

virtual int iText.Kernel.Pdf.PdfDocument.GetNumberOfPages ( )
inlinevirtual

Gets number of pages of the document.

Returns
number of pages.

◆ GetNumberOfPdfObjects()

virtual int iText.Kernel.Pdf.PdfDocument.GetNumberOfPdfObjects ( )
inlinevirtual

Get number of indirect objects in the document.

Returns
number of indirect objects.

◆ GetOriginalDocumentId()

virtual PdfString iText.Kernel.Pdf.PdfDocument.GetOriginalDocumentId ( )
inlinevirtual

Gets original document id In order to set originalDocumentId WriterProperties.SetInitialDocumentId(PdfString) should be used

Returns
original dccument id

◆ GetOutlines()

virtual PdfOutline iText.Kernel.Pdf.PdfDocument.GetOutlines ( bool  updateOutlines)
inlinevirtual

This method returns a complete outline tree of the whole document.

Parameters
updateOutlinesif the flag is true, the method read the whole document and creates outline tree. If false the method gets cached outline tree (if it was cached via calling getOutlines method before).
Returns
fully initialize PdfOutline object.

◆ GetPage() [1/2]

virtual PdfPage iText.Kernel.Pdf.PdfDocument.GetPage ( int  pageNum)
inlinevirtual

Gets the page by page number.

Parameters
pageNumpage number.
Returns
page by page number. may return null in case the page tree is broken

◆ GetPage() [2/2]

virtual PdfPage iText.Kernel.Pdf.PdfDocument.GetPage ( PdfDictionary  pageDictionary)
inlinevirtual

Gets the PdfPage instance by PdfDictionary.

Parameters
pageDictionary

PdfDictionary that present page.

Returns
page by PdfDictionary.

◆ GetPageLabels()

virtual String [] iText.Kernel.Pdf.PdfDocument.GetPageLabels ( )
inlinevirtual

This method retrieves the page labels from a document as an array of String objects.

Returns

System.String list of page labels if they were found, or null otherwise

◆ GetPageNumber() [1/2]

virtual int iText.Kernel.Pdf.PdfDocument.GetPageNumber ( PdfDictionary  pageDictionary)
inlinevirtual

Gets page number by PdfDictionary.

Parameters
pageDictionary

PdfDictionary that present page.

Returns
page number by PdfDictionary.

◆ GetPageNumber() [2/2]

virtual int iText.Kernel.Pdf.PdfDocument.GetPageNumber ( PdfPage  page)
inlinevirtual

Gets page number by page.

Parameters
pagethe page.
Returns
page number.

◆ GetPdfObject()

virtual PdfObject iText.Kernel.Pdf.PdfDocument.GetPdfObject ( int  objNum)
inlinevirtual

Gets PdfObject by object number.

Parameters
objNumobject number.
Returns

PdfObject or null , if object not found.

◆ GetPdfVersion()

virtual PdfVersion iText.Kernel.Pdf.PdfDocument.GetPdfVersion ( )
inlinevirtual

Gets PDF version.

Returns
PDF version.

◆ GetReader()

virtual PdfReader iText.Kernel.Pdf.PdfDocument.GetReader ( )
inlinevirtual

Gets PdfReader associated with the document.

Returns
PdfReader associated with the document.

◆ GetStructTreeRoot()

virtual PdfStructTreeRoot iText.Kernel.Pdf.PdfDocument.GetStructTreeRoot ( )
inlinevirtual

Gets iText.Kernel.Pdf.Tagging.PdfStructTreeRoot of tagged document.

Returns

iText.Kernel.Pdf.Tagging.PdfStructTreeRoot in case tagged document, otherwise false.

See also
IsTagged(), GetNextStructParentIndex()

◆ GetTagStructureContext()

virtual TagStructureContext iText.Kernel.Pdf.PdfDocument.GetTagStructureContext ( )
inlinevirtual

Gets document TagStructureContext.

Gets document TagStructureContext. The document must be tagged, otherwise an exception will be thrown.

Returns
document TagStructureContext.

◆ GetTrailer()

virtual PdfDictionary iText.Kernel.Pdf.PdfDocument.GetTrailer ( )
inlinevirtual

Gets document trailer.

Returns
document trailer.

◆ GetWriter()

virtual PdfWriter iText.Kernel.Pdf.PdfDocument.GetWriter ( )
inlinevirtual

Gets PdfWriter associated with the document.

Returns
PdfWriter associated with the document.

◆ GetXmpMetadata() [1/2]

virtual byte [] iText.Kernel.Pdf.PdfDocument.GetXmpMetadata ( )
inlinevirtual

Gets XMPMetadata.

◆ GetXmpMetadata() [2/2]

virtual byte [] iText.Kernel.Pdf.PdfDocument.GetXmpMetadata ( bool  createNew)
inlinevirtual

Gets XMPMetadata or create a new one.

Parameters
createNewif true, create a new empty XMPMetadata if it did not present.
Returns
existed or newly created XMPMetadata byte array.

◆ HasEventHandler()

virtual bool iText.Kernel.Pdf.PdfDocument.HasEventHandler ( String  type)
inlinevirtual

Checks if event dispatcher as an event handler assigned for a certain event type.

Implements iText.Kernel.Events.IEventDispatcher.

◆ HasOutlines()

virtual bool iText.Kernel.Pdf.PdfDocument.HasOutlines ( )
inlinevirtual

Indicates if the document has any outlines

Returns

true , if there are outlines and false otherwise.

◆ InitializeOutlines()

virtual void iText.Kernel.Pdf.PdfDocument.InitializeOutlines ( )
inlinevirtual

This method initializes an outline tree of the document and sets outline mode to true.

◆ IsAppendMode()

virtual bool iText.Kernel.Pdf.PdfDocument.IsAppendMode ( )
inlinevirtual

Returns true if the document is opened in append mode, and false otherwise.

Returns

true if the document is opened in append mode, and false otherwise.

◆ IsClosed()

virtual bool iText.Kernel.Pdf.PdfDocument.IsClosed ( )
inlinevirtual

Gets close status of the document.

Returns
true, if the document has already been closed, otherwise false.

◆ IsCloseReader()

virtual bool iText.Kernel.Pdf.PdfDocument.IsCloseReader ( )
inlinevirtual

Checks, whether Close() method will close associated PdfReader.

Returns
true, Close() method is going to close associated PdfReader, otherwise false.

◆ IsCloseWriter()

virtual bool iText.Kernel.Pdf.PdfDocument.IsCloseWriter ( )
inlinevirtual

Checks, whether Close() method will close associated PdfWriter.

Returns
true, Close() method is going to close associated PdfWriter, otherwise false.

◆ IsFlushUnusedObjects()

virtual bool iText.Kernel.Pdf.PdfDocument.IsFlushUnusedObjects ( )
inlinevirtual

Checks, whether Close() will flush unused objects, e.g. unreachable from PDF Catalog.

Checks, whether Close() will flush unused objects, e.g. unreachable from PDF Catalog. By default - false.

Returns
false, if Close() shall not flush unused objects, otherwise true.

◆ IsTagged()

virtual bool iText.Kernel.Pdf.PdfDocument.IsTagged ( )
inlinevirtual

Gets tagged status of the document.

Returns
true, if the document has tag structure, otherwise false.

◆ ListIndirectReferences()

virtual IList<PdfIndirectReference> iText.Kernel.Pdf.PdfDocument.ListIndirectReferences ( )
inlinevirtual

Gets static copy of cross reference table.

◆ MovePage() [1/2]

virtual void iText.Kernel.Pdf.PdfDocument.MovePage ( int  pageNumber,
int  insertBefore 
)
inlinevirtual

Moves page to new place in same document with all it tag structure

Parameters
pageNumbernumber of Page that will be moved
insertBeforeindicates before which page new one will be inserted to

◆ MovePage() [2/2]

virtual bool iText.Kernel.Pdf.PdfDocument.MovePage ( PdfPage  page,
int  insertBefore 
)
inlinevirtual

Moves page to new place in same document with all it tag structure

Parameters
pagepage to be moved in document if present
insertBeforeindicates before which page new one will be inserted to
Returns
true if this document contained the specified page

◆ RegisterProduct()

virtual bool iText.Kernel.Pdf.PdfDocument.RegisterProduct ( ProductInfo  productInfo)
inlinevirtual

Registers a product for debugging purposes.

Parameters
productInfoproduct to be registered.
Returns
true if the product hadn't been registered before.

◆ RemoveAllHandlers()

virtual void iText.Kernel.Pdf.PdfDocument.RemoveAllHandlers ( )
inlinevirtual

Remove all event handlers.

Implements iText.Kernel.Events.IEventDispatcher.

◆ RemoveEventHandler()

virtual void iText.Kernel.Pdf.PdfDocument.RemoveEventHandler ( String  type,
IEventHandler  handler 
)
inlinevirtual

Removes event handler.

Implements iText.Kernel.Events.IEventDispatcher.

◆ RemovePage() [1/2]

virtual void iText.Kernel.Pdf.PdfDocument.RemovePage ( int  pageNum)
inlinevirtual

Removes page from the document by page number.

Parameters
pageNumthe one-based index of the PdfPage to be removed

◆ RemovePage() [2/2]

virtual bool iText.Kernel.Pdf.PdfDocument.RemovePage ( PdfPage  page)
inlinevirtual

Removes the first occurrence of the specified page from this document, if it is present.

Removes the first occurrence of the specified page from this document, if it is present. Returns true if this document contained the specified element (or equivalently, if this document changed as a result of the call).

Parameters
pagepage to be removed from this document, if present
Returns
true if this document contained the specified page

◆ SetCloseReader()

virtual void iText.Kernel.Pdf.PdfDocument.SetCloseReader ( bool  closeReader)
inlinevirtual

Sets, whether Close() method shall close associated PdfReader.

Parameters
closeReadertrue, Close() method shall close associated PdfReader, otherwise false.

◆ SetCloseWriter()

virtual void iText.Kernel.Pdf.PdfDocument.SetCloseWriter ( bool  closeWriter)
inlinevirtual

Sets, whether Close() method shall close associated PdfWriter.

Parameters
closeWritertrue, Close() method shall close associated PdfWriter, otherwise false.

◆ SetDefaultPageSize()

virtual void iText.Kernel.Pdf.PdfDocument.SetDefaultPageSize ( PageSize  pageSize)
inlinevirtual

Sets default page size.

Parameters
pageSizepage size to be set as default.

◆ SetEncryptedPayload()

virtual void iText.Kernel.Pdf.PdfDocument.SetEncryptedPayload ( PdfFileSpec  fs)
inlinevirtual

Sets an encrypted payload, making this document an unencrypted wrapper document.

Sets an encrypted payload, making this document an unencrypted wrapper document. The file spec shall include the AFRelationship key with a value of EncryptedPayload, and shall include an encrypted payload dictionary.

Parameters
fsencrypted payload file spec. iText.Kernel.Pdf.Filespec.PdfEncryptedPayloadFileSpecFactory can produce one.

◆ SetFlushUnusedObjects()

virtual void iText.Kernel.Pdf.PdfDocument.SetFlushUnusedObjects ( bool  flushUnusedObjects)
inlinevirtual

Sets, whether Close() shall flush unused objects, e.g. unreachable from PDF Catalog.

Parameters
flushUnusedObjectsfalse, if Close() shall not flush unused objects, otherwise true.

◆ SetTagged()

virtual iText.Kernel.Pdf.PdfDocument iText.Kernel.Pdf.PdfDocument.SetTagged ( )
inlinevirtual

Specifies that document shall contain tag structure.

Specifies that document shall contain tag structure. See ISO 32000-1, section 14.8 "Tagged PDF"

Returns
this PdfDocument

◆ SetUserProperties()

virtual void iText.Kernel.Pdf.PdfDocument.SetUserProperties ( bool  userProperties)
inlinevirtual

Sets the flag indicating the presence of structure elements that contain user properties attributes.

Parameters
userPropertiesthe user properties flag