当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Pdf_Font::fontWithName方法代码示例

本文整理汇总了PHP中Zend_Pdf_Font::fontWithName方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Pdf_Font::fontWithName方法的具体用法?PHP Zend_Pdf_Font::fontWithName怎么用?PHP Zend_Pdf_Font::fontWithName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Pdf_Font的用法示例。


在下文中一共展示了Zend_Pdf_Font::fontWithName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getPdf

 /**
  * Creates a PDF report from the Minutes model given.
  * Returns the PDF as a string that can either be saved to disk
  * or streamed back to the browser.
  *
  * @param Phprojekt_Model_Interface $minutesModel The minutes model object to create the PDF from.
  *
  * @return string The resulting PDF document.
  */
 public static function getPdf(Phprojekt_Model_Interface $minutesModel)
 {
     $phpr = Phprojekt::getInstance();
     $pdf = new Zend_Pdf();
     $page = new Phprojekt_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
     $pages = array($page);
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 12);
     $page->setBorder(2.0 * Phprojekt_Pdf_Page::PT_PER_CM, 2.0 * Phprojekt_Pdf_Page::PT_PER_CM, 2.0 * Phprojekt_Pdf_Page::PT_PER_CM, 3.0 * Phprojekt_Pdf_Page::PT_PER_CM);
     $page->addFreetext(array('lines' => $minutesModel->title, 'fontSize' => 20));
     $page->addFreetext(array('lines' => array_merge(explode("\n\n", $minutesModel->description), array($phpr->translate('Start') . ': ' . $minutesModel->meetingDatetime, $phpr->translate('End') . ': ' . $minutesModel->endTime, $phpr->translate('Place') . ': ' . $minutesModel->place, $phpr->translate('Moderator') . ': ' . $minutesModel->moderator)), 'fontSize' => 12));
     $invited = Minutes_Helpers_Userlist::expandIdList($minutesModel->participantsInvited);
     $attending = Minutes_Helpers_Userlist::expandIdList($minutesModel->participantsAttending);
     $excused = Minutes_Helpers_Userlist::expandIdList($minutesModel->participantsExcused);
     $pages += $page->addTable(array('fontSize' => 12, 'rows' => array(array(array('text' => $phpr->translate('Invited'), 'width' => 4.7 * Phprojekt_Pdf_Page::PT_PER_CM), array('text' => array_reduce($invited, array('self', '_concat')), 'width' => 12.0 * Phprojekt_Pdf_Page::PT_PER_CM)), array(array('text' => $phpr->translate('Attending'), 'width' => 4.7 * Phprojekt_Pdf_Page::PT_PER_CM), array('text' => array_reduce($attending, array('self', '_concat')), 'width' => 12.0 * Phprojekt_Pdf_Page::PT_PER_CM)), array(array('text' => $phpr->translate('Excused'), 'width' => 4.7 * Phprojekt_Pdf_Page::PT_PER_CM), array('text' => array_reduce($excused, array('self', '_concat')), 'width' => 12.0 * Phprojekt_Pdf_Page::PT_PER_CM)))));
     $page = end($pages);
     $itemtable = array();
     $items = $minutesModel->items->fetchAll();
     foreach ($items as $item) {
         $itemtable[] = array(array('text' => $item->topicId, 'width' => 1.3 * Phprojekt_Pdf_Page::PT_PER_CM), array('text' => $phpr->translate($item->information->getTopicType($item->topicType)), 'width' => 3.0 * Phprojekt_Pdf_Page::PT_PER_CM), array('text' => $item->getDisplay(), 'width' => 12.4 * Phprojekt_Pdf_Page::PT_PER_CM));
     }
     $pages += $page->addTable(array('fontSize' => 12, 'rows' => array_merge(array(array('isHeader' => true, array('text' => $phpr->translate('No.'), 'width' => 1.3 * Phprojekt_Pdf_Page::PT_PER_CM), array('text' => $phpr->translate('Type'), 'width' => 3.0 * Phprojekt_Pdf_Page::PT_PER_CM), array('text' => $phpr->translate('Item'), 'width' => 12.4 * Phprojekt_Pdf_Page::PT_PER_CM))), $itemtable)));
     $page = end($pages);
     $pdf->pages = $pages;
     $pdf->properties['Title'] = $minutesModel->title;
     $owner = Minutes_Helpers_Userlist::expandIdList($minutesModel->ownerId);
     $pdf->properties['Author'] = $owner[0]['display'];
     $pdf->properties['Producer'] = 'PHProjekt version ' . Phprojekt::getVersion();
     $pdf->properties['CreationDate'] = 'D:' . gmdate('YmdHis');
     $pdf->properties['Keywords'] = $minutesModel->description;
     return $pdf->render();
 }
开发者ID:penSecIT,项目名称:PHProjekt,代码行数:40,代码来源:Pdf.php

示例2: 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');
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:60,代码来源:DrawingTest.php

示例3: process

 public function process()
 {
     $configuracao = Doctrine::getTable('Configuracao')->find(1);
     $this->document->pages[] = $page = $this->document->newPage(\Zend_Pdf_Page::SIZE_A4);
     //monta o cabecalho
     $color = array();
     $color["black"] = new Zend_Pdf_Color_Html("#000000");
     $fontTitle = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES_BOLD);
     $size = 12;
     $styleTitle = new Zend_Pdf_Style();
     $styleTitle->setFont($fontTitle, $size);
     $styleTitle->setFillColor($color["black"]);
     $page->setStyle($styleTitle);
     $page->drawText($configuracao->instituicao, Documento::DOCUMENT_LEFT, Documento::DOCUMENT_TOP, 'UTF-8');
     $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES);
     $style = new Zend_Pdf_Style();
     $style->setFont($font, $size);
     $style->setFillColor($color["black"]);
     $page->setStyle($style);
     $text = wordwrap($this->text, 95, "\n", false);
     $token = strtok($text, "\n");
     $y = 665;
     while ($token != false) {
         if ($y < 100) {
             $this->document->pages[] = $page = $this->document->newPage(Zend_Pdf_Page::SIZE_A4);
             $page->setStyle($style);
             $y = 665;
         } else {
             $y -= 15;
         }
         $page->drawText($token, 60, $y, 'UTF-8');
         $token = strtok("\n");
     }
 }
开发者ID:kidh0,项目名称:TCControl,代码行数:34,代码来源:AlunosMatriculadosDoc.class.php

示例4: getWrappedText

 public function getWrappedText($string, $max_width, $font = '', $fontsize = 14)
 {
     $font = Zend_Pdf_Font::fontWithName($font);
     $wrappedText = '';
     $nLines = 1;
     $lines = explode("\n", $string);
     foreach ($lines as $line) {
         $words = explode(' ', $line);
         $word_count = count($words);
         $i = 0;
         $wrappedLine = '';
         while ($i < $word_count) {
             /* if adding a new word isn't wider than $max_width,
                we add the word */
             if ($this->widthForStringUsingFontSize($wrappedLine . ' ' . $words[$i], $font, $fontsize) < $max_width) {
                 if (!empty($wrappedLine)) {
                     $wrappedLine .= ' ';
                 }
                 $wrappedLine .= $words[$i];
             } else {
                 $wrappedText .= $wrappedLine . "\n";
                 $nLines++;
                 $wrappedLine = $words[$i];
             }
             $i++;
         }
         $wrappedText .= $wrappedLine . "\n";
     }
     return array('text' => $wrappedText, 'n' => $nLines);
 }
开发者ID:evinw,项目名称:project_bloom_magento,代码行数:30,代码来源:Pdf.php

示例5: verPdfAction

 public function verPdfAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     $producto = $this->_producto->getDetalle($this->_getParam('id'));
     //        var_dump($producto);exit;
     $pdf = new Zend_Pdf();
     $pdf1 = Zend_Pdf::load(APPLICATION_PATH . '/../templates/producto.pdf');
     //        $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4); // 595 x842
     $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
     //        $pdf->pages[] = $page;
     //        $page->setFont($font, 20);$page->drawText('Zend: PDF', 10, 822);
     //        $page->setFont($font, 12);$page->drawText('Comentarios', 10, 802);
     //        $pdfData = $pdf->render();
     $page = $pdf1->pages[0];
     $page->setFont($font, 12);
     $page->drawText($producto['producto'], 116, 639);
     $page->drawText($producto['precio'], 116, 607);
     $page->drawText($producto['categoria'], 116, 575);
     $page->drawText($producto['fabricante'], 116, 543);
     $page->drawText('zEND', 200, 200);
     $pdfData = $pdf1->render();
     header("Content-type: application/x-pdf");
     header("Content-Disposition: inline; filename=result.pdf");
     $this->_response->appendBody($pdfData);
 }
开发者ID:helmutpacheco,项目名称:ventas,代码行数:26,代码来源:ProductoController.php

示例6: _setFontItalic

 protected function _setFontItalic($object, $size = 7)
 {
     if (!$this->getUseFont()) {
         return parent::_setFontItalic($object, $size);
     }
     $font = Zend_Pdf_Font::fontWithName(constant('Zend_Pdf_Font::FONT_' . $this->getUseFont() . '_ITALIC'));
     $object->setFont($font, $size);
     return $font;
 }
开发者ID:evinw,项目名称:project_bloom_magento,代码行数:9,代码来源:Shipment.php

示例7: setStyle

 public function setStyle()
 {
     $style = new Zend_Pdf_Style();
     $style->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 10);
     $style->setFillColor(new Zend_Pdf_Color_Html('#333333'));
     $style->setLineColor(new Zend_Pdf_Color_Html('#990033'));
     $style->setLineWidth(1);
     $this->_page->setStyle($style);
 }
开发者ID:nhochong,项目名称:qlkh-sgu,代码行数:9,代码来源:Page.php

示例8: __construct

 public function __construct()
 {
     $this->_page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
     $this->_yPosition = 60;
     $this->_leftMargin = 50;
     $this->_pageHeight = $this->_page->getHeight();
     $this->_pageWidth = $this->_page->getWidth();
     $this->_normalFont = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
     $this->_boldFont = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD);
 }
开发者ID:ramonjmz,项目名称:prosalud,代码行数:10,代码来源:Page.php

示例9: 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();
 }
开发者ID:buttasg,项目名称:cowgirlk,代码行数:53,代码来源:Sale0.php

示例10: generateSignupSheet

 /**
  * Generates the signup sheet for the given event
  * 
  * @param $event
  */
 public function generateSignupSheet($event)
 {
     /**
      * Calculate how many pages are needed
      */
     $entriesPerPage = 37;
     $pageCount = ceil(count($event['attendeeList']) / $entriesPerPage);
     /*
      * Set up the offsets for the three columns (first, last, signature)
      */
     $this->_offsets['columnLeft'] = 45;
     $this->_offsets['columnMiddle'] = 150;
     $this->_offsets['columnRight'] = 250;
     /**
      * Fill each page with user information
      */
     for ($i = 0; $i < $pageCount; $i++) {
         $page = $this->_pdf->newPage(Zend_Pdf_Page::SIZE_LETTER);
         $this->_pdf->pages[] = $page;
         $lineCounter = 0;
         $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 9);
         $page->drawText('Page ' . ($i + 1) . ' of ' . $pageCount, $this->_offsets['right'] - 40, $this->_offsets['top']);
         $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD), 12);
         $page->drawText($event['workshopTitle'], $this->center($event['workshopTitle']), $this->getLineOffset($lineCounter++));
         $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 12);
         $page->drawText($event['location'], $this->center($event['location']), $this->getLineOffset($lineCounter++));
         $date = new DateTime($event['date']);
         $startTime = new DateTime($event['startTime']);
         $endTime = new DateTime($event['endTime']);
         $dateString = $date->format('l, M d, Y') . '(' . $startTime->format('g:i A') . ' - ' . $endTime->format('g:i A') . ')';
         $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 12);
         $page->drawText($dateString, $this->center($dateString), $this->getLineOffset($lineCounter++));
         $instructorString = 'Instructor' . (count($event['instructors']) > 1 ? 's' : '') . ': ' . implode(', ', $event['instructors']);
         $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 12);
         $page->drawText($instructorString, $this->center($instructorString), $this->getLineOffset($lineCounter++));
         $lineCounter += 2;
         $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD), 12);
         $page->drawText('First Name', $this->_offsets['columnLeft'], $this->getLineOffset($lineCounter));
         $page->drawText('Last Name', $this->_offsets['columnMiddle'], $this->getLineOffset($lineCounter));
         $page->drawText('Signature', $this->_offsets['columnRight'], $this->getLineOffset($lineCounter));
         $lineCounter++;
         $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 12);
         $attendeeList = array_slice($event['attendeeList'], $i * $entriesPerPage, $entriesPerPage);
         foreach ($attendeeList as $a) {
             $page->drawText($a['firstName'], $this->_offsets['columnLeft'], $this->getLineOffset($lineCounter));
             $page->drawText($a['lastName'], $this->_offsets['columnMiddle'], $this->getLineOffset($lineCounter));
             $page->drawLine($this->_offsets['columnRight'], $this->getLineOffset($lineCounter) - 2, $this->_offsets['right'], $this->getLineOffset($lineCounter) - 2);
             $lineCounter++;
         }
     }
     return $this->_pdf->render();
 }
开发者ID:ncsuwebdev,项目名称:classmate,代码行数:57,代码来源:EventPdf.php

示例11: stringWidth

 function stringWidth($string, $fontName = PdfContext::fontHelvetica, $fontSize = 12)
 {
     $font = Zend_Pdf_Font::fontWithName($fontName);
     $drawingString = iconv('', 'UTF-16BE', $string);
     $characters = array();
     for ($i = 0; $i < strlen($drawingString); $i++) {
         $characters[] = ord($drawingString[$i++]) << 8 | ord($drawingString[$i]);
     }
     $glyphs = $font->cmap->glyphNumbersForCharacters($characters);
     $widths = $font->widthsForGlyphs($glyphs);
     $stringWidth = array_sum($widths) / $font->getUnitsPerEm() * $fontSize;
     return $stringWidth;
 }
开发者ID:laiello,项目名称:zoop,代码行数:13,代码来源:ZendPdfContext.php

示例12: drawTableHeader

 /**
  * Dessine l'entete du tableau avec la liste des produits
  *
  * @param unknown_type $page
  */
 public function drawTableHeader(&$page)
 {
     //entetes de colonnes
     $this->y -= 15;
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 12);
     $page->drawText(mage::helper('purchase')->__('Qty'), 15, $this->y, 'UTF-8');
     $page->drawText(mage::helper('purchase')->__('Manufacturer'), 70, $this->y, 'UTF-8');
     $page->drawText(mage::helper('purchase')->__('Sku'), 180, $this->y, 'UTF-8');
     $page->drawText(mage::helper('purchase')->__('Product'), 310, $this->y, 'UTF-8');
     //barre grise fin entete colonnes
     $this->y -= 8;
     $page->drawLine(10, $this->y, $this->_BLOC_ENTETE_LARGEUR, $this->y);
     $this->y -= 15;
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:19,代码来源:SelectedOrdersProductsSummaryPdf.php

示例13: generateAction

 public function generateAction()
 {
     // Create new PDF document.
     $pdf = new Zend_Pdf();
     // 421 x 596 = A5 Landscape in pixels @ 72dpi
     $pdf->pages[] = new Zend_Pdf_Page(596, 421);
     $pdf->pages[] = new Zend_Pdf_Page(596, 421);
     $front = $pdf->pages[0];
     $back = $pdf->pages[1];
     // Create new font
     $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
     // Apply font
     $front->setFont($font, 18);
     // Start at the top
     $y = 590;
     // With a left Margin of 10
     $x = 10;
     $front->drawText($this->recipe->name, $x, $y);
     $y = $y - 30;
     $front->setFont($font, 12);
     $front->drawText('Difficulty: ' . $this->recipe->difficulty, $x, $y);
     $y = $y - 15;
     $front->drawText('Preparation Time: ' . $this->recipe->preparation_time, $x, $y);
     $y = $y - 15;
     $front->drawText('Cooking Time: ' . $this->recipe->preparation_time, $x, $y);
     $y = $y - 15;
     $front->drawText('Serves: ' . $this->recipe->serves, $x, $y);
     $y = $y - 15;
     $front->drawText('Freezable: ' . $this->recipe->freezable, $x, $y);
     $ingredients = $this->recipe->findRecipeIngredient();
     $y = $y - 15;
     foreach ($ingredients as $ingredient) {
         $y = $y - 15;
         $text = '';
         if ($ingredient->quantity > 0) {
             $text .= $ingredient->quantity;
         }
         if ($ingredient->amount > 0) {
             $text .= $ingredient->amount . ' ';
         }
         if (!empty($ingredient->measurement)) {
             $text .= $ingredient->measurement_abbr . ' ';
         }
         $text .= $ingredient->name;
         $front->drawText($text, $x, $y);
     }
     $back->setFont($font, 18);
     $pdf->save('pdf/foo.pdf');
 }
开发者ID:vishaleyes,项目名称:cookingwithzend,代码行数:49,代码来源:PdfController.php

示例14: __construct

 public function __construct($labels = array())
 {
     $cols = null;
     foreach ($labels as $label) {
         $col = new Core_Pdf_Table_Column();
         $col->setText($label);
         $cols[] = $col;
     }
     if ($cols) {
         $this->setColumns($cols);
     }
     //set default alignment
     $this->_align = Core_Pdf::CENTER;
     //set default borders
     $style = new Zend_Pdf_Style();
     $style->setLineWidth(2);
     $this->setBorder(Core_Pdf::BOTTOM, $style);
     $this->setCellPaddings(array(5, 5, 5, 5));
     //set default font
     $this->_font = Zend_Pdf_Font::fontWithName(ZEND_Pdf_Font::FONT_HELVETICA_BOLD);
     $this->_fontSize = 12;
 }
开发者ID:uglide,项目名称:zfcore-transition,代码行数:22,代码来源:HeaderRow.php

示例15: generateReport

 /**
  * Creates and generates the PDF report for the items in the report.
  *
  * @param string $filePath The path to the zip that contains the generated
  * PDFs.
  */
 public function generateReport($filePath)
 {
     if (!extension_loaded('zip')) {
         throw new RuntimeException("zip extension is required to bundle " . "report PDF files.");
     }
     $options = unserialize($this->_reportFile->options);
     $this->_baseUrl = $options['baseUrl'];
     $this->_font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
     $fileSuffix = 1;
     $pdfPath = $this->_newPdf($filePath, $fileSuffix);
     while ($items = $this->_getItems()) {
         if ($this->_pdfPageCount >= $this->_pagesPerFile) {
             $fileSuffix++;
             $pdfPath = $this->_newPdf($filePath, $fileSuffix);
             _log("Created new PDF file '{$pdfPath}'");
             $this->_pdfPageCount = 0;
         }
         $this->_addItems($items, $pdfPath);
     }
     $this->_zipFiles($filePath);
     $this->_unlinkFiles();
     return $filePath;
 }
开发者ID:ungc0,项目名称:comp356-mac15,代码行数:29,代码来源:PdfQrCode.php


注:本文中的Zend_Pdf_Font::fontWithName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。