diff --git a/vendors/xtcpdf.php b/vendors/xtcpdf.php
index cc3405bf..ec5fd6a8 100755
--- a/vendors/xtcpdf.php
+++ b/vendors/xtcpdf.php
@@ -1,7 +1,9 @@
";
- if($heightLeft - ($commDetailsHeight + $totalsHeight) <= 0) {
- echo "
Need a new page for last item and commercial comments";
+
+
+ if($heightLeft - $totalsHeight <= 0) {
+ echo "
Need a new page for last item and totals";
array_pop($pageProducts[$pagesRequired]);
$pagesRequired++;
$heightLeft = $availableHeight;
- $heightLeft -= $commDetailsHeight;
+ $heightLeft -= $totalsHeight;
$pageProducts[$pagesRequired][] = $product[$docType]['id'];
}
+ if($heightLeft - $commDetailsHeight <= 0) {
+ $pagesRequired++;
+ }
+
debug($pageProducts);
return $pageProducts;
@@ -380,7 +388,7 @@ ENDPRODUCT;
$subTotal = 0;
-
+ print_r($pageProducts);
foreach ($pageProducts as $page) {
$this->AddPage();
@@ -416,7 +424,7 @@ ENDPRODUCT;
echo "