You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "chris laws (Jira)" <ji...@apache.org> on 2020/07/18 00:02:00 UTC

[jira] [Created] (PDFBOX-4918) PDFRenderer.renderImageWithDPI DPI parameter ignored in 2.0.20

chris laws created PDFBOX-4918:
----------------------------------

             Summary: PDFRenderer.renderImageWithDPI  DPI parameter ignored in 2.0.20
                 Key: PDFBOX-4918
                 URL: https://issues.apache.org/jira/browse/PDFBOX-4918
             Project: PDFBox
          Issue Type: Bug
          Components: Rendering
    Affects Versions: 2.0.20
         Environment: x64 windows. several 64-bit Java 8 JREs
            Reporter: chris laws
         Attachments: 2.0.0.png, 2.0.1.png, 2.0.10.png, 2.0.11.png, 2.0.12.png, 2.0.13.png, 2.0.14.png, 2.0.15.png, 2.0.16.png, 2.0.17.png, 2.0.18.png, 2.0.19.png, 2.0.2.png, 2.0.20.png, 2.0.3.png, 2.0.4.png, 2.0.5.png, 2.0.6.png, 2.0.7.png, 2.0.8.png, 2.0.9.png, sample_bilevel_raster.pdf

org.apache.pdfbox.rendering.PDFRenderer.renderImageWithDPI method no longer correctly renders pixels in a raster graphic PDF at the resolution requested.


PDFRenderer pdfRenderer = new PDFRenderer(PDDocument.load(new File("sample_bilevel_raster.pdf")));
BufferedImage bi = pdfRenderer.renderImageWithDPI(0, 300, ImageType.RGB);
javax.imageio.ImageIO.write(bim, "PNG", new File("my png filename));

I tested this with all Pdfbox 2 releases (2.0.0 - 2.0.20) and found this bug only affecting 2.0.20. 2.0.0-2.0.19 produced correct output.

it appears v20 renders onto a destination image of the correct size but the source image is set at 72 DPI causing the destination pixels to be extrapolated gray-scale.

This is reproducible with any bi-level raster PDF I used. See attached input and output files.

 

 



--
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