public class PDFMergerUtility
extends java.lang.Object
Modifier and Type | Class | Description |
---|---|---|
static class |
PDFMergerUtility.DocumentMergeMode |
The mode to use when merging documents.
|
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.
|
PDDocumentInformation |
getDestinationDocumentInformation() |
Get the destination document information that is to be set in
mergeDocuments(org.apache.pdfbox.io.MemoryUsageSetting) . |
java.lang.String |
getDestinationFileName() |
Get the name of the destination file.
|
PDMetadata |
getDestinationMetadata() |
Set the destination metadata that is to be set in
mergeDocuments(org.apache.pdfbox.io.MemoryUsageSetting) . |
java.io.OutputStream |
getDestinationStream() |
Get the destination OutputStream.
|
boolean |
isIgnoreAcroFormErrors() |
Indicates if acroform errors are ignored or not.
|
void |
mergeDocuments() |
Deprecated.
|
void |
mergeDocuments(MemoryUsageSetting memUsageSetting) |
Merge the list of source documents, saving the result in the destination
file.
|
void |
setDestinationDocumentInformation(PDDocumentInformation info) |
Set the destination document information that is to be set in
mergeDocuments(org.apache.pdfbox.io.MemoryUsageSetting) . |
void |
setDestinationFileName(java.lang.String destination) |
Set the name of the destination file.
|
void |
setDestinationMetadata(PDMetadata meta) |
Set the destination metadata that is to be set in
mergeDocuments(org.apache.pdfbox.io.MemoryUsageSetting) . |
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 PDDocumentInformation getDestinationDocumentInformation()
mergeDocuments(org.apache.pdfbox.io.MemoryUsageSetting)
. The default is null, which means that it is ignored.public void setDestinationDocumentInformation(PDDocumentInformation info)
mergeDocuments(org.apache.pdfbox.io.MemoryUsageSetting)
. The default is null, which means that it is ignored.info
- The destination document information.public PDMetadata getDestinationMetadata()
mergeDocuments(org.apache.pdfbox.io.MemoryUsageSetting)
. The default is null, which means that it is ignored.public void setDestinationMetadata(PDMetadata meta)
mergeDocuments(org.apache.pdfbox.io.MemoryUsageSetting)
. The default is null, which means that it is ignored.meta
- The destination metadata.public void addSource(java.lang.String source) throws java.io.FileNotFoundException
source
- Full path and file name of source document.java.io.FileNotFoundException
- If the file doesn't existpublic void addSource(java.io.File source) throws java.io.FileNotFoundException
source
- File representing source documentjava.io.FileNotFoundException
- If the file doesn't existpublic 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
documents@Deprecated public void mergeDocuments() throws java.io.IOException
java.io.IOException
- If there is an error saving the document.public void mergeDocuments(MemoryUsageSetting memUsageSetting) throws java.io.IOException
memUsageSetting
- defines how memory is used for buffering PDF streams;
in case of null
unrestricted main memory is usedjava.io.IOException
- If there is an error saving the document.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
ignoredCopyright © 2002–2018. All rights reserved.