Hi,
Thanks for your work at this great module.
I have tried both libs to generate PDF and both do not support a russian chars...
Help, please.

Comments

jcnventura’s picture

Title: Unocode Support needed » Unicode Support needed
Status: Active » Fixed

Hi,

Thanks for bringing this to my attention.. I have looked into this, and I have discovered that you must use a licensed version of PDFlib to make this work with dompdf.. If you use TCPDF, Unicode is supported, but their default font ("vera") doesn't contain any Unicode characters..

So the solution is to a) switch to TCPDF and b) switch its font to something else.

Following is a patch, but you can also do it by hand by replacing in print.pdf.inc all the PDF_FONT_NAME_MAIN and PDF_FONT_NAME_DATA with "freesans" as I have done. I am sure this will fix your problem.

João Ventura

--- print.pdf.inc       23 May 2008 11:09:33 -0000      1.8
+++ print.pdf.inc       26 May 2008 15:22:33 -0000
@@ -74,8 +74,8 @@
   $pdf->SetHeaderData("", 0, $print["title"], strip_tags($print["site_name"]));

   // set header and footer fonts
-  $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
-  $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
+  $pdf->setHeaderFont(Array("freesans", '', PDF_FONT_SIZE_MAIN));
+  $pdf->setFooterFont(Array("freesans", '', PDF_FONT_SIZE_DATA));

   // set margins
   $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
@@ -97,18 +97,18 @@
   preg_match("/<body>(.*)<\/body>/sim", $html, $matches);
   $matches[1] = preg_replace("/.*?(<[^<]*?print-content.*?>)/sim", "$1", $matches[1]);

-  $pdf->SetFont(PDF_FONT_NAME_MAIN, 'B',  PDF_FONT_SIZE_MAIN * K_TITLE_MAGNIFICATION);
+  $pdf->SetFont("freesans", 'B',  PDF_FONT_SIZE_MAIN * K_TITLE_MAGNIFICATION);
   $pdf->writeHTML($print["title"]);

   if ($print["submitted"]) {
     $pdf->Ln(2);
-    $pdf->SetFont(PDF_FONT_NAME_MAIN, 'B', PDF_FONT_SIZE_MAIN);
+    $pdf->SetFont("freesans", 'B', PDF_FONT_SIZE_MAIN);
     $pdf->writeHTML($print["submitted"]);
-    $pdf->SetFont(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN);
+    $pdf->SetFont("freesans", '', PDF_FONT_SIZE_MAIN);
     $pdf->writeHTML($print["created"]);
   }

-  $pdf->SetFont(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN);
+  $pdf->SetFont("freesans", '', PDF_FONT_SIZE_MAIN);
   $pdf->writeHTML($matches[1]);

   //Close and output PDF document
Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.