[ 
https://issues.apache.org/jira/browse/PDFBOX-5754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17807638#comment-17807638
 ] 

Tilman Hausherr edited comment on PDFBOX-5754 at 1/17/24 4:05 PM:
------------------------------------------------------------------

This will take longer. My idea was to cache the second parameter of 
{{hasBlendMode()}} in the PageDrawer class, but I get rendering differences 
with several of my test files.

A-Designers-Guide-to-Transparency-2007.pdf p15
A-Designers-Guide-to-Transparency-2007.pdf p20
PDFBOX-5307.pdf
PDFJS-4735.pdf
pop-bugzilla19670-2.pdf
Transparency_DesignGuide-2004.pdf p1
Transparency_DesignGuide-2004.pdf p3

The cause is that {{groupsDone}} can't be used as a cache because the code 
returns false when there's a "hit", it's only designed to protect against 
endless recursions.


was (Author: tilman):
This will take longer. My idea was to cache the second parameter of 
{{hasBlendMode()}} in the PageDrawer class, but I get rendering differences 
with several of my test files.

A-Designers-Guide-to-Transparency-2007.pdf p15
A-Designers-Guide-to-Transparency-2007.pdf p20
PDFBOX-5307.pdf
PDFJS-4735.pdf
pop-bugzilla19670-2.pdf
Transparency_DesignGuide-2004.pdf p1
Transparency_DesignGuide-2004.pdf p3

The cause is that {{groupsDone}} can't be used as a cache because the code 
returns false when there's a "hit", it's only designed to protect against 
recursions.

> PDF conversion in this format is very slow. Is there any room for 
> optimization?
> -------------------------------------------------------------------------------
>
>                 Key: PDFBOX-5754
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5754
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Rendering
>    Affects Versions: 2.0.30, 3.0.1 PDFBox
>            Reporter: liu
>            Assignee: Tilman Hausherr
>            Priority: Major
>             Fix For: 2.0.31, 3.0.2 PDFBox, 4.0.0
>
>         Attachments: image2.pdf
>
>
> pdf: [^image2.pdf] 
> demo: 
> {code:java}
> public static void main(String[] args) throws IOException, 
> InterruptedException {
>               File file = new File("D:\\fcs\\test\\test6\\image2.pdf");
>               final PDDocument load = PDDocument.load(file, 
> MemoryUsageSetting.setupTempFileOnly()
>                               .setTempDir(new File("D:\\fcs\\test")));
>               try {
>                       PDFRenderer renderer = new PDFRenderer(load);
> //                    renderer.setSubsamplingAllowed(true);
>                       int pageIndex = 0;
>                       float scale = 2f;
>                       BufferedImage bufferedImage = 
> renderer.renderImage(pageIndex, scale, ImageType.RGB);
>                       FileOutputStream fos = null;
>                       try {
>                               fos = new FileOutputStream(new 
> File("D:\\fcs\\test/test6/image" + pageIndex + ".jpg"));
>                               ImageIO.write(bufferedImage, "jpg", fos);
>                       } finally {
>                               if (fos != null) {
>                                       fos.close();
>                               }
>                       }
>               } catch (Throwable e){
>                       e.printStackTrace();
>               }
>               Thread.sleep(6000000);
>       }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to