When exporting PDF, the chinese/japanese characters can't be displayed

Posted by: tvhau.dev on 16 November 2020, 1:37 pm EST

    • Post Options:
    • Link

    Posted 16 November 2020, 1:37 pm EST

    hi,

    Currently I’m using wijmo.pdf.PdfDocument and angularjs to export PDF,

    When exporting pdf, the chinese/japanese characters can’t be displayed.

    Could you tell me how to can be displayed well with chinese/japanese characters?

    Could i get it for free? And it need be packed in our app installation, yes?

    Refer to the sample below.

    https://jsfiddle.net/d6p2t5yb/

    I’m waiting for your help.

    Thank you.

  • Posted 16 November 2020, 8:14 pm EST

    Hi,

    You need to register fonts for exporting Chinese and Japanese strings. Please refer to the demo link below that demonstrates how to add custom fonts and export Japanese characters:

    https://demo.grapecity.com/wijmo/demos/Grid/ImportExportPrint/PDF/CustomFonts/purejs

    Regards,

    Ashwin

  • Posted 17 November 2020, 4:42 am EST - Updated 3 October 2022, 6:09 am EST

    Hi ,

    I tried your solution, it didn’t work with Chinese

    refer to the image below



    sample : https://github.com/tvhau/PDF_EXPORT.git

    Can you show me the font can display for both Japanese and Chinese?

  • Posted 17 November 2020, 7:00 pm EST

    I think the ipaexg font is not working property with Chinese. You can try using the ZCoolXiaoWei font for Chinese characters.

    https://fonts.google.com/specimen/ZCOOL+XiaoWei?subset=chinese-simplified#standard-styles

    Please refer to the updated sample attached.

    Note that this font only works with Chinese characters and not Japanese characters.

    ~regards

    exportToPDF.zip

  • Posted 18 November 2020, 12:50 am EST

    Hi Ashwin,

    I tried installed the fonts including “Arial Unicode MS” , Then The Japanese/Chinese characters can be displayed.

    Thanks a lot.

  • Posted 25 November 2020, 4:15 am EST - Updated 3 October 2022, 6:10 am EST

    Hi again,

    Currently, I am using customCellContent to export frozenColumns to PDF

    But there is a font error

    Current solution Style class wj-cell

    .wj-cell {

    font-family : “ipaexg”

    }

    Because of the need to change fonts constantly, it is not recommended to use the above solution

    if there any other solutions that better than the solution above, please show me, thank you!

    Refer to the image below



    sample

    https://github.com/tvhau/PDF_WIJMO.git

  • Posted 25 November 2020, 4:01 pm EST

    Hi,

    If the customCellContent is set to true, then the font from the styles property will not work because the cell’s actual font takes priority over the styles font. To resolve this issue, you can use the formatItem callback and apply the ipaexg font to each cell manually:

    var settings = {
      customCellContent:true,
      styles: {....},
      formatItem: (args) => {
        args.style.font.family = 'ipaexg';
      }
    };
    

    Please refer to the sample attached.

    ~regards

    export updated.zip

  • Posted 26 November 2020, 12:08 am EST

    Hi,

    I tried your solution and it works well.

    Thanks.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels