webix export to pdf error FONT

hello, i create a datagrid like:

Tên | LỚp

Hải | A10
Lân | A11

my font pdf file is wrong, pls let me know to to resolve that

Comments

  • edited November 2019

    Hello,

    By default, Webix support the pt-sans.regular.ttf font file for export. Here's the way to change it:

    • run our CDN resources offline (as described here)

    • place the new .ttf font file in "extras" folder

    • specify the font as one of the properties:

    webix.toPDF($$("datatable"), { fontName:"custom" })

    Note that only .ttf font files are supported.

  • why webix dont use a another similar font like arial or an option to choose font

  • pt-sans.regular.ttf is a generic font which intended primarily for the execution of various documents.
    By default, Webix provides one font for export because its more convenient and lightweight.

  • i wish webix can change to arial font or at least get a way to set font more easily

  • We will consider your wishes. In the meantime, please, try this workaround:
    https://snippet.webix.com/seeebdz7

  • edited December 2019

    Hello @duynq2197,
    We have added this feature in 7.1.1 version.
    Now you can add fontName andfontURL as the second parameter of the webix.toPDFmethods:

    webix.toPDF("$dt",{
          fontName:"name",
          fontURL:"url",
        })
    

    https://snippet.webix.com/jn6nsc1k

  • dear annazankevich,
    i have tried you demo in
    https://snippet.webix.com/seeebdz7
    but when i try to add some data in Vietnamese unicode in example below:
    https://snippet.webix.com/aks3inxj

    But it's not work. Thanks

  • in the example below
    https://snippet.webix.com/nkvn1aqi
    i try to use option {fontName:"Arial"}
    but it's not work.
    Am i wrong ?

  • Yes, unfortunately, Webix font does not support Vietnamese characters and you cannot check export toPDF in the snippet.
    Instead, you can choose any font that is convenient for you and test it in the same local example. For our local tests, we took fonts from here.

  • Oh well, the problem is webix font basic does not support vietnamese so when use toPDF it can't encode to vietnamese, right ?

  • Yes, you are right.

  • why not use the same font or way like function toExcel, because when export to excel it's work well, font isn't wrong

  • Hello @duynq2197,
    These methods have different export implementations. In internal logic toPDF method stores the default font. Also for processing PDF and Excel, we rely on different third-party libraries (SheetJS and PDFJS ), so the implementation of these features can produce the different result depending on available integration options.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!