How to combine many PDFs?

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF Merger for Java (v5)  /  How to combine many PDFs?

DynamicPDF Merger for Java (v5) Forum

 Feb 25 2009 12:16 PM
I've already looked at the sample merge java class.  I need to be able to loop and add PDFs.  There may be one or many PDFs to add.

Sudo code would be something like this:

Document doc = new Document();
while( {
   path = this.rootDir + rs.getString("path");
   doc.append(new PdfDocument(path));
 Feb 25 2009 12:23 PM
Posted by a ceTe Software moderator

You can merge several PDF documents to make a single PDF document without any problem. You will have to use the MergeDocument object in order merge the PDF documents. You can not use the Document object. Bellow is a sample explanation for this.

   MergeDocument document = new MergeDocument();
   in a loop
      document.append( filePath );//You can also use the PdfDocument object here.
   end loop.

ceTe Software Support Team.
 Feb 25 2009 12:27 PM
Thanks for the quick reply.  My code appears to be correct now using MergeDocument.  However, I am getting the following exception for each file I try to append:

com.cete.dynamicpdf.merger.MergerException: Invalid XRef Stream Filter Specified

The PDFs that I'm trying to combine were created with LiveCycle and were dynamically constructed by passing XML to them to populate fields, and then each was saved to disk.
 Feb 25 2009 1:01 PM
Posted by a ceTe Software moderator

The error message indicates that one of the PDF document that you are trying to merge is corrupt and invalid. However, if you want, you can send the PDF document that is throwing the error to our Support Team and they can take a look at the PDF.

ceTe Software Support Team
 Feb 25 2009 1:05 PM
I emailed a sample PDF document to you...
 Feb 25 2009 3:22 PM
Any ideas?
 Feb 25 2009 3:37 PM
Posted by a ceTe Software moderator

We were able to fix the issue with merging the PDF document but since the PDF is created in Adobe LiveCycle, after merging the PDF, we cannot view the PDF. The original PDF has some special permissions added using LiveCycle which are getting removed when merging the PDF document.

The PDF has the below text inside when opening it in Acrobat Reader and thats becasue the PDF is likely using some customer Adobe LiveCycle functionality:

"To view the full contents of this document, you need a later version of the PDF viewer. You can upgrade to the latest version of Adobe Reader from For further support, go to".

ceTe Software Support Team
 Jul 01 2010 12:56 PM
I am getting the same exception "Invalid XRef Stream Filter Specified."
when I tried to use MergeDocument on a pdf in my .net project.
Please help!
 Jul 01 2010 1:13 PM
Posted by a ceTe Software moderator

Can you please send over the PDF document and the code you are using to our Support Team so that they can look into it further.

ceTe Software Support Team.
 Jul 01 2010 1:19 PM
I send document to support email.

All times are US Eastern Standard time. The time now is 5:36 PM.