Thank you for submitting an issue to jsPDF. Please read carefully.
Are you using the latest version of jsPDF?
Have you tried using jspdf.debug.js?
Steps to reproduce
Ideally a link too. Try fork this http://jsbin.com/rilace/edit?html,js,output
What I saw
What I expected
pdf is generating that is not a problem. i want to take that pdf file and need to send to back end and attach with mail. i cannot take pdf file to back end .
pdf is generating that is not a problem. i want to take that pdf file and need to send to back end and attach with mail. i cannot take pdf file to back end .
i've the same problem.
Solution,,
You have to send file as imageUrl from font end canvas.toDataURL('image/png')..
In back end buf = new Buffer(req.body.imageBinary.replace(/^data:image\/\w+;base64,/, ""), 'base64'); create buffer of base 64, as image or pdf format..
var data = {
Key: fileName,
Body: buf,
ContentEncoding: 'base64',
ContentType: 'pdf',
ACL: "public-read-write"
};
the data objec will be pdf file. you can store or can attache in email
Solution,,
You have to send file as imageUrl from font end canvas.toDataURL('image/png')..In back end buf = new Buffer(req.body.imageBinary.replace(/^data:image/\w+;base64,/, ""), 'base64'); create buffer of base 64, as image or pdf format..
var data = {
Key: fileName,
Body: buf,
ContentEncoding: 'base64',
ContentType: 'pdf',
ACL: "public-read-write"
};
the data objec will be pdf file. you can store or can attache in email
Frontend (Angular):
var data = pdf.output('blob');
var formData = new FormData();
formData.append("pdf", data, "myfile.pdf");
var request = new XMLHttpRequest();
request.open("POST", "http://localhost:3000/caseforms", true);
request.responseType = "blob";
request.send(formData);
backend(Nodejs) i've got gibberish raw file:
%PDF-1.3
%锟竭拷
3 0 obj
<
/Parent 1 0 R
/Resources 2 0 R
/MediaBox [0 0 595.28 841.89]
/Contents 4 0 R
>
endobj
4 0 obj
<<
/Length 10
How to send a file or how to convert pdf file in backend.
Thanks for quick response..
Most helpful comment
pdf is generating that is not a problem. i want to take that pdf file and need to send to back end and attach with mail. i cannot take pdf file to back end .