cmc-sales/views/quotes/pdf.ctp

110 lines
2 KiB
Plaintext
Raw Normal View History

<?php
2009-10-10 00:06:46 -07:00
App::import('Vendor','xtcpdf');
//App::import('Vendor', 'tcpdf/tcpdf');
//
//
$tcpdf = new XTCPDF();
2009-10-10 00:06:46 -07:00
//$tcpdf = new TCPDF();
$textfont = 'times'; // looks better, finer, and more condensed than 'dejavusans'
$tcpdf->SetTopMargin(0);
$tcpdf->SetAuthor("CMC Technologies");
2009-10-08 22:07:50 -07:00
$tcpdf->SetTitle("CMC Technologies Quote");
$tcpdf->SetAutoPageBreak( false );
$tcpdf->setHeaderFont(array($textfont,'',40));
$tcpdf->xheadercolor = array(150,0,0);
$tcpdf->xheadertext = 'CMC TECHNOLOGIES';
$tcpdf->xfootertext = 'Copyright © %d CMC Technologies. All rights reserved.';
2009-10-10 00:06:46 -07:00
//$tcpdf->Header();
//
// Now you position and print your page content
// example:
2009-10-08 22:07:50 -07:00
/*$tcpdf->SetTextColor(0, 0, 0);
$tcpdf->SetFont($textfont,'B',20);
$tcpdf->Cell(0,14, "Hello World", 0,1,'L');
2009-10-08 22:07:50 -07:00
*/
2009-10-08 22:07:50 -07:00
$tcpdf->AddPage();
$tcpdf->DetailsBox();
2009-10-08 22:07:50 -07:00
$content = <<<ENDCONTENT
<p>
Dear Bill,</p>
<p style="text-align: center;">
<br />
<strong>RE: Awesome Products</strong></p>
<p>
Thank you for your enquiry regarding our Awesome Products. Please see the following quotation for:</p>
2009-10-08 22:07:50 -07:00
<table align="center" border="0" cellpadding="1" cellspacing="1" style="width: 100%;">
<tbody>
<tr>
<td>Item</td>
<td>Product</td>
2009-10-08 22:07:50 -07:00
</tr>
<tr>
<td>1.0</td>
<td>A Product (TM)</td>
2009-10-08 22:07:50 -07:00
</tr>
<tr>
<td>2.0</td>
<td>Another Product</td>
2009-10-08 22:07:50 -07:00
</tr>
</tbody>
</table>
<p>
&nbsp;</p>
<p>
Regards,</p>
<p>
<br />
Sales Engineer</p>
<p>
&nbsp;</p>
<p>
Attachments:</p>
<p>
<em>attachment1.pdf </em><br />
<em>attachment2.pdf</em></p>
<p>
&nbsp;</p>
<p>
&nbsp;</p>
<p>
&nbsp;</p>
<p>
&nbsp;</p>
<p>
&nbsp;</p>
2009-10-08 22:07:50 -07:00
ENDCONTENT;
$currentX = $tcpdf->GetX();
$currentY = $tcpdf->GetY();
2009-10-08 22:07:50 -07:00
$tcpdf->SetTextColor(0);
$tcpdf->SetFont('times', '', 12);
$tcpdf->writeHTMLCell(0, 0, $currentX, $currentY+5, $content, 'LTRB', 1, 0, true, 'L', true);
2009-10-08 22:07:50 -07:00
2009-10-10 00:06:46 -07:00
$tcpdf->AddPage();
2009-10-08 22:07:50 -07:00
$tcpdf->AddPage();
2009-10-10 00:06:46 -07:00
2009-10-08 22:07:50 -07:00
$tcpdf->AliasNbPages();
2009-10-10 00:06:46 -07:00
$tcpdf->lastPage();
$tcpdf->Output('/home/karl/public_html/cake/quotenik-working/webroot/pdf/filename2.pdf', 'F');
2009-10-10 00:06:46 -07:00
//$tcpdf->Output('cmcquote.pdf', 'D');
?>