iText 8.0.4 API
iText.Kernel.Utils.PdfMerger Class Reference

Public Member Functions

  PdfMerger (PdfDocument pdfDocument)
  This class is used to merge a number of existing documents into one. More...
 
  PdfMerger (PdfDocument pdfDocument, bool mergeTags, bool mergeOutlines)
  This class is used to merge a number of existing documents into one. More...
 
  PdfMerger (PdfDocument pdfDocument, PdfMergerProperties properties)
  This class is used to merge a number of existing documents into one. More...
 
virtual iText.Kernel.Utils.PdfMerger  SetCloseSourceDocuments (bool closeSourceDocuments)
  If set to true then passed to the PdfMerger::merge method source documents will be closed immediately after merging specified pages into current document. More...
 
virtual iText.Kernel.Utils.PdfMerger  Merge (PdfDocument from, int fromPage, int toPage)
  This method merges pages from the source document to the current one. More...
 
virtual iText.Kernel.Utils.PdfMerger  Merge (PdfDocument from, IList< int > pages)
  This method merges pages from the source document to the current one. More...
 
virtual iText.Kernel.Utils.PdfMerger  Merge (PdfDocument from, IList< int > pages, IPdfPageExtraCopier copier)
  This method merges pages from the source document to the current one. More...
 
virtual void  Close ()
  Closes the current document. More...
 

Constructor & Destructor Documentation

◆ PdfMerger() [1/3]

iText.Kernel.Utils.PdfMerger.PdfMerger ( PdfDocument  pdfDocument )
inline

This class is used to merge a number of existing documents into one.

This class is used to merge a number of existing documents into one. By default, if source document contains tags and outlines, they will be also copied to the destination document.

Parameters
pdfDocument the document into which source documents will be merged

◆ PdfMerger() [2/3]

iText.Kernel.Utils.PdfMerger.PdfMerger ( PdfDocument  pdfDocument,
bool  mergeTags,
bool  mergeOutlines 
)
inline

This class is used to merge a number of existing documents into one.

Parameters
pdfDocument the document into which source documents will be merged
mergeTags if true, then tags from the source document are copied even if destination document is not set as tagged. Note, that if false, tag structure is still could be copied if the destination document is explicitly marked as tagged with iText.Kernel.Pdf.PdfDocument.SetTagged()
mergeOutlines if true, then outlines from the source document are copied even if in destination document outlines are not initialized. Note, that if false, outlines are still could be copied if the destination document outlines were explicitly initialized with iText.Kernel.Pdf.PdfDocument.InitializeOutlines()

◆ PdfMerger() [3/3]

iText.Kernel.Utils.PdfMerger.PdfMerger ( PdfDocument  pdfDocument,
PdfMergerProperties  properties 
)
inline

This class is used to merge a number of existing documents into one.

Parameters
pdfDocument the document into which source documents will be merged
properties properties for the created PdfMerger

Member Function Documentation

◆ Close()

virtual void iText.Kernel.Utils.PdfMerger.Close ( )
inlinevirtual

Closes the current document.

Closes the current document.

It is a complete equivalent of calling PdfDocument::close on the PdfDocument passed to the constructor of this PdfMerger instance. This means that it is enough to call close either on passed PdfDocument or on this PdfMerger instance, but there is no need to call them both.

◆ Merge() [1/3]

virtual iText.Kernel.Utils.PdfMerger iText.Kernel.Utils.PdfMerger.Merge ( PdfDocument  from,
IList< int >  pages 
)
inlinevirtual

This method merges pages from the source document to the current one.

This method merges pages from the source document to the current one.

If closeSourceDocuments flag is set to true (see SetCloseSourceDocuments(bool) ), passed PdfDocument will be closed after pages are merged.

See also iText.Kernel.Pdf.PdfDocument.CopyPagesTo(System.Collections.Generic.IList, iText.Kernel.Pdf.PdfDocument) .

Parameters
from - document, from which pages will be copied
pages - List of numbers of pages which will be copied
Returns
this PdfMerger instance

◆ Merge() [2/3]

virtual iText.Kernel.Utils.PdfMerger iText.Kernel.Utils.PdfMerger.Merge ( PdfDocument  from,
IList< int >  pages,
IPdfPageExtraCopier  copier 
)
inlinevirtual

This method merges pages from the source document to the current one.

This method merges pages from the source document to the current one.

If closeSourceDocuments flag is set to true (see SetCloseSourceDocuments(bool) ), passed PdfDocument will be closed after pages are merged.

See also iText.Kernel.Pdf.PdfDocument.CopyPagesTo(System.Collections.Generic.IList, iText.Kernel.Pdf.PdfDocument) .

Parameters
from - document, from which pages will be copied
pages - List of numbers of pages which will be copied
copier
Returns
this PdfMerger instance

◆ Merge() [3/3]

virtual iText.Kernel.Utils.PdfMerger iText.Kernel.Utils.PdfMerger.Merge ( PdfDocument  from,
int  fromPage,
int  toPage 
)
inlinevirtual

This method merges pages from the source document to the current one.

This method merges pages from the source document to the current one.

If closeSourceDocuments flag is set to true (see SetCloseSourceDocuments(bool) ), passed PdfDocument will be closed after pages are merged.

See also iText.Kernel.Pdf.PdfDocument.CopyPagesTo(System.Collections.Generic.IList, iText.Kernel.Pdf.PdfDocument) .

Parameters
from - document, from which pages will be copied
fromPage - start page in the range of pages to be copied
toPage - end (inclusive) page in the range to be copied
Returns
this PdfMerger instance

◆ SetCloseSourceDocuments()

virtual iText.Kernel.Utils.PdfMerger iText.Kernel.Utils.PdfMerger.SetCloseSourceDocuments ( bool  closeSourceDocuments )
inlinevirtual

If set to true then passed to the PdfMerger::merge method source documents will be closed immediately after merging specified pages into current document.

If set to true then passed to the PdfMerger::merge method source documents will be closed immediately after merging specified pages into current document. If false - PdfDocuments are left open. Default value - false.

Parameters
closeSourceDocuments should be true to close pdf documents in merge method
Returns
this PdfMerger instance