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

Tilman Hausherr commented on PDFBOX-3988:
-----------------------------------------

I turned on the profiler again and saw that LCMS was used and that colorspaces 
took long to initialize (and LCMS is slow anyway).
So insert all these after the "main" line:
{code}
System.setProperty("sun.java2d.cmm", 
"sun.java2d.cmm.kcms.KcmsServiceProvider"); // should be first
PDFont font = PDType1Font.COURIER;
PDDeviceCMYK.INSTANCE.toRGB(new float[]{0,0,0,0});
PDDeviceRGB.INSTANCE.toRGB(new float[]{0,0,0});
{code}
The property is mentioned in "getting started": 
https://pdfbox.apache.org/2.0/getting-started.html

Also change your pom to have the current version, which is 2.0.8 and not 2.0.6.

I didn't notice this the first time because I had tested with PDFDebugger 
instead of your project and my local version had the property set. Mea culpa!

> Performance issue when rendering first page of PDF
> --------------------------------------------------
>
>                 Key: PDFBOX-3988
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3988
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: Rendering
>    Affects Versions: 2.0.7
>            Reporter: Maciej Matecki
>         Attachments: calls.png
>
>
> Let say that you want to generate PNG for all pages in PDF.
> The generation of the first page is really slow, the second one is quite fast.
> For example test PDF contains two same PDF pages. 
> First page renders in: ~2000ms
> Second one: ~220 ms
> It looks like for the first page (inv.0) there's 359 ms overhead just for 
> creating the font.
> [^calls.png]
> Tried to use other library to perform the same operation with the same pdf 
> file and I was able to retrieve BufferedImage of the first (slower) page in 
> ~750 ms.
> For the second page the result was almost the same like for the PDFBox.
> It looks like there's the place to improve performance when starting 
> rendering the PDF page. 
> Or do you have any advices how to improve performance in the example project?
> Test project: https://github.com/mmatecki/pdfboxperformance



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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

Reply via email to