parallax / jsPDF

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

Html to pdf returns corrupted pdf file if the pdf file contains multiple pages #3521

Closed Bobvantpadje closed 1 year ago

Bobvantpadje commented 2 years ago

I have read and understood the contribution guidelines. jsPDF version: 2.5.1

I'm using the .html function to convert HTML into a pdf, but this results in a corrupted pdf file when the content is longer than one page. The file still opens correctly in Chrome, but Adobe Reader shows an error and if I check if the pdf is valid in a pdf validation/repair tool I get the following error:

0x80410321 - E - A graphics state stack underflow occurred.
    - Page No.: 1
    - File: html-to-pdf (2).pdf
0x80410113 - E - The file is corrupt and cannot be repaired. Some of the contents can possibly be recovered.
    - Page No.: 2
    - File: html-to-pdf (2).pdf

How to reproduce

Expected

Actual

C485 commented 1 year ago

I've checked your example and file with multiple pages opens fine in Adobe Reader, i've version 2022.003.20263

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 90 days with no activity. It will be closed soon. Please comment/reopen if this issue is still relevant.