Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

254
Views
Using multiple font family dynamically in jsPdf

I am using jsPdf library in angular application for PDF. Now I have a situation where I have to use Arabic font with some English font in same pdf report. Below is the piece of example code showing how I am using this before this requirements.

fontName = 'times'; //For example 
if (currentLocale === 'ar') {
  // add the font to jsPDF
  doc.addFileToVFS('ArabicFont-normal.ttf', ArabicFont);
  doc.addFileToVFS('ArabicFont-Bold-bold.ttf', ArabicFontBold);
  doc.addFont('ArabicFont-normal.ttf', 'ArabicFont', 'normal');
  doc.addFont('ArabicFont-Bold-bold.ttf', 'ArabicFont', 'bold');

  this.fontName = 'ArabicFont';
} else {
  this.fontName = 'helvetica';
}
doc.setFont(this.fontName);

doc.setFont(this.fontName, 'bold');
doc.setTextColor('#000000');
doc.text(`Some Text`, 10, 10);
doc.text(`Some Text 1`, 10, 10); //This is some Arabic text

I have both text and tables in the pdf where table may contain one or more Arabic columns as well. I wonder how can I use two font family at the same time. Any help would be appreciated. Thanks in advance!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!