I want the client to download the desired #por div in PDF format by clicking the #btn button. My site is WordPress site.
I use jsPDF and it worked. But my problem is that jsPDF does not support utf-8.(I use Persian language in #por div)
What should I do? please guide me. Thankful
<!DOCTYPE html>
<html>
<div class="por1" id="por">...</div>
<button class="btn btn-info" id="btn" onclick="pdf()" target="_blank" >Download PDF</button>
<script>
function pdf()
{
var doc = new jsPDF();
var elementHandler = {
'#ignorePDF': function (element, renderer) {
return true;
}
};
var source = window.document.getElementById('por').innerHTML;
doc.fromHTML(
source,
15,
15,
{
'width': 180,'elementHandlers': elementHandler
});
doc.save("dataurlnewwindow");
}
</script>
</html>