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 2020/04/19 12:50:00 UTC

[jira] [Closed] (PDFBOX-4815) Gray background preview becomes black squares

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

Tilman Hausherr closed PDFBOX-4815.
-----------------------------------
    Resolution: Duplicate

Duplicate of PDFBOX-4516. I'll add you as a watcher there and will reopen it and add your file and write about possible solution.

> Gray background preview becomes black squares
> ---------------------------------------------
>
>                 Key: PDFBOX-4815
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4815
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Rendering
>    Affects Versions: 2.0.16
>            Reporter: Pascal Huynh
>            Priority: Major
>         Attachments: Stencil-1107-1587152039354.png, payslip.pdf, preview.png
>
>
> Hello, I have an issue with a PDF with gray background in some parts. This gray background becomes multiple black squares when trying to preview the document.
> Analyzing images extracted from the pdf, it appears the gray background is not a plain gray background but more a set of gray and black pixels.
> Is there a way to handle this kind of background  for the preview and have the same visual rendering than the pdf?
> Source code : 
> {code:java}
> @Test
> public void shouldPreview() throws IOException {
>     String source = "payslip.pdf";
>     String result = "preview.png";
>     try (InputStream buffered = new BufferedInputStream(new FileInputStream(new File(source)));
>          PDDocument doc = PDDocument.load(buffered, MemoryUsageSetting.setupMixed( 500L * 1024L))) {
>         BufferedImage image = new PDFRenderer(doc).renderImageWithDPI(0, 300, ImageType.RGB);
>         ImageIO.write(image, "png", new File(result));
>     }
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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