Debug pdf (calculation of free text height)
This commit is contained in:
parent
58d1bdfbce
commit
ebe11cde51
3 changed files with 7 additions and 5 deletions
|
|
@ -339,6 +339,8 @@ function pdfGetHeightForHtmlContent(&$pdf, $htmlcontent)
|
|||
{
|
||||
// store current object
|
||||
$pdf->startTransaction();
|
||||
// To avoid pagebreak effect or strange behavior of writeHTMLCell when we are out of page, we imagine we are at the begin of page to test the height of the text
|
||||
$pdf->setY(0);
|
||||
// store starting values
|
||||
$start_y = $pdf->GetY();
|
||||
//var_dump($start_y);
|
||||
|
|
@ -1212,7 +1214,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
|
|||
$pdf->SetDrawColor(224, 224, 224);
|
||||
// Option for footer text color
|
||||
if (getDolGlobalString('PDF_FOOTER_TEXT_COLOR')) {
|
||||
list($r, $g, $b) = sscanf($conf->global->PDF_FOOTER_TEXT_COLOR, '%d, %d, %d');
|
||||
list($r, $g, $b) = sscanf(getDolGlobalString('PDF_FOOTER_TEXT_COLOR'), '%d, %d, %d');
|
||||
$pdf->SetTextColor($r, $g, $b);
|
||||
}
|
||||
|
||||
|
|
@ -1231,7 +1233,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
|
|||
$freetextheight = $pdf->getStringHeight($width, $line);
|
||||
} else {
|
||||
$freetextheight = pdfGetHeightForHtmlContent($pdf, dol_htmlentitiesbr($line, 1, 'UTF-8', 0)); // New method (works for HTML content)
|
||||
//print '<br>'.$freetextheight;exit;
|
||||
//print '<br>'.$freetextheight;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -831,7 +831,7 @@ class pdf_crabe extends ModelePDFFactures
|
|||
} else {
|
||||
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
|
||||
}
|
||||
$this->_pagefoot($pdf, $object, $outputlangs, 1, $this->getHeightForQRInvoice($pagenb, $object, $langs));
|
||||
$this->_pagefoot($pdf, $object, $outputlangs, 1, $this->getHeightForQRInvoice($pagenb, $object, $outputlangs));
|
||||
$pagenb++;
|
||||
$pdf->setPage($pagenb);
|
||||
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
||||
|
|
@ -849,7 +849,7 @@ class pdf_crabe extends ModelePDFFactures
|
|||
} else {
|
||||
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
|
||||
}
|
||||
$this->_pagefoot($pdf, $object, $outputlangs, 1, $this->getHeightForQRInvoice($pagenb, $object, $langs));
|
||||
$this->_pagefoot($pdf, $object, $outputlangs, 1, $this->getHeightForQRInvoice($pagenb, $object, $outputlangs));
|
||||
// New page
|
||||
$pdf->AddPage();
|
||||
if (!empty($tplidx)) {
|
||||
|
|
|
|||
|
|
@ -343,7 +343,7 @@ class pdf_sponge extends ModelePDFFactures
|
|||
$this->heightforfreetext = getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT', 5); // Height reserved to output the free text on last page
|
||||
$this->heightforfooter = $this->marge_basse + (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') ? 12 : 22); // Height reserved to output the footer (value include bottom margin)
|
||||
|
||||
$heightforqrinvoice = $heightforqrinvoice_firstpage = 0;
|
||||
$heightforqrinvoice = 0;
|
||||
if (getDolGlobalString('INVOICE_ADD_SWISS_QR_CODE') == 'bottom') {
|
||||
if ($this->getHeightForQRInvoice(1, $object, $langs) > 0) {
|
||||
// Shrink infotot to a base 30
|
||||
|
|
|
|||
Loading…
Reference in a new issue