parallax / jsPDF

Client-side JavaScript PDF generation for everyone.
https://parall.ax/products/jspdf
MIT License
29.21k stars 4.67k forks source link

multi-page document invokes error message on Acrobat Reader #572

Closed jutunen closed 6 years ago

jutunen commented 9 years ago

Create a multi-page table by using fromHTML method. Open the created PDF document with Acrobat Reader. Scroll fast to the second page and you get an error message about corrupted PDF. If you scroll gently and slowly to the second page, error message won't appear.

jutunen commented 9 years ago

Thanks to GNU gv, I think that I have found a root cause for this error: unbalanced q/Q operators. Quick fix is to change this line: return this.pdf.internal.write("q"); to this: return this; And remove or comment this line: this.pdf.internal.write("Q");

martynchamberlin commented 9 years ago

Hi @jutunen,

I've tried doing what you outline above but I'm still getting errors. Here's a document that was generated using the modified version of jspdf.debug.js as per your edits:

http://dev.perfectioncoding.com/sample-with-code-modification.pdf

Any ideas why that might have not worked? Are you consistently getting page 2 (and onwards) to render correctly in Adobe Acrobat Reader using your above modification?

Uzlopak commented 6 years ago

Hi @jutunen

is this still an open issue?

souravm84 commented 6 years ago

This is still an issue even after doing the modification mentioned above.