iText 8.0.2 API
iText.Pdfa.PdfADocument Class Reference

This class extends iText.Kernel.Pdf.PdfDocument and is in charge of creating files that comply with the PDF/A standard. More...

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

Public Member Functions

  PdfADocument (PdfWriter writer, PdfAConformanceLevel conformanceLevel, PdfOutputIntent outputIntent)
  Constructs a new PdfADocument for writing purposes, i.e. from scratch. More...
 
  PdfADocument (PdfWriter writer, PdfAConformanceLevel conformanceLevel, PdfOutputIntent outputIntent, DocumentProperties properties)
  Constructs a new PdfADocument for writing purposes, i.e. from scratch. More...
 
  PdfADocument (PdfReader reader, PdfWriter writer)
  Opens a PDF/A document in the stamping mode. More...
 
  PdfADocument (PdfReader reader, PdfWriter writer, StampingProperties properties)
  Opens a PDF/A document in stamping mode. More...
 
override void  CheckIsoConformance (Object obj, IsoKey key)
  Checks whether PDF document conforms a specific standard. More...
 
override void  CheckIsoConformance (Object obj, IsoKey key, PdfResources resources, PdfStream contentStream)
  Checks whether PDF document conforms a specific standard. More...
 
override void  CheckIsoConformance (Object obj, IsoKey key, PdfResources resources, PdfStream contentStream, Object extra)
  Checks whether PDF document conforms a specific standard. More...
 
virtual PdfAConformanceLevel  GetConformanceLevel ()
  Gets the PdfAConformanceLevel set in the constructor or in the metadata of the iText.Kernel.Pdf.PdfReader. More...
 
override void  AddOutputIntent (PdfOutputIntent outputIntent)
  Adds PdfOutputIntent that shall specify the colour characteristics of output devices on which the document might be rendered. More...
 
- Public Member Functions inherited from iText.Kernel.Pdf.PdfDocument
  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)
  Sets the XMP Metadata. More...
 
virtual void  SetXmpMetadata (XMPMeta xmpMeta)
  Sets the XMP Metadata. More...
 
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 void  MarkStreamAsEmbeddedFile (PdfStream stream)
  Marks PdfStream object as embedded file stream. 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 DIContainer  GetDiContainer ()
  Gets the container containing all available dependencies. More...
 
virtual PdfDocumentInfo  GetDocumentInfo ()
  Gets document information dictionary. More...
 
virtual PdfString  GetOriginalDocumentId ()
  Gets original document id More...
 
virtual PdfString  GetModifiedDocumentId ()
  Gets modified document id More...
 
virtual PageSize  GetDefaultPageSize ()
  Gets default page size. More...
 
virtual void  SetDefaultPageSize (PageSize pageSize)
  Sets default page size. More...
 
virtual void  AddEventHandler (String type, iText.Kernel.Events.IEventHandler handler)
 
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, iText.Kernel.Events.IEventHandler handler)
 
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< PdfPage CopyPagesTo (int pageFrom, int pageTo, iText.Kernel.Pdf.PdfDocument toDocument, int insertBeforePage)
  Copies a range of pages from current document to toDocument . More...
 
virtual IList< PdfPage CopyPagesTo (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< PdfPage CopyPagesTo (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< PdfPage CopyPagesTo (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< PdfPage CopyPagesTo (IList< int > pagesToCopy, iText.Kernel.Pdf.PdfDocument toDocument, int insertBeforePage)
  Copies a range of pages from current document to toDocument . More...
 
virtual IList< PdfPage CopyPagesTo (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< PdfPage CopyPagesTo (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< PdfPage CopyPagesTo (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 void  AddNamedDestination (PdfString key, PdfObject value)
  This methods adds new name in the Dests NameTree. More...
 
virtual IList< PdfIndirectReference ListIndirectReferences ()
  Gets static copy of cross reference table. More...
 
virtual PdfDictionary  GetTrailer ()
  Gets document trailer. 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 (ProductData productData)
  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)
  Find iText.Kernel.Font.PdfFont from loaded fonts with corresponding fontProgram and encoding or CMAP. More...
 
virtual long  GetDocumentId ()
  Obtains numeric document id. More...
 
virtual SequenceId  GetDocumentIdWrapper ()
  Obtains document id as a iText.Commons.Actions.Sequence.SequenceId. More...
 
virtual SerializeOptions  GetSerializeOptions ()
  Gets a persistent XMP metadata serialization options. More...
 
virtual void  SetSerializeOptions (SerializeOptions serializeOptions)
  Sets a persistent XMP metadata serialization options. More...
 
- Public Member Functions inherited from iText.Kernel.Events.IEventDispatcher
void  AddEventHandler (String type, iText.Kernel.Events.IEventHandler handler)
  Adds new event handler. More...
 
void  RemoveEventHandler (String type, iText.Kernel.Events.IEventHandler handler)
  Removes event handler. More...
 

Protected Member Functions

override void  AddCustomMetadataExtensions (XMPMeta xmpMeta)
  Adds custom XMP metadata extension. More...
 
override void  UpdateXmpMetadata ()
  Updates XMP metadata. More...
 
override void  CheckIsoConformance ()
  Checks whether PDF document conforms a specific standard. More...
 
override void  FlushObject (PdfObject pdfObject, bool canBeInObjStm)
  Flush an object. More...
 
override void  FlushFonts ()
  Flushes all newly added or loaded fonts. More...
 
override void  InitTagStructureContext ()
  Initializes tagStructureContext to track necessary information of document's tag structure. More...
 
override IPdfPageFactory  GetPageFactory ()
  Returns the factory for creating page instances. More...
 
override void  FlushInfoDictionary (bool appendMode)
  Flush info dictionary if needed. More...
 

Detailed Description

This class extends iText.Kernel.Pdf.PdfDocument and is in charge of creating files that comply with the PDF/A standard.

This class extends iText.Kernel.Pdf.PdfDocument and is in charge of creating files that comply with the PDF/A standard. Client code is still responsible for making sure the file is actually PDF/A compliant: multiple steps must be undertaken (depending on the iText.Kernel.Pdf.PdfAConformanceLevel ) to ensure that the PDF/A standard is followed. This class will throw exceptions, mostly iText.Pdfa.Exceptions.PdfAConformanceException , and thus refuse to output a PDF/A file if at any point the document does not adhere to the PDF/A guidelines specified by the iText.Kernel.Pdf.PdfAConformanceLevel.

Constructor & Destructor Documentation

◆ PdfADocument() [1/4]

iText.Pdfa.PdfADocument.PdfADocument ( PdfWriter  writer,
PdfAConformanceLevel  conformanceLevel,
PdfOutputIntent  outputIntent 
)
inline

Constructs a new PdfADocument for writing purposes, i.e. from scratch.

Constructs a new PdfADocument for writing purposes, i.e. from scratch. A PDF/A file has a conformance level, and must have an explicit output intent.

Parameters
writer the iText.Kernel.Pdf.PdfWriter object to write to
conformanceLevel the generation and strictness level of the PDF/A that must be followed.
outputIntent a iText.Kernel.Pdf.PdfOutputIntent

◆ PdfADocument() [2/4]

iText.Pdfa.PdfADocument.PdfADocument ( PdfWriter  writer,
PdfAConformanceLevel  conformanceLevel,
PdfOutputIntent  outputIntent,
DocumentProperties  properties 
)
inline

Constructs a new PdfADocument for writing purposes, i.e. from scratch.

Constructs a new PdfADocument for writing purposes, i.e. from scratch. A PDF/A file has a conformance level, and must have an explicit output intent.

Parameters
writer the iText.Kernel.Pdf.PdfWriter object to write to
conformanceLevel the generation and strictness level of the PDF/A that must be followed.
outputIntent a iText.Kernel.Pdf.PdfOutputIntent
properties a iText.Kernel.Pdf.DocumentProperties

◆ PdfADocument() [3/4]

iText.Pdfa.PdfADocument.PdfADocument ( PdfReader  reader,
PdfWriter  writer 
)
inline

Opens a PDF/A document in the stamping mode.

Parameters
reader PDF reader.
writer PDF writer.

◆ PdfADocument() [4/4]

iText.Pdfa.PdfADocument.PdfADocument ( PdfReader  reader,
PdfWriter  writer,
StampingProperties  properties 
)
inline

Opens a PDF/A document in stamping mode.

Parameters
reader PDF reader.
writer PDF writer.
properties properties of the stamping process

Member Function Documentation

◆ AddCustomMetadataExtensions()

override void iText.Pdfa.PdfADocument.AddCustomMetadataExtensions ( XMPMeta  xmpMeta )
inlineprotectedvirtual

Adds custom XMP metadata extension.

Adds custom XMP metadata extension. Useful for PDF/UA, ZUGFeRD, etc.

Parameters
xmpMeta

iText.Kernel.XMP.XMPMeta to add custom metadata to.

Reimplemented from iText.Kernel.Pdf.PdfDocument.

◆ AddOutputIntent()

override void iText.Pdfa.PdfADocument.AddOutputIntent ( PdfOutputIntent  outputIntent )
inlinevirtual

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

Parameters
outputIntent

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

Reimplemented from iText.Kernel.Pdf.PdfDocument.

◆ CheckIsoConformance() [1/4]

override void iText.Pdfa.PdfADocument.CheckIsoConformance ( )
inlineprotectedvirtual

Checks whether PDF document conforms a specific standard.

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

Reimplemented from iText.Kernel.Pdf.PdfDocument.

◆ CheckIsoConformance() [2/4]

override void iText.Pdfa.PdfADocument.CheckIsoConformance ( Object  obj,
IsoKey  key 
)
inlinevirtual

Checks whether PDF document conforms a specific standard.

Reimplemented from iText.Kernel.Pdf.PdfDocument.

◆ CheckIsoConformance() [3/4]

override void iText.Pdfa.PdfADocument.CheckIsoConformance ( Object  obj,
IsoKey  key,
PdfResources  resources,
PdfStream  contentStream 
)
inlinevirtual

Checks whether PDF document conforms a specific standard.

Reimplemented from iText.Kernel.Pdf.PdfDocument.

◆ CheckIsoConformance() [4/4]

override void iText.Pdfa.PdfADocument.CheckIsoConformance ( Object  obj,
IsoKey  key,
PdfResources  resources,
PdfStream  contentStream,
Object  extra 
)
inlinevirtual

Checks whether PDF document conforms a specific standard.

Reimplemented from iText.Kernel.Pdf.PdfDocument.

◆ FlushFonts()

override void iText.Pdfa.PdfADocument.FlushFonts ( )
inlineprotectedvirtual

Flushes all newly added or loaded fonts.

Reimplemented from iText.Kernel.Pdf.PdfDocument.

◆ FlushInfoDictionary()

override void iText.Pdfa.PdfADocument.FlushInfoDictionary ( bool  appendMode )
inlineprotectedvirtual

Flush info dictionary if needed.

Parameters
appendMode

Flush info dictionary if needed.

Reimplemented from iText.Kernel.Pdf.PdfDocument.

◆ FlushObject()

override void iText.Pdfa.PdfADocument.FlushObject ( PdfObject  pdfObject,
bool  canBeInObjStm 
)
inlineprotectedvirtual

Flush an object.

Parameters
pdfObject object to flush.
canBeInObjStm indicates whether object can be placed into object stream.

Reimplemented from iText.Kernel.Pdf.PdfDocument.

◆ GetConformanceLevel()

virtual PdfAConformanceLevel iText.Pdfa.PdfADocument.GetConformanceLevel ( )
inlinevirtual

Gets the PdfAConformanceLevel set in the constructor or in the metadata of the iText.Kernel.Pdf.PdfReader.

Returns
a iText.Kernel.Pdf.PdfAConformanceLevel

◆ GetPageFactory()

override IPdfPageFactory iText.Pdfa.PdfADocument.GetPageFactory ( )
inlineprotectedvirtual

Returns the factory for creating page instances.

Returns
implementation of IPdfPageFactory for current document

Reimplemented from iText.Kernel.Pdf.PdfDocument.

◆ InitTagStructureContext()

override void iText.Pdfa.PdfADocument.InitTagStructureContext ( )
inlineprotectedvirtual

Initializes tagStructureContext to track necessary information of document's tag structure.

Reimplemented from iText.Kernel.Pdf.PdfDocument.

◆ UpdateXmpMetadata()

override void iText.Pdfa.PdfADocument.UpdateXmpMetadata ( )
inlineprotectedvirtual

Updates XMP metadata.

Updates XMP metadata. Shall be overridden.

Reimplemented from iText.Kernel.Pdf.PdfDocument.