Thank you for submitting an issue to jsPDF. Please read carefully.
Are you using the latest version of jsPDF?
"jspdf": "^1.4.0",
Have you tried using jspdf.debug.js?
Steps to reproduce
I'm doing this in a React stateful component.
import { background01 } from './../data/forms/n-400/n-400-images/background01.jpg';
makeJsPdf = (q, answer) => {
let doc = new jsPDF();
doc.setFontSize(14);
let imgData = 'data:image/jpeg;base64,background01';
console.log(typeof imgData);
doc.addImage(imgData, 'JPEG', 0, 0, 400, 400);
doc.text(35, 40, answer);
doc.save("first.pdf");
}
It works fine without the image.
Ideally a link too. Try fork this http://jsbin.com/rilace/edit?html,js,output
I tried importing the image code into this jsbin and it didn't respond.
the console logged this error:
"error"
"Script error. (line 0)"
What I saw
Link to error as screenshot
What I expected
I expected the text to be on top of the image like the demo on https://parall.ax/products/jspdf
I learned that I shouldn't try to use the image but use dataURI.
I converted my image to a dataURI using this website:
https://websemantics.uk/tools/image-to-data-uri-converter/
Thank you bro, really really thank you!
Most helpful comment
I learned that I shouldn't try to use the image but use dataURI.
I converted my image to a dataURI using this website:
https://websemantics.uk/tools/image-to-data-uri-converter/