user1978104
user1978104

Reputation:

How to generate multilingual content Pdf in PHP

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.

Is there any way to generate multilingual pdf without enforcing user to download any langauge pack?

Upvotes: 5

Views: 5342

Answers (2)

devOp
devOp

Reputation: 3170

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...

Upvotes: 4

Praveen D
Praveen D

Reputation: 2377

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.

Upvotes: 0

Related Questions