121 lines
2.1 KiB
PHP
121 lines
2.1 KiB
PHP
<?php
|
|
App::import('Vendor','xtcpdf');
|
|
//App::import('Vendor', 'tcpdf/tcpdf');
|
|
//
|
|
//
|
|
$tcpdf = new XTCPDF();
|
|
|
|
//$tcpdf = new TCPDF();
|
|
|
|
$textfont = 'times'; // looks better, finer, and more condensed than 'dejavusans'
|
|
|
|
//$tcpdf->SetTopMargin();
|
|
//$tcpdf->SetLeftMargin(29);
|
|
//$tcpdf->SetMargins(1, 1);
|
|
|
|
|
|
$tcpdf->SetAuthor("CMC Technologies");
|
|
$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.';
|
|
|
|
$tcpdf->setPrintHeader(false);
|
|
$tcpdf->setPrintFooter(false);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Now you position and print your page content
|
|
// example:
|
|
/*$tcpdf->SetTextColor(0, 0, 0);
|
|
$tcpdf->SetFont($textfont,'B',20);
|
|
$tcpdf->Cell(0,14, "Hello World", 0,1,'L');
|
|
*/
|
|
|
|
$tcpdf->AddPage();
|
|
$tcpdf->Page1Header();
|
|
|
|
$tcpdf->DetailsBox();
|
|
$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>
|
|
|
|
<table align="center" border="0" cellpadding="1" cellspacing="1" style="width: 100%;">
|
|
<tbody>
|
|
<tr>
|
|
<td>Item</td>
|
|
<td>Product</td>
|
|
</tr>
|
|
<tr>
|
|
<td>1.0</td>
|
|
<td>A Product (TM)</td>
|
|
</tr>
|
|
<tr>
|
|
<td>2.0</td>
|
|
<td>Another Product</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>
|
|
</p>
|
|
<p>
|
|
Regards,</p>
|
|
<p>
|
|
<br />
|
|
Sales Engineer</p>
|
|
<p>
|
|
</p>
|
|
<p>
|
|
Attachments:</p>
|
|
<p>
|
|
<em>attachment1.pdf </em><br />
|
|
<em>attachment2.pdf</em></p>
|
|
<p>
|
|
</p>
|
|
<p>
|
|
</p>
|
|
<p>
|
|
</p>
|
|
<p>
|
|
</p>
|
|
<p>
|
|
</p>
|
|
|
|
|
|
ENDCONTENT;
|
|
|
|
$currentX = $tcpdf->GetX();
|
|
$currentY = $tcpdf->GetY();
|
|
|
|
$tcpdf->SetTextColor(0);
|
|
$tcpdf->SetFont('times', '', 12);
|
|
|
|
|
|
$tcpdf->writeHTMLCell(0, 0, $currentX, $currentY+5, $content, 'LTRB', 1, 0, true, 'L', true);
|
|
|
|
$tcpdf->AddPage();
|
|
|
|
$tcpdf->AddPage();
|
|
|
|
|
|
|
|
$tcpdf->AliasNbPages();
|
|
$tcpdf->lastPage();
|
|
$tcpdf->Output('/home/karl/public_html/cake/quotenik-working/webroot/pdf/filename2.pdf', 'F');
|
|
|
|
//$tcpdf->Output('cmcquote.pdf', 'D');
|
|
|
|
|
|
|
|
|
|
?>
|