Hi,
to insert a page break only, you need somethink like:
$pdf->AddPage('','',true);
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pageposbefore+1);
$curY = $tab_top_newpage;
But in that position the remaining content will jump to the next page also.
You must copy the “Affiche Note” section to new position behind “Affiche zone infos” and add some condition for non duplicate the note on print. I did it like that:
1- Set a new parameter at Home -> Setup -> Other :
Value: 0 or 1
Comment: Public Note position 0 for above or 1 for below product list box position
2- Use MAIN_PDF_PUBLICNOTE_POSITION as condition for both Public Note code block:
LINE 246
if (! isset($conf->global->MAIN_PDF_PUBLICNOTE_POSITION) || empty($conf->global->MAIN_PDF_PUBLICNOTE_POSITION))
{
$note_position = 0;
}
else
{
$note_position = $conf->global->MAIN_PDF_PUBLICNOTE_POSITION;
}
if ($note_position = 0)
{
if (! empty($object->note_public))
{
...... // Rest of Public Note code
}
}
LINE xxx (second block)
if ($note_position =1)
{
if (! empty($object->note_public))
{
......
// Add page break
$tab_top = 90;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
$tab_height = 130;
$tab_height_newpage = 150;
$this->_pagefoot($pdf,$object,$outputlangs,1);
$pdf->AddPage('','',true);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pageposbefore+1);
..........
// Rest of Public Note code
}
}
The code above only force a page break when note is set below product box list. Howerver I added more code to condition page break to height of the content note result, regarding the space remaining to bottom margin but function pdfGetHeightForHtmlContent($pdf, dol_htmlentitiesbr($notetoshow)) did not give me a reliable value to use in for a while.
I hope this help you a lot




