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


PHP FPDI::setMargins方法代码示例

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


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

示例1: Output

 function Output($type)
 {
     $type = strtolower($type);
     //Initialize PDF object so all subclasses can access it.
     //Loop through all objects and combine the output from each into a single document.
     if ($type == 'pdf') {
         if (!class_exists('tcpdf')) {
             require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . $this->tcpdf_dir . DIRECTORY_SEPARATOR . 'tcpdf.php';
         }
         if (!class_exists('fpdi')) {
             require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . $this->fpdi_dir . DIRECTORY_SEPARATOR . 'fpdi.php';
         }
         $pdf = new FPDI('P', 'pt');
         $pdf->setMargins(0, 0, 0, 0);
         $pdf->SetAutoPageBreak(FALSE);
         $pdf->setFontSubsetting(FALSE);
         foreach ($this->objs as $obj) {
             $obj->setPDFObject($pdf);
             $obj->Output($type);
         }
         return $pdf->Output('', 'S');
     } elseif ($type == 'efile') {
         foreach ($this->objs as $obj) {
             return $obj->Output($type);
         }
     } elseif ($type == 'xml') {
         //Since multiple XML sections may need to be joined together,
         //We must pass the XML object between each form and  build the entire XML object completely
         //then output it all at once at the end.
         $xml = NULL;
         $xml_schema = NULL;
         foreach ($this->objs as $obj) {
             if (is_object($xml)) {
                 $obj->setXMLObject($xml);
             }
             $obj->Output($type);
             if (isset($obj->xml_schema)) {
                 $xml_schema = $obj->getClassDirectory() . DIRECTORY_SEPARATOR . 'schema' . DIRECTORY_SEPARATOR . $obj->xml_schema;
             }
             if ($xml == NULL and is_object($obj->getXMLObject())) {
                 $xml = $obj->getXMLObject();
             }
         }
         if (is_object($xml)) {
             $output = $xml->asXML();
             $xml_validation_retval = $this->validateXML($output, $xml_schema);
             if ($xml_validation_retval !== TRUE) {
                 Debug::text('XML Schema is invalid! Malformed XML!', __FILE__, __LINE__, __METHOD__, 10);
                 //$output = FALSE;
                 $output = $xml_validation_retval;
             }
         } else {
             Debug::text('No XML object!', __FILE__, __LINE__, __METHOD__, 10);
             $output = FALSE;
         }
         return $output;
     }
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:58,代码来源:GovernmentForms.class.php

示例2: executeBatchPrintBadge

 public function executeBatchPrintBadge(sfWebRequest $request)
 {
     $ids = $request->getParameter('ids');
     // initiate FPDI
     $pdf = new FPDI('P', 'pt');
     // set the sourcefile
     $pdf->setSourceFile(sfConfig::get('sf_upload_dir') . '/badges/ID_new.pdf');
     foreach ($ids as $id) {
         $this->employee = EmployeePeer::retrieveByPk($id);
         // import page 1
         $tplIdx = $pdf->importPage(1);
         // add a new page based on size of the badge
         $s = $pdf->getTemplatesize($tplIdx);
         $pdf->AddPage('P', array($s['w'], $s['h']));
         $pdf->useTemplate($tplIdx);
         $pdf->setMargins(0, 0, 0, 0);
         $pdf->SetAutoPageBreak(false);
         if ($this->employee->getPicture()) {
             $pdf->Image(sfConfig::get('sf_upload_dir') . '/' . sfConfig::get('app_employee_images_dir') . '/' . $this->employee->getPicture(), 29.5, 25.5, 60.3, 74.3);
         } else {
             $pdf->Image(sfConfig::get('sf_upload_dir') . '/badges/picture_missing.jpg', 29.5, 25.5, 60.3, 74.3);
         }
         // now write some text above the imported page
         $pdf->SetFont('freesans', 'B', 12);
         $pdf->SetTextColor(82, 78, 134);
         $pdf->SetXY(22, 110);
         $pdf->Cell(0, 12, $this->employee->getFullName());
         $pdf->Ln();
         $pdf->SetX(22);
         $pdf->SetFont('freesans', 'BI', 10);
         $pdf->Cell(0, 14, $this->employee->getJob());
         $pdf->SetDisplayMode('real');
     }
     return $pdf->Output('newpdf.pdf', 'D');
 }
开发者ID:anvaya,项目名称:nckids,代码行数:35,代码来源:actions.class.php

示例3: Output

 function Output($type)
 {
     $type = strtolower($type);
     //Initialize PDF object so all subclasses can access it.
     //Loop through all objects and combine the output from each into a single document.
     if ($type == 'pdf') {
         if (!class_exists('tcpdf')) {
             require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . $this->tcpdf_dir . DIRECTORY_SEPARATOR . 'tcpdf.php';
         }
         if (!class_exists('fpdi')) {
             require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . $this->fpdi_dir . DIRECTORY_SEPARATOR . 'fpdi.php';
         }
         $pdf = new FPDI('P', 'pt');
         $pdf->setMargins(0, 0, 0, 0);
         $pdf->SetAutoPageBreak(FALSE);
         foreach ($this->objs as $obj) {
             $obj->setPDFObject($pdf);
             $obj->Output($type);
         }
         return $pdf->Output('', 'S');
     }
 }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:22,代码来源:GovernmentForms.class.php


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