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 2013/04/13 14:14:16 UTC
[jira] [Commented] (PDFBOX-1548) PDJpeg gots drawn in wrong colors
when resized -> Adobe Reader -> Windows XP & 7
[ https://issues.apache.org/jira/browse/PDFBOX-1548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13631019#comment-13631019 ]
Andreas Lehmkühler commented on PDFBOX-1548:
--------------------------------------------
I guess the problem is that you are trying to resize the image by calling setWidth/setHeight. Instead you should resize them by using a transformation matrix, see PDPageContentStream#drawXObject.
> PDJpeg gots drawn in wrong colors when resized -> Adobe Reader -> Windows XP & 7
> --------------------------------------------------------------------------------
>
> Key: PDFBOX-1548
> URL: https://issues.apache.org/jira/browse/PDFBOX-1548
> Project: PDFBox
> Issue Type: Bug
> Affects Versions: 1.7.0, 1.7.1
> Environment: Windows XP & Windows 7 -> Adobe Reader (11.0.2)
> Reporter: Marco Metting
> Attachments: iPIN_2013_03_22_18_42_25.pdf, Screen Shot Mac OSX Preview.png, Screen Shot Windows XP Adobe Reader.png
>
>
> When creating a PDF and drawing PDJpegs to it, the images' colors are changed / inverted when resizing the PDJpeg(s) before drawing them to the PDF. This issue is only visible on Windows XP and Windows 7 using e.g. Adobe Reader. Preview on Mac or the new PDF-previewer build in Windows 8 is somehow not affected by this.
> This is what I do in code:
> 1.) Create PDDocument
> 2.) Create HashMap of PDJpegs (for caching purpose):
> - Create PDJpegs by BufferedImage initialised through ImageIO.read()
> - Resize PDJpegs by calling setHeight() and setWidth()
> - Adding PDJpeg to HashMap
> 3.) Create PDPage and add it to PDDocument
> 4.) Create PDPageContentStream
> 5.) Draw some PDJpegs on the PDPage
> 6.) Close PDPageContentStream
> 7.) Save PDDocument
> 8.) Close PDDocument
> If the BufferedImages are resized before initialising the PDJpegs, everything works fine, but they don't look that sharp.
> Please provide some help, since I'm hanging on this for days now.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira