public class PdfMerger extends Object
| Constructor and Description |
|---|
PdfMerger(PdfDocument pdfDocument)
This class is used to merge a number of existing documents into one.
|
PdfMerger(PdfDocument pdfDocument,
PdfMergerProperties properties)
This class is used to merge a number of existing documents into one.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the current document.
|
PdfMerger |
merge(PdfDocument from,
int fromPage,
int toPage)
This method merges pages from the source document to the current one.
|
PdfMerger |
merge(PdfDocument from,
List<Integer> pages)
This method merges pages from the source document to the current one.
|
PdfMerger |
merge(PdfDocument from,
List<Integer> pages,
IPdfPageExtraCopier copier)
This method merges pages from the source document to the current one.
|
PdfMerger |
setCloseSourceDocuments(boolean 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. |
public PdfMerger(PdfDocument pdfDocument)
pdfDocument - the document into which source documents will be mergedpublic PdfMerger(PdfDocument pdfDocument, PdfMergerProperties properties)
pdfDocument - the document into which source documents will be mergedproperties - properties for the created PdfMergerpublic PdfMerger setCloseSourceDocuments(boolean closeSourceDocuments)
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.closeSourceDocuments - should be true to close pdf documents in merge methodPdfMerger instancepublic PdfMerger merge(PdfDocument from, int fromPage, int toPage)
If closeSourceDocuments flag is set to true (see setCloseSourceDocuments(boolean)),
passed PdfDocument will be closed after pages are merged.
See also PdfDocument.copyPagesTo(int, int, com.itextpdf.kernel.pdf.PdfDocument, int).
from - - document, from which pages will be copiedfromPage - - start page in the range of pages to be copiedtoPage - - end (inclusive) page in the range to be copiedPdfMerger instancepublic PdfMerger merge(PdfDocument from, List<Integer> pages)
If closeSourceDocuments flag is set to true (see setCloseSourceDocuments(boolean)),
passed PdfDocument will be closed after pages are merged.
See also PdfDocument.copyPagesTo(int, int, com.itextpdf.kernel.pdf.PdfDocument, int).
from - - document, from which pages will be copiedpages - - List of numbers of pages which will be copiedPdfMerger instancepublic PdfMerger merge(PdfDocument from, List<Integer> pages, IPdfPageExtraCopier copier)
If closeSourceDocuments flag is set to true (see setCloseSourceDocuments(boolean)),
passed PdfDocument will be closed after pages are merged.
See also PdfDocument.copyPagesTo(int, int, com.itextpdf.kernel.pdf.PdfDocument, int).
from - - document, from which pages will be copiedpages - - List of numbers of pages which will be copiedcopier - - a 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.PdfMerger instancepublic void close()
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.
Copyright © 1998–2024 Apryse Group NV. All rights reserved.