From 85d066374c97d32493f44c6ec23ab654acf15351 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82?= Date: Thu, 17 Oct 2013 14:39:44 +0200 Subject: [PATCH] Solves #1 (missing regional characters in PDF file) It also requires to put the DejaVuSans.ttf file somhere - in this particular case it is put to /fonts subdirectory of the PdfQrCode directory. --- models/Reports/Generator/PdfQrCode.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/models/Reports/Generator/PdfQrCode.php b/models/Reports/Generator/PdfQrCode.php index d769498..7afae26 100644 --- a/models/Reports/Generator/PdfQrCode.php +++ b/models/Reports/Generator/PdfQrCode.php @@ -5,6 +5,8 @@ * @copyright Copyright (c) 2011 Center for History and New Media * @license http://www.gnu.org/licenses/gpl-3.0.txt */ + +defined('REPORTS_TTF_DIRECTORY') or define('REPORTS_TTF_DIRECTORY', REPORTS_PLUGIN_DIRECTORY.'/models/Reports/Generator/PdfQrCode/fonts'); /** * Report generator for PDF output with QR Codes included. @@ -97,7 +99,7 @@ public function generateReport($filePath) } $options = unserialize($this->_reportFile->options); $this->_baseUrl = $options['baseUrl']; - $this->_font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA); + $this->_font = Zend_Pdf_Font::fontWithPath( REPORTS_TTF_DIRECTORY . '/DejaVuSans.ttf', Zend_Pdf_Font::EMBED_DONT_EMBED); $fileSuffix = 1; $pdfPath = $this->_newPdf($filePath, $fileSuffix); @@ -303,7 +305,7 @@ private function _drawWrappedText( $lines = explode("\n", $wrappedText); foreach($lines as $line) { - $page->drawText($line, $x, $y); + $page->drawText($line, $x, $y, 'UTF-8'); $y -= self::FONT_SIZE + 5; } }