You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2014/05/10 23:56:39 UTC

[jira] [Comment Edited] (PDFBOX-2057) Importing BufferedImage into PDPixelMap is broken in 1.8.5

    [ https://issues.apache.org/jira/browse/PDFBOX-2057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13993667#comment-13993667 ] 

Tilman Hausherr edited comment on PDFBOX-2057 at 5/9/14 4:54 PM:
-----------------------------------------------------------------

I added code to handle BITMASK transparency properly. Please give feedback whether you can get rid of your workaround.

I also added a test to prevent this from breaking in the future.

I also removed double assignments from CCITTFactory and added am test to check that they are really there.

This was done in rev 1593569, which also added the modifications of PDFBOX-2068.

Next: will look whether the problem occurs for jpeg and in 1.8.


was (Author: tilman):
I added code to handle bitmask transparency properly. Please give feedback whether you can get rid of your workaround.

I also added a test to prevent this from breaking in the future.

I also removed double assignments from CCITTFactory and added am test to check that they are really there.

This was done in rev 1593569, which also added the modifications of PDFBOX-2068.

Next: will look whether the problem occurs for jpeg and in 1.8.

> Importing BufferedImage into PDPixelMap is broken in 1.8.5
> ----------------------------------------------------------
>
>                 Key: PDFBOX-2057
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2057
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 1.8.5, 1.8.6
>         Environment: windows vista / jdk 1.7.0_45
>            Reporter: Michaƫl Michaud
>            Assignee: Tilman Hausherr
>              Labels: regression
>             Fix For: 1.8.6, 2.0.0
>
>         Attachments: CS-Convocation entretien signed.pdf, CS-Convocation entretien-IText.pdf, CS-Convocation entretien-PDFBox-with-workarround.pdf, CS-Convocation entretien-PDFBox.pdf, ImageFilterOp.java, differentBufferedImages.pdf, renderTransparentImage.zip
>
>
> Try to import a BufferedImage in a PDDocument with PDPixelMap
> BufferedImage with TYPE_4BYTE_ABGR works fine with PDFBox 1.8.4 (though, the pdf file contains instruction /ColorSpace /DeviceGray)
> BufferedImage with TYPE_4BYTE_ABGR produces an unreadable PDF with PDFBox 1.8.5 (though, the pdf file contains instruction /ColorSpace /DeviceRGB).
> Code used to demonstrate the problem is as follows (image has also been colored with some Graphics instructions to demonstrate that 1.8.4 is working) :
> {code}
> try {
>             PDDocument doc = new PDDocument();
>             PDPage page = new PDPage();
>             doc.addPage(page);
>             BufferedImage awtImage = new BufferedImage(100,100, BufferedImage.TYPE_4BYTE_ABGR);
>             PDPixelMap ximage = new PDPixelMap(doc, awtImage);
>             PDPageContentStream contentStream = new PDPageContentStream(doc, page);
>             contentStream.drawXObject(ximage, 200, 200, 100, 100);
>             contentStream.close();
>             doc.save("C:\\Temp\\PDF\\test185_4babgr.pdf");
>         } catch(COSVisitorException|IOException e) {
>             e.printStackTrace();
>         }
> {code}
> I also tried with a BufferedImage with TYPE_INT_ARGB but it throws an exception with PDFBox 1.8.4 and 1.8.5 :
> {code}
> Exception in thread "main" java.lang.IllegalArgumentException: Raster IntegerInterleavedRaster: width = 100 height = 100 #Bands = 1 xOff = 0 yOff = 0 dataOffset[0] 0 is incompatible with ColorModel ColorModel: #pixelBits = 8 numComponents = 1 color space = java.awt.color.ICC_ColorSpace@1dc80063 transparency = 1 has alpha = false isAlphaPre = false
> 	at java.awt.image.BufferedImage.<init>(BufferedImage.java:630)
> 	at org.apache.pdfbox.pdmodel.graphics.xobject.PDPixelMap.createImageStream(PDPixelMap.java:107)
> {code}
> My main purpose was to use a BufferedImage with a CMYK ColorSpace, but PDPixelMap seems to accept 1 component and 3 component ColorSpace only.



--
This message was sent by Atlassian JIRA
(v6.2#6252)