本文整理汇总了PHP中Zend_Pdf_Page::setFont方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Pdf_Page::setFont方法的具体用法?PHP Zend_Pdf_Page::setFont怎么用?PHP Zend_Pdf_Page::setFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Pdf_Page
的用法示例。
在下文中一共展示了Zend_Pdf_Page::setFont方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDrawing
public function testDrawing()
{
$pdf = new Zend_Pdf();
// Add new page generated by Zend_Pdf object (page is attached to the specified the document)
$pdf->pages[] = $page1 = $pdf->newPage('A4');
// Add new page generated by Zend_Pdf_Page object (page is not attached to the document)
$pdf->pages[] = $page2 = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_LETTER_LANDSCAPE);
// Create new font
$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
// Apply font and draw text
$page1->setFont($font, 36);
$page1->setFillColor(Zend_Pdf_Color_Html::color('#9999cc'));
$page1->drawText('Helvetica 36 text string', 60, 500);
// Use font object for another page
$page2->setFont($font, 24);
$page2->drawText('Helvetica 24 text string', 60, 500);
// Use another font
$page2->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES), 32);
$page2->drawText('Times-Roman 32 text string', 60, 450);
// Draw rectangle
$page2->setFillColor(new Zend_Pdf_Color_GrayScale(0.8));
$page2->setLineColor(new Zend_Pdf_Color_GrayScale(0.2));
$page2->setLineDashingPattern(array(3, 2, 3, 4), 1.6);
$page2->drawRectangle(60, 400, 400, 350);
// Draw circle
$page2->setLineDashingPattern(Zend_Pdf_Page::LINE_DASHING_SOLID);
$page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 0));
$page2->drawCircle(85, 375, 25);
// Draw sectors
$page2->drawCircle(200, 375, 25, 2 * M_PI / 3, -M_PI / 6);
$page2->setFillColor(new Zend_Pdf_Color_Cmyk(1, 0, 0, 0));
$page2->drawCircle(200, 375, 25, M_PI / 6, 2 * M_PI / 3);
$page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 1, 0));
$page2->drawCircle(200, 375, 25, -M_PI / 6, M_PI / 6);
// Draw ellipse
$page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 0));
$page2->drawEllipse(250, 400, 400, 350);
$page2->setFillColor(new Zend_Pdf_Color_Cmyk(1, 0, 0, 0));
$page2->drawEllipse(250, 400, 400, 350, M_PI / 6, 2 * M_PI / 3);
$page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 1, 0));
$page2->drawEllipse(250, 400, 400, 350, -M_PI / 6, M_PI / 6);
// Draw and fill polygon
$page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 1));
$x = array();
$y = array();
for ($count = 0; $count < 8; $count++) {
$x[] = 140 + 25 * cos(3 * M_PI_4 * $count);
$y[] = 375 + 25 * sin(3 * M_PI_4 * $count);
}
$page2->drawPolygon($x, $y, Zend_Pdf_Page::SHAPE_DRAW_FILL_AND_STROKE, Zend_Pdf_Page::FILL_METHOD_EVEN_ODD);
// Draw line
$page2->setLineWidth(0.5);
$page2->drawLine(60, 375, 400, 375);
$pdf->save(dirname(__FILE__) . '/_files/output.pdf');
unset($pdf);
$pdf1 = Zend_Pdf::load(dirname(__FILE__) . '/_files/output.pdf');
$this->assertTrue($pdf1 instanceof Zend_Pdf);
unset($pdf1);
unlink(dirname(__FILE__) . '/_files/output.pdf');
}
示例2: getPdf
public function getPdf()
{
$pdf = new Zend_Pdf();
$page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES);
$page->setFont($font, 12);
$width = $page->getWidth();
$i = 0;
$this->insertLogo($page);
$this->insertAddress($page);
/*$page->setFillColor(new Zend_Pdf_Color_Rgb(0.93, 0.92, 0.92));
$page->drawRectangle(25, $this->y + 15, 190, $this->y - 35);
$page->drawRectangle(190, $this->y + 15, 350, $this->y - 35);
$page->drawRectangle(350, $this->y + 15, 570, $this->y - 35);*/
$page->setFont($font, 16);
$this->y -= 50;
$page->setFillColor(new Zend_Pdf_Color_GrayScale(0.5));
$page->drawRectangle(25, $this->y + 15, 573, $this->y - 57);
$page->setFillColor(new Zend_Pdf_Color_Html('#ffffff'));
$headerText = "Report: Net Sales & Tax";
$page->drawText($headerText, 30, $this->y, 'UTF-8');
$this->y -= 22;
$page->drawText("From: " . $this->from, 30, $this->y, 'UTF-8');
$this->y -= 22;
$page->drawText("To: " . $this->to, 30, $this->y, 'UTF-8');
$page->setFont($font, 14);
$this->y -= 50;
$page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
$totalText = Mage::helper('sales')->__('Total Net Sale');
$page->drawText($totalText, 25, $this->y, 'UTF-8');
$total = Mage::helper('core')->currency($this->getTotalSale(), true, false);
$page->drawText($total, 505, $this->y, 'UTF-8');
$this->y -= 50;
$page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
$totalText = Mage::helper('sales')->__('Net Sales Texas Only');
$page->drawText($totalText, 25, $this->y, 'UTF-8');
$total = Mage::helper('core')->currency($this->getTotalTexasSale(), true, false);
$page->drawText($total, 505, $this->y, 'UTF-8');
$this->y -= 50;
$page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
$totalText = Mage::helper('sales')->__('Net Shipping Costs for Texas only');
$page->drawText($totalText, 25, $this->y, 'UTF-8');
$total = Mage::helper('core')->currency($this->getTotalTexasShipping(), true, false);
$page->drawText($total, 505, $this->y, 'UTF-8');
$this->y -= 50;
$page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
$totalText = Mage::helper('sales')->__('Texas Net Sales Tax');
$page->drawText($totalText, 25, $this->y, 'UTF-8');
$total = Mage::helper('core')->currency($this->getTotalTexasTax(), true, false);
$page->drawText($total, 505, $this->y, 'UTF-8');
$pdf->pages[] = $page;
return $pdf->render();
}
示例3: addPieceNumber
/**
* Add Piece Number
*
* @param int $pieceNumber
* @param int $piecesTotal
* @return Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_PageBuilder
* @throws InvalidArgumentException
* @throws Zend_Pdf_Exception
*/
public function addPieceNumber($pieceNumber, $piecesTotal)
{
$this->_page->saveGS();
if (!$pieceNumber || !$piecesTotal) {
throw new InvalidArgumentException(Mage::helper('usa')->__('Piece number information is missing'));
}
$this->_page->setFont($this->_fontNormal, 6);
$this->_page->drawText('Piece:', $this->_x(256), $this->_y(224));
$this->_page->setFont($this->_fontBold, 11);
$this->_page->drawText($pieceNumber . '/' . $piecesTotal, $this->_x(256), $this->_y(234));
$this->_page->restoreGS();
return $this;
}
示例4: drawFont
protected function drawFont($object)
{
$fontItem = $object->getItem();
if ($fontItem->getFace() == 'bold') {
$fontDecoration = 'bold';
} else {
$fontDecoration = 'regular';
}
$fontPath = SERVER_BASE . '/fonts/' . $fontItem->getName() . '.ttf';
if (is_file($fontPath)) {
$font = Zend_Pdf_Font::fontWithPath($fontPath, Zend_Pdf_Font::EMBED_SUPPRESS_EMBED_EXCEPTION);
} else {
if ($fontDecoration == "bold") {
$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD);
} else {
$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
}
}
if ($fontItem->getFace() == "invert") {
$this->page->setFillColor(new Zend_Pdf_Color_Rgb(0, 0, 0));
//schwarze farbe setzen fuer Hintergrund
$width = $this->widthForStringUsingFontSize($object->getValue(), $font, $fontItem->getSize());
$height = $fontItem->getSize();
$this->page->drawRectangle($this->coordX($this->mmToPts($object->getPosx())), $this->coordY($this->mmToPts($object->getPosy())) + $height / 2, $this->coordX($this->mmToPts($object->getPosx())) + $width, $this->coordY($this->mmToPts($object->getPosy())) - $height / 2, Zend_Pdf_Page::SHAPE_DRAW_FILL);
$this->page->setFillColor(new Zend_Pdf_Color_Rgb(1, 1, 1));
//weiße farbe setzen fuer Text
} else {
$this->page->setFillColor(new Zend_Pdf_Color_Rgb(0, 0, 0));
//schwarze farbe setzen fuer text
}
$this->page->setFont($font, $fontItem->getSize());
if ($fontItem->getRotation() !== null) {
$this->page->rotate($this->coordX($this->mmToPts($object->getPosx())), $this->coordY($this->mmToPts($object->getPosy())), deg2rad(360 - $fontItem->getRotation()));
}
$this->page->drawText($object->getValue(), $this->coordX($this->mmToPts($object->getPosx())), $this->coordY($this->mmToPts($object->getPosy()) + $fontItem->getSize() / 2), 'UTF-8');
if ($fontItem->getRotation() !== null) {
$this->page->rotate($this->coordX($this->mmToPts($object->getPosx())), $this->coordY($this->mmToPts($object->getPosy())), -deg2rad(360 - $fontItem->getRotation()));
}
}
示例5: addTokenToPage
/**
* Add the token to a pdf page
*
* @param \Zend_Pdf_Page $page
* @param string $tokenId
*/
protected function addTokenToPage(\Zend_Pdf_Page $page, $tokenId)
{
// Set $this->pageFont to false to prevent drawing of tokens on page.
if ($this->pageFont) {
$font = \Zend_Pdf_Font::fontWithName($this->pageFont);
if ($this->pageXfromLeft) {
$x = $this->pageX;
} else {
$x = $page->getWidth() - $this->pageX;
}
if ($this->pageYfromTop) {
$y = $page->getHeight() - $this->pageY;
} else {
$y = $this->pageY;
}
$page->setFont($font, $this->pageFontSize);
$page->drawText(strtoupper($tokenId), $x, $y, 'UTF-8');
}
}
示例6: count
$doc = "Barnbyte.pdf";//temp
if (!file_exists($reportPath.$doc)) {
$pdf = new Zend_Pdf();
$pdf->pages[] = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
$page = $pdf->pages[0];
} else {
$pdf = Library_Pdf_Base::load($reportPath.$doc);
$templatePage = count($pdf->pages)-1;
$page = new Zend_Pdf_Page($pdf->pages[$templatePage]);
unset($pdf->pages[$templatePage]);
$pdf->pages[] = $page;
}
$page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 20);
$page->setFont($page->getFont(), 12); include("$easyDBDir/easyDB.php");
include("$easyDBDir/easyDBConn2.php");
$db = easyDB('');
//process parameters.
$id = $_REQUEST['id'];
$query="Select
Fadderbarn.*
,Giver.*
,Giver.ZipTown || ' ' || Giver.ZipCode as 'Giver.Post'
From
Fadderbarn
,Giver
Where
Giver.Id = Fadderbarn.GiverId
示例7: pdfdisplayAction
function pdfdisplayAction()
{
$convertdate = new App_Model_dateConvertor();
// echo '<pre>'; print_r($this->_request->getParam('accNum'));
$this->view->details = $this->view->loanModel->searchaccounts($this->_request->getParam('accNum'));
//echo '<pre>'; print_r($this->view->details);
$this->view->tran = $this->view->loanModel->loanInstalments($this->_request->getParam('accNum'));
$this->view->paid = $this->view->loanModel->paid($this->_request->getParam('accNum'));
$this->view->unpaid = $this->view->loanModel->unpaid($this->_request->getParam('accNum'));
// $loansearch = new Loandetailsg_Form_Search();
// $loantransactions = new Loandisbursmentg_Model_loan();
$app = $this->view->baseUrl();
$word = explode('/', $app);
$projname = $word[1];
$pdf = new Zend_Pdf();
$page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
$pdf->pages[] = $page;
// Image
$image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
$image = Zend_Pdf_Image::imageWithPath($image_name);
$page->drawImage($image, 30, 770, 130, 820);
$page->setLineWidth(1)->drawLine(25, 25, 570, 25);
//bottom horizontal
$page->setLineWidth(1)->drawLine(25, 25, 25, 820);
//left vertical
$page->setLineWidth(1)->drawLine(570, 25, 570, 820);
//right vertical
$page->setLineWidth(1)->drawLine(570, 820, 25, 820);
//top horizontal
$page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8);
$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
$page->drawText('( LOAN LEDGER )', 237, 780);
$text = array("Member details");
$x0 = 50;
$x3 = 310;
$x1 = 150;
$x2 = 220;
$page->drawLine(50, 740, 290, 740);
$page->drawLine(50, 720, 290, 720);
$page->drawText($text[0], 90, 727);
$y1 = 700;
foreach ($this->view->details as $details) {
$page->drawText('Name : ' . $details->name, $x0, $y1);
$y1 = $y1 - 20;
$page->drawText('Branch : ' . $details->officename, $x0, $y1);
$y1 = $y1 - 20;
$page->drawText('Code : ' . $details->code, $x0, $y1);
$y1 = $y1 - 20;
$page->drawText('Account code : ' . $details->number, $x0, $y1);
$text1 = array("Loan details");
$y1 = $y1 - 25;
$page->drawLine(50, $y1, 290, $y1);
$y1 = $y1 - 20;
$page->drawLine(50, $y1, 290, $y1);
$y1 = $y1 + 7;
$page->drawText($text1[0], 90, $y1);
$y1 = $y1 - 25;
$page->drawText('Loan name : ' . $details->loanname, $x0, $y1);
$y1 = $y1 - 20;
$page->drawText('Loan amount Rs : ' . $details->amount, $x0, $y1);
$y1 = $y1 - 20;
$page->drawText('Interest rate % : ' . $details->interest, $x0, $y1);
$y1 = $y1 - 20;
$page->drawText('Installments : ' . $details->installments, $x0, $y1);
$y1 = $y1 - 20;
$page->drawText('Sanctioned date : ' . $details->sanctioned, $x0, $y1);
$y1 = $y1 - 20;
}
$y1 = 740;
$text2 = array("Installment status No Amount");
$page->drawLine(310, $y1, 550, $y1);
$y1 = $y1 - 20;
$page->drawLine(310, $y1, 550, $y1);
$y1 = $y1 + 7;
$page->drawText($text2[0], $x3, $y1);
foreach ($this->view->paid as $paid) {
$y1 = $y1 - 25;
$page->drawText('Paid' . $paid->paidAmt, 320, $y1);
$page->drawText($paid->paidCount, 390, $y1);
}
foreach ($this->view->unpaid as $unpaid) {
$y1 = $y1 - 20;
$page->drawText('Due', 320, $y1);
$page->drawText($unpaid->unpaidCount, 390, $y1);
$page->drawText($unpaid->unpaidAmt, 430, $y1);
}
$y1 = 480;
$text3 = array("GL.LF no Transaction date Creidt Debit Payment mode Transacted by ");
$page->drawLine(50, $y1, 550, $y1);
$y1 = $y1 - 20;
$page->drawLine(50, $y1, 550, $y1);
$y1 = $y1 + 7;
$page->drawText($text3[0], $x0, $y1);
foreach ($this->view->tran as $transaction) {
$y1 = $y1 - 20;
$page->drawText($transaction->id, 60, $y1);
$page->drawText($transaction->date, 120, $y1);
$page->drawText($transaction->cr, 160, $y1);
$page->drawText($transaction->dt, 250, $y1);
$page->drawText($transaction->mode, 330, $y1);
//.........这里部分代码省略.........
示例8: pdfdisplayAction
function pdfdisplayAction()
{
$declarationform = new Externalloan_Model_Dec();
$this->view->form = $declarationform;
$postdata = $this->_request->getpost();
//echo '<pre>'; print_r($postdata);
$this->view->membercode = $memcode = $postdata['membercode'];
//echo $this->view->membercode.'<br>';
$this->view->moduleid = $moduleid = $postdata['module_id'];
$this->view->groupresult = $results = $this->view->dbobj->groupDeatils($memcode, $moduleid);
$this->view->groupmember = $membername = $this->view->dbobj->getmember($memcode);
$this->view->represent = $repname = $this->view->dbobj->represent($memcode);
$this->view->loans = $loans = $this->view->dbobj->getgrouploans($memcode);
$app = $this->view->baseUrl();
$word = explode('/', $app);
$projname = $word[1];
$pdf = new Zend_Pdf();
$page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
$pdf->pages[] = $page;
// Image
$image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
$image = Zend_Pdf_Image::imageWithPath($image_name);
//$page->drawImage($image, 25, 770, 570, 820);
$page->drawImage($image, 30, 770, 130, 820);
$page->setLineWidth(1)->drawLine(25, 25, 570, 25);
//bottom horizontal
$page->setLineWidth(1)->drawLine(25, 25, 25, 820);
//left vertical
$page->setLineWidth(1)->drawLine(570, 25, 570, 820);
//right vertical
$page->setLineWidth(1)->drawLine(570, 820, 25, 820);
//top horizonta
// define font resource
$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
// Image
$image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
$image = Zend_Pdf_Image::imageWithPath($image_name);
$x1 = 72;
$x2 = 410;
$y1 = 670;
//$y2=;
$memcode = $this->_request->getParam('membercode');
$moduleid = $this->_request->getParam('module_id');
// echo '<pre>'; print_r($this->view->groupresult);
$dateconvert = new App_Model_dateConvertor();
foreach ($this->view->groupresult as $result) {
foreach ($this->view->represent as $name) {
foreach ($this->view->groupmember as $memberview) {
// write text to page
$page->setFont($font, 10)->drawText('( EXTERNAL LOAN REQUEST )', 237, 720);
$page->setFont($font, 9)->drawText('Group name :' . $result['name'] . '', $x1, $y1);
$page->setFont($font, 9)->drawText('Date :' . date('d-m-Y') . '', $x2, $y1);
$y1 = $y1 - 15;
$page->setFont($font, 9)->drawText('Group Address :' . $result['address1'] . '', $x1, $y1);
$page->setFont($font, 9)->drawText('Group code :' . $result['groupcode'] . '', $x2, $y1);
$y1 = $y1 - 15;
$page->setFont($font, 9)->drawText('' . $result['city'] . '', 137, $y1);
$page->setFont($font, 9)->drawText('Savings A/c :' . $result['account_number'] . '', $x2, $y1);
$y1 = $y1 - 15;
$page->setFont($font, 9)->drawText('' . $result['state'] . '', 137, $y1);
foreach ($this->view->loans as $loan) {
$page->setFont($font, 9)->drawText('Loan A/c :' . $loan['loanaccount'] . '', $x2, $y1);
}
// // $y1=$y1-15;
// // $page->setFont($font, 9)
// // ->drawText('Communication:phone/mobile :'.$loan['mobile'].'',$x1, $y1);
$y1 = $y1 - 10;
$page->setLineWidth(1)->drawLine(50, $y1, 550, $y1);
$y1 = $y1 - 25;
$page->setFont($font, 9)->drawText('1...' . $result['purpose'] . '...(PURPOSE)sfjhkjh kjhjhjdhfjn dhfjkasdhfjh..' . $result['bankname'] . '..(BANK)afd/saa/sdb', $x1, $y1);
$y1 = $y1 - 15;
$page->setFont($font, 9)->drawText('..' . $result['branchname'] . '..(Branch name) asdbnhhjh saoinm (LOAN AMOUNT)..' . $result['amount'] . '...ajjnsabvcui uwepiyqwne bodaftutguy nhgqwe.', $x1, $y1);
$y1 = $y1 - 20;
$page->setFont($font, 9)->drawText('2. aujhhjuoer uiuhjn jhsfduio uyhuasmuiohjos iuiowsmhns8u ujmnasusm sjuhm,asdfiu ', $x1, $y1);
$y1 = $y1 - 15;
$page->setFont($font, 9)->drawText('1) ' . $name['memnames'] . '', 150, $y1);
$y1 = $y1 - 25;
$page->setFont($font, 9)->drawText('aujhhjuoer uiuhjn jhsfduio uyhuasmuiohjos iuiowsmhns8u ujmnasusm sjuhm,asdfiu ', $x1, $y1);
$y1 = $y1 - 15;
$page->setLineWidth(1)->drawLine(50, $y1, 550, $y1);
$y1 = $y1 - 15;
$page->setFont($font, 9)->drawText('S.No', 80, $y1);
$page->setFont($font, 9)->drawText('Member Name', 150, $y1);
$page->setFont($font, 9)->drawText('Purpose', 270, $y1);
$page->setFont($font, 9)->drawText('Loan request', 360, $y1);
$page->setFont($font, 9)->drawText('Signature', 450, $y1);
$y1 = $y1 - 10;
$page->setLineWidth(1)->drawLine(50, $y1, 550, $y1);
$y1 = $y1 - 15;
$page->setFont($font, 9)->drawText('' . $memberview['memname'] . '', 150, $y1);
$page->setFont($font, 9)->drawText('' . $memberview['purposename'] . '', 260, $y1);
$page->setFont($font, 9)->drawText('' . $memberview['Amount'] . '', 365, $y1);
$y1 = $y1 - 10;
$page->setLineWidth(1)->drawLine(50, $y1, 550, $y1);
$y1 = $y1 - 50;
$pdf->pages[] = $page;
$pdfData = $pdf->render();
$pdfData = $pdf->render();
$pdf->save('/var/www/' . $projname . '/reports/externalloan.pdf');
$path = '/var/www/' . $projname . '/reports/externalloan.pdf';
//.........这里部分代码省略.........
示例9: downloadAction
public function downloadAction()
{
if ($this->_loadValidVoucher()) {
$voucherCode = $this->getRequest()->getParam('code');
$text = Mage::helper('voucher');
$_product = Mage::registry('current_product');
$pdf = new Zend_Pdf();
$page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_LETTER);
$pageHeight = $page->getHeight();
$pageWidth = $page->getWidth();
//$page->rotate(($pageWidth/2), ($pageHeight/2), 1);
$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
$logoImage = Zend_Pdf_Image::imageWithPath(Mage::getDesign()->getSkinBaseDir() . '/images/logo_small_en.jpg');
//$footerImage = Zend_Pdf_Image::imageWithPath(Mage::getDesign()->getSkinBaseDir() . '/images/voucher_footer_en.png'); //VD
$productImage = Zend_Pdf_Image::imageWithPath(Mage::getBaseDir() . '/media/catalog/product' . $_product->getVoucherImage());
//$footerImageHeight = $footerImage->getPixelHeight(); //VD
//$footerImageWidth = $footerImage->getPixelWidth(); //VD
$logoImageHeight = 75;
//VDEdit
$logoImageWidth = 250;
//VDEdit
$tableWidth = 568;
$startPoint = ($pageWidth - $tableWidth) / 2;
$endPoint = $startPoint + $tableWidth;
$botPoint = 10;
$topPoint = $pageHeight - 30;
$page->setLineWidth('0.3')->setLineDashingPattern(array(3, 3, 3, 3))->drawLine($startPoint, $topPoint, $startPoint, $botPoint)->drawLine($endPoint, $topPoint, $endPoint, $botPoint)->drawLine($startPoint, $topPoint, $endPoint, $topPoint)->drawLine($startPoint, $botPoint, $endPoint, $botPoint)->drawLine($startPoint, $pageHeight - $logoImageHeight - 235, $endPoint, $pageHeight - $logoImageHeight - 235)->drawLine($startPoint, $pageHeight - $logoImageHeight - 235 - 325, $endPoint, $pageHeight - $logoImageHeight - 235 - 325);
$page->setFillColor(Zend_Pdf_Color_Html::color('#16599D'))->drawRectangle($startPoint + 2, $topPoint - $logoImageHeight - 2, $endPoint, $topPoint);
$page->drawImage($logoImage, $startPoint, $topPoint - $logoImageHeight - 1, $startPoint + $logoImageWidth, $topPoint);
//$page->drawImage($footerImage, $startPoint + 2, $botPoint, $startPoint + $footerImageWidth - 20, $botPoint + $footerImageHeight);
$page->drawImage($productImage, $startPoint + 7, $topPoint - 55 - $productImage->getPixelHeight(), $startPoint + 7 + 246, $topPoint - 55 - $productImage->getPixelHeight() + 165);
$page->setFillColor(Zend_Pdf_Color_Html::color('#FFFFFF'))->setLineDashingPattern(array(1, 0, 1, 0))->drawRectangle($endPoint - 205, $topPoint - 10, $endPoint - 15, $topPoint + 10)->setLineDashingPattern(array(0, 1000, 0, 1000))->setFillColor(Zend_Pdf_Color_Html::color('#EDF4FA'))->drawRectangle($startPoint + 0.3, $pageHeight - $logoImageHeight - 235, $endPoint, $pageHeight - $logoImageHeight - 235 - 325);
$style = new Zend_Pdf_Style();
$style->setFont($font, 15);
$page->setFont($font, 12)->setFillColor(Zend_Pdf_Color_Html::color('#000000'))->drawText($text->__('Voucher Code: ' . $voucherCode), $endPoint - 193, $topPoint - 4)->setFont($font, 15);
$lines = explode("\n", $this->getWrappedText($text->__('Voucher for ') . $_product->getName(), $style, 270));
//var_dump($lines);
foreach ($lines as $k => $line) {
$page->drawText($line, $startPoint + $productImage->getPixelWidth() + 20, $topPoint - 70 - $k * 20);
}
//
$pdf->pages[0] = $page;
$pdf->save(Mage::getBaseDir() . '/media/vouchers/' . $voucherCode . '.pdf');
$this->getResponse()->clearHeaders()->setHeader('content-type:', 'Application/pdf')->setHeader('Content-Type', 'application/force-download')->setHeader('Content-Disposition', 'attachment; filename="' . $voucherCode . '.pdf"')->setBody($pdf->render());
}
}
示例10: getPdfFile
public function getPdfFile()
{
$this->_isExport = true;
$this->_prepareGrid();
$this->getCollection()->getSelect()->limit();
$this->getCollection()->setPageSize(0);
$this->getCollection()->load();
$this->_afterLoadCollection();
$pdf = new Zend_Pdf();
$page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES);
$page->setFont($font, 12);
$width = $page->getWidth();
$i = 20;
$col = array();
$header_arr = array();
foreach ($this->_columns as $column) {
if ($column->getData('renderer') && $column->getData('renderer') != "") {
$renderer = $column->getData('renderer');
} else {
$renderer = false;
}
$col[$column->getIndex()] = array('width' => round($column->getWidth() / 1.2), 'render' => $renderer);
if (!$column->getIsSystem()) {
$header = $column->getExportHeader();
$header_arr[] = array('header' => $header, 'width' => "{$i}");
//$page->drawText($header, $i, $page->getHeight()-20);
$i += round($column->getWidth() / 1.2);
}
}
//Mage::log($col);
$height = $page->getHeight() - 30;
$j = 0;
$totl = 0;
foreach ($this->getCollection() as $coll) {
$i = 20;
$data = $coll->getData();
$sorted = $this->sortArrayByArray($data, $col);
if ($totl % 20 == 0) {
$page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES);
$page->setFont($font, 12);
$totl = 0;
$height = $page->getHeight() - 30;
$width = $page->getWidth();
$pdf->pages[] = $page;
foreach ($header_arr as $header) {
$page->drawText($header['header'], $header['width'], $height);
}
}
$height -= 20;
$totl++;
foreach ($sorted as $key => $value) {
if ($col[$key]['render'] != "") {
$value = $this->getLayout()->createBlock($col[$key]['render'])->render($coll);
}
$page->drawText($value, $i, $height);
$i += $col[$key]['width'];
}
$j++;
//if($j == 50) break;
}
//$pdf->pages[] = $page;
return $pdf->render();
}
示例11: _setFontItalic
/**
* Set font as italic
*
* @param Zend_Pdf_Page $object
* @param int $size
* @return Zend_Pdf_Resource_Font
*/
protected function _setFontItalic($object, $size = 7)
{
$font = Zend_Pdf_Font::fontWithPath(Mage::getBaseDir() . '/lib/LinLibertineFont/LinLibertine_It-2.8.2.ttf');
$object->setFont($font, $size);
return $font;
}
示例12:
// Add new page generated by Zend_Pdf object (page is attached to the specified the document)
$pdf->pages[] = ($page1 = $pdf->newPage('A4'));
// Add new page generated by Zend_Pdf_Page object (page is not attached to the document)
$pdf->pages[] = ($page2 = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_LETTER_LANDSCAPE));
// Create new font
$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
// Apply font and draw text
$page1->setFont($font, 36)
->setFillColor(Zend_Pdf_Color_Html::color('#9999cc'))
->drawText('Helvetica 36 text string', 60, 500);
// Use font object for another page
$page2->setFont($font, 24)
->drawText('Helvetica 24 text string', 60, 500);
// Use another font
$page2->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES), 32)
->drawText('Times-Roman 32 text string', 60, 450);
// Draw rectangle
$page2->setFillColor(new Zend_Pdf_Color_GrayScale(0.8))
->setLineColor(new Zend_Pdf_Color_GrayScale(0.2))
->setLineDashingPattern(array(3, 2, 3, 4), 1.6)
->drawRectangle(60, 400, 400, 350);
// Draw circle
$page2->setLineDashingPattern(Zend_Pdf_Page::LINE_DASHING_SOLID)
->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 0))
示例13: dirname
<?php
header('Content-Type: application/x-pdf');
header("Content-Disposition: attachment;filename=invoice.pdf");
header("Cache-Control: no-cache, must-revalidate");
$path = dirname(dirname(__FILE__)) . '/library';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once "Zend/Pdf.php";
$pdf = new Zend_Pdf();
$page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_LETTER);
$pdf->pages[] = $page;
$pdf->pages[] = $pdf->newPage(Zend_Pdf_Page::SIZE_LETTER);
$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES_BOLD);
$page->setFont($font, 12);
$page->drawText('wewe', 110, 641);
//echo $page->getHeight();
//echo $page->getWidth();
$pdf->save("report2.pdf");
header('Location: report2.pdf');
示例14: DrawHeader
protected static function DrawHeader(Zend_Pdf_Page $objPage)
{
$intY = STEWARDSHIP_TOP - 5 / 8 * 72;
$intY -= 13.2;
$objPage->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD), 12);
$objPage->drawText(STEWARDSHIP_STATEMENT_LINE_1, 36, $intY, 'UTF-8');
$intY -= 9.199999999999999;
$objPage->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8);
$objPage->drawText(STEWARDSHIP_STATEMENT_LINE_2, 36, $intY, 'UTF-8');
$intY -= 12.1;
$objPage->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 11);
$objPage->drawText(STEWARDSHIP_STATEMENT_LINE_3, 36, $intY, 'UTF-8');
$intY -= 12.1;
$objPage->drawText(STEWARDSHIP_STATEMENT_LINE_4, 36, $intY, 'UTF-8');
if (!self::$ZendImage) {
self::$ZendImage = Zend_Pdf_Image::imageWithPath(__DOCROOT__ . __IMAGE_ASSETS__ . '/alcf_logo_stewardship.png');
}
$objPage->drawImage(self::$ZendImage, 424, STEWARDSHIP_TOP - 108, 576, STEWARDSHIP_TOP - 36);
}
示例15: setFont
protected function setFont(\Zend_Pdf_Page $page, $size = 12)
{
$basePath = APPLICATION_PATH . "/../public/fonts/";
$font = \Zend_Pdf_Font::fontWithPath($basePath . 'LiberationSans-Regular.ttf');
$page->setFont($font, $size);
}