Pdf creation using php for all languages

Hello,

I want to create PDF using php.
that can be in any language(Spanish,Japanese,Chinese…)
And I can not predict in which language the content will be.

"How could i generate the PDF that supports utf-8 chars.
I tries Fpdf,tcpdf creation images the inserting to the pdf.
creating HTML then inserting to the pdf.
no positive results .:sick:
Really frustrated.

Hi sneha!

Welcome to the Sitepoint Forums!

Although I haven’t used it myself in any project (actually no such works so far with me), but as i believe that TCPDF is the one in PHP which supports UTF-8 characters what i read in their feature page http://www.tecnick.com/public/code/cp_dpage.php?aiocp_dp=tcpdf.

no external libraries are required for the basic functions;
supports all ISO page formats;
supports custom page formats, margins and units of measure;
supports UTF-8 Unicode and Right-To-Left languages;

See the example here.

Lets us know what you have you tried so far.

I have already tried this.
Yes TCPDF supports utf-8 But there you have to specify language
like this


require_once('../config/lang/eng.php');
require_once('../tcpdf.php');

and also set the language


//set some language-dependent strings
$pdf->setLanguageArray($l); 

that is not posible in my case As i dnt know which language the content is.
It can be in any language like Spanish,Chinese,Japanese,dutch

tcpdf supports such html to pdf using writeHTML() method.
also there are html2pdf, dompdf for the same purposes.

This link may help you:
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_24707649.html

I have tries html2pdf also.
But it dnt show the other language characters properly

Did you already try the dompdf as well? But I am still not sure whether it supports UTF-8 characters.

Otherwise you must go in some other way to find which characters are to be write to the pdf and use tcpdf.

tcpdf do support unicode character even hindi but the words are wrongly expanded in the pdf documents which is difficult to understand or read.
especially the half words in the some language are wronly expanded.

I used DomPdf but gives me all content one above other.