문제

How can I manage to get special characters in a PDF file generated with jsPDF?

The texts are dynamically loaded through AJAX. Some possible chars are à, É, Ç and õ. I, up to now, didn't get how to do this.

도움이 되었습니까?

해결책

You must download the last version of jsPDF, there will be a file called jspdf.plugin.standard_fonts_metrics.js, just reference that script from your html page and that would be more than enough to user special caracters would be a simple line like this:

<script src="jspdf.plugin.standard_fonts_metrics.js"></script>
<script>
    doc.text(74, 25, 'Evaluación de prueba');
</script>

This worked for me.

다른 팁

I had some troubles with it to show the PDF inside a DIV, i solved with this code

var url = doc.output('dataurlstring');

$('embed').attr('src',url);

$('<div id="divPdf" class ="hidden" title="PDF - ORDEN DEL DIA"><embed width="95%" height="95%" name="plugin" align="center" src="" type="application/pdf"> </div>').appendTo('body');

Hope it Helps

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top