Am stuck with a problem in tcpdf.Now am creating a pdf document using tcpdf.Here i have a field which is dynamical generated from pgsql database.It contain both arabic and english.But english words are reverted when they mix with arabic.Please help me with any tutorials or sample code links.
-
Thank you for your reply.I tried your solution.But it doesn't work for me. – Freddy Pv Mar 06 '13 at 09:12
3 Answers
Please implement following solutions here:-
1) put a copy of ARIALUNI.ttf
in fonts folder under tcpdf installation
(i've taken my copy from windows\fonts folder).
2) make a temporary script in examples folder of tcpdf and execute it with this line:
$fontname = $pdf->addTTFfont('../fonts/ARIALUNI.ttf', 'TrueTypeUnicode', '', 32);
3) set the new font in your pdf generator script:
$pdf->SetFont('arialuni', '', 20);
Please refer also link How to generate multilingual content Pdf in PHP
For some time this font has not existed on a new Windows/Office. Details see: https://learn.microsoft.com/en-us/typography/font-list/arial-unicode-ms So you have to get it from another place ...
The new version of TCPDF has its own object to create font files, as they are used afterwards by TCPDF: TCPDF_FONTS
For more details and an example see: https://stackoverflow.com/a/70337995/2320007

- 822
- 12
- 28
ArialUnicodeMS Download
Install / download / require the tcpdf library into your project.
Open the library folder (for example mine was: ./vendor/tecnickcom/tcpdf).
Notice and enter to the tools folder.
Copy the TTF file(s) into this tools folder.
Run this command from the terminal (still from the tools folder): $ PHP
tcpdf_addfont -i ArialUnicodeMS.TTF
Repeat step (5) for each fonts desired.
Coding time.. To change between fonts from your php code, use the following scripts.
$pdf->SetFont($font_family = ‘ArialUnicodeMS’, $variant = ‘’, $fontsize = 11);

- 670
- 5
- 15