Created attachment 64346 [details] [review] diff of poppler-page.cc with needed changes As apposed to other pdf-viewers, there is no support for Thumbnails if (I assume) they have not built in [I have no pdf's that have them]. In the present code m_page->page->loadThumb returns false, because it cannot find the data-stream (this being,I assume, the built in Thumbnails). Adding the following would resolve this: else { ret=renderToImage(); w=50; h=75; if (ret.width() > ret.height()) { h=50; w=75; } ret = ret.scaled(w,h,Qt::IgnoreAspectRatio); } whereby I have taken a small value for the size. Adding this code would make the basic qt4 version of viewers more like other pdf-viewers. Mark Johnson
Since this is something you can perfectly do in your code if we return no built in thubmnail i don't see any reason for us to have this fallback code.
Since this happens 99% of the time, it can be considered a fallback but a default behaviour. You cannot assume that everyone using the library will spend 3-4 hours try to find out the cause and then correct it. I personally don't like Thumbnail, so I really don't care, but I consider such a option as very user unfriendly. The same goes for the other problem I reported a few days ago: https://bugs.freedesktop.org/show_bug.cgi?id=51974 (when clicking a Table of Contents Item, the viewer will go to that position) In both cases when the minimal changes are applied, your own demo will work properly. These changes from your side would be proportional to the you expect from everyone else. I have also noted the the 0.20.1 breaks gdal: was: SplashOutputDev::startDoc(poDoc->getXRef()) now: SplashOutputDev::startDoc(poDoc); just as: setErrorFunction has been replaced with: setErrorCallback with different parameters. this means that gdal will fail if a poppler library of 0.20.1. This to is very user unfriendly to expects that thousands of people spend hours trying to figure this out. This I would say that the poppler library is consider in many places unreliable/in stable.
The documentation is clear, "Get the page thumbnail if it exists. \return a QImage of the thumbnail, or a null image if the PDF does not contain one for this page" If that does not tell you it might fail returning a thumbnail, we'll there's not much i can do to help you. Besides your solution is awful because a) It renders the page at full resolution and then scales it down (SLOW!) b) It hardcodes a resolution for non existing thumbnails (hardcoded is bad) About breaking the api of the non public classes, yeah, we've millions of times we will break its api as we like, it's easy to fix, don't use the non public classes.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.