Can't show Chinese on exported pdf report

(10 posts) (2 voices)

Tags:

No tags yet.

  1. chadwickhung, Member

    We've got a report by our user recently that the export function to pdf can't show Chinese correctly. However, exporting to Excel or CSV are ok, Chinese were shown correctly.

    They were using the default export button next to the search field to export the report result to pdf.

    Please kindly help

    Thanks
    Chadwick

  2. myDBR Team, Key Master

    Chadwick,
    make sure your server has Chinese fonts installed. For example in Ubuntu you can use ttf-wqy-zenhei-font:

    % apt-get install ttf-wqy-zenhei

    --
    myDBR TEam

  3. chadwickhung, Member

    Thanks
    Our server is Centos 6. We tried 'yum groupinstall "Chinese Support"' but still can't display in pdf. However, excel export can show Chinese correctly.
    Please kindly help.
    Best regards,
    Chadwick

  4. myDBR Team, Key Master

    PDF is generated in the server and uses the server fonts available. Excel however uses fonts in the client.

    Check that the chinese fonts are installed and that you have updated the font cache:

    % fc-cache -f -v

    --
    myDBR Team

  5. chadwickhung, Member

    I think so, please see below.

    [dreamware@dreamware.com.hk ~]$fc-cache -f -v /usr/share/fonts: caching, new cache contents: 0 fonts, 3 dirs /usr/share/fonts/cjkuni-ukai: caching, new cache contents: 4 fonts, 0 dirs /usr/share/fonts/cjkuni-uming: caching, new cache contents: 4 fonts, 0 dirs /usr/share/fonts/wqy-zenhei: caching, new cache contents: 3 fonts, 0 dirs /usr/share/X11/fonts/Type1: skipping, no such directory /usr/share/X11/fonts/TTF: skipping, no such directory /usr/local/share/fonts: skipping, no such directory /var/www/vhosts/dreamware.com.hk/.fonts: skipping, no such directory /var/cache/fontconfig: not cleaning unwritable cache directory /var/www/vhosts/dreamware.com.hk/.fontconfig: cleaning cache directory fc-cache: succeeded

    [dreamware@dreamware.com.hk ~]$fc-list AR PL UMing TW:style=Light AR PL UMing HK:style=Light AR PL UMing CN:style=Light AR PL UKai TW MBE:style=Book AR PL UKai CN:style=Book AR PL UKai HK:style=Book AR PL UKai TW:style=Book WenQuanYi Zen Hei,文泉驛正黑,文泉驿正黑:style=Regular WenQuanYi Zen Hei Mono,文泉驛等寬正黑,文泉驿等宽正黑:style=Regular AR PL UMing TW MBE:style=Light WenQuanYi Zen Hei Sharp,文泉驛點陣正黑,文泉驿点阵正黑:style=Regular

    [dreamware@dreamware.com.hk ~]$ls -l /usr/share/fonts/ total 12 drwxr-xr-x 2 root root 4096 Nov 9 16:01 cjkuni-ukai drwxr-xr-x 2 root root 4096 Nov 9 16:01 cjkuni-uming drwxr-xr-x 2 root root 4096 Nov 9 16:01 wqy-zenhei

  6. myDBR Team, Key Master

    What is the wkhtmltopdf version you are using?

    You can send the output of the report to support email so we can test it with our CentOS installation. Use the '&export=sql' added to the URL to get the sql output.

    --
    myDBR Team

  7. chadwickhung, Member

    Thanks
    This is one of it, the simplest one. But actually the Chinese problem of pdf are happening on all reports.
    Chadwick

    select 'DBR.text', '壹加壹教育中心 (屯門分校)' as 'centername';
    
    select 'dbr.search', 1;
    
    select 'CHF1' as 'Code', '中一中文專科班(1.5小時)' as 'English', '中一中文專科班(1.5小時)' as 'Chinese中文', '10' as 'Max Size', '90' as 'Duration (min)', '' as 'remarks', 'Active' as 'status', 'Level' as 'Fee Calculation Method', '1' as 'No. of Classes or Months Per Enrollment'
    
    union all
    select 'CHF2', '中二中文專科班(1.5小時)', '中二中文專科班(1.5小時)', '10', '90', '', 'Active', 'Level', '1' union all
    select 'CHF3', '中三中文專科班(1.5小時)', '中三中文專科班(1.5小時)', '10', '90', '', 'Active', 'Level', '1' union all
    select 'CHF4', '中四中文專科班(1.5小時)', '中四中文專科班(1.5小時)', '10', '90', '', 'Active', 'Level', '1' union all
    select 'CHF5', '中五中文專科班(1.5小時)', '中五中文專科班(1.5小時)', '10', '90', '', 'Active', 'Level', '1' union all
    select 'CHF6', '中六中文專科班(1.5小時)', '中六中文專科班(1.5小時)', '10', '90', '', 'Active', 'Level', '1';

    PDF Image

  8. myDBR Team, Key Master

    What is the wkhtmltopdf version you are using?

    Isse is in the server configuration (likely the fonts). See same report in our server (running Ubuntu). We also tested this in our CentOS without any problems.

    Unicode report

    You can try your wkhtmltopdf installation and font configuration directly from command line:

    % wkhtmltopdf http://www.baidu.com baidu.pdf

    Without access to your server, it is difficult to say what the configuration mismatch is. You can try post the question to wkhtmltopdf mailing list.

    --
    myDBR Team

  9. chadwickhung, Member

    Fixed. Thank you.

    I got another question . When exporting a report as PDF, the Parameter fields are included in the export.

    On browser, that part is collapsed and you'd need to click on the gear icon to open it - but it seems to be opened default when wkhtmltopdf "watches" the report to create the PDF.

    We use the PDF export function primarily to manufacture Reports for our clients and we would prefer that the parameter list doesn't show. How could I achieve it?

    Thanks
    Chadwick

  10. myDBR Team, Key Master

    What is the wkhtmltopdf version you are using?

    Parameters are not shown in PDF export by default. Take a look at an example from the demo:

    Autocomplete with ID

    Have you made modifications to default CSS definitions?
    --
    myDBR Team


Reply

You must log in to post.