Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

255
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda