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


PHP FPDI::getTemplateSize方法代码示例

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


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

示例1: generate_philosophy_certificate

function generate_philosophy_certificate($confirmation, $form, $entry, $ajax)
{
    // print_r( $entry ); die;
    if ($entry['gquiz_is_pass']) {
        $upload_dir = wp_upload_dir();
        // initiate FPDI
        $pdf = new FPDI();
        // set the sourcefile
        $pdf->setSourceFile(get_template_directory() . '/library/certificate.pdf');
        // import page 1
        $tplIdx = $pdf->importPage(1);
        // get the width and height of the template
        $specs = $pdf->getTemplateSize($tplIdx);
        // add a page
        $pdf->AddPage("L", array($specs['w'], $specs['h']));
        // use the imported page as the template
        $pdf->useTemplate($tplIdx, 0, 0);
        // now write some text above the imported page
        $pdf->SetY(101);
        $pdf->SetFont("dejavuserifbi", 'I', 35);
        $pdf->SetTextColor(0, 54, 99);
        $text = $entry['2.3'] . " " . $entry['2.6'];
        $pdf->MultiCell(260, 40, $text, 0, 'C');
        // now write some text above the imported page
        $pdf->SetY(165);
        $pdf->SetFont("dejavuserifbi", 'I', 22);
        $pdf->SetTextColor(0, 54, 99);
        $text = date('F j, Y');
        $pdf->MultiCell(260, 22, $text, 0, 'C');
        // save the pdf out to file
        $pdf->Output($upload_dir['basedir'] . '/certificates/' . $entry['id'] . '.pdf', 'F');
    }
    return array('redirect' => '/philosophy-results/?id=' . $entry['id']);
}
开发者ID:giraphcreative,项目名称:nwcua-quiz,代码行数:34,代码来源:pdf.php

示例2: runProcessStep

 public function runProcessStep($dokument)
 {
     $file = $dokument->getLatestRevision()->getFile();
     $extension = array_pop(explode(".", $file->getExportFilename()));
     #$this->ziphandler->addFile($file->getAbsoluteFilename(), $file->getExportFilename());
     // Print Metainfo for PDFs
     if (strtolower($extension) == "pdf") {
         try {
             $fpdf = new FPDI();
             $pagecount = $fpdf->setSourceFile($file->getAbsoluteFilename());
             $fpdf->SetMargins(0, 0, 0);
             $fpdf->SetFont('Courier', '', 8);
             $fpdf->SetTextColor(0, 0, 0);
             $documentSize = null;
             for ($i = 0; $i < $pagecount; $i++) {
                 $string = $dokument->getLatestRevision()->getIdentifier() . " (Seite " . ($i + 1) . " von " . $pagecount . ", Revision " . $dokument->getLatestRevision()->getRevisionID() . ")";
                 $fpdf->AddPage();
                 $tpl = $fpdf->importPage($i + 1);
                 $size = $fpdf->getTemplateSize($tpl);
                 // First Page defines documentSize
                 if ($documentSize === null) {
                     $documentSize = $size;
                 }
                 // Center Template on Document
                 $fpdf->useTemplate($tpl, intval(($documentSize["w"] - $size["w"]) / 2), intval(($documentSize["h"] - $size["h"]) / 2), 0, 0, true);
                 $fpdf->Text(intval($documentSize["w"]) - 10 - $fpdf->GetStringWidth($string), 5, $string);
             }
             $this->ziphandler->addFromString($dokument->getLatestRevision()->getIdentifier() . "." . $extension, $fpdf->Output("", "S"));
         } catch (Exception $e) {
             $this->ziphandler->addFile($file->getAbsoluteFilename(), $dokument->getLatestRevision()->getIdentifier() . "." . $extension);
         }
     } else {
         $this->ziphandler->addFile($file->getAbsoluteFilename(), $dokument->getLatestRevision()->getIdentifier() . "." . $extension);
     }
 }
开发者ID:jungepiraten,项目名称:vpanel,代码行数:35,代码来源:dokumenttransitiondownload.class.php

示例3: createPDF

 public function createPDF(FPDI $fpdi, $filename)
 {
     $fpdi->setSourceFile(__DIR__ . '/A.pdf');
     $template = $fpdi->importPage(1);
     $size = $fpdi->getTemplateSize($template);
     $fpdi->AddPage('P', array($size['w'], $size['h']));
     $fpdi->useTemplate($template);
     $template = $fpdi->importPage(1);
     $fpdi->AddPage('P', array($size['w'], $size['h']));
     $fpdi->useTemplate($template);
     file_put_contents($filename, $fpdi->Output('', 'S'));
 }
开发者ID:mneuhaus,项目名称:fpdi,代码行数:12,代码来源:IntegrationTest.php

示例4: testMerge

 public function testMerge()
 {
     $fpdi = new FPDI();
     $fpdi->setSourceFile(__DIR__ . '/A.pdf');
     $template = $fpdi->importPage(1);
     $size = $fpdi->getTemplateSize($template);
     $fpdi->AddPage('P', array($size['w'], $size['h']));
     $fpdi->useTemplate($template);
     $template = $fpdi->importPage(1);
     $fpdi->AddPage('P', array($size['w'], $size['h']));
     $fpdi->useTemplate($template);
     file_put_contents(__DIR__ . '/AA.pdf', $fpdi->Output('', 'S'));
 }
开发者ID:CodeSomethingMX,项目名称:barney,代码行数:13,代码来源:IntegrationTest.php

示例5: merge

 /**
  * Merges your provided PDFs and outputs to specified location.
  * @param $outputmode
  * @param $outputname
  * @return PDF
  */
 public function merge($outputmode = 'browser', $outputpath = 'newfile.pdf')
 {
     if (!isset($this->_files) || !is_array($this->_files)) {
         throw new exception("No PDFs to merge.");
     }
     $fpdi = new FPDI();
     //$fpdi->setPrintHeader(FALSE);
     //$fpdi->setPrintFooter(FALSE);
     //merger operations
     foreach ($this->_files as $file) {
         $filename = $file[0];
         $filepages = $file[1];
         $count = $fpdi->setSourceFile($filename);
         //add the pages
         if ($filepages == 'all') {
             for ($i = 1; $i <= $count; $i++) {
                 $template = $fpdi->importPage($i);
                 $size = $fpdi->getTemplateSize($template);
                 $orientation = $size['w'] <= $size['h'] ? 'P' : 'L';
                 $fpdi->AddPage($orientation, array($size['w'], $size['h']));
                 $fpdi->useTemplate($template);
             }
         } else {
             foreach ($filepages as $page) {
                 if (!($template = $fpdi->importPage($page))) {
                     throw new exception("Could not load page '{$page}' in PDF '{$filename}'. Check that the page exists.");
                 }
                 $size = $fpdi->getTemplateSize($template);
                 $orientation = $size['w'] <= $size['h'] ? 'P' : 'L';
                 $fpdi->AddPage($orientation, array($size['w'], $size['h']));
                 $fpdi->useTemplate($template);
             }
         }
     }
     //output operations
     $mode = $this->_switchmode($outputmode);
     if ($mode == 'S') {
         return $fpdi->Output($outputpath, 'S');
     } else {
         if ($fpdi->Output($outputpath, $mode) == '') {
             return true;
         } else {
             throw new exception("Error outputting PDF to '{$outputmode}'.");
             return false;
         }
     }
 }
开发者ID:rcollard,项目名称:chronopost,代码行数:53,代码来源:PDFMerger.php

示例6: carl_merge_pdfs_fpdi

function carl_merge_pdfs_fpdi($pdffiles, $titles = array(), $metadata = array(), $metadata_encoding = 'UTF-8')
{
    // FPDI throws some notices that break the PDF
    $old_error = error_reporting(E_ERROR | E_WARNING | E_PARSE);
    include_once INCLUDE_PATH . 'pdf/tcpdf/tcpdf.php';
    include_once INCLUDE_PATH . 'pdf/fpdi/fpdi.php';
    if (gettype($pdffiles) != 'array') {
        trigger_error('$pdffiles must be an array');
        return false;
    }
    if (!(class_exists('TCPDF') && class_exists('FPDI'))) {
        trigger_error('You must have TCPDF/FPDI installed in order to run carl_merge_pdfs()');
        return false;
    }
    if (empty($pdffiles)) {
        return NULL;
    }
    $fpdi = new FPDI();
    foreach ($pdffiles as $pdffile) {
        if (file_exists($pdffile)) {
            $count = $fpdi->setSourceFile($pdffile);
            for ($i = 1; $i <= $count; $i++) {
                $template = $fpdi->importPage($i);
                $size = $fpdi->getTemplateSize($template);
                $fpdi->AddPage('P', array($size['w'], $size['h']));
                $fpdi->useTemplate($template, null, null, null, null, true);
                if ($i == 1) {
                    if (isset($titles[$pdffile])) {
                        $bookmark = html_entity_decode($titles[$pdffile]);
                    } else {
                        $bookmark = $pdffile;
                    }
                    $fpdi->Bookmark($bookmark, 1, 0, '', '', array(0, 0, 0));
                }
            }
        }
    }
    error_reporting($old_error);
    return $fpdi->Output('ignored.pdf', 'S');
}
开发者ID:hunter2814,项目名称:reason_package,代码行数:40,代码来源:pdf_utils.php

示例7: mergeDocuments

 /**
  * Simple helper function which actually merges a given array of document-paths
  * @param $paths
  * @return string The created document's url
  */
 private function mergeDocuments($paths)
 {
     include_once 'engine/Library/Fpdf/fpdf.php';
     include_once 'engine/Library/Fpdf/fpdi.php';
     $pdf = new FPDI();
     foreach ($paths as $path) {
         $numPages = $pdf->setSourceFile($path);
         for ($i = 1; $i <= $numPages; $i++) {
             $template = $pdf->importPage($i);
             $size = $pdf->getTemplateSize($template);
             $pdf->AddPage('P', array($size['w'], $size['h']));
             $pdf->useTemplate($template);
         }
     }
     $hash = md5(uniqid(rand()));
     $pdf->Output($hash . '.pdf', "D");
 }
开发者ID:GerDner,项目名称:luck-docker,代码行数:22,代码来源:Order.php

示例8: foreach

     $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);
                     }
                 }
             }
         }
         ++$n;
     }
     $pdf->Output("/tmp/{$sid}letters.pdf", 'F');
     $zip->addFile("/tmp/{$sid}letters.pdf", '/letters.pdf');
 }
 if ($table_post) {
     $zip->addFile("/tmp/{$sid}post.xls", '/post.xls');
 }
 if ($table_post_our) {
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:31,代码来源:get.php

示例9: concatFiles

    public static function concatFiles($files_path_array) {

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

        $pdf = new FPDI();
        foreach ($files_path_array AS $file) {
            // get the page count
            $pageCount = $pdf->setSourceFile($file);
            // iterate through all pages
            for ($pageNo = 1; $pageNo <= $pageCount; $pageNo++) {
                // import a page
                $templateId = $pdf->importPage($pageNo);
                // get the size of the imported page
                $size = $pdf->getTemplateSize($templateId);

                // create a page (landscape or portrait depending on the imported page size)
                if ($size['w'] > $size['h']) {
                    $pdf->AddPage('L', array($size['w'], $size['h']));
                } else {
                    $pdf->AddPage('P', array($size['w'], $size['h']));
                }

                // use the imported page
                $pdf->useTemplate($templateId);

            }
        }

        // Output the new PDF. Here we need to overwrite existing file so first array element is used.
        $pdf->Output($files_path_array[0],'F');

        return $files_path_array[0];



    }
开发者ID:ranvijayj,项目名称:htmlasa,代码行数:37,代码来源:FileModification.php

示例10: FlyerRendering

function FlyerRendering($config, $inputFile, $outputPath, $outputPostfix, $anschnitt = 0.0)
{
    // Breite der einzelnen Seiten
    $wRechts = 99.0;
    //mm
    $wMitte = 98.0;
    //mm
    $wLinks = 97.0;
    //mm
    // Community Name
    $communityNamePositionX = $wLinks + $wMitte + $config['communityNamePositionOffsetX'];
    //mm
    $communityNamePositionY = 12.2 + $config['communityNamePositionOffsetY'];
    //mm
    // Kontakt Titel
    $kontaktTitelPositionX = $wLinks + 3.975;
    //mm
    $kontaktTitelPositionY = 10.425;
    //mm
    $kontaktTitelFontSize = 15.0;
    //pt
    // Kontakt Info
    $kontaktInfoTextPositionX = $kontaktTitelPositionX + 25.0;
    //mm
    $kontaktInfoPositionY = $kontaktTitelPositionY + 7.0;
    //mm
    $kontaktInfoZeilenOffsetY = 4.7;
    //mm
    $kontaktInfoFontSize = 10.9;
    //pt
    // Kontakt Logo
    $kontaktLogoPositionX = $wLinks + $wMitte / 2 - $config['kontaktLogoWidth'] / 2;
    // Kontakt Footer
    $kontaktFooterPositionX = $wLinks;
    //mm
    $kontaktFooterPositionY = 95.40000000000001;
    //mm
    $kontaktFooterWidth = $wMitte;
    //mm
    $kontaktFooterFontSize = 10.9;
    //pt
    // Output-Dasteiname zusammenbauen
    $outputFile = $outputPath . DIRECTORY_SEPARATOR . $outputPostfix . '_' . basename($inputFile);
    // initiate FPDI
    $pdf = new FPDI();
    echo 'Input: ' . basename($inputFile) . PHP_EOL;
    $pageCount = $pdf->setSourceFile($inputFile);
    // Importiere Vorder- und Rueckseite
    $Vorderseite = $pdf->ImportPage(1);
    $Rueckseite = $pdf->ImportPage(2);
    // Seitenabmessungen holen
    $size = $pdf->getTemplateSize($Vorderseite);
    $dokumentBreite = round($size['w'], 2);
    $dokumentHoehe = round($size['h'], 2);
    echo 'Dokumenten Breite: ' . $dokumentBreite . 'mm' . PHP_EOL;
    echo 'Dokumenten Hoehe: ' . $dokumentHoehe . 'mm' . PHP_EOL;
    echo 'Anschnitt: ' . $anschnitt . 'mm' . PHP_EOL;
    // Vorderseite uebernehmen
    // Anfang eines bloeden Hacks wegen des FooterZeilen-Textes.
    // Der Footertext laesst sich nur einfügen, wenn die Seite eine A4 Seite ist.
    // Keine Ahnung warum!
    $pdf->AddPage('L');
    $tplVorderseite = $pdf->importPage(1);
    $pdf->useTemplate($tplVorderseite);
    //Margin ist wegen der Rand-Platzierung des Community Names wichtig.
    $pdf->SetMargins(0, 0, 0);
    // erstmal alle Fonts laden
    echo 'Lade Fonts...' . PHP_EOL;
    $pdf->AddFont('lato-bold');
    $pdf->AddFont('lato-regular');
    $pdf->AddFont('alternategothic');
    // Rendern Titel Text
    echo 'Verarbeite Titel Text...' . PHP_EOL;
    $pdf->SetFont('lato-bold');
    $pdf->SetFontSize($kontaktTitelFontSize);
    $pdf->SetTextColor(0, 0, 0);
    //schwarz
    $pdf->SetXY($kontaktTitelPositionX + $anschnitt, $kontaktTitelPositionY + $anschnitt);
    $pdf->Write(0, iconv('UTF-8', 'windows-1252', $config['kontaktTitelText']));
    // Rendern Info Text
    echo 'Verarbeite Info Text...' . PHP_EOL;
    $pdf->SetTextColor(0, 0, 0);
    //schwarz
    $pdf->SetFontSize($kontaktInfoFontSize);
    foreach ($config['kontaktInfoTexte'] as $a) {
        $pdf->SetFont('lato-bold');
        $pdf->SetXY($kontaktTitelPositionX + $anschnitt, $kontaktInfoPositionY + $anschnitt);
        $pdf->Write(0, iconv('UTF-8', 'windows-1252', $a[0]));
        $pdf->SetFont('lato-regular');
        $pdf->SetXY($kontaktInfoTextPositionX + $anschnitt, $kontaktInfoPositionY + $anschnitt);
        $pdf->Write(0, iconv('UTF-8', 'windows-1252', $a[1]));
        $kontaktInfoPositionY = $kontaktInfoPositionY + $kontaktInfoZeilenOffsetY;
    }
    // Rendern Community Logo
    echo 'Verarbeite Logo...' . PHP_EOL;
    $pdf->Image($config['kontaktLogoDateiName'], $kontaktLogoPositionX + $anschnitt, $config['kontaktLogoPositionY'] + $anschnitt, $config['kontaktLogoWidth'], 0);
    // Rendern Fusszeilen Text
    echo 'Verarbeite Fusszeile...' . PHP_EOL;
    $pdf->SetFont('lato-regular');
    $pdf->SetFontSize($kontaktFooterFontSize);
//.........这里部分代码省略.........
开发者ID:kraeuterhexer,项目名称:ffm-freifunk-faltblatt-6-seiten,代码行数:101,代码来源:flyermod.php

示例11: view_sign_oc

	public function view_sign_oc(){
		require_once('./assets/fpdf17/fpdf.php');
		require_once('./assets/fpdf17/fpdi.php');
		$oc_id=$this->uri->segment(3,'');
		
		// init pce data                       
		$oc_dat=$this->m_oc->get_oc_by_id($oc_id);
		$project=$this->m_project->get_project_by_id($oc_dat->project_id);
        //init sign pic
        $ae_sign_user_dat=$this->m_user->get_user_by_login_name($project->project_cs);
        $ae_sign_filename="no";
        if (isset($ae_sign_user_dat->sign_filename)) {
          $ae_sign_filename=$ae_sign_user_dat->sign_filename;
        }
        $finance_sign_dat=$this->m_user->get_user_by_login_name($oc_dat->fc_sign);
        $finance_sign_filename="no";
        if (isset($finance_sign_dat->sign_filename)) {
          $finance_sign_filename=$finance_sign_dat->sign_filename;
        }
        // initiate FPDI
        $pdf = new FPDI();

        // เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวธรรมดา กำหนด ชื่อ เป็น angsana
            $pdf->AddFont('angsana','','angsa.php');
             
            // เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวหนา  กำหนด ชื่อ เป็น angsana
            $pdf->AddFont('angsana','B','angsab.php');
             
            // เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวหนา  กำหนด ชื่อ เป็น angsana
            $pdf->AddFont('angsana','I','angsai.php');
             
            // เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวหนา  กำหนด ชื่อ เป็น angsana
            $pdf->AddFont('angsana','BI','angsaz.php');


        // get the page count
        $pageCount = $pdf->setSourceFile("./media/real_pdf/".$oc_dat->filename);
        // iterate through all pages
        for ($pageNo = 1; $pageNo <= $pageCount; $pageNo++) {
            // import a page
            $templateId = $pdf->importPage($pageNo);
            // get the size of the imported page
            $size = $pdf->getTemplateSize($templateId);

            // create a page (landscape or portrait depending on the imported page size)
            if ($size['w'] > $size['h']) {
                $pdf->AddPage('L', array($size['w'], $size['h']));
            } else {
                $pdf->AddPage('P', array($size['w'], $size['h']));
            }

            // use the imported page
            $pdf->useTemplate($templateId);

            $pdf->SetTextColor(0,0,0);
            $pdf->SetFont('angsana','B',14);
            $pdf->SetXY(5, 5);
            //$pdf->Write(8, 'A complete document imported with FPDI');

            //// temporaly disable 
            if ($finance_sign_filename!="no"&&$finance_sign_filename!=""&&$finance_sign_filename!=null) {
              //$pdf->Image("./media/sign_photo/".$finance_sign_filename,100,10,40,0);
            }
            if ($ae_sign_filename!="no"&&$ae_sign_filename!=""&&$ae_sign_filename!=null) {
              //$pdf->Image("./media/sign_photo/".$ae_sign_filename,100,110,40,0);
            }
            //$pdf->Image("images/play.png",100,100,100,0);
        }
        $new_filename=$oc_dat->oc_no."_A.pdf";

        // Output the new PDF
        //@unlink("./media/real_pdf/".$new_filename);
        $pdf->Output($new_filename,"I");
        //redirect("media/real_pdf/".$new_filename);
	}
开发者ID:sereepap2029,项目名称:rcal,代码行数:75,代码来源:project.php

示例12: die

define('FPDF_FONTPATH', __DIR__ . '/fpdf/font/');
include_once __DIR__ . '/fpdf/fpdf.php';
include_once __DIR__ . '/fpdi/fpdi.php';
ob_clean();
$file = __DIR__ . '/cupon_001.pdf';
if (!file_exists($file)) {
    die("File does not exist");
} else {
    $fullName = $_REQUEST['suname'] . ' ' . $_REQUEST['name'] . ' ' . $_REQUEST['midlname'];
    $currentDate = currentDate();
    $cuponNum = generateCuponNumber();
    sendEmail($cuponNum, $currentDate, $fullName);
    $pdf = new FPDI();
    $pdf->setSourceFile($file);
    $tpl = $pdf->importPage(1);
    $size = $pdf->getTemplateSize($tpl);
    $orientation = $size['h'] > $size['w'] ? 'P' : 'L';
    $pdf->AddPage($orientation);
    $pdf->useTemplate($tpl, null, null, $size['w'], $size['h'], true);
    $pdf->AddFont('AgencyFBCyrillic', '', 'agenfbcyr.php');
    $pdf->AddFont('GoodVibesPro', '', 'good_vibes_pro_regular.php');
    $pdf->SetXY(41.628, 91.017);
    $pdf->SetFont('GoodVibesPro', '', 40);
    $pdf->SetTextColor(184, 153, 106);
    $pdf->Cell(212.019, 20.814, iconv('UTF-8', 'CP1251', $fullName), 0, 2, 'C');
    $pdf->SetXY(56.797, 160.396);
    $pdf->SetFont('AgencyFBCyrillic', '', 21);
    $pdf->SetTextColor(32, 22, 0);
    $pdf->Cell(44.097, 7.173, iconv('UTF-8', 'CP1251', $currentDate), 0, 2, 'C');
    $pdf->SetXY(194.263, 160.396);
    $pdf->SetFont('AgencyFBCyrillic', '', 21);
开发者ID:teplizy,项目名称:teplizy.github.io,代码行数:31,代码来源:index.php

示例13: dirname

 if (!array_key_exists($id, $app['files'])) {
     $app->abort(404, 'The PDF file could not be found');
 }
 $file = $app['files'][$id];
 $parser = new \Smalot\PdfParser\Parser();
 $filepath = dirname(__FILE__) . '/../uploads/' . $file;
 $document = $parser->parseFile($filepath);
 $details = $document->getDetails();
 $dir = dirname(__FILE__) . '/../uploads/pages/' . $id;
 if (!file_exists($dir)) {
     $dirCreate = mkdir($dir);
     for ($i = 1; $i <= $details['Pages']; $i++) {
         $fpdi = new FPDI();
         $fpdi->setSourceFile($filepath);
         $tpl = $fpdi->importPage($i);
         $size = $fpdi->getTemplateSize($tpl);
         $orientation = $size['h'] > $size['w'] ? 'P' : 'L';
         $fpdi->AddPage($orientation);
         $fpdi->useTemplate($tpl, null, null, $size['w'], $size['h'], true);
         try {
             $filename = dirname(__FILE__) . '/../uploads/pages/' . $id . '/' . $i;
             $fpdi->Output($filename . '.pdf', "F");
             $imagick = new Imagick();
             $imagick->readimage($filename . '.pdf');
             $imagick->setImageFormat('jpeg');
             $imagick->setCompressionQuality(20);
             $imagick->writeImage($filename . '.jpg');
             $imagick->clear();
             $imagick->destroy();
         } catch (Exception $e) {
             echo 'Caught exception: ', $e->getMessage(), "\n";
开发者ID:emraanzaki,项目名称:pdfparsing,代码行数:31,代码来源:index.php

示例14: FlyerRendering

function FlyerRendering($inputFile, $outputPostfix, $anschnitt)
{
    /*------------------------------------------------------------------------------------
     * Bitte tragt hier eure lokalen Freifunk Daten ein.
     *------------------------------------------------------------------------------------
     *
     * Hinweiss Community-Logo: 
     * Moegliche Format sind GIF, JPG und PNG.
     *
     * Laenge des Community Namen:
     * Falls der Community-Name zu lang ist und es zu einem Zeilenumbruch kommt,
     * dann sollte $communityNameFontSize verkleiner werden
     *
    -------------------------------------------------------------------------------------*/
    // Community Name fuer Hauptseite
    $communityNameText = "Freifunk Duckburg";
    $communityNameFontSize = 48.0;
    //in pt
    $communityNamePositionOffsetX = 0.0;
    // +/- in mm
    $communityNamePositionOffsetY = 0.0;
    // +/- in mm
    // Logo auf Kontaktseite
    $kontaktLogoDateiName = "logo-template.png";
    $kontaktLogoWidth = 66.25;
    //in mm  // Muss kleiner 98.0 mm sein! Hier bitte die gewuenschte Breite des Logos auf dem Flyer eintragen.
    $kontaktLogoPositionY = 47.0;
    //in mm  // Die Hoeheneinstellung ist etwas frickelig. Es klappt aber :-)
    // Texte fuer Seite mit Kontaktdaten
    $kontaktTitelText = "Kontakt";
    $kontaktInfoTexte = [["Webseite", "http://ffdb.freifunk.net"], ["Mail", "info@ff-duckburg.ffdb"], ["Mailingliste", "subscribe@ff-duckburg.ffdb"], ["Twitter", "@FreiFunkDB"], ["Treffen", "Jeden zweiten Montag"], ["", "Und wo? Siehe unsere Webseite"], ["", ""], ["", ""]];
    // Text Fusszeile
    $kontaktFusszeileText = "Freifunk Duckburg e.V.";
    /*-----------------------------------------------------------------------------------
     *
     * Ab hier sollte nichts mehr geander werden!
     *
     ------------------------------------------------------------------------------------*/
    // Breite der einzelnen Seiten
    $wRechts = 99.0;
    //mm
    $wMitte = 98.0;
    //mm
    $wLinks = 97.0;
    //mm
    // Community Name
    $communityNamePositionX = $wLinks + $wMitte + $communityNamePositionOffsetX;
    //mm
    $communityNamePositionY = 12.2 + $communityNamePositionOffsetY;
    //mm
    // Kontakt Titel
    $kontaktTitelPositionX = $wLinks + 3.975;
    //mm
    $kontaktTitelPositionY = 10.425;
    //mm
    $kontaktTitelFontSize = 15.0;
    //pt
    // Kontakt Info
    $kontaktInfoTextPositionX = $kontaktTitelPositionX + 25.0;
    //mm
    $kontaktInfoPositionY = $kontaktTitelPositionY + 7.0;
    //mm
    $kontaktInfoZeilenOffsetY = 4.7;
    //mm
    $kontaktInfoFontSize = 10.9;
    //pt
    // Kontakt Logo
    $kontaktLogoPositionX = $wLinks + $wMitte / 2 - $kontaktLogoWidth / 2;
    // Kontakt Footer
    $kontaktFooterPositionX = $wLinks;
    //mm
    $kontaktFooterPositionY = 95.40000000000001;
    //mm
    $kontaktFooterWidth = $wMitte;
    //mm
    $kontaktFooterFontSize = 10.9;
    //pt
    echo "\n";
    // Output-Dasteiname zusammenbauen
    $outputFile = $outputPostfix . "-" . $inputFile;
    // initiate FPDI
    $pdf = new FPDI();
    echo "Input: {$inputFile}\n";
    $pageCount = $pdf->setSourceFile($inputFile);
    // Importiere Vorder- und Rueckseite
    $Vorderseite = $pdf->ImportPage(1);
    $Rueckseite = $pdf->ImportPage(2);
    // Seitenabmessungen holen
    $size = $pdf->getTemplateSize($Vorderseite);
    $dokumentBreite = round($size['w'], 2);
    $dokumentHoehe = round($size['h'], 2);
    echo "Dokumenten Breite: {$dokumentBreite} mm\n";
    echo "Dokumenten Hoehe: {$dokumentHoehe} mm\n";
    echo "Anschnitt: {$anschnitt} mm\n";
    // Vorderseite uebernehmen
    // Anfang eines bloeden Hacks wegen des FooterZeilen-Textes.
    // Der Footertext laesst sich nur einfügen, wenn die Seite eine A4 Seite ist.
    // Keine Ahnung warum!
    $pdf->AddPage('L');
    $tplVorderseite = $pdf->importPage(1);
//.........这里部分代码省略.........
开发者ID:rubo77,项目名称:ffm-freifunk-faltblatt-6-seiten,代码行数:101,代码来源:flyermod.php

示例15: pdfImg

 public function pdfImg($file)
 {
     require_once $_SERVER['DOCUMENT_ROOT'] . 'tyj_oa/Public/fpdf/fpdf.php';
     require_once $_SERVER['DOCUMENT_ROOT'] . 'tyj_oa/Public/fpdi/fpdi.php';
     $pdf = new FPDI();
     $pageCount = $pdf->setSourceFile($file);
     for ($pageNo = 1; $pageNo <= $pageCount; $pageNo++) {
         $templateId = $pdf->importPage($pageNo);
         $size = $pdf->getTemplateSize($templateId);
         if ($size['w'] > $size['h']) {
             $pdf->AddPage('L', array($size['w'], $size['h']));
         } else {
             $pdf->AddPage('P', array($size['w'], $size['h']));
         }
         if ($pageNo == $pageCount) {
             $img = $_SERVER['DOCUMENT_ROOT'] . get_save_url() . D('user')->where('id = ' . get_user_id())->getField('pic_yin');
             $pdf->Image($img, 150, 250, 0, 20);
         }
         $pdf->useTemplate($templateId);
         $pdf->SetFont('Helvetica');
         $pdf->SetXY(5, 5);
     }
     $pdf->Output($file);
 }
开发者ID:TipTimesPHP,项目名称:tyj_oa,代码行数:24,代码来源:FlowModel.class.php


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