Class PDFMergerExample


  • public class PDFMergerExample
    extends java.lang.Object
    This example demonstrates the use of the new methods PDFMergerUtility.setDestinationDocumentInformation(org.apache.pdfbox.pdmodel.PDDocumentInformation) and PDFMergerUtility.setDestinationMetadata(org.apache.pdfbox.pdmodel.common.PDMetadata) that were added in April 2016. These allow to control the meta data in a merge without having to reopen the result file.
    Author:
    Alexander Kriegisch
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.InputStream merge​(java.util.List<org.apache.pdfbox.io.RandomAccessRead> sources)
      Creates a compound PDF document from a list of input documents.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PDFMergerExample

        public PDFMergerExample()
    • Method Detail

      • merge

        public java.io.InputStream merge​(java.util.List<org.apache.pdfbox.io.RandomAccessRead> sources)
                                  throws java.io.IOException
        Creates a compound PDF document from a list of input documents.

        The merged document is PDF/A-1b compliant, provided the source documents are as well. It contains document properties title, creator and subject, currently hard-coded.

        Parameters:
        sources - list of source PDF documents as RandomAccessRead.
        Returns:
        compound PDF document as a readable input stream.
        Throws:
        java.io.IOException - if anything goes wrong during PDF merge.