mozilla / pdf.js

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

Lowering image quality to speed up rendering #7417

Closed ghost closed 8 years ago

ghost commented 8 years ago

I'm trying to use pdf.js for Tizen web application. As target is wearable device, performance is one of the most critical issue.

Target device is Gear S2, and image rendering takes too much time. (In worst case, it takes 30sec to renderr one image) Except for image, It takes average 1~2 sec to render entire page, so shortening image rendering time is main issue of my developement.

The way I'm thinking about is lowering image quality, as screen size of Gear S2 is small enough for user not to notice low quality. So I searched issues, but I couldn't find anyone except #6575 or #6717.

Is there better way to deal with image rendering time? Or any recommended way for speed up entire rendering time?

timvandermeij commented 8 years ago

If you have control over the PDF files themselves, you may want to (re)save them and compress the images, i.e. usually this is called the "save for web devices" option. If not, you can use https://github.com/mozilla/pdf.js/blob/61a4c740d2df6fa2fe1497f5436d4acc1dcbb0c8/web/ui_utils.js#L55 to set the maximum size of the canvases. Finally there is https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#optimize for more tips and tricks to optimize your PDFs for web/PDF.js usage.

Closing as answered.