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

Tilman Hausherr commented on PDFBOX-2080:
-----------------------------------------

The barcode is an inline image mask. It is similar to the file PDFBOX-1950. 
That file has also an inline image that is rendered inverted. Both are 
compressed with the ccitt filter.

In 2.0, the ccitt filter inverts by default before returning. In 1.8 this is 
not done, however the inversion is done in PDCcitt, but not in PDInlineImage.

I added the inversion in rev 1595440. I won't set this to resolved now, the 
better solution is to move this from PDInlineImage and PDCcitt (including the 
handling of other optional parameters) to CCITTFaxDecodeFilter where it 
belongs, like John has done for 2.0.

[~proba] you will find an update at the snapshot repository in a few hours.

[~lehmi] PDInlineImage mentions pci32.pdf, do you have that file?


> Barcode getting color inverted in pdf to image conversion
> ---------------------------------------------------------
>
>                 Key: PDFBOX-2080
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2080
>             Project: PDFBox
>          Issue Type: Bug
>            Reporter: proba
>         Attachments: FPR00000T9.pdf, slika2_3.jpg
>
>
> While converting a 1 page pdf to an image (both attached below), the image 
> converts properly, however the barcodes colours invert.
> The code used to do the conversion looks like this right now:
>       public static void convertPDFToJPG(String src){
>             try{
>                   //load pdf file in the document object
>                   PDDocument doc=PDDocument.load(new FileInputStream(src));
>                   //Get all pages from document and store them in a list
>                   List<PDPage> pages=doc.getDocumentCatalog().getAllPages();
>                   //create iterator object so it is easy to access each page 
> from the list
>                   Iterator<PDPage> i= pages.iterator();
>                   int count=1; //count variable used to separate each image 
> file
>                   //Convert every page of the pdf document to a unique image 
> file
>                   System.out.println("Please wait...");
>                   while(i.hasNext()){
>                         PDPage page=i.next(); 
>                         BufferedImage bi=page.convertToImage( 
> BufferedImage.TYPE_INT_RGB,  300);
>                         FileOutputStream fos = new FileOutputStream(new 
> File("d:\\slika2_3.jpg"));
>                         //ImageIO.write(bi, "jpg", new 
> File("d:\\pdfimageold.jpg"));
>                         boolean foundWriter = ImageIOUtil.writeImage(bi, 
> "jpg", fos, 300);
>                         count++;
>                   
>                   }
>                   System.out.println("Conversion complete");
>             }catch(IOException ie){ie.printStackTrace();}
>       }



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

Reply via email to