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
Repeating images can quickly crash browsers #99
Comments
Hmm, Firefox seems to handle a lot more images with grace. Safari gets really really slow but doesn't crash. Looks like this is really a Chrome issue, sorry! |
If you need to add the same image multiple times, for example a header/footer, then we could make an optimisation which adds the object only once and reference it instead of duplicating it. I'll need to have a play but I'm pretty sure this is possible. |
I was wondering about that, and thinking it must be supported by the PDF format. It would make a big difference in the rendered PDF blob size too. To keep the API as simple and beautiful as it is, what if you internally built a hash of "attachments"? Something like the first call
internally sets
since |
md5sum would be very expensive in JS, but yeah, there must be a way of On Wed, May 22, 2013 at 10:51 PM, Nathan Vonnahme
James Hall snapshot media +44 113 322 6477 Registered office: The Old Brewery, High Court, Leeds, LS2 7ES |
Oh and also, I duplicated it today with Chrome 27, and I filed a Chrome bug report last week. I worked around my issue (which is needed imminently) by using a lower-res 150 dpi image. Also, the issue is exacerbated by only supporting JPEG. For print purposes I could use a much smaller data image for RLE encoded low color TIFF or something. If you don't hash with md5sum or equivalent you'll need to accept a separate "key" argument to addImage, but maybe that's not so bad. Maybe
or even
or
I wish I were more able to dive in and contribute to this, but maybe I can help just by less vaguely imagining how it could be done :) |
…nerate them, inspired by parallax#99 and based on parallax#120
First, @MrRio I would like to thank you for developing jsPDF. Continually amazing, the things JS is doing! Thank you!
I'm doing a repeating a high-resolution image in my PDFs, and I quickly hit a limit. With the Octonyan image I can cause today's Chrome (Version 26.0.1410.64 m) to totally crash with "Aw, Snap!" by cranking up the number of repeated images. The crash starts for me around 40 octonyans.
I think it is in the blob handling code but it's a little hard to get at since it crashes the tab so thoroughly.
I'm going to try working around my issue by making smaller JPGs.
The text was updated successfully, but these errors were encountered: