Closed gupnee81 closed 2 years ago
I also got this snippet to work by downgrading to 2.3.1, my project is with Vue (2.6) and Webpack (3.6.0)
Please provide a complete project so we can reproduce the issue.
I also had this problem, it is caused by Webpack 3 and Babel missing dependencies, i think. Inside the dist files it remains still the import.
jspdf.es.js
import _typeof from '@babel/runtime/helpers/typeof';
Solution for me I created a fork with modified build.
.babelrc.json
{ "presets": [ [ "@babel/env",
{
"exclude": ["@babel/plugin-transform-typeof-symbol"]
}
]
],
"exclude": ["node_modules/**"] }
I am currently having this issue, I am on the current version and have tried downgrading as well as adding the .babelrc.json file to my root project folder. Any updates to a resolution?
Any update on the resolution for this?
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.
Any updates on how to fix this problem?
Any updates folks?
getting same issue after npm audit
in react
for jspdf
i was getting same issue, i updated npm package react-scripts
from ^2.1.3
to 5.0.1
, and now it is working.
I have the same issue exporting html in Vue project ("vue": "^2.5.11",) with webpack("webpack": "^3.6.0",)
"html2canvas": "^1.4.1", "isomorphic-dompurify": "^1.8.0", "jspdf": "^2.5.1",
a pice of code to export:
`const doc = new jsPDF({
orientation: 'l',
});
let ncToPrint = this.$refs.ncPrint.innerHTML,
pdfWidth = doc.internal.pageSize.width - 20,
sanitizedContent;
window.html2canvas = html2canvas;
sanitizedContent = DOMPurify.sanitize(ncToPrint);
doc.html(sanitizedContent, {
callback: (doc) => {
window.open(doc.output('bloburl'), '_blank').focus();
},
html2canvas: {
width: pdfWidth,
},
margin: [0, 0, 10, 0],
width: pdfWidth,
windowWidth: pdfWidth,
autoPaging: 'text',
x: 10,
y: 20,
});`
Any help?
Hi, I am facing an issue with the latest version of jspdf in the react project.
This is an error that I am getting in the console.
And, here is a code snippet using the latest version -
I tried adding the below packages as external in the webpack, which also didn't help.
canvg, html2canvas, dompurify
Also, the same code snippet works when I downgraded the version to 2.3.1.
Pls, suggest if there is something I am missing as I am aiming to use the latest one.
Thanks