diff --git a/htdocs/lib/company.lib.php b/htdocs/lib/company.lib.php index c91a725e7c4..61bbe0f2d94 100644 --- a/htdocs/lib/company.lib.php +++ b/htdocs/lib/company.lib.php @@ -804,13 +804,15 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass $pdf->SetDrawColor(224,224,224); // On positionne le debut du bas de page selon nbre de lignes de ce bas de page - $posy=$marge_basse + 1 + ($ligne?6:0) + ($ligne1?3:0) + ($ligne2?3:0); + $nbofligne=dol_nboflines($ligne); + //print 'e'.$ligne.'t'.dol_nboflines($ligne);exit; + $posy=$marge_basse + ($nbofligne*3) + ($ligne1?3:0) + ($ligne2?3:0); if ($ligne) { $pdf->SetXY($marge_gauche,-$posy); $pdf->MultiCell(190, 3, $ligne, 0, 'L', 0); - $posy-=9; // 6 of ligne + 3 of MultiCell + $posy-=($nbofligne*3); // 6 of ligne + 3 of MultiCell } $pdf->SetY(-$posy); diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index afb044126d4..cddf5355ff2 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -2529,13 +2529,14 @@ function dol_string_is_good_iso($s) /** - * \brief Return nb of lines of a text + * \brief Return nb of lines of a clear text * \param s String to check * \param maxchar Not yet used - * \return int 0 if bad iso, 1 if good iso + * \return int Number of lines */ function dol_nboflines($s,$maxchar=0) { + if ($s == '') return 0; $arraystring=split("\n",$s); $nb=sizeof($arraystring); @@ -2544,12 +2545,12 @@ function dol_nboflines($s,$maxchar=0) /** - * \brief Fonction retournant le nombre de lignes dans un texte formate - * \param texte Texte + * \brief Return nb of lines of a formated text with \n and
+ * \param texte Text * \param maxlinesize Largeur de ligne en caracteres(ou 0 si pas de limite - defaut) - * \return nblines Nombre de lignes + * \return int Number of lines */ -function num_lines($texte,$maxlinesize=0) +function dol_nboflines_bis($texte,$maxlinesize=0) { $repTable = array("\t" => " ", "\n" => "
", "\r" => " ", "\0" => " ", "\x0B" => " "); $texte = strtr($texte, $repTable);