[
https://issues.apache.org/jira/browse/PDFBOX-5051?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17251696#comment-17251696
]
Tilman Hausherr edited comment on PDFBOX-5051 at 4/22/21, 5:14 PM:
-------------------------------------------------------------------
Using {{setRGB}} brings a perfect rendering for Ghent workgroup 4.0 testcase
17.0, the "X" is no longer visible. And also two perfect renderings of the
middle squares for Ghent workgroup 5.0 testcase 23.0, and a better rendering
for the black area in PDFBOX-3556.
This suggests that {{setRGB}} might be gold standard. I get the same result by
changing the construction of ColorConvertOp to this:
{code}
renderingHints = new RenderingHints(null);
renderingHints.put(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
renderingHints.put(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
ColorConvertOp op = new ColorConvertOp(new ICC_Profile[0], renderingHints);
op.filter(src, dest);
{code}
Using this brings total rendering time to 300 secs. Your file is still slow.
Update 22.4.2021: the modified ColorConvertOp brings no improvement at all, I
wonder if I made a mistake when I tested. A look in the source code shows that
the RenderingHints aren't used.
was (Author: tilman):
Using {{setRGB}} brings a perfect rendering for Ghent workgroup 5.0 testcase
17.0, the "X" is no longer visible. This suggests that {{setRGB}} might be gold
standard. I get the same result by changing the construction of ColorConvertOp
to this:
{code}
renderingHints = new RenderingHints(null);
renderingHints.put(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
renderingHints.put(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
ColorConvertOp op = new ColorConvertOp(new ICC_Profile[0], renderingHints);
op.filter(src, dest);
{code}
Using this brings total rendering time to 300 secs. Your file is still slow.
> Slow rendering for specific PDF file
> ------------------------------------
>
> Key: PDFBOX-5051
> URL: https://issues.apache.org/jira/browse/PDFBOX-5051
> Project: PDFBox
> Issue Type: Bug
> Components: Rendering
> Affects Versions: 2.0.21
> Environment: Amazon Coretto jdk11.0.3_7, OpenJDK 15
> Reporter: Stefan Mueller
> Priority: Major
> Attachments: slowpdfbox.pdf
>
>
> Doing PDF rendering upon the document being attached is rather slow.
> It takes 18 seconds on a Core i7 machine with 32 GB of RAM and no maximum
> being imposed upon the JVM.
> {code:java}
> System.setProperty("sun.java2d.cmm",
> "sun.java2d.cmm.kcms.KcmsServiceProvider");
> long ms = System.currentTimeMillis();
> try (final PDDocument document = PDDocument.load(new
> File("C:\\temp\\slowpdfbox.pdf")))
> {
> ms = System.currentTimeMillis() -ms;
> System.out.println("Took " + ms + " milliseconds for loading");
>
> PDFRenderer pdfRenderer = new PDFRenderer(document);
> pdfRenderer.setSubsamplingAllowed(true);
> for (int page = 0; page < 1; ++page)
> {
> ms = System.currentTimeMillis();
> BufferedImage bim = pdfRenderer.renderImageWithDPI(page, 300, ImageType.RGB);
>
> ms = System.currentTimeMillis() -ms;
> System.out.println("Took " + ms + " milliseconds for rendering");
>
>
> String fileName = "c:\\temp\\test.jpg";
> ImageIOUtil.writeImage(bim, fileName, 300); //<---this number
> }
> document.close();
> }
> catch (IOException e){
> System.err.println("Exception while reading pdf document - " + e);
> }
> {code}
> Console Output:
> Took 262 milliseconds for loading
> Dez. 18, 2020 6:25:15 VORM.
> org.apache.pdfbox.pdmodel.graphics.color.PDICCBased ensureDisplayProfile
> WARNUNG: ICC profile is Perceptual, ignoring, treating as Display class
> Took 17914 milliseconds for rendering
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]