Pascal Huynh created PDFBOX-4815:
------------------------------------
Summary: 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
Attachments: 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]