Example files need `jspdf.debug.js` that doesn't exist, causing `ReferenceError: jsPDF is not defined`
Aprillion opened this issue · comments
Peter Hozák commented
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
todist/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 withnpm 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):
github-actions commented
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.
Osdeibi Acurero commented
+1