public class PDFMergerUtility
extends java.lang.Object
Constructor | Description |
---|---|
PDFMergerUtility() |
Instantiate a new PDFMergerUtility.
|
Modifier and Type | Method | Description |
---|---|---|
void |
addSource(java.io.File source) |
Add a source file to the list of files to merge.
|
void |
addSource(java.io.InputStream source) |
Add a source to the list of documents to merge.
|
void |
addSource(java.lang.String source) |
Add a source file to the list of files to merge.
|
void |
addSources(java.util.List<java.io.InputStream> sourcesList) |
Add a list of sources to the list of documents to merge.
|
void |
appendDocument(PDDocument destination,
PDDocument source) |
append all pages from source to destination.
|
java.lang.String |
getDestinationFileName() |
Get the name of the destination file.
|
java.io.OutputStream |
getDestinationStream() |
Get the destination OutputStream.
|
boolean |
isIgnoreAcroFormErrors() |
Indicates if acroform errors are ignored or not.
|
void |
mergeDocuments() |
Merge the list of source documents, saving the result in the destination
file.
|
void |
mergeDocumentsNonSeq(RandomAccess scratchFile) |
Merge the list of source documents with the non sequential parser, saving
the result in the destination file.
|
void |
setDestinationFileName(java.lang.String destination) |
Set the name of the destination file.
|
void |
setDestinationStream(java.io.OutputStream destStream) |
Set the destination OutputStream.
|
void |
setIgnoreAcroFormErrors(boolean ignoreAcroFormErrorsValue) |
Set to true to ignore acroform errors.
|
public java.lang.String getDestinationFileName()
public void setDestinationFileName(java.lang.String destination)
destination
- The destination to set.public java.io.OutputStream getDestinationStream()
public void setDestinationStream(java.io.OutputStream destStream)
destStream
- The destination to set.public void addSource(java.lang.String source)
source
- Full path and file name of source document.public void addSource(java.io.File source)
source
- File representing source documentpublic void addSource(java.io.InputStream source)
source
- InputStream representing source documentpublic void addSources(java.util.List<java.io.InputStream> sourcesList)
sourcesList
- List of InputStream objects representing source
documentspublic void mergeDocuments() throws java.io.IOException, COSVisitorException
java.io.IOException
- If there is an error saving the document.COSVisitorException
- If an error occurs while saving the
destination file.public void mergeDocumentsNonSeq(RandomAccess scratchFile) throws java.io.IOException, COSVisitorException
scratchFile
- location to store temp PDFBox data for this output
document, can be null if temp data is to be stored in memoryjava.io.IOException
- If there is an error saving the document.COSVisitorException
- If an error occurs while saving the
destination file.public void appendDocument(PDDocument destination, PDDocument source) throws java.io.IOException
destination
- the document to receive the pagessource
- the document originating the new pagesjava.io.IOException
- If there is an error accessing data from either
document.public boolean isIgnoreAcroFormErrors()
public void setIgnoreAcroFormErrors(boolean ignoreAcroFormErrorsValue)
ignoreAcroFormErrorsValue
- true if acroform errors should be
ignored