pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Buzzy Spain <bsp...@heartflow.com>
Subject Problem Merging Document
Date Thu, 09 May 2013 21:59:04 GMT
Hi all,

We generate a report using PDFBox to populate and combine some PDF form
documents.  I have our initial implementation working, but as I try to add
some additional text (or images) I seem to run into the error message
below...

 "*java.io.IOException: Error: Not allowed to get filtered stream from
array of streams*".

This is always in the context of a stack trace under
PDFMergerUtility.mergeAcroForm().  Anyone have any tips on what this might
mean I am doing wrong?  The message isn't meaningful to me.

We are using 1.8.1.  The documents will happily merge until I add that last
header text / footer image.  The code I am using to add the footer image
looks like this...

BufferedImage image = ImageIO.read(m_legendFile);
PDPage page = getPage(document, pageNumber);
PDJpeg xImage = new PDJpeg(document, image, quality);
PDPageContentStream contentStream = null;
try {
      contentStream = new PDPageContentStream(document, page, true, true,
false);
      contentStream.drawXObject(xImage, x, y, width, height);
} finally {
      if (contentStream != null) {
           contentStream.close();
      }
}

Thanks for any pointers!
Buzzy

====
Caused by: java.io.IOException: Error: Not allowed to get filtered stream
from array of streams.
at
org.apache.pdfbox.pdmodel.common.COSStreamArray.getFilteredStream(COSStreamArray.java:178)
at
org.apache.pdfbox.util.PDFCloneUtility.cloneForNewDocument(PDFCloneUtility.java:116)
at
org.apache.pdfbox.util.PDFCloneUtility.cloneForNewDocument(PDFCloneUtility.java:133)
at
org.apache.pdfbox.util.PDFCloneUtility.cloneForNewDocument(PDFCloneUtility.java:99)
at
org.apache.pdfbox.util.PDFCloneUtility.cloneForNewDocument(PDFCloneUtility.java:133)
at
org.apache.pdfbox.util.PDFMergerUtility.mergeAcroForm(PDFMergerUtility.java:441)
at
org.apache.pdfbox.util.PDFMergerUtility.appendDocument(PDFMergerUtility.java:285)

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message