You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Brian Smith <br...@statefarm.com> on 2012/08/23 19:50:14 UTC

merging dynamic pdf files

Hello. I'm trying to merge two pdf files. The files are dynamic forms that have been generated for me. I just need to merge them into one pdf file to print. The files merge ok but some of the data is missing from them after the merge. Here's the code I'm using.

        PDFMergerUtility pdfMergerUtil = new PDFMergerUtility();
                PDDocument outputDocument = new PDDocument();
            PDDocument pdfReader = null;

                pdfReader = PDDocument.load("a ByteArrayInputStream with the byte array of the first pdf document");
            pdfMergerUtil.appendDocument(outputDocument, pdfReader);
                pdfReader = PDDocument.load("a ByteArrayInputStream with the byte array of the second pdf document");
            pdfMergerUtil.appendDocument(outputDocument, pdfReader);

            outputDocument.save(outputStream);
            outputDocument.close();

Is this a known problem? Are there any workarounds or solutions to this? Thanks,

        Brian