2

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.

Freddy Pv
  • 96
  • 12

3 Answers3

1

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

Community
  • 1
  • 1
Roopendra
  • 7,674
  • 16
  • 65
  • 92
0

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

Sarah Trees
  • 822
  • 12
  • 28
0

ArialUnicodeMS Download

  1. Install / download / require the tcpdf library into your project.

  2. Open the library folder (for example mine was: ./vendor/tecnickcom/tcpdf).

  3. Notice and enter to the tools folder.

  4. Copy the TTF file(s) into this tools folder.

  5. Run this command from the terminal (still from the tools folder): $ PHP

    tcpdf_addfont -i ArialUnicodeMS.TTF

  6. 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);
Ali Raza
  • 670
  • 5
  • 15