Chupacabras created PDFBOX-1394:
-----------------------------------

             Summary: Image streams are lost when adding new images to page
                 Key: PDFBOX-1394
                 URL: https://issues.apache.org/jira/browse/PDFBOX-1394
             Project: PDFBox
          Issue Type: Bug
    Affects Versions: 1.7.1
         Environment: Oracle JDK 1.6.0_26
            Reporter: Chupacabras


I open existing PDF which contains images. Then I want to insert new images and 
save it as new PDF.
The resulting PDF does not contain original images, just the new ones. Adobe 
Reader complains about missing object too.

PDDocument pdDoc=PDDocument.load("input.pdf", false);
PDXObjectImage ximage = new PDJpeg(pdDoc, bufferedImage);
PDPage page=(PDPage) pdDoc.getDocumentCatalog().getAllPages().get(0);
PDPageContentStream content = new PDPageContentStream(pdDoc, page, true, true);
content.drawXObject(ximage, 100, 600, 200, 130);
// or content.drawImage(ximage, 0, 0);
content.close();
pdDoc.save("output.pdf");
pdDoc.close();

When I look into PDF binary file I can see only 1 image stream (the one I 
added) and I can't see streams of original images, they simply are not there.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to