在jspdf-autotable标头阿拉伯文本中破译

问题描述 投票:0回答:1
 document.autoTable({
      head,
      body,
      startY: XX,
      styles: { lineColor: '#c7c7c7', lineWidth: 0, cellPadding: 2, font: 'Helvetica' },
      headStyles: { fillColor: '#ffffff', textColor: '#333333', font: 'Helvetica' },
      bodyStyles: { fillColor: '#f5f5f5', textColor: '#333333', fontSize: 7, lineColor: '#c7c7c7', lineWidth: 0 }
    });

head am passing as below:
const head = [{
        content: "طيران الإمارات",
        styles: { valign: 'centre', cellPadding: {top: 3}, fontSize: 9, fontStyle: 'bold', cellWidth: 110.6 },
      },
      {
        content: 'Miles',
        styles: { fontSize: 9, fontStyle: 'normal', valign: 'centre', cellWidth: 35 },
      },
      {
        content: 'Tier Miles',
        styles: { fontSize: 9, fontStyle: 'normal', valign: 'centre', cellWidth: 35 },
      }
      ];

with Helvetica字体,标题文本显示为特殊字符。Special Characters

使用自定义字体,它以阿拉伯语显示,但单词断了我已将此标头显示为“طيرانالإمارات”,但在pdf中显示为“طيرلإماBreaking word

jspdf jspdf-autotable
1个回答
0
投票

headStyles: { fillColor: '#bde4d1', textColor: '#333333' , fontStyle: 'Amiri' }

您必须在headStyles对象中添加fontStyle

© www.soinside.com 2019 - 2024. All rights reserved.