當前位置: 首頁>>代碼示例>>PHP>>正文


PHP TCPDF::setImageScale方法代碼示例

本文整理匯總了PHP中TCPDF::setImageScale方法的典型用法代碼示例。如果您正苦於以下問題:PHP TCPDF::setImageScale方法的具體用法?PHP TCPDF::setImageScale怎麽用?PHP TCPDF::setImageScale使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在TCPDF的用法示例。


在下文中一共展示了TCPDF::setImageScale方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: PdfAction

 public function PdfAction()
 {
     $pdf = new TCPDF('L');
     $pdf->SetPrintHeader(true);
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     // set margins
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     // set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     // set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     // set some language-dependent strings (optional)
     if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
         require_once dirname(__FILE__) . '/lang/eng.php';
         $pdf->setLanguageArray($l);
     }
     // set font
     $pdf->SetFont('helvetica', '', 8);
     // add a page
     $pdf->AddPage();
     //get report data into $data variable
     $project = $this->getServiceLocator()->get('ProjectTable');
     $data = $project->getWsr();
     $view = new PhpRenderer();
     $resolver = new TemplateMapResolver();
     //set the path of the pdf.phtml file
     $resolver->setMap(array('PDFTemplate' => '/var/www/html/WSRAutomation/module/Application/view/application/index/pdf.phtml'));
     $view->setResolver($resolver);
     $viewModel = new ViewModel();
     $viewModel->setTemplate('PDFTemplate')->setVariables(array('projects' => $data, 'view' => 'pdf'));
     $html = $view->render($viewModel);
     $pdf->writeHTML($html, true, 0, true, 0);
     $pdf->Output('WsrReport.pdf', 'I');
 }
開發者ID:vikas1monu,項目名稱:ProductionWsr,代碼行數:35,代碼來源:IndexController.php

示例2: testPdfOutput

 public function testPdfOutput()
 {
     $this->markTestIncomplete('Transparency rendering on signature not working.');
     // create new PDF document
     $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('Nicola Asuni');
     $pdf->SetTitle('TCPDF Example 052');
     $pdf->SetSubject('TCPDF Tutorial');
     $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
     // set default header data
     $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 052', PDF_HEADER_STRING);
     // set header and footer fonts
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     // set margins
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     // set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     // set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     // set some language-dependent strings (optional)
     $pdf->setLanguageArray($this->langSettings);
     // ---------------------------------------------------------
     /*
     NOTES:
      - To create self-signed signature: openssl req -x509 -nodes -days 365000 -newkey rsa:1024 -keyout tcpdf.crt -out tcpdf.crt
      - To export crt to p12: openssl pkcs12 -export -in tcpdf.crt -out tcpdf.p12
      - To convert pfx certificate to pem: openssl pkcs12 -in tcpdf.pfx -out tcpdf.crt -nodes
     */
     // set certificate file
     $certificate = 'file://tests/data/cert/tcpdf.crt';
     // set additional information
     $info = array('Name' => 'TCPDF', 'Location' => 'Office', 'Reason' => 'Testing TCPDF', 'ContactInfo' => 'http://www.tcpdf.org');
     // set document signature
     $pdf->setSignature($certificate, $certificate, 'tcpdfdemo', '', 2, $info);
     // set font
     $pdf->SetFont('helvetica', '', 12);
     // add a page
     $pdf->AddPage();
     // print a line of text
     $text = 'This is a <b color="#FF0000">digitally signed document</b> using the default (example) <b>tcpdf.crt</b> certificate.<br />To validate this signature you have to load the <b color="#006600">tcpdf.fdf</b> on the Arobat Reader to add the certificate to <i>List of Trusted Identities</i>.<br /><br />For more information check the source code of this example and the source code documentation for the <i>setSignature()</i> method.<br /><br /><a href="http://www.tcpdf.org">www.tcpdf.org</a>';
     $pdf->writeHTML($text, true, 0, true, 0);
     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     // *** set signature appearance ***
     // create content for signature (image and/or text)
     $pdf->Image('tests/images/tcpdf_signature.png', 180, 60, 15, 15, 'PNG');
     // define active area for signature appearance
     $pdf->setSignatureAppearance(180, 60, 15, 15);
     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     // *** set an empty signature appearance ***
     $pdf->addEmptySignatureAppearance(180, 80, 15, 15);
     $this->comparePdfs($pdf);
 }
開發者ID:fooman,項目名稱:tcpdf,代碼行數:59,代碼來源:Example052Test.php

示例3: testPdfOutput

    public function testPdfOutput()
    {
        // create new PDF document
        $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
        // set document information
        $pdf->SetCreator(PDF_CREATOR);
        $pdf->SetAuthor('Nicola Asuni');
        $pdf->SetTitle('TCPDF Example 001');
        $pdf->SetSubject('TCPDF Tutorial');
        $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
        // set default header data
        $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 001', PDF_HEADER_STRING, array(0, 64, 255), array(0, 64, 128));
        $pdf->setFooterData(array(0, 64, 0), array(0, 64, 128));
        // set header and footer fonts
        $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
        $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
        // set default monospaced font
        $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
        // set margins
        $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
        $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
        $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
        // set auto page breaks
        $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
        // set image scale factor
        $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
        // set some language-dependent strings (optional)
        $pdf->setLanguageArray($this->langSettings);
        // ---------------------------------------------------------
        // set default font subsetting mode
        $pdf->setFontSubsetting(true);
        // Set font
        // dejavusans is a UTF-8 Unicode font, if you only need to
        // print standard ASCII chars, you can use core fonts like
        // helvetica or times to reduce file size.
        $pdf->SetFont('dejavusans', '', 14, '', true);
        // Add a page
        // This method has several options, check the source code documentation for more information.
        $pdf->AddPage();
        // set text shadow effect
        $pdf->setTextShadow(array('enabled' => true, 'depth_w' => 0.2, 'depth_h' => 0.2, 'color' => array(196, 196, 196), 'opacity' => 1, 'blend_mode' => 'Normal'));
        // Set some content to print
        $html = <<<EOD
<h1>Welcome to <a href="http://www.tcpdf.org" style="text-decoration:none;background-color:#CC0000;color:black;">&nbsp;<span style="color:black;">TC</span><span style="color:white;">PDF</span>&nbsp;</a>!</h1>
<i>This is the first example of TCPDF library.</i>
<p>This text is printed using the <i>writeHTMLCell()</i> method but you can also use: <i>Multicell(), writeHTML(), Write(), Cell() and Text()</i>.</p>
<p>Please check the source code documentation and other examples for further information.</p>
<p style="color:#CC0000;">TO IMPROVE AND EXPAND TCPDF I NEED YOUR SUPPORT, PLEASE <a href="http://sourceforge.net/donate/index.php?group_id=128076">MAKE A DONATION!</a></p>
EOD;
        // Print text using writeHTMLCell()
        $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
        $this->comparePdfs($pdf);
    }
開發者ID:fooman,項目名稱:tcpdf,代碼行數:53,代碼來源:Example001Test.php

示例4: createPdfFromImage

 function createPdfFromImage($arrImagename, $strFilename)
 {
     $this->load->library('tcpdf/TCPDF');
     $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
         require_once dirname(__FILE__) . '/lang/eng.php';
         $pdf->setLanguageArray($l);
     }
     // -------------------------------------------------------------------
     $pdf->AddPage();
     $pdf->setJPEGQuality(75);
     $imgdata = base64_decode('iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABlBMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDrEX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg==');
     $pdf->Image('@' . $imgdata);
     $intY = 25;
     foreach ($arrImagename as $intkey => $oneImage) {
         if ($intkey % 2 == 0 && $intkey != 0) {
             $intY = 25;
             $pdf->AddPage();
         }
         $pdf->Image($oneImage, 10, $intY, 180, 103, 'png', '', 'C', true, 150, '', false, false, 1, false, false, false);
         $intY += 125;
     }
     $pdf->Output($strFilename . '.pdf', 'I');
 }
開發者ID:riyajk,項目名稱:nmsApp,代碼行數:33,代碼來源:Report.php

示例5: testPdfOutput

 public function testPdfOutput()
 {
     // create new PDF document
     $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('Nicola Asuni');
     $pdf->SetTitle('TCPDF Example 017');
     $pdf->SetSubject('TCPDF Tutorial');
     $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
     // set default header data
     $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 017', PDF_HEADER_STRING);
     // set header and footer fonts
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     // set margins
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     // set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     // set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     // set some language-dependent strings (optional)
     $pdf->setLanguageArray($this->langSettings);
     // ---------------------------------------------------------
     // set font
     $pdf->SetFont('helvetica', '', 20);
     // add a page
     $pdf->AddPage();
     $pdf->Write(0, 'Example of independent Multicell() columns', '', 0, 'L', true, 0, false, false, 0);
     $pdf->Ln(5);
     $pdf->SetFont('times', '', 12);
     // create columns content
     // create columns content
     $left_column = '[LEFT COLUMN] left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column' . "\n";
     $right_column = '[RIGHT COLUMN] right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column' . "\n";
     // MultiCell($w, $h, $txt, $border=0, $align='J', $fill=0, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0)
     // set color for background
     $pdf->SetFillColor(255, 255, 200);
     // set color for text
     $pdf->SetTextColor(0, 63, 127);
     // write the first column
     $pdf->MultiCell(80, 0, $left_column, 1, 'J', 1, 0, '', '', true, 0, false, true, 0);
     // set color for background
     $pdf->SetFillColor(215, 235, 255);
     // set color for text
     $pdf->SetTextColor(127, 31, 0);
     // write the second column
     $pdf->MultiCell(80, 0, $right_column, 1, 'J', 1, 1, '', '', true, 0, false, true, 0);
     // reset pointer to the last page
     $pdf->lastPage();
     $this->comparePdfs($pdf);
 }
開發者ID:fooman,項目名稱:tcpdf,代碼行數:56,代碼來源:Example017Test.php

示例6: generatePDF

 /**
  * Method creates a PDF in landscape mode, using ilPDFGeneration Job
  * Rest of method similar to superclass method
  *
  * @param ilPDFGenerationJob $job
  */
 public static function generatePDF(ilPDFGenerationJob $job)
 {
     // create new PDF document
     // 'L' for Landscape
     $pdf = new TCPDF('L', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     // set document information
     $pdf->SetCreator($job->getCreator());
     $pdf->SetAuthor($job->getAuthor());
     $pdf->SetTitle($job->getTitle());
     $pdf->SetSubject($job->getSubject());
     $pdf->SetKeywords($job->getKeywords());
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     $pdf->SetMargins($job->getMarginLeft(), $job->getMarginTop(), $job->getMarginRight());
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     $pdf->SetAutoPageBreak($job->getAutoPageBreak(), $job->getMarginBottom());
     $pdf->setImageScale($job->getImageScale());
     $pdf->SetFont('dejavusans', '', 10);
     foreach ($job->getPages() as $page) {
         $pdf->AddPage();
         $pdf->writeHTML($page, true, false, true, false, '');
     }
     $result = $pdf->Output($job->getFilename(), $job->getOutputMode());
     // (I - Inline, D - Download, F - File)
 }
開發者ID:studer-raimann,項目名稱:RoomSharing,代碼行數:33,代碼來源:class.ilRoomSharingTCPDFGenerator.php

示例7: __construct

 public function __construct($orientation = 'P', $format = "Letter", $color = 'gray')
 {
     parent::__construct($orientation, "pt", $format);
     self::$document_orientation = $orientation;
     self::$document_format = $format;
     $margins = parent::getMargins();
     $this->document_width = parent::getPageWidth() - $margins['left'] - $margins['right'];
     $this->last_width = $margins['left'];
     $this->last_height = $margins['top'];
     $this->document_color = $color;
     if ($color == 'red') {
         parent::SetDrawColorArray(array(255, 128, 128));
     } elseif ($color == 'green') {
         parent::SetDrawColorArray(array(128, 255, 128));
     } elseif ($color == 'blue') {
         parent::SetDrawColorArray(array(128, 128, 255));
     } else {
         parent::SetDrawColorArray(array(128, 128, 128));
     }
     parent::SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     parent::SetAutoPageBreak(true, PDF_MARGIN_BOTTOM);
     parent::setImageScale(PDF_IMAGE_SCALE_RATIO);
     parent::SetHeaderMargin(PDF_MARGIN_HEADER);
     parent::SetFooterMargin(PDF_MARGIN_FOOTER + 10);
 }
開發者ID:kailIII,項目名稱:pos-erp,代碼行數:25,代碼來源:pdf.php

示例8: indexAction

 public function indexAction(Request $request, SessionInterface $session)
 {
     Util::checkUserIsLoggedInAndRedirect();
     $loggedInUserId = $session->get('user/id');
     $pageId = $request->get('id');
     $page = $this->getRepository(Entity::class)->getById($pageId, $loggedInUserId);
     // create new PDF document
     $pdf = new \TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     $pdf->setPrintHeader(false);
     //set margins
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     //set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     //set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     // ---------------------------------------------------------
     // set font
     $pdf->SetFont('dejavusans', '', 10);
     // add a page
     $pdf->AddPage();
     $html = $page['content'];
     $pdf->writeHTML($html, true, false, true, false, '');
     // Close and output PDF document
     $pdf->Output('./../../' . $page['name'] . '.pdf', 'D');
 }
開發者ID:spiasecki,項目名稱:ubirimi,代碼行數:29,代碼來源:EntityExportPdfController.php

示例9: new_pdf

    public static function new_pdf($orientation='P',$unit='mm',$format=null) {
        ini_set('memory_limit', '512M');
        require_once(TCPDF_DIR.'tcpdf.php');
        
        if ($format===null) $format = Base_User_SettingsCommon::get('Libs/TCPDF','page_format');

        $tcpdf = new TCPDF($orientation, $unit, $format, true);

        $tcpdf->SetCreator(PDF_CREATOR);
        $tcpdf->SetAuthor("Powered by epesi");
        $tcpdf->SetKeywords("PDF");

        // set header and footer fonts
        $tcpdf->setHeaderFont(Array(self::$default_font, '', PDF_FONT_SIZE_MAIN));
        $tcpdf->setFooterFont(Array(self::$default_font, '', PDF_FONT_SIZE_DATA));

        //set margins
        $tcpdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
        $tcpdf->SetHeaderMargin(PDF_MARGIN_HEADER);
        $tcpdf->SetFooterMargin(PDF_MARGIN_FOOTER);

        //set auto page breaks
        $tcpdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);

        //set image scale factor
        $tcpdf->setImageScale(PDF_IMAGE_SCALE_RATIO);

        return $tcpdf;
    }
開發者ID:62BRAINS,項目名稱:EPESI,代碼行數:29,代碼來源:TCPDFCommon_0.php

示例10: initTcpdfObject

 private function initTcpdfObject()
 {
     $tcpdf = new \TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     if ($this->creator) {
         $tcpdf->SetCreator($this->creator);
     }
     if ($this->author) {
         $tcpdf->SetAuthor($this->author);
     }
     if ($this->title) {
         $tcpdf->SetTitle($this->title);
     }
     if ($this->subject) {
         $tcpdf->SetSubject($this->subject);
     }
     if (!empty($this->keywords)) {
         $tcpdf->SetKeywords(implode(', ', $this->keywords));
     }
     // set default header data
     //$tcpdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 006', PDF_HEADER_STRING);
     // document defaults
     $tcpdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $tcpdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $tcpdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     $tcpdf->SetAutoPageBreak(true, PDF_MARGIN_BOTTOM);
     $tcpdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     return $tcpdf;
 }
開發者ID:martinlindhe,項目名稱:core3,代碼行數:28,代碼來源:Pdf.php

示例11: renderRfqRequest

 /**
  * Render a PDF file and show in browser or save to disk
  * If save to disk return file location
  */
 public function renderRfqRequest($quote, $saveToDisk = false)
 {
     $storeid = $quote->getStoreId();
     if ($storeid) {
         $appEmulation = Mage::getSingleton('core/app_emulation');
         $initial = $appEmulation->startEnvironmentEmulation($storeid, Mage_Core_Model_App_Area::AREA_FRONTEND, true);
     }
     $pdf = new TCPDF();
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     $pdf->AddPage();
     $pdf->SetAutoPageBreak(true, 30);
     $pdf->setHeaderMargin(20);
     $pdf->setFooterMargin(20);
     $pdf->setImageScale(1.5);
     $emailtext = Mage::helper('request4quote/email')->sendRequestProposalNotification($quote, false, true);
     $pdf->writeHTML(Mage::helper('cms')->getBlockTemplateProcessor()->filter($emailtext), false);
     $pdf->endPage();
     if ($storeid) {
         $appEmulation->stopEnvironmentEmulation($initial);
     }
     $rfqfilename = 'rfq_' . $quote->getId() . '.pdf';
     if (!$saveToDisk) {
         return $pdf->Output($rfqfilename);
     } else {
         if ($saveToDisk) {
             $filePath = $this->getFilePath() . $rfqfilename;
             $pdf->Output($filePath, 'F');
             return $filePath;
         }
     }
     exit;
 }
開發者ID:VinuWebtech,項目名稱:production267,代碼行數:37,代碼來源:Quotepdf.php

示例12: __construct

 /**
  * 初始化
  *
  * @access public
  * @param  array  $params 初始化參數
  * @return void
  */
 public function __construct($params)
 {
     $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor($this->pdf_author);
     $pdf->SetTitle($this->pdf_title);
     $pdf->SetSubject($this->pdf_subject);
     $pdf->SetKeywords($this->pdf_keywords);
     // 不顯示頭部和底部
     $pdf->setPrintHeader(FALSE);
     $pdf->setPrintFooter(FALSE);
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     //set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     //set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     //set some language-dependent strings
     require TCPDF_BASE_PATH . 'tcpdf/config/lang/eng.php';
     $pdf->setLanguageArray($l);
     // set font
     $pdf->SetFont('stsongstdlight', '', 10);
     $pdf->AddPage();
     $pdf->writeHTML($params['content'], true, false, true, false, '');
     $pdf->lastPage();
     // 輸出方式 I:瀏覽器直接輸出 D:文件下載 如果需要瀏覽器輸出或者下載的同時生成文件請在前麵加上F
     $pdf->Output($params['filename'], $params['flag']);
 }
開發者ID:tmlsoft,項目名稱:main,代碼行數:35,代碼來源:pdf.php

示例13: printTicket

 static function printTicket($ticket_html, $order)
 {
     ob_end_clean();
     $config = JComponentHelper::getParams('com_bookpro');
     $page_ticket = "<h1 color='Red'> Wellcome to tcpdf </h1>";
     $page_ticket = $ticket_html;
     // create new PDF document
     $pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false);
     $order_number = $order->order_number;
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('Joombooking');
     $pdf->SetTitle('Travel Ticket ' . $order_number);
     $pdf->SetSubject('Travel Ticket');
     $pdf->SetKeywords('TCPDF, PDF, ticket, travel, booking');
     // set default header data
     //$pdf->SetHeaderData($config->get('company_logo'),50, $config->get('company_name'), "Ticket \n www.");
     // set header and footer fonts
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     //$pdf->setHeaderMargin(10);
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     //set margins
     //$pdf->SetMargins(30, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     //$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     //set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     //set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     //set some language-dependent strings
     $pdf->setLanguageArray($l);
     // ---------------------------------------------------------
     // set font
     $pdf->SetFont('times', '', 11);
     // add a page
     $pdf->AddPage();
     // set JPEG quality
     $pdf->setJPEGQuality(75);
     $style['position'] = 'R';
     /*
      *     $type type of barcode (see tcpdf_barcodes_1d.php for supported formats).
      *      
      */
     //$pdf->write1DBarcode($order_number, 'C128B','', '', '', 10, 0.4, $style, 'M');
     // create some HTML content
     //$pdf->writeHTML($htmlcontent, true, 0, true, 0);
     //$pdf->WriteHTML(file_get_contents('test.html'));
     $pdf->WriteHTML($page_ticket);
     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     // reset pointer to the last page
     $pdf->lastPage();
     // ---------------------------------------------------------
     //Close and output PDF document
     ob_end_clean();
     $pdf->Output($order->name . '.pdf', 'I');
     //Should use variable to make file name
     ob_end_flush();
 }
開發者ID:hixbotay,項目名稱:executivetransport,代碼行數:60,代碼來源:pdf.php

示例14: pdf

 /**
  * @param string $html 要轉為pdf的內容
  * @param string $filename 文件名
  * @param string $type 'I'在頁麵中顯示;'D'直接下載
  */
 public static function pdf($html, $filename = 'hzd.pdf', $type = 'I')
 {
     import("Tools.TCPDF.TCPDF");
     import("Tools.TCPDF.config.tcpdf_config.php");
     $pdf = new \TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('HZD');
     $pdf->SetTitle('HZD');
     $pdf->SetSubject('HZD');
     $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
     $pdf->setPrintHeader(false);
     //不顯示頭部
     $pdf->setPrintFooter(false);
     //不顯示底部
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     // set margins
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     // set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     // set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     // ---------------------------------------------------------
     // set font
     $pdf->SetFont('stsongstdlight', '', 20);
     // add a page
     $pdf->AddPage();
     // output the HTML content
     $pdf->writeHTML($html, true, false, true, false, '');
     // ---------------------------------------------------------
     //Close and output PDF document
     $pdf->Output($filename, $type);
 }
開發者ID:hzd1989,項目名稱:tcpdf,代碼行數:40,代碼來源:Pdf.class.php

示例15: testPdfOutput

    public function testPdfOutput()
    {
        // create new PDF document
        $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
        // set document information
        $pdf->SetCreator(PDF_CREATOR);
        $pdf->SetAuthor('Nicola Asuni');
        $pdf->SetTitle('TCPDF Example 023');
        $pdf->SetSubject('TCPDF Tutorial');
        $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
        // set default header data
        $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 023', PDF_HEADER_STRING);
        // set header and footer fonts
        $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
        $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
        // set default monospaced font
        $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
        // set margins
        $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
        $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
        $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
        // set auto page breaks
        $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
        // set image scale factor
        $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
        // set some language-dependent strings (optional)
        $pdf->setLanguageArray($this->langSettings);
        // ---------------------------------------------------------
        // set font
        $pdf->SetFont('times', 'BI', 14);
        // Start First Page Group
        $pdf->startPageGroup();
        // add a page
        $pdf->AddPage();
        // set some text to print
        $txt = <<<EOD
Example of page groups.
Check the page numbers on the page footer.

This is the first page of group 1.
EOD;
        // print a block of text using Write()
        $pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0);
        // add second page
        $pdf->AddPage();
        $pdf->Cell(0, 10, 'This is the second page of group 1', 0, 1, 'L');
        // Start Second Page Group
        $pdf->startPageGroup();
        // add some pages
        $pdf->AddPage();
        $pdf->Cell(0, 10, 'This is the first page of group 2', 0, 1, 'L');
        $pdf->AddPage();
        $pdf->Cell(0, 10, 'This is the second page of group 2', 0, 1, 'L');
        $pdf->AddPage();
        $pdf->Cell(0, 10, 'This is the third page of group 2', 0, 1, 'L');
        $pdf->AddPage();
        $pdf->Cell(0, 10, 'This is the fourth page of group 2', 0, 1, 'L');
        $this->comparePdfs($pdf);
    }
開發者ID:fooman,項目名稱:tcpdf,代碼行數:59,代碼來源:Example023Test.php


注:本文中的TCPDF::setImageScale方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。