From b57232bd249e6f52199a9d3b64eac49c98008efe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 Aug 2009 17:40:13 +0000 Subject: [PATCH] Restore old behaviour for free text using a manual break because new one has several bugs: * Text must not start before left margin (text truncated on some printers). * Autowrap works iif there is two lines but not more. * A blank line is wasted. * Break is sometimes wrong, sometimes good dependin if there is special char or not in text. * There is no way to choose how to format/wrap text. Manual choice make user to free to wrap where he wants. --- htdocs/lib/pdf.lib.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/htdocs/lib/pdf.lib.php b/htdocs/lib/pdf.lib.php index 2bfa670eb0d..f7fc6f6e9db 100644 --- a/htdocs/lib/pdf.lib.php +++ b/htdocs/lib/pdf.lib.php @@ -176,15 +176,18 @@ 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 - $nbofligne=dol_nboflines_bis($ligne); + $nbofligne=dol_nboflines_bis($ligne); + //print 'nbofligne='.$nbofligne; exit; //print 'e'.$ligne.'t'.dol_nboflines($ligne);exit; - $posy=$marge_basse + ($nbofligne*4) + ($ligne1?3:0) + ($ligne2?3:0); + $posy=$marge_basse + ($nbofligne*3) + ($ligne1?3:0) + ($ligne2?3:0); if ($ligne) // Free text { - $pdf->SetXY($marge_gauche-5,-$posy); - $pdf->MultiCell(200, 3, $ligne, 0, 'C', 0); // Use a large value 20000, to not have automatic wrap. This make user understand, he need to add CR on its text. - $posy-=($nbofligne*4); // 6 of ligne + 3 of MultiCell + $pdf->SetXY($marge_gauche,-$posy); + $width=20000; $align='L'; // By default, ask a manual break: We use a large value 20000, to not have automatic wrap. This make user understand, he need to add CR on its text. + if ($conf->global->MAIN_USE_AUTOWRAP_ON_FREETEXT) { $width=200; $align='C'; } + $pdf->MultiCell($width, 3, $ligne, 0, $align, 0); + $posy-=($nbofligne*3); // 6 of ligne + 3 of MultiCell } $pdf->SetY(-$posy); @@ -193,14 +196,14 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass if ($ligne1) { - $pdf->SetXY($marge_gauche-5,-$posy); + $pdf->SetXY($marge_gauche,-$posy); $pdf->MultiCell(200, 2, $ligne1, 0, 'C', 0); } if ($ligne2) { $posy-=3; - $pdf->SetXY($marge_gauche-5,-$posy); + $pdf->SetXY($marge_gauche,-$posy); $pdf->MultiCell(200, 2, $ligne2, 0, 'C', 0); }