Skip to content

could pdf support chinese or non? #3

Closed

Description

@wrjcs

Hello,
Could the widget pdf support chinese or no?
By testing the app, I input one chinese char, it can't generate pdf.
Thanks.

Activity

  1. Anand3595 commented on Oct 5, 2020

    @Anand3595

    Hi @wrjcs ,

    We can add Chinese, Japanese and Korean text by using the PDF CJK standard font, by using PdfCjkStandardFont class. Please find the below code example and sample for more details.

    //Create a new PDF document
    PdfDocument document = PdfDocument();
    //Add a page and draw text
    document.pages.add().graphics.drawString('你好,世界', PdfCjkStandardFont(PdfCjkFontFamily.monotypeHeiMedium, 20));
    //Save the document
    List bytes = document.save();

    Sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/create_pdf_file1521138299

    For more details about CJK fonts refer the documentation here https://help.syncfusion.com/flutter/pdf/working-with-text#draw-text-using-cjk-fonts

    We can also add these text by using supported true type fonts with the help of PdfTrueTypeFont instance. For more details, refer the documentation from https://help.syncfusion.com/flutter/pdf/working-with-text#drawing-text-using-different-fonts.

    Note: Standard fonts (PdfStandardFont) does not support unicode and CJK text.

    Regards,
    Anand Panchamoorthi

  2. wrjcs commented on Nov 14, 2020

    @wrjcs
    Author

    Hello,yes , I can generate an pdf by using your code.
    it can also open in pdf.
    but when I want to print it, I get nothing.
    this is capture of pdf
    image
    this is caputre of preview before print
    image

  3. Anand3595 commented on Nov 16, 2020

    @Anand3595

    Hi wrjcs,

    We are checked the provided PDF document in our devices and taken screenshots for your reference. The adobe viewer and print preview in our devices are working as expected. Please find the screenshots below,

    Viewing PDF document in adobe reader mobile,
    1

    Print preview in mobile device,
    2

    Please provide the following details, it will more helpful for us to analyze further and update you.

    1. Android version
    2. PDF viewer
    3. Flutter version.

    You can also try our TTF font support to draw the CJK text with supported fonts. For this we can use PdfTrueTypeFont class with appropriate font data as bas64String or list of bytes. Or else we can also load TTF font data from Google Fonts package as explained in https://www.syncfusion.com/kb/11976/how-to-draw-unicode-text-in-a-pdf-file-using-google-fonts-package .

    Please find the more details to draw text with PdfTrueTypeFonts from https://help.syncfusion.com/flutter/pdf/working-with-text#draw-text-using-truetype-fonts .

    With Regards,
    Anand Panchamoorthi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions