[
https://issues.apache.org/jira/browse/PDFBOX-4815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17086032#comment-17086032
]
Tilman Hausherr edited comment on PDFBOX-4815 at 4/17/20, 8:06 PM:
-------------------------------------------------------------------
Sadly this is a known java problem (PDFBOX-4516). Java has to render the
attached stencil image at a lower resolution but fails to smooth things out.
That is likely a scanned image with a gray background and the scanner produced
a dither pattern.
was (Author: tilman):
Sadly this is a known java problem (I can't find the issue now). Java has to
render the attached stencil image at a lower resolution but fails to smooth
things out.
That is likely a scanned image with a gray background and the scanner produced
a dither pattern.
> 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: [email protected]
For additional commands, e-mail: [email protected]