You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Andreas Lehmkühler (JIRA)" <ji...@apache.org> on 2012/08/23 17:47:42 UTC

[jira] [Resolved] (PDFBOX-1394) Image streams are lost when adding new images to page

     [ https://issues.apache.org/jira/browse/PDFBOX-1394?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Lehmkühler resolved PDFBOX-1394.
----------------------------------------

    Resolution: Fixed
      Assignee: Andreas Lehmkühler

I added the patch in revision 1376553 with some small changes, so that addXObject works similar to addFont.

Thanks for the contribution!
                
> 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
>          Components: PDModel
>    Affects Versions: 1.7.1
>         Environment: Oracle JDK 1.6.0_26
>            Reporter: Juraj Lonc
>            Assignee: Andreas Lehmkühler
>             Fix For: 1.8.0
>
>         Attachments: input.pdf, output.pdf, PDFBOX-1394.patch
>
>
> 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