mozilla / pdf.js

PDF Reader in JavaScript
https://mozilla.github.io/pdf.js/
Apache License 2.0
48.42k stars 9.98k forks source link

PDF.js slow at rendering complex image #2618

Closed fmms closed 9 years ago

fmms commented 11 years ago

I tried to look at http://bugzilla-attachments.gnome.org/attachment.cgi?id=226471. The progress bar moves to 100% and then nothing happens.

I am using Firefox 19 and pdf.js 0.7.99 on Ubuntu 13.04.

gigaherz commented 11 years ago

[22:56:16.345] Error: bad XRef entry @ resource://pdf.js/build/pdf.js:656

gigaherz commented 11 years ago

Same as #2388 ?

fmms commented 11 years ago

Still there with todays version:

[11:10:46.743] An error occured while loading the file
PDF.js Version 0.8.180 (build: 3641c22)
Message: bad XRef entry
timvandermeij commented 11 years ago

More console output. Error is the same as above, only in Dutch ;-)

error@resource://pdf.js/build/pdf.js:1184
XRef_fetch@resource://pdf.js/build/pdf.js:5554
XRef_fetchIfRef@resource://pdf.js/build/pdf.js:5521
Dict_get@resource://pdf.js/build/pdf.js:4768
pdfjsWrapper/Catalog.prototype.documentOutline@resource://pdf.js/build/pdf.js:4900
LocalPdfManager_ensure@resource://pdf.js/build/pdf.js:542
BasePdfManager_ensureCatalog@resource://pdf.js/build/pdf.js:497
parseSuccess@resource://pdf.js/build/pdf.js:36266
Promise_then@resource://pdf.js/build/pdf.js:1923
pdfjsWrapper/wphSetup/loadDocument//@resource://pdf.js/build/pdf.js:36297
Promise_then@resource://pdf.js/build/pdf.js:1923
pdfjsWrapper/wphSetup/loadDocument/@resource://pdf.js/build/pdf.js:36298
Promise_then@resource://pdf.js/build/pdf.js:1923
loadDocument@resource://pdf.js/build/pdf.js:36299
pdfManagerReady@resource://pdf.js/build/pdf.js:36441
Promise_then@resource://pdf.js/build/pdf.js:1923
wphSetupDoc@resource://pdf.js/build/pdf.js:36440
messageHandlerComObjOnMessage@resource://pdf.js/build/pdf.js:36220
Er is een fout opgetreden bij het laden van het PDF-bestand. PDF.js versie 0.8.180 (build 3641c22) Bericht: bad XRef entry
timvandermeij commented 11 years ago

Still renders forever, but there are less (or no) errors in the console now:

Warning: Unable to read document outline
PDF c79c336f9cc7a242a4cd36f2317f7b59 [1.4 PDFsharp 1.31.1789-g (www.pdfsharp.com) / PDFsharp 1.31.1789-g (www.pdfsharp.com)] (PDF.js: 0.8.291)

Note that this PDF, http://march12.rsf.org/i/Report_EnemiesoftheInternet_2012.pdf, has the same console warnings, but does render. Maybe that helps to track down the problem.

Snuffleupagus commented 11 years ago

An update: using PDF.js 0.8.296 the file (http://bugzilla-attachments.gnome.org/attachment.cgi?id=226471) actually renders, but it takes approximately 1.5 minutes before it finishes. As a comparison, it's even slow in Adobe Reader, taking 15 seconds before finishing rendering.

Snuffleupagus commented 11 years ago

After #3461 landed, this file renders somewhat quicker than before. In my testing, the rendering time has gone down from approximately 90 to 75 seconds. More importantly than the speed-up, is that with the latest version of PDF.js the text is rendered immediately and you only have to wait for the figure to finish rendering.

timvandermeij commented 11 years ago

Renders in 37 seconds for me using PDF.js 0.8.396. Maybe the difference with your results is a difference in configuration, @Snuffleupagus? Indeed, the text is now available immediately, so that is a big advantage.

fmms commented 11 years ago

This is indeed just a performance problem now, somebody should either rename or close this bug.

timvandermeij commented 11 years ago

@fmms You can rename it yourself since you opened the issue ;-) The issue title should have an Edit button next to it. Just rename it to 'PDF.js slow at rendering complex image' or something like that.

fmms commented 10 years ago

Still there with todays version:

"Warning: Unable to read document outline" pdf.js:198
 "PDF c79c336f9cc7a242a4cd36f2317f7b59 [1.4 PDFsharp 1.31.1789-g (www.pdfsharp.com) / PDFsharp 1.31.1789-g (www.pdfsharp.com)] (PDF.js: 0.8.773)"
nnethercote commented 10 years ago

This document is notable for having millions of inline images, which are used to build up the textured parts of the picture.

nnethercote commented 10 years ago

And disabling QueueOptimizer slows it down a lot, because the paintImageMaskXObjectGroup optimization can't be performed.

CodingFabian commented 9 years ago

5445 has landed, i would go so far that the rendering is now acceptable. what do you guys think?

yurydelendik commented 9 years ago

I think it is good. Other viewers (Preview and Chrome) have performance issues with that as well -- try zooming. Closing as resolved

nnethercote commented 9 years ago

Nice work, Fabian.