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 "

$pageNo

"; - print_r($page); + // print_r($page); //Start Printing Product cells, until we run out of room. Then continue on the next page @@ -485,7 +493,7 @@ ENDPRODUCT; * */ - + $this->totals($currency, $subTotal, $gst); $this->commercialComments($commercialDetails); @@ -578,7 +586,7 @@ ENDHTMLCONTENTS; function termsAndConditions() { - + @@ -588,7 +596,7 @@ ENDHTMLCONTENTS; function totals($currency, $subTotal, $gst) { - $itemColwidth = 12; + $itemColwidth = 12; $qtyColwidth = 10; $descColwidth = 120; $unitpriceColwidth = 25; diff --git a/views/quotes/pdf.ctp b/views/quotes/pdf.ctp index 4dce1947..81c33041 100755 --- a/views/quotes/pdf.ctp +++ b/views/quotes/pdf.ctp @@ -1,5 +1,6 @@ Wrote: ".$output_dir.$filename; //$tcpdf->Output('cmcquote.pdf', 'D'); +App::import('Vendor', 'xfpdi'); + + +//$newpdf = new concat_pdf(); + +$newpdf = new XFPDI(); + +$newpdf->SetMargins(2, 2); +$newpdf->setPrintHeader(false); +$newpdf->setPrintFooter(false); + +$newpdf->setFiles(array($output_dir.$filename, $output_dir.'CMC_terms_and_conditions2006_A4.pdf')); +$newpdf->concat(); +$newpdf->Output($output_dir.$filename, "F"); ?> \ No newline at end of file