[poppler] Loading a page as image using qt-poppler

Albert Astals Cid aacid at kde.org
Sat Dec 17 02:43:03 PST 2011


El Dissabte, 17 de desembre de 2011, a les 09:58:06, Bogdan Cristea va 
escriure:
> Hi

Hi

> I have wrote a PDF reader in Qt using poppler. Now I am trying to
> optimize the time needed when switching pages. In order to do so the
> pages to be displayed are loaded in advance in a separate thread using
> the following code:
> 
> doc_->page(page)
>                       ->renderToImage(scaleFactor_ * physicalDpiX_,
>                                       scaleFactor_ * physicalDpiY_)
> 
> Thus the pages are stored in memory in a QImage buffer before beeing
> displayed. However, I have noticed that when the page is loaded with the
> above code the entire GUI is blocked as if the disk access operation is
> made by the GUI thread. My question is what are the alternative methods
> needed in order to load the PDF document image in background, without
> affecting the GUI thread?

You create your own thread and call renderToImage from it.

Albert

> 
> thanks


More information about the poppler mailing list