How to generate multilingual content Pdf in PHP

前端 未结 2 2013
忘了有多久
忘了有多久 2020-12-11 07:26

I am using TCPDF to generate multilingual content PDF in PHP. I am using TCPDF and using font \'cid0jp\' but It is forcing user to download language pack for adobe reader.

相关标签:
2条回答
  • 2020-12-11 07:47

    Yes, there's a way. I just had the same issue. Why Adobe Reader is asking for the language pack i don't know.

    But i know that the best way to create multilingual PDFs is to use the Arial Unicode MS-Font which is included in windows. That's the font with the most characters according to wikipedia!! But there's no Bold or Italics. You can buy a Arial Unicode Bold from http://www.linotype.com/en/817674/ArialUnicode-family.html#.

    I use the Arial MS Unicode-Font with chinese, japanese, cyrilic. For western languages i use the normal Arial so i have italics and bold. An other possibility is to use for each language a own font which is made for this language.

    To make the Arial MS Unicode to work with tcpdf follow the steps on the answer of this Question: Creating PDFs using TCPDF that supports all languages especially CJK

    I hope i could help...

    0 讨论(0)
  • 2020-12-11 07:56

    Use html2pdf for multilingual.
    I tried with this and it worked for me.I developed site for (English/Japanese) Used font arialunicid0 for multilingual.

    require_once('Classes/library/html2pdf.class.php');   
        //$html2pdf = new HTML2PDF('P', 'A4', 'en');
        $html2pdf = new HTML2PDF('P', 'A4', 'en', true, 'UTF-8');       
        $html2pdf->setDefaultFont('arialunicid0');       
        $html2pdf->pdf->SetDisplayMode('fullpage');
        $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
        $filename = $filename .'_'.date('Ymd');
        $html2pdf->Output($filename.'.pdf','D');
    

    It download file with Japanese text.
    Only problem I facing here with file name.
    IF I pass Japanese character for file name it downloads file with blank name.

    0 讨论(0)
提交回复
热议问题