Initial slowness opening a PDF file

A forum for questions or concerns related to the PDF-XChange Core API SDK

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
csterg
User
Posts: 15
Joined: Fri Mar 28, 2014 11:34 pm

Initial slowness opening a PDF file

Post by csterg »

Hello,
I am trying to open a PDF file (rather large, say 100 pages) and create a raster image of a page (e.g. page #50) of a small size (e.g. 80x100 pixels), something like a thumbnail.

My problem is that the first time i open the PDF document i get 'hit' with and extra delay; it looks as if the library does some initial parsing of the file. I am using the DrawPageToDC to create the thumbnail, and it is slow the first time (e.g. ~400ms); if I call the same method in a loop, the next times it is fast.
Just to mention that in comparison, other PDF libraries get the same function in ~20ms. This is a server app that provides thumbnails from a pool of PDF files, so the operation of 'Open file -> create thumb -> close file' is a common use case.

Is there an optimization i can do OR is this the way that the SDK works? Does it do some kind of startup loading of the PDF?

Thank you,
Costas
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Initial slowness opening a PDF file

Post by Sasha - Tracker Dev Team »

Hello Costas,

Our library is optimized for usage when it's being loaded once with your program start and unloaded once when the program ends it's work (not load it every time you need something). The document is optimized for the same usage, meaning: open the document, do ALL of the operations needed with it and then close it (not open it fro each operation separately). This will ensure the maximum efficiency of work with our library.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
csterg
User
Posts: 15
Joined: Fri Mar 28, 2014 11:34 pm

Re: Initial slowness opening a PDF file

Post by csterg »

Thanks Alex!
What would you suggest if I am going to use the SDK for a server app like the use case i mentioned above? Is there a way to minimize this 'initial hit'?
Thank you
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Initial slowness opening a PDF file

Post by Sasha - Tracker Dev Team »

Hello csterg,

Well, as I previously said the best optimization would be loading the library once and let it be loaded until overall work is finished. The first time loading is always slow, because heavy things like system fonts are being loaded. If you create the library once and leave it alive through the program workflow, it will cache all of these things and opening of the next documents would be much faster.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply