本文整理汇总了PHP中Zend_Pdf::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Pdf::save方法的具体用法?PHP Zend_Pdf::save怎么用?PHP Zend_Pdf::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Pdf
的用法示例。
在下文中一共展示了Zend_Pdf::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCreate
public function testCreate()
{
$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: _buildPDFDocuments
protected function _buildPDFDocuments(Doc_Book $book)
{
set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/../_vendor/zf');
$pdf = new Zend_Pdf();
$page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
$font = Zend_Pdf_Font::fontWithPath('c:\\windows\\fonts\\simkai.ttf');
$page->setFont($font, 12);
$pdf->pages[] = $page;
$page->drawText('中文测试', 100, 430, 'UTF-8');
$pdf->save('output.pdf');
}
示例3: 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');
}
示例4: deploy
public function deploy()
{
$this->checkExportRights();
$this->setRecordsPerPage(0);
parent::deploy();
$width = 0;
$colors = array('title' => '#000000', 'subtitle' => '#111111', 'footer' => '#111111', 'header' => '#AAAAAA', 'row1' => '#EEEEEE', 'row2' => '#FFFFFF', 'sqlexp' => '#BBBBBB', 'lines' => '#111111', 'hrow' => '#E4E4F6', 'text' => '#000000', 'filters' => '#F9EDD2', 'filtersBox' => '#DEDEDE');
$this->_deploy['colors'] = array_merge($colors, (array) $this->_deploy['colors']);
$la = '';
if (!isset($this->_deploy['save'])) {
$this->_deploy['save'] = false;
}
if (!isset($this->_deploy['download'])) {
$this->_deploy['download'] = false;
}
if ($this->_deploy['save'] != 1 && $this->_deploy['download'] != 1) {
throw new Exception('Nothing to do. Please specify download&&|save options');
}
if (empty($this->_deploy['name'])) {
$this->_deploy['name'] = date('H_m_d_H_i_s');
}
if (substr($this->_deploy['name'], -4) == '.xls') {
$this->_deploy['name'] = substr($this->_deploy['name'], 0, -4);
}
if (!isset($this->_deploy['noPagination'])) {
$this->_deploy['noPagination'] = 0;
}
$this->_deploy['dir'] = rtrim($this->_deploy['dir'], '/') . '/';
if (!isset($this->_deploy['dir']) || !is_dir($this->_deploy['dir'])) {
throw new Bvb_Grid_Exception($this->_deploy['dir'] . ' is not a dir');
}
if (!is_writable($this->_deploy['dir'])) {
throw new Bvb_Grid_Exception($this->_deploy['dir'] . ' is not writable');
}
$larg = self::calculateCellSize();
$lengthTotal = array_sum($larg);
$cellFontSize = 8;
//set font
$titulos = parent::_buildTitles();
$sql = parent::_buildSqlExp();
$grid = parent::_BuildGrid();
if (!$this->getInfo('hRow,field')) {
$this->_info['hRow']['field'] = '';
}
if (strtoupper($this->_deploy['orientation']) == 'LANDSCAPE' && strtoupper($this->_deploy['size']) == 'A4') {
$totalPaginas = ceil(count($grid) / 26);
} elseif (strtoupper($this->_deploy['orientation']) == 'LANDSCAPE' && strtoupper($this->_deploy['size']) == 'LETTER') {
$totalPaginas = ceil(count($grid) / 27);
} else {
$totalPaginas = ceil(count($grid) / 37);
}
if ($totalPaginas < 1) {
$totalPaginas = 1;
}
$pdf = new Zend_Pdf();
// Create new Style
$style = new Zend_Pdf_Style();
$style->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['lines']));
$topo = new Zend_Pdf_Style();
$topo->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['header']));
$td = new Zend_Pdf_Style();
$td->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['row2']));
$styleFilters = new Zend_Pdf_Style();
$styleFilters->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['filters']));
$styleFiltersBox = new Zend_Pdf_Style();
$styleFiltersBox->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['filtersBox']));
$td2 = new Zend_Pdf_Style();
$td2->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['row1']));
$hRowStyle = new Zend_Pdf_Style();
$hRowStyle->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['hrow']));
$styleSql = new Zend_Pdf_Style();
$styleSql->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['sqlexp']));
$styleText = new Zend_Pdf_Style();
$styleText->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['text']));
// Add new page to the document
if (strtoupper($this->_deploy['size'] = 'LETTER') && strtoupper($this->_deploy['orientation']) == 'LANDSCAPE') {
$page = $pdf->newPage(Zend_Pdf_Page::SIZE_LETTER_LANDSCAPE);
} elseif (strtoupper($this->_deploy['size'] = 'LETTER') && strtoupper($this->_deploy['orientation']) != 'LANDSCAPE') {
$page = $pdf->newPage(Zend_Pdf_Page::SIZE_LETTER);
} elseif (strtoupper($this->_deploy['size'] != 'A4') && strtoupper($this->_deploy['orientation']) == 'LANDSCAPE') {
$page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
} else {
$page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
}
$page->setStyle($style);
$pdf->pages[] = $page;
$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
$page->setFont($font, 14);
//$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
if (file_exists($this->_deploy['logo'])) {
$image = Zend_Pdf_Image::imageWithPath($this->_deploy['logo']);
list($width, $height, $type, $attr) = getimagesize($this->_deploy['logo']);
$page->drawImage($image, 40, $page->getHeight() - $height - 40, 40 + $width, $page->getHeight() - 40);
}
$page->drawText($this->__($this->_deploy['title']), $width + 70, $page->getHeight() - 70, $this->getCharEncoding());
$page->setFont($font, $cellFontSize);
$page->drawText($this->__($this->_deploy['subtitle']), $width + 70, $page->getHeight() - 80, $this->getCharEncoding());
//Iniciar a contagem de páginas
$pagina = 1;
$page->drawText($this->_deploy['footer'], 40, 40, $this->getCharEncoding());
//.........这里部分代码省略.........
示例5: pdfgenerationAction
function pdfgenerationAction()
{
//$fetchMeetings=new Meetingreport_Model_Meetingreport();
$pdf = new Zend_Pdf();
$page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
// $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
$pdf->pages[] = $page;
// Image
$app = $this->view->baseUrl();
$word = explode('/', $app);
$projname = '';
for ($i = 0; $i < count($word); $i++) {
if ($i > 0 && $i < count($word) - 1) {
$projname .= '/' . $word[$i];
}
}
$image_name = "/var/www" . $app . "/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 horizontal
$page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8);
$text = array("Bank", "Branch", "Thumb Impression Declaration", "I hereby declare that Smt/sri ______________________ has given the thumb impression in the presence of me and his mother tongue", " ___________________________", "Date", "Yours sincerely");
$x0 = 60;
$x10 = 450;
$x11 = 285;
$page->drawText($text[0], $x0, 725);
$page->drawText($text[1], $x0, 700);
$page->drawText($text[2], $x0, 675);
$page->drawText($text[3], $x0, 650);
$page->drawText($text[4], $x0, 625);
$page->drawText($text[5], $x0, 575);
$page->drawText($text[6], $x10, 575);
$page->setLineWidth(1)->drawLine(50, 750, 550, 750);
$page->setLineWidth(1)->drawLine(50, 750, 50, 465);
$page->setLineWidth(1)->drawLine(50, 750, 50, 465);
$page->setLineWidth(1)->drawLine(50, 465, 550, 465);
$page->setLineWidth(1)->drawLine(550, 465, 550, 750);
$page->setLineWidth(1)->drawLine(50, 690, 550, 690);
$page->setLineWidth(1)->drawLine(50, 670, 550, 670);
$y1 = 700;
$totalAmount = "0";
$totaldebit = "0";
$pdfData = $pdf->render();
$pdf->save('/var/www' . $projname . '/reports/thumbdeclaration' . date('Y-m-d') . '.pdf');
$path = '/var/www' . $projname . '/reports/thumbdeclaration' . date('Y-m-d') . '.pdf';
chmod($path, 0777);
}
示例6: pdfdisplayAction
public function pdfdisplayAction()
{
$date1 = $this->_request->getParam('date1');
$date2 = $this->_request->getParam('date2');
$glsubcode = $this->_request->getParam('ledger');
$pdf = new Zend_Pdf();
$page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
$pdf->pages[] = $page;
$app = $this->view->baseUrl();
$word = explode('/', $app);
$projname = $word[1];
//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 horizontal
//set the font
$page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8);
$this->view->search = 10;
$generalLedger = new Generalledger_Model_Generalledger();
//Lia
$this->view->ledegerList = $generalLedger->generalLedger($date1, $date2, $glsubcode);
$openingCash = $generalLedger->openingBalance($date1, $glsubcode);
print_r($openingCash);
// // Assets
$this->view->ledegerListAssets = $generalLedger->generalLedgerAssets($date1, $date2, $glsubcode);
$this->view->openingCashAssets = $generalLedger->openingBalanceAssets($date1, $glsubcode);
if (!$this->view->ledegerListAssets && !$this->view->openingCashAssets) {
} else {
$this->view->search = 0;
echo "<font color='red'><b> Record not found</b> </font>";
}
if (count($openingCash)) {
foreach ($openingCash as $openingCash) {
if ($openingCash["glsubcode_id"] == $ledegerList["glsubcode_id"]) {
$liabilityCash = $openingCash["openingCash"];
}
}
}
$text = array("Particular", "debit", "credit", "balance", "Opening balance");
$x0 = 60;
$x1 = 200;
$x2 = 340;
$x3 = 480;
$page->drawLine(50, 740, 550, 740);
$page->drawLine(50, 720, 550, 720);
$page->drawText($text[0], $x0, 725);
$page->drawText($text[1], $x1, 725);
$page->drawText($text[2], $x2, 725);
$page->drawText($text[3], $x3, 725);
$page->drawText($text[4], $x0, 700);
foreach ($openingCash as $openingCash) {
$page->drawText($openingCash["openingCash"], $x3, 700);
}
$y1 = 725;
//$page->drawText(Opening balance,$x0, $y1);
$pdf->save('/var/www/' . $projname . '/reports/GL.pdf');
$path = '/var/www/' . $projname . '/reports/GL.pdf';
// $pdf->save('/var/www/ourbank/reports/GL.pdf');
// $path = '/var/www/ourbank/reports/GL.pdf';
chmod($path, 0777);
}
示例7: testFontExtracting
public function testFontExtracting()
{
if (PHP_OS == 'AIX') {
$this->markTestSkipped('Not supported on AIX');
}
$pdf = new Zend_Pdf();
$fontsList = array(Zend_Pdf_Font::FONT_COURIER, Zend_Pdf_Font::FONT_HELVETICA_BOLD, Zend_Pdf_Font::FONT_TIMES_BOLD_ITALIC);
foreach ($fontsList as $fontName) {
// Add new page generated by Zend_Pdf object (page is attached to the specified the document)
$pdf->pages[] = $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
$font = Zend_Pdf_Font::fontWithName($fontName);
$page->setFont($font, 10)->drawText($font->getFontName(Zend_Pdf_Font::NAME_POSTSCRIPT, 'en') . ':', 100, 400);
$page->setFont($font, 20)->drawText("'The quick brown fox jumps over the lazy dog'", 100, 360);
$type = $font->getFontType();
}
$TTFFontsList = array('VeraBd.ttf', 'VeraBI.ttf', 'VeraIt.ttf', 'VeraMoBd.ttf', 'VeraMoBI.ttf', 'VeraMoIt.ttf', 'VeraMono.ttf', 'VeraSeBd.ttf', 'VeraSe.ttf', 'Vera.ttf');
foreach ($TTFFontsList as $fontName) {
// Add new page generated by Zend_Pdf object (page is attached to the specified the document)
$pdf->pages[] = $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
$font = Zend_Pdf_Font::fontWithPath(dirname(__FILE__) . '/_fonts/' . $fontName);
$page->setFont($font, 10)->drawText($font->getFontName(Zend_Pdf_Font::NAME_POSTSCRIPT, 'en', 'CP1252') . ':', 100, 400);
$page->setFont($font, 20)->drawText("'The quick brown fox jumps over the lazy dog'", 100, 360);
$type = $font->getFontType();
}
$pdf->save(dirname(__FILE__) . '/_files/output.pdf');
unset($pdf);
$pdf1 = Zend_Pdf::load(dirname(__FILE__) . '/_files/output.pdf');
$newPages = array();
$fontList = array();
$fontNames = array();
foreach ($pdf1->pages as $page) {
$pageFonts = $page->extractFonts();
foreach ($pageFonts as $font) {
$fontList[] = $font;
$fontNames[] = $font->getFontName(Zend_Pdf_Font::NAME_POSTSCRIPT, 'en', 'UTF-8');
}
}
$this->assertEquals(array(Zend_Pdf_Font::FONT_COURIER, Zend_Pdf_Font::FONT_HELVETICA_BOLD, Zend_Pdf_Font::FONT_TIMES_BOLD_ITALIC, 'BitstreamVeraSans-Bold', 'BitstreamVeraSans-BoldOblique', 'BitstreamVeraSans-Oblique', 'BitstreamVeraSansMono-Bold', 'BitstreamVeraSansMono-BoldOb', 'BitstreamVeraSansMono-Oblique', 'BitstreamVeraSansMono-Roman', 'BitstreamVeraSerif-Bold', 'BitstreamVeraSerif-Roman', 'BitstreamVeraSans-Roman'), $fontNames);
$pdf1->pages[] = $page = $pdf1->newPage(Zend_Pdf_Page::SIZE_A4);
$yPosition = 700;
foreach ($fontList as $font) {
$page->setFont($font, 15)->drawText("The quick brown fox jumps over the lazy dog", 100, $yPosition);
$yPosition -= 30;
}
$fontNames1 = array();
foreach ($pdf1->extractFonts() as $font) {
$fontNames1[] = $font->getFontName(Zend_Pdf_Font::NAME_POSTSCRIPT, 'en', 'UTF-8');
}
$this->assertEquals(array(Zend_Pdf_Font::FONT_COURIER, Zend_Pdf_Font::FONT_HELVETICA_BOLD, Zend_Pdf_Font::FONT_TIMES_BOLD_ITALIC, 'BitstreamVeraSans-Bold', 'BitstreamVeraSans-BoldOblique', 'BitstreamVeraSans-Oblique', 'BitstreamVeraSansMono-Bold', 'BitstreamVeraSansMono-BoldOb', 'BitstreamVeraSansMono-Oblique', 'BitstreamVeraSansMono-Roman', 'BitstreamVeraSerif-Bold', 'BitstreamVeraSerif-Roman', 'BitstreamVeraSans-Roman'), $fontNames1);
$page = reset($pdf1->pages);
$font = $page->extractFont(Zend_Pdf_Font::FONT_COURIER);
$this->assertTrue($font instanceof Zend_Pdf_Resource_Font_Extracted);
$font = $page->extractFont(Zend_Pdf_Font::FONT_TIMES_BOLD_ITALIC);
$this->assertNull($font);
$font = $pdf1->extractFont(Zend_Pdf_Font::FONT_TIMES_BOLD_ITALIC);
$this->assertTrue($font instanceof Zend_Pdf_Resource_Font_Extracted);
$font = $pdf1->extractFont(Zend_Pdf_Font::FONT_TIMES_ROMAN);
$this->assertNull($font);
$pdf1->save(dirname(__FILE__) . '/_files/output1.pdf');
unset($pdf1);
$pdf2 = Zend_Pdf::load(dirname(__FILE__) . '/_files/output1.pdf');
$this->assertTrue($pdf2 instanceof Zend_Pdf);
unset($pdf2);
unlink(dirname(__FILE__) . '/_files/output.pdf');
unlink(dirname(__FILE__) . '/_files/output1.pdf');
}
示例8: pdfAction
//.........这里部分代码省略.........
$shgdeclaration = " SHG I hereby declare and confirm further that I have not committed any default in paying the lease amount to the lesser and have not committed any breach of the terms and conditions of the lease.Moreover,I declare further that there are no arrears of any lease amount.\n\nI have also not resorted to outside borrowing against security of the present crop which is the subject matter of the bank finance.The crop to be raised is free from the charge/encumbrances.";
$jlgdeclaration = " JLG I hereby declare and confirm further that I have not committed any default in paying the lease amount to the lesser and have not committed any breach of the terms and conditions of the lease.Moreover,I declare further that there are no arrears of any lease amount.\n\nI have also not resorted to outside borrowing against security of the present crop which is the subject matter of the bank finance.The crop to be raised is free from the charge/encumbrances.";
$pdf = new Zend_Pdf();
foreach ($this->view->memberdetails as $memberdetails) {
$page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
$pdf->pages[] = $page;
//Path
$app = $this->view->baseUrl();
$word = explode('/', $app);
$projname = $word[1];
// 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), 10);
$title = "";
if (substr($this->view->groupcode, 4, 1) == 2) {
$title = "Self Helf Group member";
} else {
if (substr($this->view->groupcode, 4, 1) == 3) {
$title = "Joint Liability Group member";
}
}
$page->drawText($title, 230, 740);
$page->drawText($title, 230, 740);
//set the font
$page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8);
$page->drawText("Date : " . date('d-m-Y'), 500, 800);
$y1 = 710;
$y2 = 740;
$x1 = 60;
$x2 = 350;
$x3 = 230;
$x4 = 400;
if ($y1 > 45) {
$page->drawText("To,", $x1, $y1);
$page->drawText("The Branch manager,", $x1, $y1 = $y1 - 15);
$page->drawText($this->view->bankdetails[0]['bankname'] . ',', $x1, $y1 = $y1 - 15);
$page->drawText($this->view->bankdetails[0]['branch'] . '.', $x1, $y1 = $y1 - 15);
$page->drawText('Respected sir,', $x1, $y1 = $y1 - 35);
if ($memberdetails['alias']) {
$alias = "@ " . $memberdetails['alias'];
} else {
$alias = '';
}
$village = $this->view->Dbobj->fetchvillagedetails($memberdetails['village_id']);
$subject = $memberdetails['membername'] . " " . $alias . " " . $memberdetails['age'] . " Age " . $this->view->groupdetails[0]['group_name'] . " Group " . $village[0]['villagename'] . " Village " . $village[0]['talukname'] . " Taluk " . $village[0]['distname'] . " District.";
$page->drawText($subject, $x1, $y1 = $y1 - 25);
$y1 = $y1 - 25;
$addressline = 0;
if (substr($this->view->groupcode, 4, 1) == 2) {
$newtext = wordwrap($shgdeclaration, 30, "<br />");
$pieces = explode("<br />", $newtext);
$page->drawText($pieces, $x1, $y1);
} else {
if (substr($this->view->groupcode, 4, 1) == 3) {
$newtext = wordwrap($jlgdeclaration, 130, "<br />");
$pieces = explode("<br />", $newtext);
foreach ($pieces as $pieces1) {
$page->drawText(substr($pieces1, 0, 300), $x1, $y1);
$y1 -= 15;
$addressline++;
}
$y1 -= $addressline * 15;
// $page->drawText($pieces,$x1, $y1);
}
}
$y1 = $y1 - 35;
$page->drawText("Date :" . $this->view->groupdetails[0]['group_created_date'], $x1, $y1);
$page->drawText("yours obediently,", $x2, $y1);
$page->drawText("Place :" . $this->view->groupdetails[0]['place'], $x1, $y1 = $y1 - 15);
$y1 = $y1 - 35;
$page->drawText($memberdetails['membername'], $x2, $y1);
$page->drawText("Signature", $x2, $y1 = $y1 - 15);
$y1 = $y1 - 45;
$page->drawText("Representative Seal & signature", $x1, $y1);
$y1 = $y1 - 25;
$page->drawText("Representative 1", $x1, $y1);
$page->drawText("Representative 2", $x3, $y1);
$page->drawText("Representative 3", $x4, $y1);
$y1 = $y1 - 15;
foreach ($this->view->representative as $representative) {
$page->drawText($representative['membername'], $x1, $y1);
$x1 = $x1 + 170;
}
}
}
$pdfData = $pdf->render();
$pdf->save('/var/www/' . $projname . '/reports/membersdeclaration.pdf');
$path = '/var/www/' . $projname . '/reports/membersdeclaration.pdf';
chmod($path, 0777);
}
示例9: pdftransactionAction
//.........这里部分代码省略.........
$productname = "To " . $loansCredit->account_number;
$page->drawText($productname, $x2, $y1);
$page->drawText($loansCredit->account_id, $x3, $y1);
if ($loansCredit->paymenttype_id == 1) {
$page->drawText($loansCredit->amount_to_bank, $x4, $y1);
$totalCredit = $totalCredit + $loansCredit->amount_to_bank;
$columntotal += $loansCredit->amount_to_bank;
} elseif ($loansCredit->paymenttype_id == 5) {
$page->drawText($loansCredit->amount_to_bank, $x5, $y1);
$totalTransferCredit = $totalTransferCredit + $loansCredit->amount_to_bank;
$columntotal += $loansCredit->amount_to_bank;
}
$page->drawText(sprintf("%4.2f", $columntotal), $x6, $y1);
$page->drawText(sprintf("%4.2f", $columntotal), $x6, $y1);
$columntotal1 += $columntotal;
$y1 = $y1 - 15;
}
}
$i = 0;
foreach ($loanDebit as $loansDebit) {
$i++;
$columntotald = 0;
if ($loansDebit->paymenttype_id == 1 or $loansDebit->paymenttype_id == 5) {
$page->drawText($i, $x7, $y2);
$productnamed = "By " . $loansDebit->account_number;
$page->drawText($productnamed, $x8, $y2);
$page->drawText($loansDebit->account_id, $x9, $y2);
if ($loansDebit->paymenttype_id == 1) {
$page->drawText($loansDebit->amount_from_bank, $x10, $y2);
$totalDebit = $totalCredit + $loansDebit->amount_from_bank;
$columntotald += $loansDebit->amount_from_bank;
} elseif ($loansDebit->paymenttype_id == 5) {
$page->drawText($loansDebit->amount_from_bank, $x11, $y2);
$totalTransferDebit = $totalTransferDebit + $loansDebit->amount_from_bank;
$columntotald += $loansDebit->amount_from_bank;
}
$page->drawText(sprintf("%4.2f", $columntotald), $x12, $y2);
$page->drawText(sprintf("%4.2f", $columntotald), $x12, $y2);
$columntotald1 += $columntotald;
$y2 = $y2 - 15;
}
}
$page->drawLine(30, $y1, 570, $y1);
$page->drawLine(30, $y1 - 20, 570, $y1 - 20);
$page->drawText($text[6], $x1, $y1 - 15);
$page->drawText($text[6], $x1, $y1 - 15);
if ($totalCredit != "0") {
$page->drawText(sprintf("%4.2f", $totalCredit), $x4, $y1 - 15);
$page->drawText(sprintf("%4.2f", $totalCredit), $x4, $y1 - 15);
} else {
$page->drawText("----", $x4, $y1 - 15);
$page->drawText("----", $x4, $y1 - 15);
}
if ($totalTransferCredit != "0") {
$page->drawText(sprintf("%4.2f", $totalTransferCredit), $x5, $y1 - 15);
$page->drawText(sprintf("%4.2f", $totalTransferCredit), $x5, $y1 - 15);
} else {
$page->drawText("----", $x5, $y1 - 15);
$page->drawText("----", $x5, $y1 - 15);
}
if ($columntotal1 != "0") {
$page->drawText(sprintf("%4.2f", $columntotal1), $x6, $y1 - 15);
$page->drawText(sprintf("%4.2f", $columntotal1), $x6, $y1 - 15);
} else {
$page->drawText("----", $x6, $y1 - 15);
$page->drawText("----", $x6, $y1 - 15);
}
if ($totalDebit != "0") {
$page->drawText(sprintf("%4.2f", $totalDebit), $x10, $y1 - 15);
$page->drawText(sprintf("%4.2f", $totalDebit), $x10, $y1 - 15);
} else {
$page->drawText("----", $x10, $y1 - 15);
$page->drawText("----", $x10, $y1 - 15);
}
if ($totalTransferDebit != "0") {
$page->drawText(sprintf("%4.2f", $totalTransferDebit), $x11, $y1 - 15);
$page->drawText(sprintf("%4.2f", $totalTransferDebit), $x11, $y1 - 15);
} else {
$page->drawText("----", $x11, $y1 - 15);
$page->drawText("----", $x11, $y1 - 15);
}
if ($columntotald1 != "0") {
$page->drawText(sprintf("%4.2f", $columntotald1), $x12, $y1 - 15);
$page->drawText(sprintf("%4.2f", $columntotald1), $x12, $y1 - 15);
} else {
$page->drawText("----", $x12, $y1 - 15);
$page->drawText("----", $x12, $y1 - 15);
}
// Virtual table
$page->setLineWidth(1)->drawLine(30, $y1 - 20, 30, 750);
//Table left vertical
$page->setLineWidth(1)->drawLine(298, $y1 - 20, 298, 750);
//Table center vertical
$page->setLineWidth(1)->drawLine(570, $y1 - 20, 570, 750);
//table rigth vertical
$pdfData = $pdf->render();
$pdf->save('/var/www/' . $projname . '/reports/loansupplementary.pdf');
$path = '/var/www/' . $projname . '/reports/loansupplementary.pdf';
chmod($path, 0777);
}
示例10: pdfgenerationAction
function pdfgenerationAction()
{
$declarationform = new Declaration_Form_Account();
$this->view->form = $declarationform;
$this->view->membercode = $memcode = $this->_request->getParam('membercode');
if (substr($memcode, 4, 1) == 2 or substr($memcode, 4, 1) == 3) {
$this->view->groupresult = $result = $this->view->dbobj->getmembers($memcode);
//
if ($result) {
$declarationform->populate($result[0]);
$this->view->groupcode = $groupcode = $result[0]['groupcode'];
$this->view->relation = $result = $this->view->dbobj->getrelations($groupcode);
}
} else {
$this->view->result = $result = $this->view->dbobj->getmember($memcode);
//
if ($result) {
$declarationform->populate($result[0]);
$this->view->membercode1 = $familyid = $result[0]['family_id'];
$this->view->relation = $result = $this->view->dbobj->getrelation($familyid);
$dbobj = new Declaration_Model_Dec();
$app = $this->view->baseUrl();
$word = explode('/', $app);
$projname = $word[1];
$title1 = "declaration";
$this->view->pageTitle = $title1;
$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);
$Declaration = new Declaration_Model_Dec();
$memcode = $this->_request->getParam('membercode');
$familyid = $this->_request->getParam('membercode1');
$showgetmember = $Declaration->getmember($memcode);
$showgetrelation = $Declaration->getrelation($familyid);
$dateconvert = new App_Model_dateConvertor();
foreach ($this->view->result as $result) {
}
// write text to page
$page->setFont($font, 12)->drawText('DECLARATION', 240, 720);
// $page->setLineWidth(1)->drawLine(0, 800, 820, 250);
$page->setFont($font, 10)->drawText('(TO BE SUBMITTED BY THE BORROWER UNDER SBI JOINT LIABILITY GROUP)', 72, 700);
$page->setFont($font, 9)->drawText('I,' . $result['name'] . ' (Name of the borrower), Son of ' . $this->view->relation[0]['fathername'] . '', 72, 670);
$page->setFont($font, 9)->drawText('Aged around ' . $result['age'] . ' years,presently residing at ' . $result['street'] . ' do here by', 72, 655);
$page->setFont($font, 9)->drawText('Solemnly affirm and sincerely state on Oath as follows:', 72, 625);
$page->setFont($font, 9)->drawText('i) I propose to avail a crop loan under SBI JLG scheme against hypothecation of the crop which the loan is to be sanctioned.', 72, 605);
$page->setFont($font, 9)->drawText('ii) In this connection, I confirm that and declare that I am land less labourer / share cropper /tenant farmer /oral lessee', 72, 585);
$page->setFont($font, 9)->drawText('( Stricke out which ever not applicable ).', 80, 575);
$page->setFont($font, 9)->drawText('iii) I hereby declare and confirm furture that the properties mentioned in the schedule to the affidavit is the property which', 72, 555);
$page->setFont($font, 9)->drawText('is the subject matter of lease (Oral /written) in my favour for year to year or for period of ' . $dateconvert->normalformat($result['created_date']) . '', 80, 545);
$page->setFont($font, 9)->drawText('year as mentioned in the document and the lease is presently in force and Sri ' . $result['landowner_name'] . ' is the lesser and ', 80, 535);
$page->setFont($font, 9)->drawText('the owner of the property (a copy of the lease deed is enclosed).', 80, 525);
$page->setFont($font, 9)->drawText('iv)I hereby declare and confirm further that I have not committed any default in paying the lease amount to the lesser and', 72, 505);
$page->setFont($font, 9)->drawText('have not committed any breach of the terms and conditions of the lease.Moreover,I declare further that there are no', 80, 495);
$page->setFont($font, 9)->drawText('arrears of any lease amount.', 80, 485);
$page->setFont($font, 9)->drawText('v) I have also not resorted to outside borrowing against security of the present crop which is the subject matter of the bank', 72, 465);
$page->setFont($font, 9)->drawText('finance.The crop to be raised is free from the charge/encumbrances.', 80, 455);
// add page to document
$pdf->pages[] = $page;
$pdfData = $pdf->render();
$pdfData = $pdf->render();
$pdf->save('/var/www/' . $projname . '/reports/declaration.pdf');
$path = '/var/www/' . $projname . '/reports/declaration.pdf';
chmod($path, 0777);
// $this->_redirect('/declaration/index');
}
}
}
示例11: pdftransactionAction
//.........这里部分代码省略.........
$totalamount = 0;
$withdrawlAmount = 0;
$depositAmount = 0;
} else {
echo "***";
}
}
$page->drawLine($xx, $y1, $xy, $y1);
$y1 -= 18;
$page->drawText("Total", $x3, $y1);
$pos = position(sprintf("%4.2f", $sum));
$page->drawText(sprintf("%4.2f", $sum), $pos, $y1);
$y1 -= 10;
$page->drawLine($xx, $y1, $xy, $y1);
$page->drawLine($xx, $y1, $xx, $startlinepoint);
//1st vertical line
$page->drawLine($x2 - 8, $y1, $x2 - 8, $startlinepoint);
//1st vertical line
$page->drawLine($x3 - 10, $y1, $x3 - 10, $startlinepoint);
//1st vertical line
$page->drawLine($x4 - 10, $y1, $x4 - 10, $startlinepoint);
//1st vertical line
$page->drawLine($xy, $y1, $xy, $startlinepoint);
//1st vertical line
//echo "<pre>";print_r($accountBalanc);echo "<pre>";
if (!$result && !$accountBalanc) {
echo "<font color='RED' size = '3'>No Savings Account</font>";
}
} else {
// $office_id = $this->_request->getParam('field1');
$savingsummary = new Depositsummary_Model_Depositsummary();
$result = $savingsummary->SavingsDetails();
$this->view->result = $result;
$accountBalanc = $savingsummary->accountBalance();
$this->view->accountBalanc = $accountBalanc;
$depositAmount = 0;
$deposit = 0;
$withdrawlAmount = 0;
$withdrawl = 0;
$totalamount = 0;
$sum = 0;
foreach ($result as $result) {
$page->drawText($result['productname'], $x1, $y1);
$page->drawText($result['prodoffername'], $x2, $y1);
$page->drawText($result['countvalue'], $x3, $y1);
$accountBalanc = $savingsummary->accountBalance();
$this->view->accountBalanc = $accountBalanc;
foreach ($accountBalanc as $accountBalanc) {
if ($result['id'] == $accountBalanc['offerprodid']) {
if ($accountBalanc['transactiontype_id'] == 1) {
$depositAmount = $depositAmount + $accountBalanc['amount_to_bank'];
$deposit = $deposit + $accountBalanc['amount_to_bank'];
}
if ($accountBalanc['transactiontype_id'] == 2) {
$withdrawlAmount = $withdrawlAmount + $accountBalanc['amount_from_bank'];
$withdrawl = $withdrawl + $accountBalanc['amount_from_bank'];
}
$totalamount = $depositAmount - $withdrawlAmount;
$sum = $deposit - $withdrawl;
}
}
if ($totalamount) {
$pos = position(sprintf("%4.2f", $totalamount));
$page->drawText(sprintf("%4.2f", $totalamount), $pos, $y1);
$y1 -= 18;
$totalamount = 0;
$withdrawlAmount = 0;
$depositAmount = 0;
} else {
echo "***";
}
}
$page->drawLine($xx, $y1, $xy, $y1);
$y1 = 18;
$page->drawText("Total", $x3, $y1);
$pos = position(sprintf("%4.2f", $sum));
$page->drawText(sprintf("%4.2f", $sum), $pos, $y1);
$y1 = 15;
$page->drawLine($xx, $y1, $xy, $y1);
$page->drawLine($xx, $y1, $xx, $startlinepoint);
//1st vertical line
$page->drawLine($x2 - 8, $y1, $x2 - 8, $startlinepoint);
//1st vertical line
$page->drawLine($x3 - 10, $y1, $x3 - 10, $startlinepoint);
//1st vertical line
$page->drawLine($x4 - 10, $y1, $x4 - 10, $startlinepoint);
//1st vertical line
$page->drawLine($xy, $y1, $xy, $startlinepoint);
//1st vertical line
if (!$result && !$accountBalanc) {
echo "<font color='RED' size = '3'>No Savings Account</font>";
}
}
// $y1-=15;
$pdfData = $pdf->render();
$pdf->save('/var/www' . $projname . '/reports/depositsummaryreport.pdf');
$path = '/var/www' . $projname . '/reports/depositsummaryreport.pdf';
chmod($path, 0777);
$this->_redirect('depositsummary/index');
}
示例12: actionZendPdf
/**
* This is the default 'index' action that is invoked
* when an action is not explicitly requested by users.
*/
public function actionZendPdf()
{
set_include_path( '/home/asaap/src/protected/extensions/' );
require_once 'Zend/Pdf.php';
require_once 'Zend/Pdf/Style.php';
require_once 'Zend/Pdf/Color/Cmyk.php';
require_once 'Zend/Pdf/Color/Html.php';
require_once 'Zend/Pdf/Color/GrayScale.php';
require_once 'Zend/Pdf/Color/Rgb.php';
require_once 'Zend/Pdf/Page.php';
require_once 'Zend/Pdf/Font.php';
//$argv[1]='/home/asaap/src/protected/data/Pdf/test.pdf';
$argv[1]='/home/asaap/src/protected/data/Pdf/document1.pdf';
$argv[2]='/home/asaap/src/protected/data/Pdf/test_new.pdf';
if (!isset($argv[1])) {
echo "USAGE: php demo.php <pdf_file> [<output_pdf_file>]\n";
exit;
}
try {
$pdf = Zend_Pdf::load($argv[1]);
} catch (Zend_Pdf_Exception $e) {
if ($e->getMessage() == 'Can not open \'' . $argv[1] . '\' file for reading.') {
// Create new PDF if file doesn't exist
$pdf = new Zend_Pdf();
if (!isset($argv[2])) {
// force complete file rewriting (instead of updating)
$argv[2] = $argv[1];
}
} else {
// Throw an exception if it's not the "Can't open file" exception
throw $e;
}
}
//$pdf->pages = array_reverse($pdf->pages);
// Add new page generated by Zend_Pdf object (page is attached to the specified the document)
$pdf->pages[] = ($page1 = $pdf->newPage('A4'));
//saving here
$pdf->save($argv[2]);
// $pdf->save($argv[1], true /* update */);
}
示例13: createpdfAction
//.........这里部分代码省略.........
$pdfPage->drawText($value->frequenciaAula, 475, $stringpos, 'UTF-8');
$pdfPage->drawText($value->turnoAula, 595, $stringpos, 'UTF-8');
$pdfPage->drawText($value->quantGabinete, 695, $stringpos, 'UTF-8');
$stringpos = $stringpos - $stringdif;
// subtrai para que a
// linha fique embaixo
}
if ($stringpos < 285) {
array_push($pdf->pages, $pdfPage);
$pdfPage = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
$stringpos = 580;
}
$stringpos -= 4;
$pdfPage->setFont($font, 12);
$pdfPage->drawText('Quantidade tipo gabinete', 20, $stringpos, 'UTF-8');
$pdfPage->drawText('Sistema operacional', 205, $stringpos, 'UTF-8');
$pdfPage->drawText('Licença DTI?', 365, $stringpos, 'UTF-8');
$pdfPage->drawText('OCS instalado?', 475, $stringpos, 'UTF-8');
$pdfPage->drawText('Ips servidores', 595, $stringpos, 'UTF-8');
$pdfPage->drawText('Estrutura L.rede', 710, $stringpos, 'UTF-8');
$stringpos -= 12;
$pdfPage->setFont($font, 9);
foreach ($valor as $value) {
$pdfPage->drawText($stringpos, 20, $stringpos, 'UTF-8');
$pdfPage->drawText($value->sisOperacional, 205, $stringpos, 'UTF-8');
$pdfPage->drawText($value->licencaDti, 365, $stringpos, 'UTF-8');
$pdfPage->drawText($value->ocsInstalado, 475, $stringpos, 'UTF-8');
$pdfPage->drawText($value->ipsServidores, 595, $stringpos, 'UTF-8');
$pdfPage->drawText($value->estruturaLRede, 710, $stringpos, 'UTF-8');
$stringpos = $stringpos - $stringdif;
// subtrai para que a
// linha fique embaixo
}
if ($stringpos < 198) {
array_push($pdf->pages, $pdfPage);
$pdfPage = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
$stringpos = 580;
}
$stringpos -= 4;
$pdfPage->setFont($font, 12);
$pdfPage->drawText('Roteador', 20, $stringpos, 'UTF-8');
$pdfPage->drawText('Ip entrada', 205, $stringpos, 'UTF-8');
$pdfPage->drawText('Ip saída', 365, $stringpos, 'UTF-8');
$pdfPage->drawText('Nome responsável', 475, $stringpos, 'UTF-8');
$pdfPage->drawText('Ramal', 595, $stringpos, 'UTF-8');
$pdfPage->drawText('E-mail', 715, $stringpos, 'UTF-8');
$stringpos -= 12;
$pdfPage->setFont($font, 9);
foreach ($valor as $value) {
$pdfPage->drawText($stringpos, 20, $stringpos, 'UTF-8');
$pdfPage->drawText($value->ipEntrada, 205, $stringpos, 'UTF-8');
$pdfPage->drawText($value->ipSaida, 365, $stringpos, 'UTF-8');
$pdfPage->drawText($value->nomeResponsavel, 475, $stringpos, 'UTF-8');
$pdfPage->drawText($value->ramal, 595, $stringpos, 'UTF-8');
$pdfPage->drawText($value->email, 715, $stringpos, 'UTF-8');
$stringpos = $stringpos - $stringdif;
// subtrai para que a
// linha fique embaixo
if ($stringpos < 14) {
}
}
if ($stringpos <= 170) {
array_push($pdf->pages, $pdfPage);
$pdfPage = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
$stringpos = 580;
}
$stringpos -= 4;
$pdfPage->setFont($font, 12);
$pdfPage->drawText('Acesso remoto', 20, $stringpos, 'UTF-8');
$pdfPage->drawText('Backup', 205, $stringpos, 'UTF-8');
$pdfPage->drawText('Firewall', 375, $stringpos, 'UTF-8');
$pdfPage->drawText('Observações', 475, $stringpos, 'UTF-8');
$stringpos -= 12;
$pdfPage->setFont($font, 9);
foreach ($valor as $value) {
$pdfPage->drawText($value->acessoRemoto, 20, $stringpos, 'UTF-8');
$pdfPage->drawText($value->backup, 205, $stringpos, 'UTF-8');
$pdfPage->drawText($value->firewall, 375, $stringpos, 'UTF-8');
$pdfPage->drawText($value->observacoes, 475, $stringpos, 'UTF-8');
$stringpos = $stringpos - $stringdif;
// subtrai para que a
// linha fique embaixo
}
if ($stringpos < 14) {
array_push($pdf->pages, $pdfPage);
$pdfPage = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
}
// if $stringpos = 250 muda a pagina
//
// adicionamos nossa página como a 1ª página de nosso documento
// $pagina=$stringpos/250;
array_push($pdf->pages, $pdfPage);
// $pdf->pages[1] = $pdfPage;
$pdf->save('lab.pdf');
header('Content-type: application/pdf');
echo $pdf->render();
} else {
return $this->_helper->redirector('select', 'lab');
}
}
示例14: pdfmeetingAction
//.........这里部分代码省略.........
$page->drawText($members['uid'], 180, $y1);
//$members['uid']
$memberabsent = $currentbalance->memberabsent($memberid, $attendance['id']);
$memberlate = $currentbalance->memberlate($memberid, $attendance['id']);
if ($memberabsent) {
$absente = 'A';
} else {
if ($memberlate) {
$absente = 'L';
} else {
$absente = 'P';
}
}
$page->drawText($absente, 245, $y1);
if ($memberlate) {
$totallatefee += $latefee = $members['penalty_latecoming'];
$pos = position(sprintf("%4.2f", $latefee), $x3);
$page->drawText(sprintf("%4.2f", $latefee), $pos + 2, $y1);
} else {
$latefee = 0;
$pos = position(sprintf("%4.2f", ''), $x3);
$page->drawText(sprintf("%4.2f", ''), $pos + 2, $y1);
}
if ($memberabsent) {
$totalabsentfee += $absentfee = $members['penalty_notcoming'];
$pos = position(sprintf("%4.2f", $absentfee), $x4);
$page->drawText(sprintf("%4.2f", $absentfee), $pos + 2, $y1);
} else {
$absentfee = 0;
$pos = position(sprintf("%4.2f", ''), $x4);
$page->drawText(sprintf("%4.2f", ''), $pos + 2, $y1);
}
$creditbalance = $currentbalance->creditbalance($memberid);
$debitbalance = $currentbalance->debitbalance($memberid);
if ($creditbalance) {
if ($debitbalance) {
$debitbalance1 = $debitbalance;
} else {
$debitbalance1 = 0;
}
$currentbalance1 = $creditbalance[0]['currentbalance'] - $debitbalance1[0]['currentbalance'];
$pos = position(sprintf("%4.2f", $currentbalance1), $x5);
$page->drawText(sprintf("%4.2f", $currentbalance1), $pos + 2, $y1);
} else {
$pos = position(sprintf("%4.2f", ''), $x5);
$page->drawText(sprintf("%4.2f", ''), $pos + 2, $y1);
}
$currentbalance2 += $currentbalance1;
$perweek = $members['saving_perweek'];
$pos = position(sprintf("%4.2f", $members['saving_perweek']), $x6);
$page->drawText(sprintf("%4.2f", $members['saving_perweek']), $pos + 2, $y1);
$loanoutstanding = $currentbalance->loanoutstanding($memberid);
if ($loanoutstanding) {
$loanoutstanding1 = $loanoutstanding[0]['outstanding'];
$pos = position(sprintf("%4.2f", $loanoutstanding[0]['outstanding']), $x7);
$page->drawText(sprintf("%4.2f", $loanoutstanding[0]['outstanding']), $pos + 2, $y1);
}
$currentbalance3 += $loanoutstanding1;
$loandue = $currentbalance->loandue($memberid);
if ($loandue) {
$pos = position(sprintf("%4.2f", $loandue[0]['outstanding']), $x8);
$page->drawText(sprintf("%4.2f", $loandue[0]['outstanding']), $pos + 2, $y1);
$loandue1 = $loandue[0]['outstanding'];
}
$loandue2 += $loandue1;
$total = $latefee + $absentfee + $currentbalance1 + $loandue1;
$pos = position(sprintf("%4.2f", $total), $x9);
$page->drawText(sprintf("%4.2f", $total), $pos + 2, $y1);
$page->drawLine(50, $y1 - 10, 550, $y1 = $y1 - 10);
$no++;
$Topay += $members['saving_perweek'];
$total1 += $total;
}
$y1 = $y1 - 15;
$page->drawText("Total", 180, $y1);
$pos = position(sprintf("%4.2f", $totallatefee), $x3);
$page->drawText(sprintf("%4.2f", $totallatefee), $pos + 2, $y1);
$pos = position(sprintf("%4.2f", $totalabsentfee), $x4);
$page->drawText(sprintf("%4.2f", $totalabsentfee), $pos + 2, $y1);
$pos = position(sprintf("%4.2f", $currentbalance2), $x5);
$page->drawText(sprintf("%4.2f", $currentbalance2), $pos + 2, $y1);
$pos = position(sprintf("%4.2f", $Topay), $x6);
$page->drawText(sprintf("%4.2f", $Topay), $pos + 2, $y1);
$pos = position(sprintf("%4.2f", $currentbalance3), $x7);
$page->drawText(sprintf("%4.2f", $currentbalance3), $pos + 2, $y1);
$pos = position(sprintf("%4.2f", $loandue2), $x8);
$page->drawText(sprintf("%4.2f", $loandue2), $pos + 2, $y1);
$pos = position(sprintf("%4.2f", $total1), $x9);
$page->drawText(sprintf("%4.2f", $total1), $pos + 2, $y1);
$page->drawLine(50, $y1 - 10, 550, $y1 = $y1 - 10);
// Virtual table
$page->setLineWidth(1)->drawLine(50, $y1, 50, $y3);
//Table left vertical
$page->setLineWidth(1)->drawLine(550, $y1, 550, $y3);
//table rigth vertical
$pdfData = $pdf->render();
$pdf->save('/var/www/' . $projname . '/reports/meetingbook.pdf');
$path = '/var/www/' . $projname . '/reports/meetingbook.pdf';
chmod($path, 0777);
}
示例15: _generatePdf
/**
* Generate a review portal pdf.
*
* @param integer $portalId
* @return string The pdf name
*/
protected function _generatePdf($portalId)
{
$portal = new Object_ReviewPortal($portalId);
if (!$portal->getId()) {
return false;
}
// Get the screenshots of all the portal pages.
$pages = Repo_ReviewPortalPage::getInstance()->getPortalPages($portalId);
if (!$pages || $pages->count() == 0) {
return false;
}
$pdf = new Zend_Pdf();
$pageNumber = 1;
$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
$fontSize = 10;
foreach ($pages as $_p) {
$_images = array();
$_page = new Object_Page($_p->id);
// Try get static screenshots if the setting is set.
if ($_page->screenshot_type == Repo_Page::SCREENSHOT_TYPE_STATIC) {
$_images = $_page->getStaticScreenshots(true);
}
// Get dynamic one.
if (empty($_images)) {
$_images[] = Manager_ScreenCapture_Page::getInstance()->getScreenshot($_p->id);
}
foreach ($_images as $_image) {
$_pdfImage = Zend_Pdf_Image::imageWithPath($_image);
$_pdfPage = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_LETTER_LANDSCAPE);
$_pdfPage->drawImage($_pdfImage, 20, 36, $_pdfPage->getWidth() - 20, $_pdfPage->getHeight() - 20);
$_pdfPage->setFont($font, 16);
$_pdfPage->setFillColor(Zend_Pdf_Color_Html::color('#333333'))->drawText($pageNumber, $_pdfPage->getWidth() / 2, 10);
$pageNumber++;
$pdf->pages[] = $_pdfPage;
}
}
$pdfName = $portalId . '_' . time() . '.pdf';
$path = $this->_rootPath . DS . $pdfName;
$pdf->save($path);
return $pdfName;
}