PDF T and C concat working

This commit is contained in:
Karl Cordes 2010-03-04 09:23:28 +11:00
parent abeca8a3a9
commit 9fd2507c46
2 changed files with 32 additions and 9 deletions

26
vendors/xtcpdf.php vendored
View file

@ -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
@ -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;

View file

@ -1,5 +1,6 @@
<?php
App::import('Vendor','xtcpdf');
@ -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");
?>