| Modifier and Type | Class and Description |
|---|---|
| public static enum | PDFMergerUtility.
The mode to use when merging AcroForm between documents:
|
| public static enum | PDFMergerUtility.
The mode to use when merging documents:
|
| Modifier and Type | Field and Description |
|---|---|
| private PDFMergerUtility. | |
| private PDDocumentInformation | |
| private String | |
| private PDMetadata | |
| private OutputStream | |
| private PDFMergerUtility. | |
| private boolean | |
| private static final Log | LOG
Log instance. |
| private int | |
| private final List |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private void | |
| public void | |
| public void | |
| public void | addSource(RandomAccessRead
RandomAccessRead representing source document. To pass an InputStream, wrap it
into a source)RandomAccessReadBuffer.Add a source to the list of documents to merge. |
| public void | addSources(List<RandomAccessRead>
List of RandomAccessRead objects representing source documents sourcesList)Add a list of sources to the list of documents to merge. |
| public void | appendDocument(PDDocument
the document to receive the pages destination, PDDocument the document originating the new pages source)append all pages from source to destination. |
| public PDFMergerUtility. | Returns: the current AcroFormMergeModeGet the merge mode to be used for merging AcroForms between documents
|
| public PDDocumentInformation | Returns: The destination document information.Get the destination document information that is to be set in
|
| public String | |
| public PDMetadata | Returns: The destination metadata.Set the destination metadata that is to be set in
|
| public OutputStream | Returns: Returns the destination OutputStream.Get the destination OutputStream. |
| public PDFMergerUtility. | Returns: the current DocumentMergeModeGet the merge mode to be used for merging documents
|
| pack-priv static Map | |
| pack-priv static Map | |
| private boolean | |
| private boolean | Returns: true if there is a dynamic XFA form.the AcroForm acroForm)Test for dynamic XFA content. |
| public boolean | Returns: true if acroform errors are ignoredIndicates if acroform errors are ignored or not. |
| private void | legacyMergeDocuments(RandomAccessStreamCache.
a function to create an instance of a stream cache; in case of streamCacheCreateFunction,null
unrestricted main memory is usedMerge the list of source documents, saving the result in the destination file. |
| private void | |
| public void | mergeDocuments(RandomAccessStreamCache.
a function to create an instance of a stream cache; in case of streamCacheCreateFunctionnull
unrestricted main memory is usedMerge the list of source documents, saving the result in the destination file. |
| public void | mergeDocuments(RandomAccessStreamCache.
a function to create an instance of a stream cache; in case of streamCacheCreateFunction,null
unrestricted main memory is useddefines if compressed object streams are enabled compressParameters)Merge the list of source documents, saving the result in the destination file. |
| private void | mergeIDTree(PDFCloneUtility cloner, PDStructureTreeRoot srcStructTree, PDStructureTreeRoot destStructTree)
|
| private void | mergeInto(COSDictionary
The source dictionary to get the keys/values from. src, COSDictionary The destination dictionary to merge the keys/values into. dst, Set<COSName> Names of keys that shall be skipped. exclude)This will add all of the dictionaries keys/values to this dictionary, but only if they are not in an exclusion list and if they don't already exist. |
| private void | mergeKEntries(PDFCloneUtility cloner, PDStructureTreeRoot srcStructTree, PDStructureTreeRoot destStructTree)
|
| private void | |
| private void | |
| private void | mergeOutputIntents(PDFCloneUtility cloner, PDDocumentCatalog srcCatalog, PDDocumentCatalog destCatalog)
|
| private void | |
| private void | |
| private void | optimizedMergeDocuments(RandomAccessStreamCache.
|
| public void | setAcroFormMergeMode(PDFMergerUtility.
AcroFormMergeMode to be used theAcroFormMergeModeSet the merge mode to be used for merging AcroForms between documents
|
| public void | setDestinationDocumentInformation(PDDocumentInformation
The destination document information. info)Set the destination document information that is to be set in
|
| public void | setDestinationFileName(String
The destination to set. destination)Set the name of the destination file. |
| public void | setDestinationMetadata(PDMetadata
The destination metadata. meta)Set the destination metadata that is to be set in
|
| public void | setDestinationStream(OutputStream
The destination to set. destStream)Set the destination OutputStream. |
| public void | setDocumentMergeMode(PDFMergerUtility.
DocumentMergeMode to be used theDocumentMergeModeSet the merge mode to be used for merging documents
|
| public void | setIgnoreAcroFormErrors(boolean
true if acroform errors should be
ignored ignoreAcroFormErrorsValue)Set to true to ignore acroform errors. |
| private void | updatePageReferences(PDFCloneUtility cloner, Map<Integer, COSObjectable> numberTreeAsMap, Map<COSDictionary, COSDictionary> objMapping)
Update the Pg and Obj references to the new (merged) page. |
| private void | updatePageReferences(PDFCloneUtility cloner, COSDictionary parentTreeEntry, Map<COSDictionary, COSDictionary>
mapping between old and new references objMapping)Update the Pg and Obj references to the new (merged) page. |
| private void | updatePageReferences(PDFCloneUtility cloner, COSArray parentTreeEntry, Map<COSDictionary, COSDictionary> objMapping)
|
| private void | updateParentEntry(COSArray
the kids array kArray, COSDictionary the new parent newParent, COSName the new structure type in /S or null so it doesn't get replaced newStructureType)Update the P reference to the new parent dictionary. |
| private void | updateStructParentEntries(PDPage
the new page page, int the offset which should be applied structParentOffset)Update the StructParents and StructParent values in a PDPage. |
| acroFormMergeMode | back to summary |
|---|---|
| private PDFMergerUtility. | |
| destinationDocumentInformation | back to summary |
|---|---|
| private PDDocumentInformation destinationDocumentInformation | |
| destinationFileName | back to summary |
|---|---|
| private String destinationFileName | |
| destinationMetadata | back to summary |
|---|---|
| private PDMetadata destinationMetadata | |
| destinationStream | back to summary |
|---|---|
| private OutputStream destinationStream | |
| documentMergeMode | back to summary |
|---|---|
| private PDFMergerUtility. | |
| ignoreAcroFormErrors | back to summary |
|---|---|
| private boolean ignoreAcroFormErrors | |
| LOG | back to summary |
|---|---|
| private static final Log LOG Log instance. | |
| nextFieldNum | back to summary |
|---|---|
| private int nextFieldNum | |
| sources | back to summary |
|---|---|
| private final List<Object> sources | |
| PDFMergerUtility | back to summary |
|---|---|
| public PDFMergerUtility() Instantiate a new PDFMergerUtility. | |
| acroFormJoinFieldsMode | back to summary |
|---|---|
| private void acroFormJoinFieldsMode(PDFCloneUtility cloner, PDAcroForm destAcroForm, PDAcroForm srcAcroForm) throws IOException | |
| acroFormLegacyMode | back to summary |
|---|---|
| private void acroFormLegacyMode(PDFCloneUtility cloner, PDAcroForm destAcroForm, PDAcroForm srcAcroForm) throws IOException | |
| addSource | back to summary |
|---|---|
| public void addSource(String source) throws FileNotFoundException Add a source file to the list of files to merge.
| |
| addSource | back to summary |
|---|---|
| public void addSource(File source) throws FileNotFoundException Add a source file to the list of files to merge.
| |
| addSource | back to summary |
|---|---|
| public void addSource(RandomAccessRead source) Add a source to the list of documents to merge.
| |
| addSources | back to summary |
|---|---|
| public void addSources(List<RandomAccessRead> sourcesList) Add a list of sources to the list of documents to merge.
| |
| appendDocument | back to summary |
|---|---|
| public void appendDocument(PDDocument destination, PDDocument source) throws IOException append all pages from source to destination.
| |
| getAcroFormMergeMode | back to summary |
|---|---|
| public PDFMergerUtility. Get the merge mode to be used for merging AcroForms between documents
| |
| getDestinationDocumentInformation | back to summary |
|---|---|
| public PDDocumentInformation getDestinationDocumentInformation() Get the destination document information that is to be set in
| |
| getDestinationFileName | back to summary |
|---|---|
| public String getDestinationFileName() Get the name of the destination file.
| |
| getDestinationMetadata | back to summary |
|---|---|
| public PDMetadata getDestinationMetadata() Set the destination metadata that is to be set in
| |
| getDestinationStream | back to summary |
|---|---|
| public OutputStream getDestinationStream() Get the destination OutputStream.
| |
| getDocumentMergeMode | back to summary |
|---|---|
| public PDFMergerUtility. Get the merge mode to be used for merging documents
| |
| getIDTreeAsMap | back to summary |
|---|---|
| pack-priv static Map | |
| getNumberTreeAsMap | back to summary |
|---|---|
| pack-priv static Map | |
| hasOnlyDocumentsOrParts | back to summary |
|---|---|
| private boolean hasOnlyDocumentsOrParts(COSArray kLevelOneArray) | |
| isDynamicXfa | back to summary |
|---|---|
| private boolean isDynamicXfa(PDAcroForm acroForm) Test for dynamic XFA content.
| |
| isIgnoreAcroFormErrors | back to summary |
|---|---|
| public boolean isIgnoreAcroFormErrors() Indicates if acroform errors are ignored or not.
| |
| legacyMergeDocuments | back to summary |
|---|---|
| private void legacyMergeDocuments(RandomAccessStreamCache. Merge the list of source documents, saving the result in the destination file.
| |
| mergeAcroForm | back to summary |
|---|---|
| private void mergeAcroForm(PDFCloneUtility cloner, PDDocumentCatalog destCatalog, PDDocumentCatalog srcCatalog) throws IOException | |
| mergeDocuments | back to summary |
|---|---|
| public void mergeDocuments(RandomAccessStreamCache. Merge the list of source documents, saving the result in the destination file. The source
list is not reset after merge. If you want to merge one document at a time, then it's better
to use
| |
| mergeDocuments | back to summary |
|---|---|
| public void mergeDocuments(RandomAccessStreamCache. Merge the list of source documents, saving the result in the destination file. The source
list is not reset after merge. If you want to merge one document at a time, then it's better
to use
| |
| mergeIDTree | back to summary |
|---|---|
| private void mergeIDTree(PDFCloneUtility cloner, PDStructureTreeRoot srcStructTree, PDStructureTreeRoot destStructTree) throws IOException | |
| mergeInto | back to summary |
|---|---|
| private void mergeInto(COSDictionary src, COSDictionary dst, Set<COSName> exclude) This will add all of the dictionaries keys/values to this dictionary, but only if they are not in an exclusion list and if they don't already exist. If a key already exists in this dictionary then nothing is changed.
| |
| mergeKEntries | back to summary |
|---|---|
| private void mergeKEntries(PDFCloneUtility cloner, PDStructureTreeRoot srcStructTree, PDStructureTreeRoot destStructTree) throws IOException | |
| mergeLanguage | back to summary |
|---|---|
| private void mergeLanguage(PDDocumentCatalog destCatalog, PDDocumentCatalog srcCatalog) | |
| mergeMarkInfo | back to summary |
|---|---|
| private void mergeMarkInfo(PDDocumentCatalog destCatalog, PDDocumentCatalog srcCatalog) | |
| mergeOutputIntents | back to summary |
|---|---|
| private void mergeOutputIntents(PDFCloneUtility cloner, PDDocumentCatalog srcCatalog, PDDocumentCatalog destCatalog) throws IOException | |
| mergeRoleMap | back to summary |
|---|---|
| private void mergeRoleMap(PDStructureTreeRoot srcStructTree, PDStructureTreeRoot destStructTree) | |
| mergeViewerPreferences | back to summary |
|---|---|
| private void mergeViewerPreferences(PDDocumentCatalog destCatalog, PDDocumentCatalog srcCatalog) | |
| optimizedMergeDocuments | back to summary |
|---|---|
| private void optimizedMergeDocuments(RandomAccessStreamCache. | |
| setAcroFormMergeMode | back to summary |
|---|---|
| public void setAcroFormMergeMode(PDFMergerUtility. Set the merge mode to be used for merging AcroForms between documents
| |
| setDestinationDocumentInformation | back to summary |
|---|---|
| public void setDestinationDocumentInformation(PDDocumentInformation info) Set the destination document information that is to be set in
| |
| setDestinationFileName | back to summary |
|---|---|
| public void setDestinationFileName(String destination) Set the name of the destination file.
| |
| setDestinationMetadata | back to summary |
|---|---|
| public void setDestinationMetadata(PDMetadata meta) Set the destination metadata that is to be set in
| |
| setDestinationStream | back to summary |
|---|---|
| public void setDestinationStream(OutputStream destStream) Set the destination OutputStream.
| |
| setDocumentMergeMode | back to summary |
|---|---|
| public void setDocumentMergeMode(PDFMergerUtility. Set the merge mode to be used for merging documents
| |
| setIgnoreAcroFormErrors | back to summary |
|---|---|
| public void setIgnoreAcroFormErrors(boolean ignoreAcroFormErrorsValue) Set to true to ignore acroform errors.
| |
| updatePageReferences | back to summary |
|---|---|
| private void updatePageReferences(PDFCloneUtility cloner, Map<Integer, COSObjectable> numberTreeAsMap, Map<COSDictionary, COSDictionary> objMapping) throws IOException Update the Pg and Obj references to the new (merged) page. | |
| updatePageReferences | back to summary |
|---|---|
| private void updatePageReferences(PDFCloneUtility cloner, COSDictionary parentTreeEntry, Map<COSDictionary, COSDictionary> objMapping) throws IOException Update the Pg and Obj references to the new (merged) page.
| |
| updatePageReferences | back to summary |
|---|---|
| private void updatePageReferences(PDFCloneUtility cloner, COSArray parentTreeEntry, Map<COSDictionary, COSDictionary> objMapping) throws IOException | |
| updateParentEntry | back to summary |
|---|---|
| private void updateParentEntry(COSArray kArray, COSDictionary newParent, COSName newStructureType) Update the P reference to the new parent dictionary.
| |
| updateStructParentEntries | back to summary |
|---|---|
| private void updateStructParentEntries(PDPage page, int structParentOffset) throws IOException Update the StructParents and StructParent values in a PDPage.
| |
AcroFormMergeMode#JOIN_FORM_FIELDS_MODE fields with the same fully qualified name
will be merged into one with the widget annotations of the merged fields
becoming part of the same field.
AcroFormMergeMode#PDFBOX_LEGACY_MODE fields with the same fully qualified name
will be renamed and treated as independent. This mode was used in versions
of PDFBox up to 2.x.
| Modifier and Type | Field and Description |
|---|---|
| public static final PDFMergerUtility. | |
| public static final PDFMergerUtility. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static PDFMergerUtility. | |
| public static PDFMergerUtility. |
| JOIN_FORM_FIELDS_MODE | back to summary |
|---|---|
| public static final PDFMergerUtility. | |
| PDFBOX_LEGACY_MODE | back to summary |
|---|---|
| public static final PDFMergerUtility. | |
| AcroFormMergeMode | back to summary |
|---|---|
| private AcroFormMergeMode() | |
| valueOf | back to summary |
|---|---|
| public static PDFMergerUtility. | |
| values | back to summary |
|---|---|
| public static PDFMergerUtility. | |
DocumentMergeMode#OPTIMIZE_RESOURCES_MODE Optimizes resource handling such as
closing documents early. Not all document elements are merged compared to
the PDFBOX_LEGACY_MODE. Currently supported are:
DocumentMergeMode#PDFBOX_LEGACY_MODE Keeps all files open until the
merge has been completed. This is currently necessary to merge documents
containing a Structure Tree.
| Modifier and Type | Field and Description |
|---|---|
| public static final PDFMergerUtility. | |
| public static final PDFMergerUtility. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static PDFMergerUtility. | |
| public static PDFMergerUtility. |
| OPTIMIZE_RESOURCES_MODE | back to summary |
|---|---|
| public static final PDFMergerUtility. | |
| PDFBOX_LEGACY_MODE | back to summary |
|---|---|
| public static final PDFMergerUtility. | |
| DocumentMergeMode | back to summary |
|---|---|
| private DocumentMergeMode() | |
| valueOf | back to summary |
|---|---|
| public static PDFMergerUtility. | |
| values | back to summary |
|---|---|
| public static PDFMergerUtility. | |