Answer the question
In order to leave comments, you need to log in
How to save pictures and Cyrillic text from html page in pdf file?
Converting html page to pdf using javascript on the client side. I do this using the jspdf and html2canvas libraries according to the instructions from the video
But, unfortunately, this method does not save images (canvas) Here is my demo
function getPDF() {
doCanvas();
$(document).bind('function_a_complete', doPDF);
}
function doCanvas() {
html2canvas(document.querySelector("#myDiv")).then(canvas => {
document.querySelector("#newDiv").appendChild(canvas);
});
$(document).trigger('function_a_complete');
}
function doPDF() {
console.log("do pdf");
var doc = new jsPDF();
doc.fromHTML($('#newDiv').html(), 20, 20, {'width':500});
doc.text(50,50, "Новый текст");
doc.save('test.pdf');
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question