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


PHP FPDF::addPage方法代码示例

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


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

示例1: generate_pdf

 private function generate_pdf($srcText, $dest)
 {
     // Set some document variables
     $author = "";
     $x = 50;
     $text = "<<<EOT" . $srcText . "EOT";
     // Create fpdf object
     $pdf = new FPDF('P', 'pt', 'Letter');
     // Set base font to start
     $pdf->SetFont('Times', 'B', 24);
     // Add a new page to the document
     $pdf->addPage();
     // Set the x,y coordinates of the cursor
     $pdf->SetXY($x, 50);
     // Write 'Simple PDF' with a line height of 1 at the current position
     $pdf->Write(25, 'Simple PDF');
     // Reset the font
     $pdf->SetFont('Courier', 'I', 10);
     // Set the font color
     $pdf->SetTextColor(255, 0, 0);
     // Reset the cursor, write again.
     $pdf->SetXY($x, 75);
     $pdf->Cell(0, 11, "By: {$author}", 'B', 2, 'L', false);
     // Place an image on the pdf document
     //$pdf->Image('graph.jpg', $x, 100, 150, 112.5, 'JPG');
     // Reset font, color, and coordinates
     $pdf->SetFont('Arial', '', 12);
     $pdf->SetTextColor(0, 0, 0);
     $pdf->SetXY($x, 250);
     // Write out a long text blurb.
     $pdf->write(13, $srcText);
     //        echo "<pre>";
     //        print_r($pdf);exit;
     $fileName = substr($dest, 0, strpos($dest, '.')) . "_" . time() . '.pdf';
     $pdf->Output($fileName, 'F');
 }
开发者ID:passionybr2003,项目名称:gmaps,代码行数:36,代码来源:PdfCreator.php

示例2: construct

 function construct($svg, $data = array())
 {
     $t = new XML_SvgToPDF();
     $x = new XML_Tree_Morph($svg, array('debug' => 0, 'filter' => array('svg' => array(&$t, 'buildObject'), 'text' => array(&$t, 'buildObject'), 'tspan' => array(&$t, 'buildObject'), 'rect' => array(&$t, 'buildObject'), 'g' => array(&$t, 'buildObject'), 'path' => array(&$t, 'buildObject'), 'sodipodi:namedview' => array(&$t, 'buildNull'), 'defs' => array(&$t, 'buildNull'))));
     $tree = $x->getTreeFromFile();
     $tree = $t->buildobject($tree);
     $orientation = $tree->width > $tree->height ? 'L' : 'P';
     $pdf = new FPDF($orientation, 'mm', 'A4');
     $pdf->open();
     $pdf->setAutoPageBreak(false);
     $pdf->AliasNbPages();
     // convert data to array.
     if (is_object($data)) {
         $data = (array) $data;
     }
     // no data page..
     if (empty($data)) {
         $pdf->addPage();
         $tree->writePDF($pdf, $data);
         $t->debug($tree);
         return $pdf;
     }
     // work out how many pages...
     list($var, $perpage) = $tree->calcPerPage();
     if ($var == '') {
         die('No dynamic group found');
     }
     if (!isset($data[$var])) {
         die('Incorrect dynamic group name');
     }
     $alldata = $data[$var];
     $page = 0;
     while (count($alldata)) {
         $page++;
         $t->debug("<B>PAGE {$page}<B>");
         $page_data = array_splice($alldata, 0, $perpage);
         $data[$var] = $page_data;
         $pdf->addPage();
         $tree->writePDF($pdf, $data);
     }
     $t->debug($tree);
     return $pdf;
 }
开发者ID:rohmad-st,项目名称:fpdf,代码行数:43,代码来源:SvgToPdf.php

示例3: addPage

 /**
  * Wrapper for FPDF::addPage. It uses a template for every page and counts pages if desired.
  *
  * @param string See FPDF::addPage for this parameter, defaults to 'P' when null
  * @param string Template to use, defaults to './templates/invoice_template.pdf' when null
  * @param bool   If we should count pages. Always uses last value when null.
  *
  * @author Former03 GmbH :: Florian Lippert <flo@syscp.org>
  */
 function addPage($orientation = null, $template = null, $count = null)
 {
     if ($orientation == null) {
         $orientation = 'P';
     }
     parent::addPage($orientation);
     if ($count !== null) {
         $this->_count_pages = $count;
     }
     if ($this->_count_pages === true) {
         $this->_my_page_count++;
     }
     /*		if($template == null)
     		{
     			$template = './templates/invoice_template.pdf';
     		}
     
     		$pagecount = $this->setSourceFile($template);
     		$tplidx = $this->ImportPage(1);
     		$this->useTemplate($tplidx, 0, 0, false);*/
 }
开发者ID:HobbyNToys,项目名称:SysCP,代码行数:30,代码来源:class.PDF.php

示例4: FPDF

<?php

define('FPDF_FONTPATH', '.');
require '../../fpdf.php';
$pdf = new FPDF();
$pdf->addFont('Calligrapher', '', 'calligra.php');
$pdf->addPage();
$pdf->setFont('Calligrapher', '', 35);
$pdf->cell(0, 10, 'Enjoy new fonts with FPDF!');
$pdf->output();
开发者ID:feryardiant,项目名称:fpdf,代码行数:10,代码来源:tuto7.php

示例5: report_content

 public function report_content()
 {
     if (FormLib::get('excel') == '1099') {
         $data = $this->fetch_report_data();
         $pdf = new FPDF('P', 'mm', 'Letter');
         $bridge = GumLib::getSetting('posLayer');
         $year = date('Y', strtotime(FormLib::get('endDate')));
         foreach ($data as $row) {
             $custdata = $bridge::getCustdata($row[0]);
             $meminfo = $bridge::getMeminfo($row[0]);
             $ssn = $row[10] == 'No key' ? $row[9] : $row[10];
             $amount = array(1 => $row[8]);
             $form = new GumTaxFormTemplate($custdata, $meminfo, $ssn, $tax_year, $amount);
             $pdf->addPage();
             $form->renderAsPDF($pdf, 15);
         }
         $pdf->Output('taxform.pdf', 'I');
     } else {
         return parent::report_content();
     }
 }
开发者ID:phpsmith,项目名称:IS4C,代码行数:21,代码来源:GumDividendTaxReport.php

示例6: appendApprovalSignature

    public static function appendApprovalSignature($path_to_dir,$filename,$page=''){
            //do nothing need to be changed
        require(Yii::app()->basePath.'/extensions/Fpdf/fpdf.php');
        require(Yii::app()->basePath.'/extensions/Fpdi/fpdi.php');


        $pdf = new FPDF();
        $pdf->setSourceFile($path_to_dir.'/'.$filename);
        $tplIdx = $pdf->importPage(1, '/MediaBox');
        $pdf->addPage();
        $pdf->useTemplate($tplIdx, true);
        //die("after set sourse");
        try{

            $pdf->SetFont('Helvetica','B',20);
            $pdf->SetTextColor(255,0,0);
            $pdf->SetXY (10,5);
            $pdf->SetFontSize(10);
            $pdf->Write(5,'VOID void VOID void VOID void VOID void VOID void VOID void VOID void VOID void VOID void VOID ');
            $pdf->Output($path_to_dir.'/'.$filename,'F');
        }catch (Exception $e) {
            $result['error']="Could not render this file";
            die('Could not render this file');
        }
        $result['path_to_dir']=$path_to_dir;
        $result['filename']=$filename;
        $result['ext']='pdf';
        return $result;
    }
开发者ID:ranvijayj,项目名称:htmlasa,代码行数:29,代码来源:FileModification.php

示例7: FPDF

<?php

require '../../fpdf.php';
$pdf = new FPDF();
$pdf->addPage()->setFont('Arial', 'B', 16)->cell(40, 10, 'Hello World!')->output('Doc.pdf', 'D');
开发者ID:feryardiant,项目名称:fpdf,代码行数:5,代码来源:tuto1.php

示例8: generatePDF


//.........这里部分代码省略.........
            foreach ($input as $theinput) {
                // Récupération du parent
                $categorie = $theinput->xpath('..')[0];
                // Catégorie du graphique
                if (isset($data[(string) $categorie['nom']][(string) $theinput['nomBDD']]['moyenne'])) {
                    $tempData['data'][constant($theinput['label'] . '_SHORT')] = $data[(string) $categorie['nom']][(string) $theinput['nomBDD']]['moyenne'] + 5;
                }
            }
            // Affichage de l'image
            $pdf->Image(eval_ccpc_genGraphRadar($tempData), $pdf->getX() - 0.45 * $A4Height, $pdf->getY() + 40, floor(0.4 * $A4Height), 0, 'PNG');
            // Affiche du logo
            $pdf->Image(ROOT . 'theme/img/logo.png', 10, $A4Width - 100, 0, 50, 'PNG');
            // Pied de Page
            $pdf->SetX(0.5 * $A4Height);
            $pdf->SetY($A4Width - 40);
            $textSize = 10;
            $pdf->SetFont('Arial', 'I', $textSize);
            // Ligne de demarcation
            $pdf->Line(15, $pdf->getY(), $A4Height - 15, $pdf->getY());
            // Accès aux résultats
            $pdf->SetX(0.5 * $A4Height);
            $pdf->Cell(0.5 * $A4Height - 15, $textSize + 5, utf8_decode(LANG_FORM_CCPC_PDF_FOOTER_FULLRESULT . ' ' . getPageUrl('evalView', array('evaluationType' => 1, 'service' => $data['service']['id']))), 0, 1, 'R', 0);
            // Coordonées CSG
            if ($commentMSG) {
                $pdf->SetFont('Arial', 'B', $textSize);
                $pdf->SetX(15);
                $pdf->Cell($A4Height - 15, $textSize + 5, utf8_decode(LANG_FORM_CCPC_PDF_FOOTER_STRUCTURENAME . ' - ' . CONTACT_STAGE_MAIL), 0, 0, 'C', 0);
            }
            /**
            							Commentaires
            						**/
            // Ajout des commentaires, points positifs et points négatifs : 'pdfComment'
            if ($comment) {
                $pdf->addPage('P', 'A4');
                // Titre
                $pdf->SetFont('Arial', 'B', $titleSize);
                $pdf->SetFillColor(70, 70, 242);
                $pdf->SetTextColor(255, 255, 255);
                $pdf->SetX(floor(0.1 * $A4Width));
                $pdf->Cell(floor(0.8 * $A4Width), $titleSize + 5, utf8_decode(LANG_FORM_CCPC_PDF_COMMENT_TITLE), 'LRTB', 1, 'C', TRUE);
                $pdf->SetTextColor(0, 0, 0);
                $pdf->SetFillColor(245, 245, 245);
                // Les commentaires
                $input = $form->xpath('categorie/input[@pdfComment="1"]');
                foreach ($input as $theinput) {
                    $categorie = $theinput->xpath('..')[0];
                    if ($theinput['type'] == 'text') {
                        // Création de l'array contenant les données à afficher sous forme [timestamp fin][timestamp début][timestamp commantaire][idMessage][] => message
                        $tempData = array();
                        foreach ($theinput->text as $value) {
                            if (isset($data[(string) $categorie['nom']][(string) $value['nomBDD']])) {
                                foreach ($data[(string) $categorie['nom']][(string) $value['nomBDD']] as $idEval => $textValue) {
                                    if (isset($data['donnees'][$idEval]['infos'])) {
                                        $tempData[$data['donnees'][$idEval]['infos']['dateFin']][$data['donnees'][$idEval]['infos']['dateDebut']][$data['donnees'][$idEval]['infos']['date']][$idEval][] = $textValue;
                                    }
                                }
                            }
                        }
                        $textArea = '';
                        $firstLoop = TRUE;
                        // On affiche les commentaires
                        krsort($tempData);
                        foreach ($tempData as $dateFin => $tempvalue) {
                            krsort($tempvalue);
                            foreach ($tempvalue as $dateDebut => $value2) {
                                krsort($value2);
开发者ID:alibell,项目名称:PAS,代码行数:67,代码来源:fnDisplayEvaluationResult.php

示例9: generatePDF


//.........这里部分代码省略.........
            foreach ($input as $theinput) {
                // Récupération du parent
                $categorie = $theinput->xpath('..')[0];
                // Catégorie du graphique
                if (isset($data[(string) $categorie['nom']][(string) $theinput['nomBDD']]['moyenne'])) {
                    $tempData['data'][constant($theinput['label'] . '_SHORT')] = $data[(string) $categorie['nom']][(string) $theinput['nomBDD']]['moyenne'] + 5;
                }
            }
            // Affichage de l'image
            $pdf->Image(eval_ccpc_genGraphRadar($tempData), $pdf->getX() - 0.45 * $A4Height, $pdf->getY() + 40, floor(0.4 * $A4Height), 0, 'PNG');
            // Affiche du logo
            $pdf->Image(ROOT . 'theme/img/logo.png', 10, $A4Width - 100, 0, 50, 'PNG');
            // Pied de Page
            $pdf->SetX(0.5 * $A4Height);
            $pdf->SetY($A4Width - 40);
            $textSize = 10;
            $pdf->SetFont('Arial', 'I', $textSize);
            // Ligne de demarcation
            $pdf->Line(15, $pdf->getY(), $A4Height - 15, $pdf->getY());
            // Accès aux résultats
            $pdf->SetX(0.5 * $A4Height);
            $pdf->Cell(0.5 * $A4Height - 15, $textSize + 5, utf8_decode(LANG_FORM_CCPC_PDF_FOOTER_FULLRESULT . ' ' . getPageUrl('evalView', array('evaluationType' => 1, 'service' => $data['service']['id']))), 0, 1, 'R', 0);
            // Coordonées CSG
            if ($commentMSG) {
                $pdf->SetFont('Arial', 'B', $textSize);
                $pdf->SetX(15);
                $pdf->Cell($A4Height - 15, $textSize + 5, utf8_decode(LANG_FORM_CCPC_PDF_FOOTER_STRUCTURENAME . ' - ' . CONTACT_STAGE_MAIL), 0, 0, 'C', 0);
            }
            /**
            							Commentaires
            						**/
            // Ajout des commentaires, points positifs et points négatifs : 'pdfComment'
            if ($comment) {
                $pdf->addPage('P', 'A4');
                // Titre
                $pdf->SetFont('Arial', 'B', $titleSize);
                $pdf->SetFillColor(70, 70, 242);
                $pdf->SetTextColor(255, 255, 255);
                $pdf->SetX(floor(0.1 * $A4Width));
                $pdf->Cell(floor(0.8 * $A4Width), $titleSize + 5, utf8_decode(LANG_FORM_CCPC_PDF_COMMENT_TITLE), 'LRTB', 1, 'C', TRUE);
                $pdf->SetTextColor(0, 0, 0);
                $pdf->SetFillColor(245, 245, 245);
                // Les commentaires
                $input = $form->xpath('categorie/input[@pdfComment="1"]');
                foreach ($input as $theinput) {
                    $categorie = $theinput->xpath('..')[0];
                    if ($theinput['type'] == 'text') {
                        $textArea = '';
                        $firstLoop = TRUE;
                        foreach ($theinput->text as $text) {
                            if (isset($data[(string) $categorie['nom']][(string) $text['nomBDD']])) {
                                foreach ($data[(string) $categorie['nom']][(string) $text['nomBDD']] as $comment) {
                                    if ($comment != '') {
                                        if (!$firstLoop) {
                                            $textArea .= PHP_EOL . PHP_EOL;
                                        } else {
                                            $firstLoop = FALSE;
                                        }
                                        // Saut de ligne
                                        $textArea .= $comment;
                                    }
                                }
                            }
                        }
                        if ($textArea != '') {
                            // On affiche les textes dans le PDF
开发者ID:Galinijay,项目名称:PAS,代码行数:67,代码来源:fnDisplayEvaluationResult.php

示例10: makepdf

    public function makepdf()
    {
        global $user;
        // Get required files.
        require_once 'others/fpdf/fpdf.php';
        // Set some document variables
        $author = "eduCloud";
        $x = 35;
        $text = <<<EOT
Hello
EOT;
        // Create fpdf object
        $pdf = new FPDF('P', 'pt', 'Letter');
        // Set base font to start
        $pdf->SetFont('Arial', 'B', 16);
        // Add a new page to the document
        $pdf->addPage();
        $pdf->setLeftMargin($x);
        //page border
        $pdf->Line(35, 30, 35, 750);
        $pdf->Line(35, 30, 575, 30);
        $pdf->Line(575, 30, 575, 750);
        $pdf->Line(575, 750, 35, 750);
        //end of page border
        // Set the x,y coordinates of the cursor
        $pdf->SetXY($x + 20, 40);
        // Write 'Simple PDF' with a line height of 1 at the current position
        $pdf->Write(25, 'Employee Details');
        $pdf->Image($_SERVER['DOCUMENT_ROOT'] . '/cloud/images/school_logo.jpg', 500, 35, 50, 50, 'JPG');
        // Reset the font
        // Reset font, color, and coordinates
        $pdf->SetFont('Arial', '', 12);
        $pdf->SetTextColor(0, 0, 0);
        $pdf->SetLeftMargin($x + 50);
        $pdf->setXY($x + 50, 90);
        global $objPDO;
        require_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/teacher_class.php';
        $record = new Teacher($objPDO);
        if ($user->checkAdmin()) {
            $eid = $_GET['uid'];
        } else {
            $student = new Student($objPDO, $user->getuserId());
            $eid = $student->getID();
        }
        $record->loadByUserId($eid);
        // Write out a long text blurb.
        //$array=$record->getAsArray();
        //$x=0;
        /* TEMPLATE 1 DESIGN*/
        $pdf->SetFont('Arial', '', 8);
        $pdf->setFillColor(255, 255, 255);
        $pdf->cell(200, 20, 'Employee Id (reference) : ' . $record->getTeacherId(), 0, 1, 'L', true);
        $pdf->SetFont('Arial', '', 12);
        $pdf->setFillColor(50, 50, 50);
        $pdf->setTextColor(255, 255, 255);
        $pdf->cell(450, 20, 'Employee Details', 0, 1, 'C', true);
        $pdf->setTextColor(0, 0, 0);
        $pdf->setFillColor(221, 221, 221);
        $pdf->cell(200, 20, 'Employee Name', 0, 0, 'C', true);
        $pdf->cell(250, 20, $record->getName(), 0, 1, 'C', true);
        $pdf->setFillColor(255, 255, 255);
        $pdf->cell(200, 20, 'Qualification', 0, 0, 'C', true);
        $pdf->cell(250, 20, $record->getQualification(), 0, 1, 'C', true);
        require_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/subject_class.php';
        $subject_id = new Subject($objPDO);
        $subject_id->setID($record->getSubjectId());
        $pdf->setFillColor(221, 221, 221);
        $pdf->cell(200, 20, 'Subject', 0, 0, 'C', true);
        $pdf->cell(250, 20, $subject_id->getName(), 0, 1, 'C', true);
        $pdf->setFillColor(255, 255, 255);
        $pdf->cell(200, 20, 'Date Of Birth', 0, 0, 'C', true);
        $pdf->cell(250, 20, $record->getDateOfBirth(), 0, 1, 'C', true);
        $pdf->setFillColor(221, 221, 221);
        $pdf->cell(200, 20, 'Gender', 0, 0, 'C', true);
        $pdf->cell(250, 20, ucfirst($record->getGender()), 0, 1, 'C', true);
        $pdf->setFillColor(255, 255, 255);
        $pdf->cell(200, 20, 'Blood Group', 0, 0, 'C', true);
        $pdf->cell(250, 20, $record->getBloodGroup(), 0, 1, 'C', true);
        $pdf->setFillColor(255, 255, 255);
        $pdf->cell(200, 20, '', 0, 0, 'C', true);
        $pdf->cell(250, 20, '', 0, 1, 'C', true);
        $pdf->setFillColor(50, 50, 50);
        $pdf->setTextColor(255, 255, 255);
        $pdf->cell(450, 20, 'Contact Details', 0, 1, 'C', true);
        $pdf->setTextColor(0, 0, 0);
        $pdf->setFillColor(221, 221, 221);
        $pdf->cell(200, 20, 'Correspondence Address', 0, 0, 'C', true);
        $pdf->cell(250, 20, $record->getCorrespondenceAddressLine1(), 0, 1, 'C', true);
        $pdf->cell(200, 20, '', 0, 0, 'C', true);
        $pdf->cell(250, 20, $record->getCorrespondenceAddressLine2(), 0, 1, 'C', true);
        $pdf->setFillColor(255, 255, 255);
        $pdf->cell(200, 20, 'City', 0, 0, 'C', true);
        $pdf->cell(250, 20, $record->getCorrespondenceCity(), 0, 1, 'C', true);
        $pdf->setFillColor(221, 221, 221);
        $pdf->cell(200, 20, 'State', 0, 0, 'C', true);
        $pdf->cell(250, 20, $record->getCorrespondenceState(), 0, 1, 'C', true);
        $pdf->setFillColor(255, 255, 255);
        $pdf->cell(200, 20, 'Pincode', 0, 0, 'C', true);
        $pdf->cell(250, 20, $record->getCorrespondencePincode(), 0, 1, 'C', true);
        $pdf->setFillColor(221, 221, 221);
//.........这里部分代码省略.........
开发者ID:srinivasans,项目名称:educloud,代码行数:101,代码来源:teacherController.php


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