Bug 173681

Summary: Large PDF pages cause Okular to crawl
Product: [Applications] okular Reporter: Diederik van der Boor <vdboor>
Component: PDF backendAssignee: Okular developers <okular-devel>
Status: RESOLVED FIXED    
Severity: normal CC: aacid, bluedzins, eric.brunet, iorsh, jacob.benoit.1, kde, Martin.vGagern, oceanofsolaris
Priority: NOR    
Version: 0.7.2   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Diederik van der Boor 2008-10-27 14:28:12 UTC
Version:           0.7.2 (using 4.1.2 (KDE 4.1.2) "release 44.2", KDE:KDE4:Factory:Desktop / openSUSE_10.3)
Compiler:          gcc
OS:                Linux (i686) release 2.6.22.18-0.2-default

I've received a large PDF file from a designer, which contained one page of 3,251.2 x 1,625.6 mm. Okular is able to display this page, except when you're trying to zoom it to 50% or 100%. This causes Okular to crawl completely.
Comment 1 Pino Toscano 2008-10-27 19:45:26 UTC
Document, please.
Comment 2 Pino Toscano 2008-11-09 12:50:07 UTC
Hi, can you please attach a sample document showing the issue?
Also, please note which version of the poppler-qt4 library you have installed.
Comment 3 Diederik van der Boor 2008-11-24 22:34:11 UTC
For the record, I e-mailed the document to Pino Toscano since it's still copyrighted by the designer. (from which I asked approval to e-mail the document).
Comment 4 Pino Toscano 2008-11-24 23:10:22 UTC
(In reply to comment #3)
> For the record, I e-mailed the document to Pino Toscano

I did not receive it, sorry.
Comment 5 Diederik van der Boor 2008-11-26 22:45:37 UTC
ok, I've sent it again.
Comment 6 Pino Toscano 2008-11-29 15:07:09 UTC
(In reply to comment #5)
> ok, I've sent it again.

Received, thanks.

This is a really big document. Okular has a "protection" to avoid rendering pages whose area at the current zoom level is more than 20.000.000 pixels, but of course for smaller areas it will take some memory.

The problem is basically similar to the reason why the maximum zoom level is 400%.
Comment 7 Diederik van der Boor 2008-11-29 21:24:20 UTC
I can understand the reasons behind it, since it would generate a very large bitmap in the memory.

Adobe's Acrobat reader can render the document quite fast btw. I guess they're using some kind of "tile engine" (like Google Maps) to avoid these issues.
Comment 8 Pino Toscano 2008-12-05 21:15:25 UTC
*** Bug 177011 has been marked as a duplicate of this bug. ***
Comment 9 Éric Brunet 2009-08-14 23:26:43 UTC
I have the same (?) problem on a public and useful document: the full map of Paris city bus with the streets:

The map can be downloaded from

http://www.ratp.info/orienter/f_plan.php?fm=gif&loc=reseaux&nompdf=bus_paris_geo&lang=

(or, more user-friendly, click on ''Plan des bus avec rues'' from http://www.ratp.info/orienter/bus.php)

I can view this with okular at 90%, but not at 100% on okular 0.9, in kde 4.3.0
Comment 10 Myriam Schweingruber 2011-12-27 17:02:17 UTC
*** Bug 185676 has been marked as a duplicate of this bug. ***
Comment 11 Myriam Schweingruber 2011-12-27 17:03:11 UTC
Confirmed by duplicate
Comment 12 Maxim Iorsh 2012-11-07 21:43:11 UTC
For my PDF, the same. At small resolutions (below 100%), very slow display. Above 100% - no display at all. See https://docs.google.com/file/d/14hFFrjSSbiEcfML1sgOttcT865GC7tHqv27wiuEfQ-KlvuRfU67Dkj9E9JaM/edit

For comparison, PDF-XChange Viewer for Windows is blazingly fast.
Comment 13 Albert Astals Cid 2012-11-07 22:24:48 UTC
Please report bugs of slowlyness rendering of PDF files at bugs.freedesktop.org against the poppler product since we use the poppler library for rendering PDF so there is not much we can do to increase the speed from the Okular side
Comment 14 Martin von Gagern 2012-11-08 06:52:54 UTC
(In reply to comment #13)
> there is not much we can do to increase the speed from the Okular side

This bug here is due to the fact that Okilar renders THE WHOLE DOCUMENT into an off-screen image. Note that bug #185676 (and its duplicates), which was (imho correctly) resolved a duplicate of this one here, is not about slowness, but about an out of memory condition. So the fix to both issues would be only rendering a portion of the PDF file. This might be the portion currently visible, or might be some set of tiles to help scrolling. In either case, memory consumption sould go down, and there is a good chance that speed would go up as well. The Poppler::Page::renderToImage function DOES support rendering of only a portion of the image. So I'd suggest making use of that, and only if rendering remasins slow, THEN it is time to bug upstream about this. Until then, please REOPEN this bug.
Comment 15 Maxim Iorsh 2012-11-08 07:41:35 UTC
The file in comment#12 has an embedded 21590 x 161385 b/w bitmap.
Comment 16 Albert Astals Cid 2012-11-14 12:28:27 UTC
Ok, reopening then, my bad for not reading the bug correctly. Anyone can check if they are happy with the results produced by the current master git branch of okular (that if you know how to compile from git, etc, otherwise just wait for 4.10)
Comment 17 Maxim Iorsh 2012-11-14 12:34:09 UTC
Please see related bug in poppler bugzilla: 
https://bugs.freedesktop.org/show_bug.cgi?id=56858#c6

There is a discussion about rendering tile-by-tile versus complete page rendering.
Comment 18 Albert Astals Cid 2012-11-14 12:35:38 UTC
Being the poppler maintainer, i'm aware of it.
Comment 19 Stephan Burkhardt 2013-02-20 13:03:09 UTC
This looks partially fixed with okular 4.10. Looking at the pdf from comment#12 , I can at least look at the image at higher zoom levels (it's not 'blazingly' fast by any standards though, takes about at minute to render even a small part of the document).

Kudos to the Okular developers for 4.10, okular got much better for me personally (finally more than 400% zoom!).
Comment 20 Otso Helenius 2013-08-01 08:34:54 UTC
I'm running 4.10.5 on F19 and still suffering from ridiculously slow page thumbnail generation and page rendering. This was also present on the Ubuntu 13.04 KDE spin. The poppler-qt lib is 0.22.1.

For example, rendering some of the page thumbs for this pdf take roughly 20 seconds and the actual pages around 15 seconds: http://www.skrolli.fi/2013.2.web.pdf on a Core-i7. (To be fair, Evince suffers from similar lag in rendering the pages). With Adobe Reader, Foxit reader and Sumatra PDF rendering is pretty much instantaneous even with the cover pages. I'm expecting to get similar performance with Okular.
Comment 21 Albert Astals Cid 2013-08-01 08:41:35 UTC
Orso is your pdf a "large pdf"? Seems a regular A4. Does not qualify as large in my book of large things.

Anyway i'm closing this bug as fixed if you have separate please open separate bugs, otherwise it's going to turn into the regular bug dump that it's impossible to fix because there's lots of users complaining about lots of different and unrelated things