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

Albert Astals Cid aacid at kde.org
Sat Dec 17 05:19:35 PST 2011


El Dissabte, 17 de desembre de 2011, a les 13:27:17, Bogdan Cristea va 
escriure:
> This is exactly what I am doing, but it seems to block the entire
> process. Is there a way to tell poppler to read asynchronously from a
> PDF file ?

You are doing it wrong then. Why would a function called in a secondary thread 
block the main one?

Albert

> 
> On Sat, Dec 17, 2011 at 11:43 AM, Albert Astals Cid <aacid at kde.org> wrote:
> > 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
> > 
> > _______________________________________________
> > poppler mailing list
> > poppler at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/poppler


More information about the poppler mailing list