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

Tilman Hausherr commented on PDFBOX-2853:
-----------------------------------------

Can you attach a file of your own?

Re your patch suggestion: Indeed - this was first was done in PDFBOX-584 / 
r928408 and then was copied in PDFBOX-1445 / r1410890 - Transparency.OPAQUE was 
used at a place where "the index of the fully transparent pixel" should have 
been. The intention from the text was to create an opaque image, so your 
solution is correct, but one could also just remove the parameter.

making the change in PDCCitt improves things:
- PDFBOX-1708-faxcrash.pdf - better
- PDFBOX-2158-077702.pdf p13,17,19 - better (i.e. closer to what Adobe Reader 
shows)
- PDFBOX-2332-PDFBOX-195 - better
- PDFBOX-2338-203886.pdf p6 - hard to tell whether better or not, the file has 
font issues

However... making the same change in PDPixelMap worsens things.

Note that 1.8 has a lot of rendering issues. As long as you're only processing 
the files like the one you have trouble with, it is OK. But if you want to 
process all sort of files, then you might want to try the unreleased 2.0 
version.

> CCITT: Background is rendered as transparent color
> --------------------------------------------------
>
>                 Key: PDFBOX-2853
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2853
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Rendering
>    Affects Versions: 1.8.9
>            Reporter: Jakob Pyttlik
>              Labels: easyfix
>         Attachments: ccittbug.png
>
>
> CCITT-Images with colorspace different from PDIndexed are created using 
> PDCCitt.java/getRGBImage:
> {code}
>  if (colorspace instanceof PDIndexed)
>         {
>            ...
>         }
>         else
>         {
>             byte[] map = new byte[] { (byte) 0x00, (byte) 0xFF };
>             colorModel = new IndexColorModel(1, map.length, map, map, map, 
> Transparency.OPAQUE);
>         }
> {code}
> The value Transparency.OPAQUE (=1) is provided for the parameter 
> "transparentIndex" - this creates an image, in which the white color is 
> treated as transparent.
> This bug is especially annoying for some OCR-documents I had to work with 
> (using PageDrawer). They consist of rendered text (as result of the OCR), 
> that has the original content as image rendered on top, fully covering the 
> text. When the white background is rendered as transparent, the rendered page 
> gets messed up, because both texts can be seen,
> *Proposed Fix/Patch*
> Replace the value *Transparency.OPAQUE* with *-1*, so that no color is 
> transparent.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to