html2pdf.js
html2pdf.js copied to clipboard
issue with arabic words
I have a really strange problem, as you can see in the photo, when i try to generate pdf that contain arabic string, the space between the last two words always gets ignored, i tried everything (quite literally) and i have no idea how to fix this
hey @lMicklel checkout the issue i raised i think it can help with your issue too: #497
@lMicklel I solved my problem by load every latest library like that
<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-promise/4.2.8/es6-promise.min.js" ></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js" ></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js" ></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.min.js" ></script>
<script>
function smartPrint(html, filename = '', orientation = 'portrait') {
if (filename) {
filename = filename + ".pdf"
} else {
filename = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15) + ".pdf";
}
var opt = {
margin: 1,
filename: filename,
image: { type: 'jpeg', quality: 0.98 },
html2canvas: { scale: 2 },
jsPDF: { unit: 'in', format: 'letter', orientation: orientation }
};
html2pdf().set(opt).from(html).save();
}
//try this
var html='ماهر جابر شقليه';
smartPrint(html);
</script>
the problem with html2pdf.bundle.min.js version
I have a strange problem too, with persian or arabic words and numbers... when i don't add space between words the following sentence gets all messed up. now I cannot control users to make sure they use space after every word.