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


PHP FPDI::addPage方法代码示例

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


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

示例1: merge

 /**
  * Merge multiple documents.
  *
  * @return Dhl_Intraship_Helper_Pdf             $this
  * @throws Dhl_Intraship_Helper_Pdf_Exception
  */
 public function merge()
 {
     // Include required fpdi library.
     if (!class_exists('FPDF', false)) {
         require_once Mage::getBaseDir('base') . DS . 'lib' . DS . 'fpdf' . DS . 'fpdf.php';
     }
     if (!class_exists('FPDI', false)) {
         require_once Mage::getBaseDir('base') . DS . 'lib' . DS . 'fpdf' . DS . 'fpdi.php';
     }
     // Try to merge documents via FPDI.
     try {
         // Create new FPDI document
         $this->_document = new FPDI('P', 'mm', $this->getConfig()->getFormat());
         $this->_document->SetAutoPageBreak(false);
         $page = 1;
         foreach ($this->_collection as $document) {
             $pages = $this->_document->setSourceFile($document->getFilePath());
             for ($i = 1; $i <= $pages; $i++) {
                 $this->_document->addPage();
                 $this->_document->useTemplate($this->_document->importPage($i, '/MediaBox'));
                 $page++;
             }
         }
     } catch (Exception $e) {
         throw new Dhl_Intraship_Helper_Pdf_Exception('pdf merging failed. service temporary not available', $e->getCode());
     }
     return $this;
 }
开发者ID:igorvasiliev4,项目名称:magento_code,代码行数:34,代码来源:Pdf.php

示例2: renderPDF

function renderPDF($id,$mode)
{
	$pdf = new FPDI();
	
	$db_catalogue_pages = new catalogue_pages;
	$db_catalogue_pages->get_one_catalogue_pages($id);
	$db_catalogue_pages->load();
	$template_id = $db_catalogue_pages->get_pag_template();
	
	$template = new catalogue_templates;

	$template->getOne($template_id);
	$template->load();

	$pdf->addPage("Landscape","Letter");

	$db_catalogue_objects = new catalogue_objects;
	$db_catalogue_objects->get_all($id);

	$pdf->SetFont('Arial','',14);

	$pdf->Image("pdftemplates/".$template->get_tem_file().".jpg",0,0);
	while($db_catalogue_objects->load())
	{
		$var = explode("_",$db_catalogue_objects->get_obj_var());
		if($var[0] == "image")
		{
			if(file_exists($db_catalogue_objects->field->obj_image)) $pdf->Image($db_catalogue_objects->field->obj_image,($db_catalogue_objects->field->obj_posx*0.353),($db_catalogue_objects->field->obj_posy*0.353),"50","50");
		}
		$pdf->SetXY($db_catalogue_objects->field->obj_posx*0.353,($db_catalogue_objects->field->obj_posy*0.35) + 60);
		$pdf->Write(5,$db_catalogue_objects->field->obj_text);
	}

	$db_catalogue_objects->close();
	$db_catalogue_pages->close();
	//if($mode=="I") $pdf->Output("page_".$id.".pdf", "I");
	//else $pdf->Output("pages/page_".$id.".pdf", "F");
	$pdf->Output("pages/page_".$id.".pdf", "F");
	
}
开发者ID:highestgoodlikewater,项目名称:scrumban,代码行数:40,代码来源:static.php

示例3: pathinfo

         }
         $docs[] = $doc['name'] . ':::' . $cfile->size;
         // нужно переделать на хеш файла
         $fnames[] = $cfile->name;
         $p = pathinfo($cfile->name);
         if (strtolower($p['extension']) != 'pdf') {
             $save = false;
             break;
         }
         ++$count_docs;
         $tmp_name = '/tmp/' . uniqid() . '.pdf';
         file_put_contents($tmp_name, file_get_contents(WDCPREFIX . '/' . $cfile->path . $cfile->name));
         $pagecount = $pdf->setSourceFile($tmp_name);
         $tplidx = $pdf->importPage($pagecount, '/MediaBox');
         if (preg_match('/^Счет-фактура/', $doc['name'])) {
             $pdf->addPage('L');
         } else {
             $pdf->addPage('P');
         }
         $pdf->useTemplate($tplidx, 0, 0);
         if ($doc['type'] == '20480') {
             $pagecount = $pdf->setSourceFile($tmp_name);
             $tplidx = $pdf->importPage($pagecount, '/MediaBox');
             $pdf->addPage('P');
             $pdf->useTemplate($tplidx, 0, 0);
         }
     }
 }
 if (!$save) {
     break;
 }
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:31,代码来源:import_docs.php

示例4: addPage

 /**
  * This method adds a new page to the PDF.
  */
 public function addPage($orientation = '', $format = '', $keepmargins = false, $tocpage = false, $path = NULL, $reset = FALSE, $numbering = 'main')
 {
     // Do not add any new page, if we are writing
     // in the footer or header.
     if ($this->InFooter) {
         return;
     }
     $this->mainContentPageNumber++;
     $this->rowContentPageNumber++;
     // Prevent a reset without any template
     if ($reset == TRUE && (empty($path) || !file_exists($path))) {
         parent::addPage();
         $this->setPageFormat($this->defaultFormat, $this->defaultOrientation);
         return;
     }
     $files = $this->defaultPageTemplateFiles;
     // Reset with new template
     if ($reset) {
         $files = array();
     }
     if ($path != NULL) {
         $files[] = array('path' => $path, 'numbering' => $numbering);
     }
     $format = FALSE;
     foreach ($files as $file) {
         if (!empty($file['path']) && file_exists($file['path'])) {
             $path = realpath($file['path']);
             $numberOfPages = $this->setSourceFile($path);
             if ($file['numbering'] == 'row') {
                 $index = min($this->rowContentPageNumber, $numberOfPages);
             } else {
                 $index = min($this->mainContentPageNumber, $numberOfPages);
             }
             $page = $this->importPage($index);
             // ajust the page format (only for the first template)
             if ($format == FALSE) {
                 $dim = $this->getTemplateSize($index);
                 $format[0] = $dim['w'];
                 $format[1] = $dim['h'];
                 //$this->setPageFormat($format);
                 if ($dim['w'] > $dim['h']) {
                     $orientation = 'L';
                 } else {
                     $orientation = 'P';
                 }
                 $this->setPageFormat($format, $orientation);
                 parent::addPage();
             }
             // Apply the template
             $this->useTemplate($page, 0, 0);
         }
     }
     // if all paths were empty, ensure that at least the page is added
     if ($format == FALSE) {
         parent::addPage();
         $this->setPageFormat($this->defaultFormat, $this->defaultOrientation);
     }
 }
开发者ID:kastowo,项目名称:idbigdata,代码行数:61,代码来源:views_pdf_template.php

示例5: FPDI

 $certificate = "lead";
 $name = $user->forename . ' ' . $user->surname;
 // map FPDF to tFPDF so FPDF_TPL can extend it
 class FPDF extends tFPDF
 {
     protected $_tplIdx;
 }
 $pdf = new FPDI();
 if ($user->getPrivilege() <= 10) {
     $source = "docs/certificatelead.pdf";
 } else {
     $source = "docs/certificate.pdf";
 }
 $pagecount = $pdf->setSourceFile($source);
 $tplidx = $pdf->importPage(1);
 $pdf->addPage('L');
 $pdf->useTemplate($tplidx, 0, 0, 0);
 $date = date('jS F Y');
 $pdf->AddFont('DejaVu', '', 'DejaVuSansCondensed.ttf', true);
 $pdf->SetFont('DejaVu', '', 30);
 $pdf->SetTextColor(0, 0, 0);
 $pdf->SetXY(0, 95);
 $pdf->Cell(297, 15, $name, 0, 0, 'C', 0);
 $pdf->SetFont('Arial', '', 18);
 $pdf->SetXY(170, 160);
 $pdf->Write(0, $date);
 $attachment = $pdf->output('Certificate.pdf', 'S');
 header('Pragma: public');
 header('Expires: -1');
 header('Content-Transfer-Encoding: binary');
 header('Content-Type: application/pdf');
开发者ID:uhtoff,项目名称:eCRF,代码行数:31,代码来源:process.php

示例6: FPDI

 function back_id($results)
 {
     $this->load->helper('settings');
     //print preview of MR
     $this->load->library('fpdf');
     $this->load->library('fpdi');
     // initiate FPDI
     $pdf = new FPDI('L');
     // add a page
     $pdf->AddPage();
     // set the sourcefile
     $pagecount = $pdf->setSourceFile('pdf-report/id/back-id.pdf');
     // import page 1
     $tplIdx = $pdf->importPage(1);
     // use the imported page and place it at point 10,10 with a width of 100 mm
     $pdf->useTemplate($tplIdx);
     // now write some text above the imported page
     $pdf->SetTextColor(0, 0, 0);
     $pdf->SetFont('Arial', '', 7);
     $n = 1;
     foreach ($results as $result) {
         $s = new Personal_m();
         $row = $s->get_by_employee_id($result->employee_id);
         //======================== START Column 1 | Right to Left ==============================
         if ($n == 11) {
             //add new page
             $pdf->addPage();
             for ($n = 1; $n <= 1; $n++) {
                 $tplidx = $pdf->ImportPage(1);
                 $pdf->useTemplate($tplIdx);
                 //, 1, 1, 210
             }
             $n = $n - 1;
         }
         $bday = $row->birth_date;
         $address = $row->res_address;
         $blood_type = '"' . $row->blood_type . '"';
         $gsis = $row->gsis;
         $pagibig = $row->pagibig;
         $philhealth = $row->philhealth;
         $tin = $row->tin;
         $emergency = '';
         $contact = $row->cp;
         //----------------------------- Row 1 ----------------------------------
         ///Birthday
         if ($n == 1) {
             //Birthday
             if ($bday != '0000-00-00') {
                 $pdf->SetXY(247, 23);
                 $pdf->Cell(50, 0, date('F d, Y', strtotime(date('F d, Y', strtotime($bday)))), '0', 0, 'C', false);
             }
             //Address
             $pdf->SetXY(257, 15);
             $addr = splitstroverflow(ucwords(strtolower(utf8_decode($address))), 28);
             $pdf->Cell(30, 0, $addr[0], '0', 0, 'C', false);
             //display text overflow
             if ($addr[1]) {
                 $pdf->Ln(2.5);
                 $pdf->SetX(257);
                 $pdf->Cell(30, 0, $addr[1], '0', 0, 'C', false);
             }
             if ($addr[2]) {
                 $pdf->Ln(2.5);
                 $pdf->SetX(257);
                 $pdf->Cell(30, 0, $addr[2], '0', 0, 'C', false);
             }
             if ($addr[3]) {
                 $pdf->Ln(2.5);
                 $pdf->SetX(257);
                 $pdf->Cell(30, 0, $addr[3], '0', 0, 'C', false);
             }
             //Blood Type
             $pdf->SetXY(247, 28.3);
             $pdf->Cell(50, 0, strtoupper($blood_type), '0', 0, 'C', false);
             //GSIS
             $pdf->SetXY(247, 33);
             $pdf->Cell(50, 0, strtoupper($gsis), '0', 0, 'C', false);
             //PAGIBIG
             $pdf->SetXY(247, 38);
             $pdf->Cell(50, 0, strtoupper($pagibig), '0', 0, 'C', false);
             //PHILHEALTH
             $pdf->SetXY(247, 43.5);
             $pdf->Cell(50, 0, strtoupper($philhealth), '0', 0, 'C', false);
             //PHILHEALTH
             $pdf->SetXY(247, 48.5);
             $pdf->Cell(50, 0, strtoupper($tin), '0', 0, 'C', false);
             //in case of emergency
             $pdf->SetXY(235, 75.5);
             $pdf->Cell(60, 0, strtoupper($emergency), '0', 0, 'C', false);
             //CP No.
             $pdf->SetXY(250, 78);
             $cpno = splitstroverflow($contact, 13);
             $pdf->Cell(30, 0, $cpno[0], '0', 0, 'C', false);
             if ($cpno[1]) {
                 $pdf->Ln(3);
                 $pdf->SetX(250);
                 $pdf->Cell(30, 0, $cpno[1], '0', 0, 'C', false);
             }
         }
         //----------------------------- Row 2 ----------------------------------
//.........这里部分代码省略.........
开发者ID:billyriantono,项目名称:ihrmis,代码行数:101,代码来源:id_preview.php

示例7: FPDI

     $pdf->SetFont('TimesNewRomanPSMT', '', 12);
     $pdf->SetTextColor(0, 0, 0);
     $pdf->AddPage('L');
     $pdf->SetXY(197, 145);
     $pdf->SetDrawColor(50, 60, 100);
     $pdf->MultiCell(65, 6, 'Кому: ' . html_entity_decode($letter['user']) . "\nКуда: " . html_entity_decode($letter['address']), 0, 'L');
     $pdf->Output("/tmp/{$sid}-{$n}letters.pdf", 'F');
     ++$n;
 }
 $pdf = new FPDI();
 $pagecount = 1;
 $n = 1;
 foreach ($envelopes as $letter) {
     $pagecount = $pdf->setSourceFile("/tmp/{$sid}-{$n}letters.pdf");
     $tplidx = $pdf->importPage($pagecount, '/MediaBox');
     $pdf->addPage('L');
     $pdf->useTemplate($tplidx, 0, 0);
     if ($letter['files']) {
         foreach ($letter['files'] as $file_id) {
             $cfile = new CFile($file_id);
             if (preg_match("/\\.pdf\$/", $cfile->name)) {
                 $tmp_name = '/tmp/' . uniqid() . '.pdf';
                 file_put_contents($tmp_name, file_get_contents(WDCPREFIX . '/' . $cfile->path . $cfile->name));
                 $pagecount = $pdf->setSourceFile($tmp_name);
                 for ($i = 1; $i <= $pagecount; ++$i) {
                     $tplidx = $pdf->importPage($i);
                     $specs = $pdf->getTemplateSize($tplidx);
                     $pdf->addPage($specs['h'] > $specs['w'] ? 'P' : 'L');
                     $pdf->useTemplate($tplidx);
                 }
             }
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:31,代码来源:get.php

示例8: appendVoidText

public static function appendVoidText($path_to_dir,$filename,$page=''){

        require_once(Yii::app()->basePath.'/extensions/Fpdf/fpdf.php');
        require_once(Yii::app()->basePath.'/extensions/Fpdi/fpdi.php');

        $pdf = new FPDI();
        $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,代码行数:28,代码来源:FileModification.php

示例9: getRAuftrag

$rep = getRAuftrag($_GET["aid"]);
$masch = getAllMaschine($rep["mid"]);
$firma = getFirmenStamm($masch["customer_id"]);
$hist = getHistory($rep["mid"]);
$material = getAllMat($_GET["aid"], $rep["mid"]);
if ($material) {
    foreach ($material as $zeile) {
        $mat .= $zeile["menge"] . " x " . substr($zeile["description"], 0, 70) . "\n";
    }
}
require "fpdf.php";
require "fpdi.php";
$pdf = new FPDI('P', 'mm', 'A4');
$seiten = $pdf->setSourceFile("vorlage/repauftrag.pdf");
$hdl = $pdf->ImportPage(1);
$pdf->addPage();
$pdf->useTemplate($hdl);
$pdf->SetFont($repfont, 'B', $repsizeL);
$pdf->Text($repname[x], $repname[y], utf8_decode($firma["name"]));
$pdf->Text($repstr[x], $repstr[y], utf8_decode($firma["street"]));
$pdf->Text($report[x], $report[y], $firma["zipcode"] . " " . utf8_decode($firma["city"]));
$pdf->Text($repphone[x], $repphone[y], $firma["phone"]);
$pdf->Text($repaid[x], $repaid[y], $_GET["aid"]);
$pdf->SetFont($repfont, '', $repsizeN);
$pdf->Text($repwvnr[x], $repwvnr[y], $masch['contractnumber']);
$pdf->Text($repkdnr[x], $repkdnr[y], $firma["customernumber"]);
$pdf->Text($repdate[x], $repdate[y], date("d.m.Y"));
$pdf->Text($repmasch[x], $repmasch[y], utf8_decode($masch["description"]));
$pdf->Text($repser[x], $repser[y], $masch["serialnumber"]);
$pdf->Text($repsort[x], $repsort[y], utf8_decode($masch["standort"]));
$pdf->Text($repcnt[x], $repcnt[y], $masch["counter"]);
开发者ID:vanloswang,项目名称:kivitendo-crm,代码行数:31,代码来源:prtRAuftrag.php

示例10: generatesExternalReport

 public function generatesExternalReport($id = -1)
 {
     /* 
      * Loading libraries and helpers
      */
     $this->load->library(array('rb', 'fpdf_gen'));
     $this->load->helper(array('date', 'utility'));
     /*
      * The request id is not set 
      */
     if ($id == -1) {
         echo "Parece que não foi especificado qual o id da Solicitação.";
         exit;
     }
     /* 
      * Loading request
      */
     $request = R::findOne('request', 'id=?', array($id));
     /* 
      * Request exists
      */
     if ($request == null) {
         echo 'Parece que a solicitação não existe.';
         exit;
     }
     /* 
      * Creating PDF
      */
     $pdf = new FPDI();
     $pdf->addPage('L');
     /* *********************************************************
      * BEGIN  - HEADER
      ********************************************************* */
     $pdf->image(public_url('img/' . $this->config->item('system_report_logo')), 140, 5);
     $pdf->ln(14);
     $pdf->SetFont('Courier', 'B', 9);
     $pdf->Cell(0, 0, utf8_decode($this->config->item('system_name')), 0, 0, 'C');
     $pdf->Ln(5);
     $pdf->SetFont('Courier', '', 9);
     $pdf->Cell(0, 0, utf8_decode("SOLICITAÇÃO DE INFORMAÇÃO"), 0, 0, 'C');
     /* *********************************************************
      * END - HEADER
      ********************************************************* */
     $pdf->Ln(10);
     $pdf->SetFont('Courier', 'B', 9);
     $pdf->SetDrawColor(217, 217, 217);
     $pdf->SetFillColor(217, 217, 217);
     $pdf->Cell(0, 10, utf8_decode(' DADOS DA SOLICITAÇÃO'), 'LRTB', 0, 'L', true);
     $pdf->Ln(10);
     $pdf->Cell(24, 10, utf8_decode(' PROTOCOLO: '), 'LTB', 0, 'L', false);
     $pdf->SetFont('Courier', '', 9);
     $pdf->Cell(110, 10, utf8_decode($request->protocol), 'TBR', 0, 'L', false);
     $pdf->SetFont('Courier', 'B', 9);
     $pdf->Cell(32, 10, utf8_decode(' SOLICITADA EM: '), 'TB', 0, 'L', false);
     $pdf->SetFont('Courier', '', 9);
     $pdf->Cell(111, 10, utf8_decode(mdate('%d/%m/%Y', strtotime($request->createdAt))), 'TBR', 0, 'L', false);
     $pdf->Ln(10);
     $pdf->SetFont('Courier', 'B', 9);
     $pdf->Cell(24, 10, utf8_decode(' SITUAÇÃO: '), 'LB', 0, 'L', false);
     $pdf->SetFont('Courier', '', 9);
     $pdf->Cell(253, 10, utf8_decode(status_text($request->status)), 'TBR', 0, 'L', false);
     $pdf->Ln(10);
     $pdf->SetFont('Courier', 'B', 9);
     $pdf->Cell(0, 10, utf8_decode(' SOLICITAÇÃO: '), 'LR', 0, 'L', false);
     $pdf->Ln(8);
     $pdf->SetFont('Courier', '', 9);
     $pdf->MultiCell(0, 5, utf8_decode(' ' . $request->request), 'LR', 'L', false);
     $pdf->Cell(0, 4, '', 'LR', 0, 'L', false);
     $pdf->Ln(4);
     $pdf->SetFont('Courier', 'B', 9);
     $pdf->Cell(0, 10, utf8_decode(' TRÂMITAÇÃO'), 'LRTB', 0, 'L', true);
     $pdf->Ln(10);
     $pdf->SetFont('Courier', '', 9);
     $statuses = R::find('status', ' request_id = ? ORDER BY created_at ASC ', array($request->id));
     if (!count($statuses)) {
         $pdf->Cell(0, 10, utf8_decode(' Nenhuma trâmitação ainda'), 'LRB', 0, 'L', false);
     } else {
         foreach ($statuses as $s) {
             $pdf->SetFont('Courier', 'B', 9);
             $pdf->Cell(0, 10, utf8_decode(' ' . status_text($s->type) . ' [' . date('d/m/Y', strtotime($s->createdAt)) . ']'), 'LR', 0, 'L', false);
             $pdf->Ln(10);
             $pdf->SetFont('Courier', '', 9);
             $pdf->MultiCell(0, 5, utf8_decode(' ' . $s->response), 'LRB', 'L', false);
         }
     }
     $pdf->Ln(10);
     $pdf->Output();
 }
开发者ID:victorschinaider,项目名称:solicitacao-informacao,代码行数:88,代码来源:Request.php

示例11: addPage

  /**
   * This method adds a new page to the PDF.
   */
  public function addPage($path = NULL, $reset = false, $numbering = 'main') {
    
    $this->mainContentPageNumber++;
    $this->rowContentPageNumber++;
    
    // Reset without any template
    if ((empty($path) || !file_exists($path)) && $reset == true) {
      parent::addPage();
      $this->setPageFormat($this->defaultFormat, $this->defaultOrientation);
      return;
    }
    
    $files = $this->defaultPageTemplateFiles;
    
    // Reset with new template
    if ($reset) {
      $files = array();
    }
    
    if ($path != NULL) {
      $files[] = array('path' => $path, 'numbering' => $numbering);
    }
    $format = false;
    foreach ($files as $file) {
      if (!empty($file['path']) && file_exists($file['path'])) {
        $path = realpath($file['path']);

        $numberOfPages = $this->setSourceFile($path);
        if ($file['numbering'] == 'row')  {
          $index = min($this->rowContentPageNumber, $numberOfPages);
        }
        else {
          $index = min($this->mainContentPageNumber, $numberOfPages);
        }
        
    
        $page = $this->importPage($index);
    
        // ajust the page format (only for the first template)
        if ($format == false) {
          
          $dim = $this->getTemplateSize($index);
          $format[0] = $dim['w'];
          $format[1] = $dim['h'];
          //$this->setPageFormat($format);
          if ($dim['w'] > $dim['h']) {
            $orientation = 'L';
          }
          else {
            $orientation = 'P';
          }
          $this->setPageFormat($format, $orientation);
          parent::addPage();
        }
        
        // Apply the template
        $this->useTemplate($page,0,0);
      }
    }
    
    // if all paths were empty, ensure that at least the page is added
    if ($format == false) {
      parent::addPage();
      $this->setPageFormat($this->defaultFormat, $this->defaultOrientation);
    }
    
    // When a new page is added, we copy the header / footer data from the prvevious page.
    // this ensures that we get always the data, independent on a page break
    // inside a record.
    if (isset($this->headerFooterData[($this->getPage() - 1)])) {
    //  $this->headerFooterData[$this->getPage()] = $this->headerFooterData[($this->getPage() - 1)];
    }  
    
  }
开发者ID:ATouhou,项目名称:www.alim.org,代码行数:77,代码来源:views_pdf_template.php

示例12: ceaseAndDesistPDFAction

 public function ceaseAndDesistPDFAction(Request $request, $work, $name)
 {
     //try {
     $user = $this->getUser();
     $file = $this->getDoctrine()->getRepository('AppBundle:ProtectedFile')->findOneBy(array("registrationNumber" => $work));
     $pdf = new \FPDI();
     $pdf->SetFont('Helvetica', '', 11);
     $pdf->addPage('P');
     $pdf->SetXY(13, 10);
     $pdf->Write(8, strip_tags($this->renderView('profile/ceaseAndDesistLetter.html.twig', array('user' => $user, 'name' => $name, 'work' => $file))));
     $pdf = $this->createAttachmentPDF($file, $pdf);
     $response = new Response($pdf->Output('D', 'Cease&Desist Letter.pdf'), Response::HTTP_OK);
     $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'Cease&Desist Letter.pdf');
     return $response;
     //} catch (\Exception $e) {
     //    return new BinaryFileResponse(null);
     //}
 }
开发者ID:DanieleMenara,项目名称:CreateSafe,代码行数:18,代码来源:ProfileController.php

示例13: resizePdf

 /**
  * resizePdf 
  * 
  * @return void
  */
 public function resizePdf()
 {
     try {
         if (false === class_exists('FPDF', false)) {
             require_once Mage::getBaseDir('base') . DS . 'lib' . DS . 'fpdf' . DS . 'fpdf.php';
         }
         if (false === class_exists('FPDI', false)) {
             require_once Mage::getBaseDir('base') . DS . 'lib' . DS . 'fpdf' . DS . 'fpdi.php';
         }
         // Create new FPDI document
         $document = new FPDI('P', 'mm', $this->getConfig()->getFormat());
         $margins = $this->getConfig()->getMargins();
         $document->SetAutoPageBreak(false);
         $pages = $document->setSourceFile($this->getPathToPdf());
         for ($i = 1; $i <= $pages; $i++) {
             $document->addPage();
             $document->useTemplate($document->importPage($i, '/MediaBox'), $margins['left'], $margins['top']);
         }
         $document->Output($this->getPathToPdf(), 'F');
     } catch (Exception $e) {
         throw new Dhl_Intraship_Helper_Pdf_Exception('pdf resizing failed. service temporary not available. ' . $e->getMessage(), $e->getCode());
     }
 }
开发者ID:igorvasiliev4,项目名称:magento_code,代码行数:28,代码来源:Document.php

示例14: generateCoupon

 public function generateCoupon($coupon_image_url, $user_id, $email_id)
 {
     require_once $_SERVER['DOCUMENT_ROOT'] . '/application/libraries/fpdf/fpdf.php';
     require_once $_SERVER['DOCUMENT_ROOT'] . '/application/libraries/fpdf/fpdi.php';
     $pdf = new FPDI();
     $pageCount = $pdf->setSourceFile($_SERVER['DOCUMENT_ROOT'] . "/application/libraries/coupon.pdf");
     $tplIdx = $pdf->importPage(1, '/MediaBox');
     $count = 0;
     $y = 145.5;
     $i = 1;
     $amt = 0;
     $pdf->addPage();
     $pdf->useTemplate($tplIdx, 3, 3, 210, 300);
     $pdf->SetFont('Arial', '', '9');
     $pdf->SetTextColor(0, 0, 0);
     $pdf->Text(50, 80, 'User ID :');
     $pdf->Text(100, 80, $user_id);
     $pdf->Text(50, 90, 'Email ID :');
     $pdf->Text(100, 90, $email_id);
     $pdf->Image($coupon_image_url, 50, 100);
     $save_status = 1;
     if (!$save_status) {
         $pdf->Output();
     } else {
         $pdf->Output($_SERVER['DOCUMENT_ROOT'] . '/images/coupons/' . 'coupon_' . $user_id . '.pdf', 'F');
     }
 }
开发者ID:shibu20sxc,项目名称:SalesWhereWhen,代码行数:27,代码来源:home.php


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