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


PHP TCPDF::Write方法代碼示例

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


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

示例1: text

 /**
  * Writes text at the specified x and y coordinates
  *
  * See {@link Style::munge_color()} for the format of the color array.
  *
  * @param float $x
  * @param float $y
  * @param string $text the text to write
  * @param string $font the font file to use
  * @param float $size the font size, in points
  * @param array $color
  * @param float $adjust word spacing adjustment
  */
 function text($x, $y, $text, $font, $size, $color = array(0, 0, 0), $adjust = 0, $angle = 0, $blend = "Normal", $opacity = 1.0)
 {
     dompdf_debug("trace", "({$x}, {$y}, {$text}, " . basename($font) . ", {$size}, [{$color['0']}, {$color['1']}, {$color['2']}], {$adjust}, {$angle}, {$blend}, {$opacity})");
     list($r, $g, $b) = $this->_get_rgb($color);
     $this->_pdf->SetTextColor($r, $g, $b);
     $this->_set_line_transparency($blend, $opacity);
     $this->_set_fill_transparency($blend, $opacity);
     $fontdata = $this->_get_font($font);
     $this->_pdf->SetFont($fontdata['family'], $fontdata['style'], $size, $font);
     //$this->_pdf->SetFontSize($size);
     // ???
     if ($adjust > 0) {
         $a = explode(' ', $text);
         //$this->_pdf->SetXY($x - 3, $y + (self::FONT_HEIGHT_SCALE - 1) * $size);
         $this->_pdf->SetXY($x, $y);
         //$y += self::FONT_HEIGHT_SCALE * $size + 1;
         for ($i = 0; $i < count($a) - 1; $i++) {
             $this->_pdf->Write($size, $a[$i] . ' ', '');
             //$this->_pdf->Text($x, $y, $a[$i].' ');
             $this->_pdf->SetX($this->_pdf->GetX() + $adjust);
             //$x += $this->_pdf->GetX() + $adjust;
         }
         $this->_pdf->Write($size, $a[$i], '');
         //$this->_pdf->Text($x, $y, $a[$i].' ');
     } else {
         if ($angle != 0) {
             $this->_pdf->StartTransform();
             //$y += self::FONT_HEIGHT_SCALE * $size;
             //$y += $size;
             $this->_pdf->Rotate(-$angle, $x, $y);
             $this->_pdf->Text($x, $y, $text, false, false, true, 0, 0, '', 0, '', 0, false, 'T', 'T');
             $this->_pdf->StopTransform();
         } else {
             //$pippo = $this->_pdf->getFontAscent($fontdata['family'], $fontdata['style'], $size);
             //$y += $pippo / 8;
             //$y = $y - 0.85 * $size;	// + 0.8 * $size;
             $this->_pdf->Text($x, $y, $text, false, false, true, 0, 0, '', 0, '', 0, false, 'T', 'T');
         }
     }
 }
開發者ID:Razinsky,項目名稱:echaude-com,代碼行數:53,代碼來源:tcpdf_adapter.cls.php

示例2: 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

示例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 047');
        $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 . ' 047', 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', '', 16);
        // add a page
        $pdf->AddPage();
        $txt = 'Example of Transactions.
TCPDF allows you to undo some operations using the Transactions.
Check the source code for further information.';
        $pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0);
        $pdf->Ln(5);
        $pdf->SetFont('times', '', 12);
        // start transaction
        $pdf->startTransaction();
        $pdf->Write(0, "LINE 1\n");
        $pdf->Write(0, "LINE 2\n");
        // restarts transaction
        $pdf->startTransaction();
        $pdf->Write(0, "LINE 3\n");
        $pdf->Write(0, "LINE 4\n");
        // rolls back to the last (re)start
        $pdf = $pdf->rollbackTransaction();
        $pdf->Write(0, "LINE 5\n");
        $pdf->Write(0, "LINE 6\n");
        // start transaction
        $pdf->startTransaction();
        $pdf->Write(0, "LINE 7\n");
        // commit transaction (actually just frees memory)
        $pdf->commitTransaction();
        $this->comparePdfs($pdf);
    }
開發者ID:fooman,項目名稱:tcpdf,代碼行數:57,代碼來源:Example047Test.php

示例4: prepareDownloadImagePdf

 public function prepareDownloadImagePdf($filename, $newfilename, $firstname, $lastname, $title, $description, $code, $date_end)
 {
     // calculate date
     $currentDate = new DateTime();
     $currentDate->modify('+ ' . $date_end . ' month');
     $date_end = $currentDate->format('Y-m-d');
     $this->load->model('tool/image');
     require_once DIR_SYSTEM . 'library/tcpdf/tcpdf.php';
     $pdf = new TCPDF();
     // disable auto-page-break
     $pdf->SetAutoPageBreak(false, 0);
     // set image 1
     $pdf->AddPage();
     $pdf->Image(DIR_IMAGE . $filename, 0, 0, 210, 297, '', '', '', false, 300, '', false, false, 0);
     $pdf->setPageMark();
     /*if(stripos('.pdf',$newfilename)===false)
       {
           $t = explode('.',$newfilename);
           array_pop($t);
           $newfilename = implode('.',$t).'.pdf';
       }*/
     $pdf->SetFont('times', '', 13);
     $pdf->SetTextColor(50, 50, 50);
     for ($i = 0; $i <= 16; $i++) {
         $pdf->Ln(10);
     }
     $pdf->setCellPaddings(90);
     $pdf->Ln(10);
     $pdf->Write(0, $firstname . ' ' . $lastname);
     $pdf->Ln(10);
     $pdf->Ln(10);
     $pdf->Write(0, $title);
     $pdf->Ln(10);
     $pdf->SetFont('times', '', 11);
     $pdf->Write(0, $description);
     $pdf->setCellPaddings(70);
     $pdf->Ln(10);
     $pdf->Ln(10);
     $pdf->Ln(10);
     $pdf->Ln(10);
     $pdf->Ln(10);
     $pdf->SetFont('times', '', 7);
     $pdf->Write(0, 'Beauty Center Billstedt');
     $pdf->Ln(4);
     $pdf->SetFont('times', 'B', 9);
     $pdf->Write(0, '#' . $code);
     $pdf->Ln(4);
     $pdf->SetFont('times', '', 9);
     $pdf->Write(0, 'Gültig bis:: ' . $date_end);
     $pdf->Output(DIR_IMAGE . $newfilename, 'F');
 }
開發者ID:miechuliv,項目名稱:BeautyCenter,代碼行數:51,代碼來源:download.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 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

示例6: testPdfOutput

    public function testPdfOutput()
    {
        $this->markTestIncomplete("Missing system fonts");
        // 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 038');
        $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 . ' 038', 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();
        $txt = 'Example of CID-0 CJK unembedded font.
To display extended text you must have CJK fonts installed for your PDF reader:';
        $pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0);
        // set font
        $pdf->SetFont('cid0jp', '', 40);
        $txt = 'こんにちは世界';
        $pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0);
        $this->comparePdfs($pdf);
    }
開發者ID:fooman,項目名稱:tcpdf,代碼行數:42,代碼來源:Example038Test.php

示例7: 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 035');
     $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 . ' 035', 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', 16);
     // add a page
     $pdf->AddPage();
     $pdf->Write(0, 'Example of SetLineStyle() method', '', 0, 'L', true, 0, false, false, 0);
     $pdf->Ln();
     $pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 4, 'color' => array(255, 0, 0)));
     $pdf->SetFillColor(255, 255, 128);
     $pdf->SetTextColor(0, 0, 128);
     $text = "DUMMY";
     $pdf->Cell(0, 0, $text, 1, 1, 'L', 1, 0);
     $pdf->Ln();
     $pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 255)));
     $pdf->SetFillColor(255, 255, 0);
     $pdf->SetTextColor(0, 0, 255);
     $pdf->MultiCell(60, 4, $text, 1, 'C', 1, 0);
     $pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 255, 0)));
     $pdf->SetFillColor(0, 0, 255);
     $pdf->SetTextColor(255, 255, 0);
     $pdf->MultiCell(60, 4, $text, 'TB', 'C', 1, 0);
     $pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 255)));
     $pdf->SetFillColor(0, 255, 0);
     $pdf->SetTextColor(255, 0, 255);
     $pdf->MultiCell(60, 4, $text, 1, 'C', 1, 1);
     $this->comparePdfs($pdf);
 }
開發者ID:fooman,項目名稱:tcpdf,代碼行數:54,代碼來源:Example035Test.php

示例8: getPdfData

 private function getPdfData()
 {
     $pdf = new \TCPDF();
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     $pdf->SetFont('times', 'BI', 12);
     $pdf->AddPage();
     $pdf->Write(0, 'Fichier pdf', '', 0, 'C', true, 0, false, false, 0);
     return $pdf->Output('fichier.pdf', 'S');
 }
開發者ID:famfij,項目名稱:TP-BilletsDuLouvre,代碼行數:11,代碼來源:TicketsSenderTest.php

示例9: 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 029');
     $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 . ' 029', 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 array for viewer preferences
     $preferences = array('HideToolbar' => true, 'HideMenubar' => true, 'HideWindowUI' => true, 'FitWindow' => true, 'CenterWindow' => true, 'DisplayDocTitle' => true, 'NonFullScreenPageMode' => 'UseNone', 'ViewArea' => 'CropBox', 'ViewClip' => 'CropBox', 'PrintArea' => 'CropBox', 'PrintClip' => 'CropBox', 'PrintScaling' => 'AppDefault', 'Duplex' => 'DuplexFlipLongEdge', 'PickTrayByPDFSize' => true, 'PrintPageRange' => array(1, 1, 2, 3), 'NumCopies' => 2);
     // Check the example n. 60 for advanced page settings
     // set pdf viewer preferences
     $pdf->setViewerPreferences($preferences);
     // set font
     $pdf->SetFont('times', '', 14);
     // add a page
     $pdf->AddPage();
     // print a line
     $pdf->Cell(0, 12, 'DISPLAY PREFERENCES - PAGE 1', 1, 1, 'C');
     $pdf->Ln(5);
     $pdf->Write(0, 'You can use the setViewerPreferences() method to change viewer preferences.', '', 0, 'L', true, 0, false, false, 0);
     // add a page
     $pdf->AddPage();
     // print a line
     $pdf->Cell(0, 12, 'DISPLAY PREFERENCES - PAGE 2', 0, 0, 'C');
     // add a page
     $pdf->AddPage();
     // print a line
     $pdf->Cell(0, 12, 'DISPLAY PREFERENCES - PAGE 3', 0, 0, 'C');
     $this->comparePdfs($pdf);
 }
開發者ID:fooman,項目名稱:tcpdf,代碼行數:51,代碼來源:Example029Test.php

示例10: 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 031');
     $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 . ' 031', 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', 'B', 20);
     // add a page
     $pdf->AddPage();
     $pdf->Write(0, 'Example of PieSector() method.');
     $xc = 105;
     $yc = 100;
     $r = 50;
     $pdf->SetFillColor(0, 0, 255);
     $pdf->PieSector($xc, $yc, $r, 20, 120, 'FD', false, 0, 2);
     $pdf->SetFillColor(0, 255, 0);
     $pdf->PieSector($xc, $yc, $r, 120, 250, 'FD', false, 0, 2);
     $pdf->SetFillColor(255, 0, 0);
     $pdf->PieSector($xc, $yc, $r, 250, 20, 'FD', false, 0, 2);
     // write labels
     $pdf->SetTextColor(255, 255, 255);
     $pdf->Text(105, 65, 'BLUE');
     $pdf->Text(60, 95, 'GREEN');
     $pdf->Text(120, 115, 'RED');
     $this->comparePdfs($pdf);
 }
開發者ID:fooman,項目名稱:tcpdf,代碼行數:49,代碼來源:Example031Test.php

示例11: 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 033');
     $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 . ' 033', 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);
     // ---------------------------------------------------------
     // add a page
     $pdf->AddPage();
     // set default font subsetting mode
     $pdf->setFontSubsetting(false);
     $pdf->SetFont('helvetica', 'B', 20);
     $pdf->Write(0, 'Font Types', '', 0, 'C', 1, 0, false, false, 0);
     $pdf->Ln(10);
     $pdf->SetFont('times', '', 10);
     $pdf->MultiCell(80, 0, "[Core font] : Cras eros leo, porttitor porta, accumsan fermentum, ornare ac, est. Praesent dui lorem, imperdiet at, cursus sed, facilisis aliquam, nibh. Nulla accumsan nonummy diam. Donec tempus. Etiam posuere. Proin lectus. Donec purus. Duis in sem pretium urna feugiat vehicula. Ut suscipit velit eget massa. Nam nonummy, enim commodo euismod placerat, tortor elit tempus lectus, quis suscipit metus lorem blandit turpis.\n", 1, 'J', 0, 1, '', '', true, 0);
     $pdf->Ln(2);
     $pdf->SetFont('dejavusans', '', 10);
     $pdf->MultiCell(80, 0, "[True Type Unicode font] : Cras eros leo, porttitor porta, accumsan fermentum, ornare ac, est. Praesent dui lorem, imperdiet at, cursus sed, facilisis aliquam, nibh. Nulla accumsan nonummy diam. Donec tempus. Etiam posuere. Proin lectus. Donec purus. Duis in sem pretium urna feugiat vehicula. Ut suscipit velit eget massa. Nam nonummy, enim commodo euismod placerat, tortor elit tempus lectus, quis suscipit metus lorem blandit turpis.\n", 1, 'J', 0, 1, '', '', true, 0);
     $pdf->Ln(2);
     $pdf->SetFont('cid0jp', '', 9);
     $pdf->MultiCell(80, 0, "[CID-0 font] : Cras eros leo, porttitor porta, accumsan fermentum, ornare ac, est. Praesent dui lorem, imperdiet at, cursus sed, facilisis aliquam, nibh. Nulla accumsan nonummy diam. Donec tempus. Etiam posuere. Proin lectus. Donec purus. Duis in sem pretium urna feugiat vehicula. Ut suscipit velit eget massa. Nam nonummy, enim commodo euismod placerat, tortor elit tempus lectus, quis suscipit metus lorem blandit turpis.\n", 1, 'J', 0, 1, '', '', true, 0);
     $this->comparePdfs($pdf);
 }
開發者ID:fooman,項目名稱:tcpdf,代碼行數:45,代碼來源:Example033Test.php

示例12: 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 058');
     $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 . ' 058', 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', '', 10);
     // add a page
     $pdf->AddPage();
     // NOTE: Uncomment the following line to rasterize SVG image using the ImageMagick library.
     //$pdf->setRasterizeVectorImages(true);
     $pdf->ImageSVG($file = 'tests/images/testsvg.svg', $x = 15, $y = 30, $w = '', $h = '', $link = 'http://www.tcpdf.org', $align = '', $palign = '', $border = 1, $fitonpage = false);
     $pdf->ImageSVG($file = 'tests/images/tux.svg', $x = 30, $y = 100, $w = '', $h = 100, $link = '', $align = '', $palign = '', $border = 0, $fitonpage = false);
     $pdf->SetFont('helvetica', '', 8);
     $pdf->SetY(195);
     $txt = '© The copyright holder of the above Tux image is Larry Ewing, allows anyone to use it for any purpose, provided that the copyright holder is properly attributed. Redistribution, derivative work, commercial use, and all other use is permitted.';
     $pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0);
     // ---------------------------------------------------------
     $this->comparePdfs($pdf);
 }
開發者ID:fooman,項目名稱:tcpdf,代碼行數:43,代碼來源:Example058Test.php

示例13: 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 034');
     $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 . ' 034', 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', 'B', 20);
     // add a page
     $pdf->AddPage();
     $pdf->Write(0, 'Image Clipping using geometric functions', '', 0, 'C', 1, 0, false, false, 0);
     //Start Graphic Transformation
     $pdf->StartTransform();
     // set clipping mask
     $pdf->StarPolygon(105, 100, 30, 10, 3, 0, 1, 'CNZ');
     // draw jpeg image to be clipped
     $pdf->Image('tests/images/image_demo.jpg', 75, 70, 60, 60, '', 'http://www.tcpdf.org', '', true, 72);
     //Stop Graphic Transformation
     $pdf->StopTransform();
     $this->comparePdfs($pdf);
 }
開發者ID:fooman,項目名稱:tcpdf,代碼行數:43,代碼來源:Example034Test.php

示例14: 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 036');
        $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 . ' 036', 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', '', 16);
        // add a page
        $pdf->AddPage();
        $txt = 'Example of Text Annotation.
Move your mouse over the yellow box or double click on it to display the annotation text.';
        $pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0);
        // text annotation
        $pdf->Annotation(83, 27, 10, 10, "Text annotation example\naccented letters test: à èéìòù", array('Subtype' => 'Text', 'Name' => 'Comment', 'T' => 'title example', 'Subj' => 'example', 'C' => array(255, 255, 0)));
        $this->comparePdfs($pdf);
    }
開發者ID:fooman,項目名稱:tcpdf,代碼行數:39,代碼來源:Example036Test.php

示例15: print_pdf

function print_pdf($pdf_filename, $pdf_body)
{
    // Include the main TCPDF library (search for installation path).
    require_once ABSPATH . 'lib/tcpdf/tcpdf.php';
    // 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('Περιφέρεια Δυτικής Μακεδονίας');
    $pdf->SetTitle('Περιφέρεια Δυτικής Μακεδονίας');
    $pdf->SetSubject('Περιφέρεια Δυτικής Μακεδονίας');
    $pdf->SetKeywords('Περιφέρεια Δυτικής Μακεδονίας');
    // set default header data
    $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, 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 default font subsetting mode
    $pdf->setFontSubsetting(true);
    // set font
    $pdf->SetFont('freeserif', '', 11);
    // add a page el
    $pdf->AddPage();
    $pdf->Write(0, '', '', 0, 'L', true, 0, false, false, 0);
    $pdf->writeHTML($pdf_body, true, false, false, false, '');
    //Close and output PDF document
    $pdf->Output($pdf_filename, 'F');
}
開發者ID:eellak,項目名稱:opengov_adeies,代碼行數:39,代碼來源:print.php


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