Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow rendering pdf #9810

Closed
kavisherlock opened this issue Jun 13, 2018 · 6 comments
Closed

Slow rendering pdf #9810

kavisherlock opened this issue Jun 13, 2018 · 6 comments

Comments

@kavisherlock
Copy link

kavisherlock commented Jun 13, 2018

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

Configuration:

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

@akshay-bhagat
Copy link

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..

@kavisherlock
Copy link
Author

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

@k1nger
Copy link

k1nger commented Jun 19, 2018

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.

@PSpSynedra
Copy link

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

@Snuffleupagus
Copy link
Collaborator

This issue is quite old, but given that it appears to only affect a particular platform (iOS) it seems very unlikely to be actionable/valid in the PDF.js project. More likely, there are/were problems either with font loading and/or canvas rendering in iOS, which we however cannot really do anything about.

Given that this renders more-or-less instantly in e.g. Firefox, I'd suggest closing this issue since it doesn't seem actionable here.

@mmroden
Copy link

mmroden commented Mar 24, 2021

I'm now seeing this error when trying to render the attached PDF on Firefox through hugo (via https://github.com/anvithks/hugo-embed-pdf-shortcode) on a mac. I realize the tech stack may be a bit esoteric, but I've never seen such a slow render. From what I can read of his code, he's just straight loading the mozilla pdf.js code to display the pdf.
D-TET-001103-0 Fan Box Drawing.pdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants