Package com.itextpdf.text.pdf
Class PdfConcatenate
java.lang.Object
com.itextpdf.text.pdf.PdfConcatenate
Wrapper class for PdfCopy and PdfSmartCopy.
Allows you to concatenate existing PDF documents with much less code.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates an instance of the concatenation class.PdfConcatenate
(OutputStream os, boolean smart) Creates an instance of the concatenation class. -
Method Summary
Modifier and TypeMethodDescriptionint
Adds the pages from an existing PDF document.void
close()
We've finished writing the concatenated document.Gets the PdfCopy instance so that you can add bookmarks or change preferences before you close PdfConcatenate.void
open()
Opens the document (if it isn't open already).
-
Field Details
-
document
The Document object for PdfCopy. -
copy
The actual PdfWriter
-
-
Constructor Details
-
PdfConcatenate
Creates an instance of the concatenation class.- Parameters:
os
- the OutputStream for the PDF document- Throws:
DocumentException
-
PdfConcatenate
Creates an instance of the concatenation class.- Parameters:
os
- the OutputStream for the PDF documentsmart
- do we want PdfCopy to detect redundant content?- Throws:
DocumentException
-
-
Method Details
-
addPages
Adds the pages from an existing PDF document.- Parameters:
reader
- the reader for the existing PDF document- Returns:
- the number of pages that were added
- Throws:
DocumentException
IOException
-
getWriter
Gets the PdfCopy instance so that you can add bookmarks or change preferences before you close PdfConcatenate. -
open
public void open()Opens the document (if it isn't open already). Opening the document is done implicitly. -
close
public void close()We've finished writing the concatenated document.
-