parallax / jsPDF

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

Some pages are blank when try to open with adobe. #3740

Open jaidevjk opened 3 months ago

jaidevjk commented 3 months ago

Issue Statement : After downloading the pdf from jspdf , it is opening in other apps and browsers but not in adobe reader

1.Example - let say a pdf generated using jspdf has 7 pages , it opens in browser, all 7 pages are visible and displayed properly , but if we open same pdf in adobe reader , some of the pages will be empty and totally blank. we will get a popup saying " An Error exists on this page. Acrobat may not display the page correctly. Please contact the person who created this file".

Looking for a solution,I hope i will get the proper soltion in a short time.

Thank You .....


image

jaidevjk commented 2 months ago

Looking for a help.....regarding the issue #3740

febkosq8 commented 1 month ago

I created a demo to show the issue with Adobe opening any pdf generated by jspdf. Hopefully someone will be able to tell me where I am going wrong.

Current issues I am facing in Adobe Acrobat :

  • Page fails to load
  • Link to a page does not work

This sounds like the same issue that my comment in #3428 shows. I don't think this is going to be fixed given the state of this lib.

I discovered a workaround which works like 50% of the time. I found that having \n causes the pdf to fail for sure. However if I add a space before \n, it helps a lot in the frequency of errors.

Before you send your text to doc.splitTextToSize(content, maxContentWidth), do a content = content.replace(/\n/g, " \n") and then send it.