You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Michał Pomarański (JIRA)" <ji...@apache.org> on 2019/07/03 12:27:00 UTC
[jira] [Created] (PDFBOX-4591) Black dots and rectangles when
converting from pdf to png
Michał Pomarański created PDFBOX-4591:
-----------------------------------------
Summary: Black dots and rectangles when converting from pdf to png
Key: PDFBOX-4591
URL: https://issues.apache.org/jira/browse/PDFBOX-4591
Project: PDFBox
Issue Type: Bug
Affects Versions: 2.0.16
Reporter: Michał Pomarański
Attachments: test-pdf.pdf
I get a weird black dots and rectangles/elipses when I'm trying to convert a pdf file to png image with pdfbox. I haven't noticed anything specific about those pdf files except that they're scanned files. I've also tried using the linux tool `convert` and with that tool I don't have any problems. Here's a sample of the code I'm using:
{code:java}
private static BufferedImage rasterizePdfBox(String ref, int pageIndex, PDFRenderer renderer, PreviewMode mode) throws IOException {
Future<BufferedImage> result = executorService.submit(() -> {
LOGGER.info(String.format("Generate preview for ref: %s, page: %s, mode: %s ", ref, pageIndex, mode.name()));
return renderer.renderImageWithDPI(pageIndex - 1, mode.getDpi(), ImageType.RGB);
});
try {
return result.get();
} catch (InterruptedException | ExecutionException e) {
LOGGER.error(String.format("Error when generating preview: %s", e.getMessage()));
Thread.currentThread().interrupt();
throw new IOException(e.getMessage());
}
{code}
I'm attaching an example file that I have this problem with. Thanks!
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org