Jspdf-autotable: Not supporting for custom fonts. Like arabic, japanse

Created on 30 Jan 2019  Β·  4Comments  Β·  Source: simonbengtsson/jsPDF-AutoTable

I added Japanese custom fonts in jspdf. working fine in jspdf but not working in jspdf-autoable

 doc.addFileToVFS("MouhitsuBold.ttf", MouhitsuBold);
      doc.addFont('MouhitsuBold.ttf', 'Mouhitsu', 'bold');

      doc.setFont('Mouhitsu', 'bold'); // set font
      doc.setFontSize(20);

    // From HTML
    doc.autoTable({html: '.table'});


    // From Javascript
    let finalY = doc.previousAutoTable.finalY;
    doc.text("γŠγ―γ‚ˆγ†γ”γ–γ„γΎγ™", 14, finalY + 15);

    doc.autoTable({
        startY: finalY + 20,
        head: [
            ['γŠγ―γ‚ˆγ†γ”γ–γ„γΎγ™', 'γŠγ―γ‚ˆγ†γ”γ–γ„γΎγ™', 'Email', 'Country', 'IP-address'],
        ],
        body: [
            ['1', 'Donna', 'γͺに', 'China', '211.56.242.221'],
            ['2', 'Ruth' , '[email protected]', 'Ukraine', '38.36.7.199'],
            ['3', 'Ruth', '[email protected]', 'Trinidad and Tobago', '19.162.133.184'],
            ['4', 'Jason', '[email protected]', 'Brazil', '10.68.11.42'],
            ['5', 'Jane', '[email protected]', 'United States', '47.32.129.71'],
            ['6', 'Adam', '[email protected]', 'Canada', '18.186.38.37']
        ],
    });

    finalY = doc.previousAutoTable.finalY;
    doc.text("γͺに", 14, 10);
    doc.autoTable({
        startY: finalY + 20,
        html: '.table',
        useCss: true,
        styles: {
            font: 'Mouhitsu',
            lineColor: [44, 62, 80],
            lineWidth: 1
        },
    });

    return doc;

image

doc.text("γͺに", 14, 10); --- working fine for JSPDF

doc.autoTable .. data not working

Most helpful comment

Added an example for how to use custom fonts now in the custom example. It seems like everything is working? Take a look at your console and make sure you don't have any warnings/errors.

All 4 comments

Added an example for how to use custom fonts now in the custom example. It seems like everything is working? Take a look at your console and make sure you don't have any warnings/errors.

@simonbengtsson Really thanks for implement custom fonts. Its working fine but
I have multiple languages in one PDF export using Anuglar5 ,JSPDF and Jspdf autotable. . how to do for multiple fonts in Jspdf autotable. Please refer the screenshots.
If i use Japanse or Arabic fonts working fine for particular language.

image

I am facing this same issue. Arabic labels are not rendering on pdf table header. I am using jspdf autotable. here is the output
Screenshot 2019-03-14 at 2 34 40 PM

`  doc.autoTable(columns, row, {
      margin: {horizontal: 7},
      bodyStyles: { valign: 'top' },
      styles: { cellPadding:0.7, fontSize: 7, overflow: 'linebreak',startY: 20 },  
      columnStyles: {
        text: {columnWidth: 5},
        },
      theme: 'grid'
    });
    doc.save("print001.pdf");`

Hi @prakashsam
Am facing same issue,
as per your above comments, how did you resolved with custom fonts.

Can you please help me

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tapz picture tapz  Β·  3Comments

simonbengtsson picture simonbengtsson  Β·  5Comments

Alorse picture Alorse  Β·  4Comments

webdream-fr picture webdream-fr  Β·  6Comments

mmghv picture mmghv  Β·  4Comments