Pdf.js: Slow rendering pdf

Created on 13 Jun 2018  ·  4Comments  ·  Source: mozilla/pdf.js

Attach (recommended) or Link to PDF file here:
pdfExample10.pdf

Configuration:

  • Web browser and its version: Safari, Chrome (latest)
  • Operating system and its version: iOS 11.3 (on iPad)
  • PDF.js version: latest (or whatever's on https://mozilla.github.io/pdf.js/web/viewer.html)
  • Is a browser extension: No

Steps to reproduce the problem:

  1. Save the above pdf on an iOS device (in our case: iPad)
  2. Load the pdf in a browser on the iPad using the pdf.js demo (https://mozilla.github.io/pdf.js/web/viewer.html)

What is the expected behavior? (add screenshot)
Pdf loads in a reasonable amount of time
fullsizeoutput_5ca

What went wrong? (add screenshot)
Pdf loads very slowly, one line at a time, taking up to 45 seconds at times.
fullsizeoutput_5cb

Some background
I've tried going through the pdf.js code to see what might be causing the slow rendering, and the only thing I can guess is the font that this particular pdf uses. File size and the amount of text doesn't seem to affect the rendering speeds (I have other, larger pdfs that load fine). This pdf was made using MS Word and the font type is TrueType, if that helps.
I'm primarily hoping for a reason why this pdf might be loading slowly and possibly a fix that I can do on my side (I've tried changing preferences listed in your preferences_schema and that doesn't seem to help. If there are code changes that might be needed on your side, if you can guide me in the direction of what code might need the change, I would really appreciate that

Link to a viewer (if hosted on a site other than mozilla.github.io/pdf.js or as Firefox/Chrome extension):
https://mozilla.github.io/pdf.js/web/viewer.html

1-core 2-performance 4-os-ios

Most helpful comment

We have similar issues with rendering a PDF on iOS (11.4.1).
Blocks/Lines are drawn onto the target canvas very slowly ...

All 4 comments

Do you have any images in your source PDF file??

I am also facing the same slow loading of PDF file in web page..

Please share if you got something on it..

No. I don't. It's text only. However, while unrelated to this, I do recall seeing some slowness in rendering if the image is of high quality (scanned at a high dpi for instance). Not sure if that's your case

We've noticed that PDF documents that don't have everything embedded are causing performance issues on the ipad. Possibly an issue with the @font-face loading completion detection.

Taking a PDF and converting it to a PDFA(rchive) has seemed to improve performance to acceptable levels. I'm going to dig into the PDFjs code to see if there's anything we can do to improve these scenarios but any pointers as to where I may want to start would be helpful.

We have similar issues with rendering a PDF on iOS (11.4.1).
Blocks/Lines are drawn onto the target canvas very slowly ...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PeterNerlich picture PeterNerlich  ·  3Comments

timvandermeij picture timvandermeij  ·  4Comments

liuzhen2008 picture liuzhen2008  ·  4Comments

jigskpatel picture jigskpatel  ·  3Comments

aaronshaf picture aaronshaf  ·  3Comments