Spaces writing a PDF file from PHP with TCPDF -
this question exact duplicate of:
- write space tcpdf pdf file 3 answers
i must write dynamic data sent form post method , script should write list of element, divided blank line in pdf file.
the code is:
<?php require_once('libs/tcpdf/config/lang/ita.php'); require_once('libs/tcpdf/tcpdf.php'); // create new pdf document $pdf = new tcpdf(pdf_page_orientation, pdf_unit, pdf_page_format, true, 'utf-8', false); // set document information $pdf->setcreator(pdf_creator); $pdf->setauthor('label creator'); $pdf->settitle('labels'); $pdf->setsubject('labels di prova'); $pdf->setkeywords('tcpdf, pdf, example, test, guide'); // set default monospaced font $pdf->setdefaultmonospacedfont(pdf_font_monospaced); $pdf->setprintheader(false); $pdf->setprintfooter(false); //set auto page breaks $pdf->setautopagebreak(true,0); //set image scale factor $pdf->setimagescale(pdf_image_scale_ratio); //set language-dependent strings $pdf->setlanguagearray($l); // set font $pdf->setfont('times', '', 10); //imposto il margine sinistro 30mm $pdf->setmargins(18,15,18,false); // add page $pdf->addpage(); //$pdf->write(0, 'example of html tables', '', 0, 'l', true, 0, false, false, 0); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// for($i=0;$i<count($_post['article']);$i++) { $j=0; while($j<$_post['qnt'][$i]) { $label= 'art.: '.ucfirst($_post['article'][$i]). 'colore: '.ucfirst($_post['colore'][$i]). 'fondo: '.ucfirst($_post['fondo'][$i]). 'numero: '.$_post['numero'][$i]; $pdf->cell(0, 0 , $label, 0, 1, 'c', 0, '', 0,false,'t','m',0, 1, 'c', 0, ''); $pdf->cell(0, 0 , $label, 0, 1, 'c', 0, '', 0,false,'t','m',0, 1, 'c', 0, ''); } } //close , output pdf document $pdf->output('../../labels.pdf', 'f'); echo 'generated'; ?>
however, in pdf have words near each other without spaces! i've check lot of times correct syntax of library looks okay. suggestions?
i've found solution. it bug of chrome on linux systems!
Comments
Post a Comment