bimbee Posted January 26, 2009 Share Posted January 26, 2009 Just wanna share my experience with TCPDF after I found out FPDF does not support Unicode in my language (Vietnamese):1. Download TCPDF from TCPDF at Sourceforge2. Unzip TCPDF into Tools folder, at the same place with FPDF3. Modify the following files:+ config\config.inc.php: add 01 line define('_PS_TCPDF_PATH_', _PS_TOOL_DIR_.'tcpdf/'); + classes\PDF.php:- Line 15: include_once(_PS_TCPDF_PATH_.'tcpdf.php'); - Line 17: class PDF extends TCPDF - Line 51: parent::__construct($orientation, $unit, $format, true, 'UTF-8'); - Line 162 + 297: $pdf->getAliasNbPages(); - Line 498: $this->MultiCell($w[++$i], 5, Tools::iconv('utf-8', self::encoding(), $product['product_name']).' - '.self::l('Customized'), 'B', 'L'); - Line 520: $this->MultiCell($w[++$i], 5, Tools::iconv('utf-8', self::encoding(), $product['product_name']), 'B', 'L'); - Line 708: return $font ? $font : 'freesans'; + class\Tools.php: Go to line 784 to modify static public function iconv(...) static public function iconv($from, $to, $string) { //$converted = htmlentities($string, ENT_NOQUOTES, $from); //$converted = html_entity_decode($converted, ENT_NOQUOTES, $to); //return $converted; return $string; } Everything works well except you need to modify PDF.php manually to change PDF font. However I don't do it frequently, so either FreeSans or DejaVuSans is enough. Remember to include the bold version of the font, too. 1 Link to comment Share on other sites More sharing options...
Guest Posted January 26, 2009 Share Posted January 26, 2009 Thanks sharing tips mate... Link to comment Share on other sites More sharing options...
rigorchik Posted January 29, 2009 Share Posted January 29, 2009 Hello!!! Thanks! Everything works great, but!!!In Version 1.1.0.5 line numbers are not correctso:In file classes\PDF.php:line 15 and 17 is correct,Line 51 -> 50Line 162 -> 161Line 297 -> 296Line 498 -> 497Line 520 -> 519Line 708 -> 707Other files are ok! Link to comment Share on other sites More sharing options...
cactusman2 Posted January 31, 2009 Share Posted January 31, 2009 If you use Japanese or Chinese you will need to replace on file classes\PDF.php line 707 : return $font ? $font : 'freesans'; by: return $font ? $font : 'kozminproregular'; Thank you very much I was waiting for a solution for a while! Link to comment Share on other sites More sharing options...
bimbee Posted February 2, 2009 Author Share Posted February 2, 2009 Thank rigorchik for the line number correction. I should have included the original code so it would be easier for newbies. A bit lazy when new year came )By the way, I had to modify the column width of the product table since it is not enough to fit my description. The magic is line #452: $w = array(90, 15, 25, 10, 25, 25); I increased the column width from 90 to 92 and everything worked as expected for me. You may want to increase more but I am afraid it may ruin the order structure since items are placed manually. I wish if we could have a kind of layout like GridBagLayout in Java to automate calculation of sizes & positions. Link to comment Share on other sites More sharing options...
ai.farfa Posted February 9, 2009 Share Posted February 9, 2009 thanks so much. its finally work!Somehow after modified ../classes/PDF.php as above.PDF constructer function will try to include selected-font in your back-office >> preferrences >> PDF setting which refered to /fpdf/font/ (but new PDF search this font in it's own tcpdf/font/) this will cause error "TCPDF ERROR: Could not include font definition file: "to fix this error, in /classes/PDF.php constructor fix $_pdfparams to your desired font line: 48 replace or comment out this line 'font' => (isset($conf['PS_PDF_FONT_'.$lang]) AND $conf['PS_PDF_FONT_'.$lang] == true) ? $conf['PS_PDF_FONT_'.$lang] : 'helvetica' with this 'font' =>'' now PDF class will ignore PDF useless setting in web-user interface Link to comment Share on other sites More sharing options...
bimbee Posted February 9, 2009 Author Share Posted February 9, 2009 Well, I did not get the same message as you did when I left only DejaVuSans, FreeSans, etc. in the tcpdf/font folder. However generated PDF could not display Vietnamese characters so I had to include helvetica, times, courier, etc. Everything is running fine for me. So if you copy just helvetica, I think the problem can be solved without the modification you made.(Why I copied only selected fonts? Because the CJK fonts eat up so much valuable space and lengthen ftp transfer time.) thanks so much. its finally work!Somehow after modified ../classes/PDF.php as above.PDF constructer function will try to include selected-font in your back-office >> preferrences >> PDF setting which refered to /fpdf/font/ (but new PDF search this font in it's own tcpdf/font/) this will cause error "TCPDF ERROR: Could not include font definition file: "to fix this error, in /classes/PDF.php constructor fix $_pdfparams to your desired font line: 48 replace or comment out this line'font' => (isset($conf['PS_PDF_FONT_'.$lang]) AND $conf['PS_PDF_FONT_'.$lang] == true) ? $conf['PS_PDF_FONT_'.$lang] : 'helvetica' with this 'font' =>'' now PDF class will ignore PDF useless setting in web-user interface Link to comment Share on other sites More sharing options...
Dezigner Posted February 23, 2009 Share Posted February 23, 2009 Hey, I tried to make changes to all the files as You sugested, but without luck. My site just stoped working, it doesnt work anymore... at all.. so can someone tell me how to make that PDF work on UTF-8, I need it for Lithuanian language.. Link to comment Share on other sites More sharing options...
wiseguy Posted March 16, 2009 Share Posted March 16, 2009 Can some one upload the right files with correction, for us just to download them and distribute them to the right folders?? I am trying to view Hebrew font on PDF,Who can upload the "PDF pack "? Link to comment Share on other sites More sharing options...
BOIK Posted April 18, 2009 Share Posted April 18, 2009 I did something wrong I get this error: Warning: require_once(/Applications/MAMP/htdocs/SHOP/config/../classes/FPDF.php) [function.require-once]: failed to open stream: No such file or directory in /Applications/MAMP/htdocs/SHOP/config/config.inc.php on line 22Fatal error: require_once() [function.require]: Failed opening required '/Applications/MAMP/htdocs/SHOP/config/../classes/FPDF.php' (include_path='.:/Applications/MAMP/bin/php5/lib/php') in /Applications/MAMP/htdocs/SHOP/config/config.inc.php on line 22This is line 22: require_once(dirname(__FILE__).'/../classes/'.$className.'.php');What's it talking about??Thx Link to comment Share on other sites More sharing options...
wiseguy Posted April 18, 2009 Share Posted April 18, 2009 i follow the instruction 1 to 1, and it still didn't work for me, if you will get it right , please do a favour to all, and upload those 3 file that you need to change Link to comment Share on other sites More sharing options...
IVANH83 Posted May 1, 2009 Share Posted May 1, 2009 Hi all!In attach you can find configured php files and tcpdf folder download from http://sourceforge.net/project/showfiles.php?group_id=128076IMPORTANT!before replacing php files BACKUP OLD FILES!Files to replace:config\config.inc.phpclasses\PDF.phpclass\Tools.phpUpload TCPDF into Tools folder, at the same place with FPDFWorks fine to me and i hope that should work fine to others. php.zip Link to comment Share on other sites More sharing options...
VIXUS Posted May 1, 2009 Share Posted May 1, 2009 I have only one letter error...I see in PDF small letter č as big letter Č.any tips where and how to fix that? Link to comment Share on other sites More sharing options...
BOIK Posted May 10, 2009 Share Posted May 10, 2009 Hi all,i found this on a forum (original post http://www.prestashop.com/forums/viewthread/14105/#79197). I just uploaded files (classes folder needs override) and čžš works without problems.It's for PS 1.1In back office in pdf settings you have to choose CP1250 and font arialmt.Boik cs_pdf_prestashop_11_final.zip Link to comment Share on other sites More sharing options...
VIXUS Posted May 10, 2009 Share Posted May 10, 2009 Hi all,i found this on a forum (original post http://www.prestashop.com/forums/viewthread/14105/#79197). I just uploaded files (classes folder needs override) and čžš works without problems.It's for PS 1.1In back office in pdf settings you have to choose CP1250 and font arialmt.Boik EXCELLENT MATE, FINALLY IT WORKS!!!THANX!This solution shud go to sticky!!!! Link to comment Share on other sites More sharing options...
nmoussas Posted July 15, 2009 Share Posted July 15, 2009 i changed the files manually and i get a blank page each time i open the pdf invoice!!damm did anyone solved it for greek? Link to comment Share on other sites More sharing options...
thpoul Posted July 28, 2009 Share Posted July 28, 2009 Hello there and thanks for sharing this migration with us. I'm having the same problem as the person above me (keep getting blank page) and I know it has something to do with the PDF.php which I edited manually, downloaded the files in this thread but each time I'm getting the same result.Running the default PDF.php gives me (PDF exports perfectly, well almost due to UTF-8 failure): Warning: include_once(_PS_FPDF_PATH_fpdf.php) [function.include-once]: failed to open stream: No such file or directory in /home2/warjoker/public_html/eshop/classes/PDF.php on line 15Warning: include_once() [function.include]: Failed opening '_PS_FPDF_PATH_fpdf.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home2/warjoker/public_html/eshop/classes/PDF.php on line 15Fatal error: Class 'FPDF' not found in /home2/warjoker/public_html/eshop/classes/PDF.php on line 17 meanwhile the migrated PDF.php: Warning: include_once(_PS_TCPDF_PATH_tcpdf.php) [function.include-once]: failed to open stream: No such file or directory in /home2/warjoker/public_html/eshop/classes/PDF.php on line 16Warning: include_once() [function.include]: Failed opening '_PS_TCPDF_PATH_tcpdf.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home2/warjoker/public_html/eshop/classes/PDF.php on line 16Fatal error: Class 'FPDF' not found in /home2/warjoker/public_html/eshop/classes/PDF.php on line 18 Any ideas please? Link to comment Share on other sites More sharing options...
nmoussas Posted July 29, 2009 Share Posted July 29, 2009 hello thpoul,i see you have the same problem with me.i still havent fixed that but i found that from the moment i enter the include_once(_PS_TCPDF_PATH_tcpdf.php) in pdf.php i got the blank page and if i remove it the page shows up again!!maybe there is something wrong with the path...?? Link to comment Share on other sites More sharing options...
thpoul Posted July 29, 2009 Share Posted July 29, 2009 I don't think there is something wrong with the path there. If you set it correctly on your config.inc.php there shouldn't be a problem. Thing is that even if you run PDF.php in a fresh install the syntax error is still there for some reason. Link to comment Share on other sites More sharing options...
thpoul Posted July 31, 2009 Share Posted July 31, 2009 Anyone can implement TCPDF in 1.2 stable? Link to comment Share on other sites More sharing options...
thpoul Posted August 8, 2009 Share Posted August 8, 2009 Bumpity bump Link to comment Share on other sites More sharing options...
sibony88 Posted August 31, 2009 Share Posted August 31, 2009 in prestashop 1.1 the tcpdf worked fine with hebrew but in prestashop 1.2 the code is different does anybody know how to implement it in prestashop 1.2 pls help Link to comment Share on other sites More sharing options...
radders Posted August 31, 2009 Share Posted August 31, 2009 I couldn't apply the instructions from the first post to 1.2 as the files have changed significantly, so I was looking for a simpler solution as I only need Eastern and Western Euopean characters.Looking at this thread. Hi all,i found this on a forum (original post http://www.prestashop.com/forums/viewthread/14105/#79197). I just uploaded files (classes folder needs override) and čžš works without problems.It's for PS 1.1In back office in pdf settings you have to choose CP1250 and font arialmt.Boik Do they fix FPDF just for characters in the Czech language or is it a more general solution? As far as I could tell it didn't involve TCPDF, just adding a more useful font to FPDF.I can see that classes/PDF.php has the available fonts hardcoded in so that file needs changing to add arielmt. Also install the arialmt font fron the zip file and select arialmt in Back Office >> Preferences >> PDF? Link to comment Share on other sites More sharing options...
langbianiam Posted September 4, 2009 Share Posted September 4, 2009 Hi all!In attach you can find configured php files and tcpdf folder download from http://sourceforge.net/project/showfiles.php?group_id=128076IMPORTANT!before replacing php files BACKUP OLD FILES!Files to replace:config\config.inc.phpclasses\PDF.phpclass\Tools.phpUpload TCPDF into Tools folder, at the same place with FPDFWorks fine to me and i hope that should work fine to others. Thanks, but it can not work with 1.2.2can anyone fix it?many thanks Link to comment Share on other sites More sharing options...
Suraj Posted September 6, 2009 Share Posted September 6, 2009 hi, can anyone plz make it work for 1.2.2. It would be a great help.thanks a lot Link to comment Share on other sites More sharing options...
zabounis Posted September 24, 2009 Share Posted September 24, 2009 I managed to install the customization for pretashop Version 1.1.0.5 smoothly.The only problem is with the euro symbol. It doesn't appear right. I tried changing fonts but the problem persists.Any ideas ? Link to comment Share on other sites More sharing options...
vulcanas Posted September 29, 2009 Share Posted September 29, 2009 maybe somebody resolved fpdf to tcpdf migration problem on 1.2.4 version? Link to comment Share on other sites More sharing options...
bsphere Posted October 30, 2009 Share Posted October 30, 2009 joining the question about 1.2.x migration to tcpdf Link to comment Share on other sites More sharing options...
Ravendark Posted November 17, 2009 Share Posted November 17, 2009 Any guide on incorporating TCPDF to version 1.2.5 please?? Link to comment Share on other sites More sharing options...
rami Posted February 16, 2010 Share Posted February 16, 2010 joining Ravendark Link to comment Share on other sites More sharing options...
sibony88 Posted February 18, 2010 Share Posted February 18, 2010 six month past since my last request and still no answer can anyone pls find a solution to tcpdf in hebrew rtl pls..... Link to comment Share on other sites More sharing options...
mstiopa Posted May 13, 2010 Share Posted May 13, 2010 If anyone is interested... for PS 1.3 RC6.Like bimbee wrote in his first post:1. Download TCPDF from TCPDF at Sourceforge2. Unzip TCPDF into Tools folder, at the same place with FPDF (default: /tools/tcpdf)3. Edit the file: /config/config.inc.phpa)Find: define('_PS_FPDF_PATH_', _PS_TOOL_DIR_.'fpdf/'); Replace with: define('_PS_TCPDF_PATH_', _PS_TOOL_DIR_.'tcpdf/'); Find: include_once(_PS_FPDF_PATH_.'fpdf.php'); class PDF_PageGroup extends FPDF Replace with: include_once(_PS_TCPDF_PATH_.'tcpdf.php'); class PDF_PageGroup extends TCPDF 4. Edit the file: /classes/PDF.phpa)Find: FPDF::FPDF($orientation, $unit, $format); Replace with: parent::__construct($orientation, $unit, $format, true, 'UTF-8'); Find: 'encoding' => (isset($conf['PS_PDF_ENCODING_'.$isoCode]) AND $conf['PS_PDF_ENCODING_'.$isoCode] == true) ? $conf['PS_PDF_ENCODING_'.$isoCode] : 'iso-8859-1', Replace with: 'encoding' => (isset($conf['PS_PDF_ENCODING_'.$isoCode]) AND $conf['PS_PDF_ENCODING_'.$isoCode] == true) ? $conf['PS_PDF_ENCODING_'.$isoCode] : 'utf-8', c)Find: return (isset(self::$_pdfparams[self::$_iso]) AND is_array(self::$_pdfparams[self::$_iso]) AND self::$_pdfparams[self::$_iso]['encoding']) ? self::$_pdfparams[self::$_iso]['encoding'] : 'iso-8859-1'; Replace with: return (isset(self::$_pdfparams[self::$_iso]) AND is_array(self::$_pdfparams[self::$_iso]) AND self::$_pdfparams[self::$_iso]['encoding']) ? self::$_pdfparams[self::$_iso]['encoding'] : 'utf-8'; d)Find: return $font ? $font : 'Arial'; Replace with: return $font ? $font : 'freesans'; That's it. Works for me. 1 Link to comment Share on other sites More sharing options...
nick_escu Posted May 30, 2010 Share Posted May 30, 2010 Hi,TCPDF works after applying these instructions but the invoice and the delivery slip has a strange alignment for product name – justified from left to right, pls. see attachment.version 1.2.5Any ideea what or where to change this ?Thank you, justified.pdf Link to comment Share on other sites More sharing options...
andrewsmark Posted May 31, 2010 Share Posted May 31, 2010 i changed the files manually and i get a blank page each time Link to comment Share on other sites More sharing options...
tata.mata Posted June 14, 2010 Share Posted June 14, 2010 using prestashop 1.3both encoding and font dropdowns are empty under admin/preferences/pdf. any idea where to fix this? Link to comment Share on other sites More sharing options...
tata.mata Posted June 14, 2010 Share Posted June 14, 2010 open admin/tabs/AdminPDF.phpfind $fontFiles = scandir(_PS_FPDF_PATH_.'font'); replace with $fontFiles = scandir(_PS_TCPDF_PATH_.'fonts'); and find $encodingFiles = scandir(_PS_FPDF_PATH_.'font/makefont'); replace with $encodingFiles = scandir(_PS_TCPDF_PATH_.'fonts/utils/enc'); Link to comment Share on other sites More sharing options...
tata.mata Posted June 14, 2010 Share Posted June 14, 2010 still cannot get pdf to show šđčćž Link to comment Share on other sites More sharing options...
tata.mata Posted June 14, 2010 Share Posted June 14, 2010 finally got it.edit /classes/Tools.phpFind: static public function iconv ( $from , $to , $string ) { if (function_exists('iconv')) return iconv($from, $to.'//TRANSLIT', str_replace('¬•', '¥', str_replace('¬£', '£', str_replace('‚Ǩ', '€', $string)))); return html_entity_decode(htmlentities($string, ENT_NOQUOTES, $from), ENT_NOQUOTES, $to); return $string ; } Replace with: static public function iconv ( $from , $to , $string ) { /*if (function_exists('iconv')) return iconv($from, $to.'//TRANSLIT', str_replace('¬•', '¥', str_replace('¬£', '£', str_replace('‚Ǩ', '€', $string)))); return html_entity_decode(htmlentities($string, ENT_NOQUOTES, $from), ENT_NOQUOTES, $to);*/ return $string ; } Link to comment Share on other sites More sharing options...
Abh Posted July 2, 2010 Share Posted July 2, 2010 The instructions work, except the define('_PS_TCPDF_PATH_', _PS_TOOL_DIR_.'tcpdf/'); this line, put in config.inc.php gives several path errors in 1.3.1, and that's understandable since there was nothing to replace with it. The config.inc.php does not have define('_PS_FPDF_PATH_', _PS_TOOL_DIR_.'fpdf/'); So the line should go to defines.inc.php under define('_PS_FPDF_PATH_', _PS_TOOL_DIR_.'fpdf/'); The only problem remaining si the currency symbol that doesn't show, but i replaced it with EUR from BO-Payment-Currencies and i'm satisfied with it. Link to comment Share on other sites More sharing options...
BorisK Posted July 22, 2010 Share Posted July 22, 2010 Hello everybody,I come from SLOVENIA where we use čžš like many other languages. I also set charset to UTF-8 and I try to solve the PDF problems by instructions from mstiopa for PS 1.3 RC6. I stop at first step. Oh I have to say I work on PS 1.3.1.1.In file /config/config.inc.php I can't find line define('_PS_FPDF_PATH_', _PS_TOOL_DIR_.'fpdf/'); . OK , I undarstand if line is not there I create new one and insert define('_PS_TCPDF_PATH_', _PS_TOOL_DIR_.'tcpdf/'); .I also insert or change all missing lines to suggested files but I get only empty screen when I open PDF invoice.Now question.Does anybody have clear instructions - step by step how to solve this problem.Thank you ...regardsBoris Link to comment Share on other sites More sharing options...
Abh Posted July 22, 2010 Share Posted July 22, 2010 @BorisK, maybe you should read what i wrote above you. Link to comment Share on other sites More sharing options...
BorisK Posted July 22, 2010 Share Posted July 22, 2010 Abh, I read all but still no luck :-(regardsBoris Link to comment Share on other sites More sharing options...
ezakimak Posted July 26, 2010 Share Posted July 26, 2010 Hi , I am using **Prestashop 1.2.5**Thanks for these tipsI've applied them and everyhing worked except for these issues1- the product description justification in invoices (**solved**)*** I have solved this problem , in /clases/pdf.php look for lines like this $this->MultiCell($w[0], 5, Tools::iconv('utf-8', self::encoding(), $product['product_name']), 'B'); end replace like this $this->MultiCell($w[0], 5, Tools::iconv('utf-8', self::encoding(), $product['product_name']), 'B', 'L'); there are two or three of these , the default justification in the TCPDF is 'J' justified , that was the reason, other way is to change the implementation of TCPDF::MultiCell() and leave the align argument default value to 'L' instead of 'J'.2- The japanese YEN symbol was removed (**solved**)*** to solve this look for this method in /classes/pdf.php static private function convertSign($s) { return str_replace('¥', chr(165), str_replace('£', chr(163), str_replace('€', chr(128), $s))); return $s; } and replace with static private function convertSign($s) { //return str_replace('¥', chr(165), str_replace('£', chr(163), str_replace('€', chr(128), $s))); return $s; } I dont know what side effects these changes would produce. 3- the page number/totalpagenumber numbers on the footer ( prints like this Page 1/{nb1}(**solved**)*** Solved this modifying /classes/pdf.php function _beginpage($orientation, $arg2) { parent::_beginpage($orientation, $arg2); if($this->NewPageGroup) { // start a new group $n = sizeof($this->PageGroups)+1; $alias = "{nb$n}"; $this->PageGroups[$alias] = 1; $this->CurrPageGroup = $alias; $this->NewPageGroup=false; } elseif($this->CurrPageGroup) $this->PageGroups[$this->CurrPageGroup]++; } 4- generating the invoices from BO/Orders/Invoices->Print PDF Invoices generates blank pages(**Pending**)I have attached two pfds genereated from our shop , one is the "old" pdf generated which doesnot print kanji and the new one with prints all kanji but with those issuesAny idea where should I start to look to try to solve themthanksPrestashop V1.2.5 000002-6.pdf 000002-7.pdf Link to comment Share on other sites More sharing options...
ezakimak Posted July 27, 2010 Share Posted July 27, 2010 Continuing with this ,Our shop needs to print the invoince(two copies), in order to solve this I just simple called the printing function twice, but this gave me an undesired result, I've attached the pdf generated, could anyone give a hint on what could be wrong***to call the printing function twice I changed /admin/pdf.php in line 30 if (!isset($_GET['id_order'])) die (Tools::displayError('order ID is missing')); $order = new Order(intval($_GET['id_order'])); if (!Validate::isLoadedObject($order)) die(Tools::displayError('cannot find order in database')); PDF::invoice2($order); //here i call invoice2() instead of the original invoice() and add this method to /classes/PDF.php in which I call the invoice function twice //invoice duplicado public static function invoice2($order) { $pdf = new PDF('P', 'mm', 'A4'); if (Validate::isLoadedObject($order)) { self::invoice($order, 'D', true, $pdf); self::invoice($order, 'D', true, $pdf); }; return $pdf->Output('invoices.pdf', 'D'); } removing the extra call, produces a correct pdf file. I attatched the pdfs generated calling twice and onceforgot to mention, this happened after migrating to the new pdf library, the old one was ok. invoices.pdf invoices(2).pdf Link to comment Share on other sites More sharing options...
Mat2000 Posted August 27, 2010 Share Posted August 27, 2010 Tata mata ,your solution is not working.I did all steps and i still get white screen on generating pdf.i'm using PS 1.31 Link to comment Share on other sites More sharing options...
istox Posted September 21, 2010 Share Posted September 21, 2010 Works on presta 1.3.1! Great Thanks! Followed all steps. Made few changes.1) 3. Edit the file: /config/config.inc.phpa)Find: define('_PS_FPDF_PATH_', _PS_TOOL_DIR_.'fpdf/'); Replace with: define('_PS_TCPDF_PATH_', _PS_TOOL_DIR_.'tcpdf/'); Just in /config/define.inc.php2) Find: include_once(_PS_FPDF_PATH_.'fpdf.php'); class PDF_PageGroup extends FPDF Replace with: include_once(_PS_TCPDF_PATH_.'tcpdf.php'); class PDF_PageGroup extends TCPDF Located in the Classes/pdf.php3) Find: return $font ? $font : 'Arial'; Replace with: return $font ? $font : 'dejavusans'; Also in the classes/pdf.php Freesans doesn't worked for me in correct types. Dejavusans font look great and works. Thanks fellows! I hope it can helps for 1.3.1 users. Link to comment Share on other sites More sharing options...
nima Posted October 5, 2010 Share Posted October 5, 2010 can anyone help me about presta 1.3.2 ? thanks Link to comment Share on other sites More sharing options...
ezakimak Posted October 5, 2010 Share Posted October 5, 2010 Could you be more specific ? Link to comment Share on other sites More sharing options...
WooF Posted October 23, 2010 Share Posted October 23, 2010 I try this tactic in Version 1.3.2.3 but no luck for now it look like that PDF.pdf isnt the same as in 1.3.1. versinon. I cant find the lines include_once(_PS_FPDF_PATH_.'fpdf.php'); class PDF_PageGroup extends FPDF to replace it with include_once(_PS_TCPDF_PATH_.'tcpdf.php'); class PDF_PageGroup extends TCPDF Is there any body who would upload this files to dounload them or help us to get this working thx. Link to comment Share on other sites More sharing options...
shokinro Posted October 24, 2010 Share Posted October 24, 2010 I checked the ./classes/PDF.php of Ver 1.3.2.3, the lines are there, starts from line 15 as following include_once(_PS_FPDF_PATH_.'fpdf.php'); class PDF_PageGroup extends FPDF { Please make sure you are looking into the correct file and your file has not been customized by someone before. Link to comment Share on other sites More sharing options...
WooF Posted October 24, 2010 Share Posted October 24, 2010 Thank you very much I realy dont no wat I was looking. Now it's working well just € singh looks like these �. Link to comment Share on other sites More sharing options...
WooF Posted October 29, 2010 Share Posted October 29, 2010 PLEASE HELP. I have two problems. 1.) When I migrate from FPDF to TCPDF everithing work great exept € sign looks like these �. If there is a solition for this or how to change in Eur if posible.2.) For editing invoices i use jbx_custominvoice module and it have a problem becouse of TCPDF give me error (TCPDF ERROR: Could not include font definition file: arial)How to edit jbx_custominvoice.php file to work in my shop with TCPDF?Thank you very much for any tips you my have. jbx_custominvoice.php Link to comment Share on other sites More sharing options...
xejay Posted January 20, 2011 Share Posted January 20, 2011 Need help, i have installed prestasop Version 1.3.5.0, set all configuaration tcpdf, but i cant get UTF-8 encoding. In older versions of prestashop everything works. Look in my pdf. Anyone know how to fix it? 000002.pdf Link to comment Share on other sites More sharing options...
xejay Posted January 20, 2011 Share Posted January 20, 2011 I figure out, i cahnge AdminPDF.php that i can change fonts in administration, and set cp1251 - dejavusasns and it worked. Link to comment Share on other sites More sharing options...
China Posted February 13, 2011 Share Posted February 13, 2011 Followed #45 Istox's and #37 tata.mata's tutorial.Also followed #1 blmbee's tutorial-to add/edit Line51, Line162+297, Line 498 and Line 520 in my 1.3.6.0 PDF.php file(the Lines number is different).But still get white screen on generating pdf.Can anyone please make it work for 1.3.6.0. It would be a great help.Thanks in advance! Link to comment Share on other sites More sharing options...
China Posted February 14, 2011 Share Posted February 14, 2011 I figure out, i cahnge AdminPDF.php that i can change fonts in administration, and set cp1251 - dejavusasns and it worked. hi xejay, will you please public your /classes/PDF.php here, 1.3.6.0 vision is near your 1.3.5.0 vision. 1.3.6.0 users may be enlightened by your PDF.php file. Link to comment Share on other sites More sharing options...
vuongquoc Posted February 22, 2011 Share Posted February 22, 2011 Mine after change like instruction, when i click on the PDF generator link, it says:TCPDF ERROR: Some data has already been output to browser, can't send PDF fileSo anyone know how to fix this error?I'm using the latest PS, 1.3.7Thanks. Link to comment Share on other sites More sharing options...
pjbnz Posted February 24, 2011 Share Posted February 24, 2011 I am quite new here. My prestashop version is 1.3.6.0.I am stuck with pdf files generated in Prestashop. Korean charactors in the pdf files not showing correctly, showing like ‘?? ???? ???’. I did trasnlate from English to Korean under Tools. In Korean view, all showing like ????? ??? ??? except for numbers. I could see, in Engish view, some English words which I translated from, but some Koreans still showing like ??? ???? ???. Would anyone please help me out? Link to comment Share on other sites More sharing options...
vuongquoc Posted February 27, 2011 Share Posted February 27, 2011 Everythings work ok except the font is still view "?" instead of unicode characters... (i'm using Vietnamese UTF-8)PS still not support Vietnamese PDF Invoices right? Link to comment Share on other sites More sharing options...
swankiat Posted March 30, 2011 Share Posted March 30, 2011 Mine after change like instruction, when i click on the PDF generator link, it says:TCPDF ERROR: Some data has already been output to browser, can't send PDF fileSo anyone know how to fix this error?I'm using the latest PS, 1.3.7Thanks. The way I fixed this problem is add ob_clean(); at tcpdf.php between line 8066 & 8068. Have a try! Link to comment Share on other sites More sharing options...
kelvinlym Posted April 14, 2011 Share Posted April 14, 2011 Can anyone help with Prestashop 1.4.0.17? Link to comment Share on other sites More sharing options...
lucasss Posted April 14, 2011 Share Posted April 14, 2011 I have 1.4.0.17. Got working TCPDF without errors, but printed PDFs are still missing special characters as ť or č. Do you have any idea guys? I've tried many fonts and many encodings (dejavusans/freesans with cp1250 included). Besides that, I tried all mentioned ideas/hints in this thread...Any help appreciated Link to comment Share on other sites More sharing options...
kelvinlym Posted April 15, 2011 Share Posted April 15, 2011 Hi lucasss, could you be so kind to share what changes have you done to have 1.4.0.17 working with TCPDF? The instructions here are not for the current version. Link to comment Share on other sites More sharing options...
lucasss Posted April 15, 2011 Share Posted April 15, 2011 below is quoted my post from the other thread... hey people, i’m still struggling with certain symbols as ť č í ….over the last days I’ve gathered all the available knowledge from this forum and managed to get TCPDF “working”, actually not giving me any errors, printing PDFs but still without those special characters – some fonts print out “?” instead of “č” for instance, while others keep me looking sadly on the 257th exported PDF with just space instead of the particular special character.I’m attaching all the files I’ve modified, feel free to use them & edit them. I’d appreciate your feedback whether it works for you or not, where by “it” I mean special characters, also please state your language and special characters which are working and those, which are not.These files were imported from PS 1.4.0.17, which I’m using right now.Everybody interested in this problem can reach me here or at Freenode, #prestashop.I believe we lately manage to get this tcpdf vs. utf8 tragedy working as soon as possible.PS: Please backup all your current files (which you’re planning to overwrite) if you didn’t yet, as I don’t want to be held responsible for any committed suicides after debugging… files.zip Link to comment Share on other sites More sharing options...
kelvinlym Posted April 15, 2011 Share Posted April 15, 2011 Hey lucasss,Thanks for the help. At least for me, I managed to get it to print a pdf, but the pdf only shows the logo of my shop and nothing else. At least it's an improvement for me I'll tinker around a little and see what happens. Link to comment Share on other sites More sharing options...
lucasss Posted April 15, 2011 Share Posted April 15, 2011 what language/characters do you need?you know, fonts for the TCPDF have to be changed in ...classes/PDF.php, not from the webadmin... Link to comment Share on other sites More sharing options...
Asenar Posted April 15, 2011 Share Posted April 15, 2011 Hi everyone,can someone post this as a suggestion of improvement in the forge ? If we can simply change the class to make the function compatible 100% with other language, we will add it in a future release . Then post the id here, so we could contribute Link to comment Share on other sites More sharing options...
kelvinlym Posted April 15, 2011 Share Posted April 15, 2011 Hi everyone,can someone post this as a suggestion of improvement in the forge ? If we can simply change the class to make the function compatible 100% with other language, we will add it in a future release . Then post the id here, so we could contribute Already did.http://forge.prestashop.com/browse/PSCFI-1479 Link to comment Share on other sites More sharing options...
kelvinlym Posted April 15, 2011 Share Posted April 15, 2011 what language/characters do you need?you know, fonts for the TCPDF have to be changed in ...classes/PDF.php, not from the webadmin... I'm trying to get chinese to work.Thing is, I tried the files you gave on a clean installation of Prestashop but the PDF output is still blank except for the logo. Which means even English is not 100% working on mine. Link to comment Share on other sites More sharing options...
Asenar Posted April 15, 2011 Share Posted April 15, 2011 You posted the new feature task, but there is much more in this thread : modifications to make, modified files are attached here, etc..This is much more simple for us if we have already the solution Link to comment Share on other sites More sharing options...
kelvinlym Posted April 15, 2011 Share Posted April 15, 2011 You posted the new feature task, but there is much more in this thread : modifications to make, modified files are attached here, etc..This is much more simple for us if we have already the solution The problem is, even with lucasss help from the modified files he provided, I still couldn't get it to work. I'll work on it a little more and will update if there are any breakthroughs. Link to comment Share on other sites More sharing options...
Asenar Posted April 15, 2011 Share Posted April 15, 2011 Thanks a lot, I send you a message with my gtalk / skype to see if I can help Link to comment Share on other sites More sharing options...
kelvinlym Posted April 15, 2011 Share Posted April 15, 2011 It seems to be working for me now regarding the chinese characters. PDF seems to be printing out OK. It must have been the proxy caching the old php files when I was at work.I'll post a full and detailed change here Sunday morning as I'll be away tomorrow. Credit goes to lucasss. Link to comment Share on other sites More sharing options...
naus42 Posted April 16, 2011 Share Posted April 16, 2011 It seems to be working for me now regarding the chinese characters. PDF seems to be printing out OK. It must have been the proxy caching the old php files when I was at work.I'll post a full and detailed change here Sunday morning as I'll be away tomorrow. Credit goes to lucasss. Please do post when you get a chance. I'm also having trouble getting the Chinese characters to work with PDF. Followed the TCPDF instructions so far, but still showing the characters as '?????' I'm however using 1.3.6 at the moment but considering upgrading to 1.4 Link to comment Share on other sites More sharing options...
lucasss Posted April 16, 2011 Share Posted April 16, 2011 Chinese should work right after applying those files attached earlier on version 1.4.0.17 Link to comment Share on other sites More sharing options...
kelvinlym Posted April 16, 2011 Share Posted April 16, 2011 Chinese should work right after applying those files attached earlier on version 1.4.0.17 Yes, chinese seems to be working. Currency signs like € however is not. Link to comment Share on other sites More sharing options...
kelvinlym Posted April 16, 2011 Share Posted April 16, 2011 Changes needed to make TCPDF work in Prestashop 1.4.0.17Easy way:1. Download the zip file provided by lucasss.2. Backup your admin/tabs/AdminPDF.php, classes/PDF.php, classes/Tools.php, config/config.inc.php, config/defines.inc.php3. Upload the provided files by lucasss. It should work now.The better way, for those who have modified versions of their own files.1. Changes in AdminPDF.phpFind $fontFiles = scandir(_PS_FPDF_PATH_.’font’); under /* Collect all font files and build array for combo box */ and replace with $fontFiles = scandir(_PS_TCPDF_PATH_.’fonts’); Find scandir(_PS_FPDF_PATH_.’font/makefont’); under /* Collect all encoding map files and build array for combo box */ and replace with scandir(_PS_TCPDF_PATH_.’fonts/utils/enc’); 2. Changes in PDF.phpFind include_once(_PS_FPDF_PATH_.’fpdf.php’); and replace with include_once(_PS_TCPDF_PATH_.’tcpdf.php’); Find class PDF_PageGroupCore extends FPDF and replace with class PDF_PageGroupCore extends TCPDF Find FPDF::FPDF($orientation, $unit, $format); under the __construct function and replace with parent::__construct($orientation, $unit, $format, true, ‘UTF-8′); Find ‘encoding’ => (isset($conf['PS_PDF_ENCODING_'.$isoCode]) AND $conf['PS_PDF_ENCODING_'.$isoCode] == true) ? $conf['PS_PDF_ENCODING_'.$isoCode] : ‘iso-8859-1′, under the _initpdffonts function and replace iso-8859-1 with utf-8Find ‘font’ => (isset($conf['PS_PDF_FONT_'.$isoCode]) AND $conf['PS_PDF_FONT_'.$isoCode] == true) ? $conf['PS_PDF_FONT_'.$isoCode] : ‘helvetica’ and replace with ‘font’ => ‘kozminproregular’ This means kozminproregular is always embedded. Maybe that's why lucasss couldn't get his special symbols to show?Find $this->MultiCell($w[0], 5, Tools::iconv(’utf-8′, self::encoding(), $product['product_name']), ‘B’); under the ProdReturnTab() function and replace with $this->MultiCell($w[++$i], 5, Tools::iconv(’utf-8′, self::encoding(), $product['product_name']).’ – ‘.self::l(’Customized’), ‘B’, ‘L’); But I think this is not needed.Find $this->MultiCell($w[++$i], 5, Tools::iconv(’utf-8′, self::encoding(), $product['product_name']).’ – ‘.self::l(’Customized’), ‘B’), under ProdTab function and add ‘L’ after ‘B’.Find $arr['before'] = array(’€’, ‘£’, ‘¥’); under the function convertSign($s) and replace with $arr['before'] = array(’‚Ǩ’, ‘¬£’, ‘¬•’); Find ‘iso-8859-1′ under the encoding() function and replace with ‘utf-8′ Find Arial under fontname() function and replace with kozminproregular3. Changes in Tools.phpThe changes are regarding some Currency strings, I suggest you compare it with lucasss' files and change as necessary. I don't think it is essential for tcpdf to work4. Changes in defines.inc.phpAdd define(’_PS_TCPDF_PATH_’, _PS_TOOL_DIR_.’tcpdf/’); Link to comment Share on other sites More sharing options...
lucasss Posted April 16, 2011 Share Posted April 16, 2011 I can agree on that, € sign is not working, but you can still replace it by EUR Link to comment Share on other sites More sharing options...
lucasss Posted April 17, 2011 Share Posted April 17, 2011 kozminproregular font is good for chinese as long as I know ... Link to comment Share on other sites More sharing options...
lucasss Posted April 17, 2011 Share Posted April 17, 2011 alright, lately got working all special characters. The last thing why it didn't work in my case was pdf reader, I used default one in OSX, which didn't decode it properly.... adobe reader does it perfectly.All the special characters work with freesans and dejavusans (including all subtypes of dejavusans, as for instance dejavusanscondensed)Result: everything, but € sign works... Link to comment Share on other sites More sharing options...
naus42 Posted April 18, 2011 Share Posted April 18, 2011 Thanks lucasss & kelvinlym!PDF is now working properly in Chinese. I decided to follow kelvinlym's steps since I've already modified some files earlier. I was afraid of theme compatibility issues with v1.4 so I decided to hold off the upgrade and apply the changes directly to v1.3.6 first to see if it worked. Everything works now.Thanks again!! Link to comment Share on other sites More sharing options...
Lotus Ong Posted April 21, 2011 Share Posted April 21, 2011 If you want to display Chinese Simplified , you should use stsongstdlight font. Link to comment Share on other sites More sharing options...
Endrik Posted April 28, 2011 Share Posted April 28, 2011 how to change € sign to EUR, at the moment there's just ? Link to comment Share on other sites More sharing options...
lucasss Posted May 1, 2011 Share Posted May 1, 2011 go to admin backend, then Payment / Currencies / Choose EUR Currency / Click the edit button, then change "Symbol" from € to EUR and Apply. Link to comment Share on other sites More sharing options...
Endrik Posted May 1, 2011 Share Posted May 1, 2011 go to admin backend, then Payment / Currencies / Choose EUR Currency / Click the edit button, then change "Symbol" from € to EUR and Apply. thanks! Link to comment Share on other sites More sharing options...
kelvinlym Posted May 2, 2011 Share Posted May 2, 2011 Heads up on 1.4.10Tools.php from lucasss will break 1.4.10Proceed with caution Link to comment Share on other sites More sharing options...
xydong Posted May 18, 2011 Share Posted May 18, 2011 请教一下,1.4.1版本的要怎样才能正常显示中文发票么 Link to comment Share on other sites More sharing options...
Endrik Posted May 18, 2011 Share Posted May 18, 2011 请教一下,1.4.1版本的要怎样才能正常显示中文发票么 Maybe it's better if you write in English:D请教一下,1.4.1版本的要怎样才能正常显示中文发票么 = Asking about 1.4.1 version, how to properly display Chinese invoice Link to comment Share on other sites More sharing options...
lucasss Posted June 11, 2011 Share Posted June 11, 2011 working on the update for 1.4.2.5. Should anyone have it earlier, don't be shy to share Link to comment Share on other sites More sharing options...
lucasss Posted June 11, 2011 Share Posted June 11, 2011 spent the day playing with that...still getting this error:Strict Standards: Declaration of PDF_PageGroupCore::_beginpage() should be compatible with that of TCPDF::_beginpage() in /home/*my_user*/*my_website*/_/classes/PDF.php on line 31 Strict Standards: Declaration of PDF_PageGroupCore::StartPageGroup() should be compatible with that of TCPDF::startPageGroup() in /home/*my_user*/*my_website*/_/classes/PDF.php on line 31 TCPDF ERROR: Some data has already been output, can't send PDF fileAny help appreciated!Thanks Link to comment Share on other sites More sharing options...
Asenar Posted June 23, 2011 Share Posted June 23, 2011 Hi,sorry I didn't answered soonerbeginpage and startpagegroup should be declared like that (according to the original PDF.php ) : function _beginpage($orientation, $arg2) function StartPageGroup() You can also notice the change of line 554 : if ($h['id_order_state'] == Configuration::get('PS_OS_SHIPPING')) Please give me feedback about that, if this still doesn't work, I will follow your tutorial and try to see what is missing.Regards, Link to comment Share on other sites More sharing options...
Senjaman Posted June 24, 2011 Share Posted June 24, 2011 I uploaded the files provided by lucasss but I still got this error :TCPDF ERROR: Could not include font definition file: arialPrestashop 1.4.2.5 Link to comment Share on other sites More sharing options...
lucasss Posted June 24, 2011 Share Posted June 24, 2011 arial is not available by default as far as i knowyou should use as "font" dejavusans or freesans, try to replace one or two "arial" matches in PDF.php with the fonts I mentioned, it could probably start working.however, i'm out of home for 2 days for work. will catch ya later hopefully Link to comment Share on other sites More sharing options...
istox Posted June 25, 2011 Share Posted June 25, 2011 Any news for 1.4.3 version?Can't see right encoding for cyrilic Link to comment Share on other sites More sharing options...
Senjaman Posted June 26, 2011 Share Posted June 26, 2011 My language is chinese so i replaced all "arial" occurences by "stsongstdlight" but i have this error and can't understand why.TCPDF ERROR: Could not include font definition file: arialcan someone give me a fix for prestashop 1.4.2.5it would be great if prestashop could includ TCPDF instead of FPDF Link to comment Share on other sites More sharing options...
Senjaman Posted June 29, 2011 Share Posted June 29, 2011 TCPDF doesn't work. Please help me I just miss chinese invoices to launch my shop online.I tried another solution here http://www.prestashop.com/forums/viewthread/116718/general_discussion/how_to_add_a_new_font_in_fpdf_ but I need a hand too to make it works. Link to comment Share on other sites More sharing options...
Senjaman Posted July 7, 2011 Share Posted July 7, 2011 I finally fixed it yesterday.My 1st problem was this error message :TCPDF ERROR: Could not include font definition file: arialthis was due to the name of arial font in the archive of tcpdf I downloaded, it was named arialunicid0.php, I renamed it arial.php and it works.The 2nd problem was with encoding, I just replaced the line 'encoding' => (isset($conf['PS_PDF_ENCODING_'.$isoCode]) AND $conf['PS_PDF_ENCODING_'.$isoCode] == true) ? $conf['PS_PDF_ENCODING_'.$isoCode] : 'utf-8',with'encoding' => 'utf-8',under the _initPDFFonts() function in PDF.phpAnd now it works perfectly !!! Link to comment Share on other sites More sharing options...
lucasss Posted July 7, 2011 Share Posted July 7, 2011 congratulations! Link to comment Share on other sites More sharing options...
majinkun180 Posted July 8, 2011 Share Posted July 8, 2011 I'm probably asking a newbie question but does this fix work for Japanese too? Link to comment Share on other sites More sharing options...
majinkun180 Posted July 8, 2011 Share Posted July 8, 2011 So I went ahead and tried to do the fixes that Kevin suggested but I couldn't figure out the third step 3. Changes in Tools.phpThe changes are regarding some Currency strings, I suggest you compare it with lucasss’ files and change as necessary. I don’t think it is essential for tcpdf to workso I left it blank.After finishing what I can, every time I click the invoice/delivery slip I just get a blank screen. Is it because I didn't do anything for the tools.php?I'm using the newest 1.4.3.Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts