PDF T and C concat working
This commit is contained in:
parent
abeca8a3a9
commit
9fd2507c46
22
vendors/xtcpdf.php
vendored
22
vendors/xtcpdf.php
vendored
|
|
@ -1,7 +1,9 @@
|
|||
<?php
|
||||
|
||||
App::import('Vendor','tcpdf/tcpdf');
|
||||
|
||||
class XTCPDF extends TCPDF {
|
||||
|
||||
class XTCPDF extends TCPDF {
|
||||
|
||||
var $xheadertext = 'PDF created using CakePHP and TCPDF';
|
||||
var $xheadercolor = array(0,0,200);
|
||||
|
|
@ -336,15 +338,21 @@ ENDPRODUCT;
|
|||
|
||||
echo "Currently have $heightLeft Comm details height is ".$commDetailsHeight." totals height is: ".$totalsHeight."<br>";
|
||||
|
||||
if($heightLeft - ($commDetailsHeight + $totalsHeight) <= 0) {
|
||||
echo "<br>Need a new page for last item and commercial comments";
|
||||
|
||||
|
||||
if($heightLeft - $totalsHeight <= 0) {
|
||||
echo "<br>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 "<h2>$pageNo</h2>";
|
||||
print_r($page);
|
||||
// print_r($page);
|
||||
|
||||
//Start Printing Product cells, until we run out of room. Then continue on the next page
|
||||
|
||||
|
|
@ -588,7 +596,7 @@ ENDHTMLCONTENTS;
|
|||
|
||||
function totals($currency, $subTotal, $gst) {
|
||||
|
||||
$itemColwidth = 12;
|
||||
$itemColwidth = 12;
|
||||
$qtyColwidth = 10;
|
||||
$descColwidth = 120;
|
||||
$unitpriceColwidth = 25;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
$tcpdf = new XTCPDF('P', 'mm', 'A4', true, false, 'UTF-8');
|
||||
|
||||
|
||||
|
|
@ -121,5 +122,19 @@ echo "<br> 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");
|
||||
|
||||
?>
|
||||
Loading…
Reference in a new issue