jsPDF
jsPDF copied to clipboard
How to generate / download pdf from HTML
var pdf = new jsPDF('p', 'pt', 'a5');
var canvas = pdf.canvas;
canvas.height = 72 * 11;
canvas.width = 72 * 8.5;
html2pdf(document.body, pdf, function (pdf)
{
var iframe = document.createElement('iframe');
iframe.setAttribute('style', 'position:absolute;right:0; top:0; bottom:0; height:100%; width:500px');
document.body.appendChild(iframe);
iframe.src = pdf.output('datauristring');
}
);
I have an html page with CSS styling. this page will be used as an certificate page. i want to download the html certificate as it is with it styling. previously i was using addhtml. english was working fine with that, however, arabic was scarambling.
Imho a perfect html to pdf will not work and arabic support is right now not implemented.
Oh, what is the alternate in this case.
Separate the model layer and write separate view-layers, one normal HTML and one jsPDF. Meaning: Write it complete new in jsPDF.