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

PDF Taking a Long Time To Render #9581

Closed
Jon-Murray opened this issue Mar 18, 2018 · 8 comments
Closed

PDF Taking a Long Time To Render #9581

Jon-Murray opened this issue Mar 18, 2018 · 8 comments

Comments

@Jon-Murray
Copy link

Jon-Murray commented Mar 18, 2018

architectural_-_annotation_scaling_and_multileaders.SECTIONS AND DETAILSs2 (2).png.pdf
architectural_-_annotation_scaling_and_multileaders sections and detailss2

Hi guys,

Apologies, as I hate these types of bug filings, but I have a relatively simple PDF which takes a long time to load on FF 59. This loads pretty much instantly in other PDF viewers. The PDF is just an embedded PNG inside a PDF document (though the attached document has a simple annotation added as well, this happens without it). It is causing me some grief as it takes ~40 seconds to load in Firefox/embedded PDFJS (both the most up-to-date versions as of March 2018) but has no issues in other browsers. Both the PDF and the original PNG should be attached here.

Configuration:

  • Web browser and its version: FF 59
  • Operating system and its version: Windows, Ryzen 1700, 16GB RAM
  • PDF.js version: (PDF.js: 2.0.288) and older
  • Is a browser extension: Both native FF and using PDFJS in other browsers

Steps to reproduce the problem:

  1. Open the attached PDF

What is the expected behavior? (add screenshot) Renders ~5s

What went wrong? (add screenshot): Consistently renders ~40s

I really have no further information nor the skills to say why the resultant PDF is complex, sorry.

Thanks!

@Jon-Murray
Copy link
Author

architectural_-_annotation_scaling_and_multileaders sections and detailss2

@timvandermeij
Copy link
Contributor

timvandermeij commented Mar 18, 2018

Evince takes about six seconds to render this PDF file. I think the problem is that the embedded image is 8000 x 5333 pixels, which is rather large. Vector images would be much faster than large embedded PNG images. To fix this, we most likely need canvas tiling.

@Jon-Murray
Copy link
Author

Hi, thanks for getting back so ridiculously quickly! I have tried resizing this to a standard (scaled) A4 PDF as well which also seems to take quite a while to render. This is a different file but both are attached here. Again this renders slowly on FF/PDFJS but quickly on other browser. These are both images generated from CAD drawings so may be complex.

Thanks again
architectural_-_annotation_scaling_and_multileaders.Model (1).png.pdf
architectural_-_annotation_scaling_and_multileaders model

@Jon-Murray
Copy link
Author

architectural_-_annotation_scaling_and_multileaders model

@THausherr
Copy link
Contributor

Related / Duplicate of issue #6741 ?

@Jon-Murray
Copy link
Author

Actually, you are right. My "scaled" PDF (using itextsharp's image.ScaleToFit(document.PageSize)) does not actually seem to resize the image itself, meaning that even in the a4 example it is still a large image (despite it not being a large draw size, if that makes sense). Manually opening the image in MS Paint and resizing it to say 800x500 and embedding it then will render in the correct amount of time. As a workaround for now i can probably resize the images down to A3 size before embedding them, but it would be nice for future if i was able to render the larger images. For now though this does appear to be a duplicate issue.

Thanks

@mauro1855
Copy link

Hi,
We have the issue. We are using pdf.js to render a 1-page, 444 kB PDF with a 7027x4972 image embeded. It takes around 15 to 20 seconds to render this PDF. The same happens if I try to open the PDF with FF 63.0.3 default previewer.
The same does not happen when opening the PDF in Chrome and Edge, its immediate.

Thanks,
Mauro

@timvandermeij
Copy link
Contributor

Closing since this file now renders in about 5 seconds after the fix above, as indicated in the original post and as I found Okular takes too.

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

4 participants