parallax / jsPDF

Client-side JavaScript PDF generation for everyone.

Home Page:https://parall.ax/products/jspdf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Example files need `jspdf.debug.js` that doesn't exist, causing `ReferenceError: jsPDF is not defined`

Aprillion opened this issue · comments

HTML files in the examples folder, e.g. html2pdf/auto_break.html, point to a file that no longer exists:
<script src="../../dist/jspdf.debug.js"></script>

This is showing up as ReferenceError: jsPDF is not defined in browser console instead of rendering the iframe with PDF.

Workaround

  • clone repo
  • copy file dist/jspdf.umd.js to dist/jspdf.debug.js
  • add a line near the end of the file (e.g. right after line exports.jsPDF = jsPDF;) with code:
    window.jsPDF = jsPDF;
  • navigate to the local example file, e.g. http://127.0.0.1:8000/examples/html2pdf/auto_break.html
    (after starting the server with npm start)
  • the generated PDF is not perfect, especially in Firefox on Mac, but that's probably a known limitation when using html2canvas
    (please let me know if this only happens due to my workaround method and it would look better when using the library in a proper way):
    jsPDF html2pdf auto_break

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.