diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 3b61a3150b5..a1885cbba14 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -839,7 +839,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass } // Show page nb only on iso languages (so default Helvetica font) - if (pdf_getPDFFont($outputlangs) == 'Helvetica') + if (mb_strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica') { $pdf->SetXY(-20,-$posy); //print 'xxx'.$pdf->PageNo().'-'.$pdf->getAliasNbPages().'-'.$pdf->getAliasNumPage();exit; diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index 6a0feda2e9d..3aaae21aa11 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2011 Fabrice CHERRIER + * Copyright (C) 2013 Cédric Salvador * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -93,15 +94,15 @@ class pdf_soleil extends ModelePDFFicheinter } /** - * Function to build pdf onto disk - * - * @param int $object Id of object to generate - * @param object $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1=OK, 0=KO + * Function to build pdf onto disk + * + * @param int $object Id of object to generate + * @param object $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int $hidedetails Do not show line details + * @param int $hidedesc Do not show desc + * @param int $hideref Do not show ref + * @return int 1=OK, 0=KO */ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) { @@ -118,7 +119,7 @@ class pdf_soleil extends ModelePDFFicheinter if ($conf->ficheinter->dir_output) { - $object->fetch_thirdparty(); + $object->fetch_thirdparty(); $objectref = dol_sanitizeFileName($object->ref); $dir = $conf->ficheinter->dir_output; @@ -136,25 +137,25 @@ class pdf_soleil extends ModelePDFFicheinter if (file_exists($dir)) { - $pdf=pdf_getInstance($this->format); - $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance - $heightforinfotot = 50; // Height reserved to output the info and total part - $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page - $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) - $pdf->SetAutoPageBreak(1,0); + $pdf=pdf_getInstance($this->format); + $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance + $heightforinfotot = 50; // Height reserved to output the info and total part + $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page + $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) + $pdf->SetAutoPageBreak(1,0); - if (class_exists('TCPDF')) - { - $pdf->setPrintHeader(false); - $pdf->setPrintFooter(false); - } - $pdf->SetFont(pdf_getPDFFont($outputlangs)); - // Set path to the background PDF File - if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) - { - $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); - $tplidx = $pdf->importPage(1); - } + if (class_exists('TCPDF')) + { + $pdf->setPrintHeader(false); + $pdf->setPrintFooter(false); + } + $pdf->SetFont(pdf_getPDFFont($outputlangs)); + // Set path to the background PDF File + if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) + { + $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); + $tplidx = $pdf->importPage(1); + } $pdf->Open(); $pagenb=0; @@ -175,7 +176,6 @@ class pdf_soleil extends ModelePDFFicheinter $pagenb++; $this->_pagehead($pdf, $object, 1, $outputlangs); $pdf->SetFont('','', $default_font_size - 1); - $pdf->MultiCell(0, 3, ''); // Set interline to 3 $pdf->SetTextColor(0,0,0); $tab_top = 90; @@ -215,7 +215,6 @@ class pdf_soleil extends ModelePDFFicheinter $pdf->SetFont('', '', $default_font_size - 1); - $pdf->MultiCell(0, 3, ''); // Set interline to 3 $pdf->SetXY($this->marge_gauche, $tab_top + 8); $text=$object->description; if ($object->duree > 0) @@ -231,8 +230,6 @@ class pdf_soleil extends ModelePDFFicheinter $pdf->line($this->marge_gauche, $nexY, $this->page_largeur-$this->marge_droite, $nexY); - $pdf->MultiCell(0, 2, ''); // Set interline to 3. Then writeMultiCell must use 3 also. - $nblines = count($object->lines); // Loop on each lines @@ -248,14 +245,14 @@ class pdf_soleil extends ModelePDFFicheinter $pdf->SetTextColor(0,0,0); $pdf->setTopMargin($tab_top_newpage); - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext/*+$heightforinfotot*/); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); // Description of product line $txt=''.dol_htmlentitiesbr($outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true)." - ".$outputlangs->transnoentities("Duration")." : ".convertSecondToTime($objectligne->duration),1,$outputlangs->charset_output).''; $desc=dol_htmlentitiesbr($objectligne->desc,1); - $pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txt,$desc), 0, 1, 0); + $pdf->writeHTMLCell(0, 0, $curX, $curY + 1, dol_concatdesc($txt,$desc), 0, 1, 0); $nexY = $pdf->GetY(); $pageposafter=$pdf->getPage(); @@ -276,26 +273,27 @@ class pdf_soleil extends ModelePDFFicheinter $pdf->setPage($pagenb); if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext, 0, $outputlangs, 0, 1); } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter - $heightforfreetext, 0, $outputlangs, 1); } $this->_pagefoot($pdf,$object,$outputlangs,1); $pagenb++; $pdf->setPage($pagenb); + $this->_pagehead($pdf, $object, 0, $outputlangs); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. } if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) { if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext, 0, $outputlangs, 0, 1); } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter - $heightforfreetext, 0, $outputlangs, 1, 1); } $this->_pagefoot($pdf,$object,$outputlangs,1); // New page @@ -309,12 +307,12 @@ class pdf_soleil extends ModelePDFFicheinter // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfreetext - $heightforfooter - 50, 0, $outputlangs, 0, 0); $bottomlasttab=$this->page_hauteur - $heightforfooter - $heightforfooter + 1; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfreetext - $heightforfooter - 50, 0, $outputlangs, 1, 0); $bottomlasttab=$this->page_hauteur - $heightforfooter - $heightforfooter + 1; } @@ -322,7 +320,6 @@ class pdf_soleil extends ModelePDFFicheinter if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); $pdf->Close(); - $pdf->Output($file,'F'); if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); @@ -360,9 +357,6 @@ class pdf_soleil extends ModelePDFFicheinter { global $conf; - // Force to disable hidetop and hidebottom - $hidebottom=0; - if ($hidetop) $hidetop=-1; $default_font_size = pdf_getPDFFontSize($outputlangs); /* @@ -392,7 +386,7 @@ class pdf_soleil extends ModelePDFFicheinter */ // Output Rect - $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height+3, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param + $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height+1, 0, 0); // Rect prend une longueur en 3eme param et 4eme param if (empty($hidebottom)) { @@ -591,7 +585,7 @@ class pdf_soleil extends ModelePDFFicheinter /** * Show footer of page. Need this->emetteur object - * + * * @param PDF &$pdf PDF * @param Object $object Object to show * @param Translate $outputlangs Object lang for output