0

I needed to use bangla font in jsPDF. I tried but it didn't work perfectly. Need the output like this 'বাংলাদেশ এক্সটেনশন এডুকেশন সার্ভিসেস, ব্রাঞ্চ অফিসে দায়িত্ব প্রাপ্ত বিএম এর নামঃ' but got the result as shown below.

Image

I tried-

var doc = new jsPDF('p', 'pt', 'a4');
doc.addFileToVFS('kalapurush.ttf', font);
doc.addFont('kalapurush.ttf', 'kalapurush', 'normal');
doc.addFont('kalapurush.ttf', 'kalapurush', 'bold');
doc.setFont('kalapurush');

doc.setFontSize(16);
doc.setTextColor(30);
doc.setFontStyle('bold');
doc.text('বাংলাদেশ এক্সটেনশন এডুকেশন সার্ভিসেস', 200, 40);
doc.setFontSize(12);
doc.setFontStyle('normal');
doc.text('ব্রাঞ্চ অফিসে দায়িত্ব প্রাপ্ত বিএম এর নামঃ ', 260, 55);
doc.addJS('print({});');
window.open(doc.output('bloburl'), '_blank');
doc.autoPrint();
Suraj Rao
  • 29,388
  • 11
  • 94
  • 103

0 Answers0