barcodes
2 years ago
config
1 year ago
data
5 years ago
images
2 years ago
lang
5 years ago
example_001.php
2 years ago
example_002.php
2 years ago
example_003.php
2 years ago
example_004.php
2 years ago
example_005.php
2 years ago
example_006.php
2 years ago
example_007.php
2 years ago
example_008.php
2 years ago
example_009.php
2 years ago
example_010.php
2 years ago
example_011.php
2 years ago
example_012.pdf
5 years ago
example_012.php
2 years ago
example_013.php
2 years ago
example_014.php
2 years ago
example_015.php
2 years ago
example_016.php
2 years ago
example_017.php
2 years ago
example_018.php
2 years ago
example_019.php
2 years ago
example_020.php
2 years ago
example_021.php
2 years ago
example_022.php
2 years ago
example_023.php
2 years ago
example_024.php
2 years ago
example_025.php
2 years ago
example_026.php
2 years ago
example_027.php
2 years ago
example_028.php
2 years ago
example_029.php
2 years ago
example_030.php
2 years ago
example_031.php
2 years ago
example_032.php
2 years ago
example_033.php
2 years ago
example_034.php
2 years ago
example_035.php
2 years ago
example_036.php
2 years ago
example_037.php
2 years ago
example_038.php
2 years ago
example_039.php
2 years ago
example_040.php
2 years ago
example_041.php
2 years ago
example_042.php
2 years ago
example_043.php
2 years ago
example_044.php
2 years ago
example_045.php
2 years ago
example_046.php
2 years ago
example_047.php
2 years ago
example_048.php
2 years ago
example_049.php
1 year ago
example_050.php
2 years ago
example_051.php
2 years ago
example_052.php
2 years ago
example_053.php
2 years ago
example_054.php
2 years ago
example_055.php
2 years ago
example_056.php
2 years ago
example_057.php
2 years ago
example_058.php
2 years ago
example_059.php
2 years ago
example_060.php
2 years ago
example_061.php
2 years ago
example_062.php
2 years ago
example_063.php
2 years ago
example_064.php
2 years ago
example_065.php
2 years ago
example_066.php
1 year ago
example_067.php
2 years ago
index.php
2 years ago
tcpdf_include.php
2 years ago
example_001.php
111 lines
| 1 | <?php |
| 2 | //============================================================+ |
| 3 | // File name : example_001.php |
| 4 | // Begin : 2008-03-04 |
| 5 | // Last Update : 2013-05-14 |
| 6 | // |
| 7 | // Description : Example 001 for TCPDF class |
| 8 | // Default Header and Footer |
| 9 | // |
| 10 | // Author: Nicola Asuni |
| 11 | // |
| 12 | // (c) Copyright: |
| 13 | // Nicola Asuni |
| 14 | // Tecnick.com LTD |
| 15 | // www.tecnick.com |
| 16 | // info@tecnick.com |
| 17 | //============================================================+ |
| 18 | |
| 19 | /** |
| 20 | * Creates an example PDF TEST document using TCPDF |
| 21 | * @package com.tecnick.tcpdf |
| 22 | * @abstract TCPDF - Example: Default Header and Footer |
| 23 | * @author Nicola Asuni |
| 24 | * @since 2008-03-04 |
| 25 | * @group header |
| 26 | * @group footer |
| 27 | * @group page |
| 28 | * @group pdf |
| 29 | */ |
| 30 | |
| 31 | // Include the main TCPDF library (search for installation path). |
| 32 | require_once('tcpdf_include.php'); |
| 33 | |
| 34 | // create new PDF document |
| 35 | $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); |
| 36 | |
| 37 | // set document information |
| 38 | $pdf->setCreator(PDF_CREATOR); |
| 39 | $pdf->setAuthor('Nicola Asuni'); |
| 40 | $pdf->setTitle('TCPDF Example 001'); |
| 41 | $pdf->setSubject('TCPDF Tutorial'); |
| 42 | $pdf->setKeywords('TCPDF, PDF, example, test, guide'); |
| 43 | |
| 44 | // set default header data |
| 45 | $pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 001', PDF_HEADER_STRING, array(0,64,255), array(0,64,128)); |
| 46 | $pdf->setFooterData(array(0,64,0), array(0,64,128)); |
| 47 | |
| 48 | // set header and footer fonts |
| 49 | $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); |
| 50 | $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); |
| 51 | |
| 52 | // set default monospaced font |
| 53 | $pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); |
| 54 | |
| 55 | // set margins |
| 56 | $pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); |
| 57 | $pdf->setHeaderMargin(PDF_MARGIN_HEADER); |
| 58 | $pdf->setFooterMargin(PDF_MARGIN_FOOTER); |
| 59 | |
| 60 | // set auto page breaks |
| 61 | $pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); |
| 62 | |
| 63 | // set image scale factor |
| 64 | $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); |
| 65 | |
| 66 | // set some language-dependent strings (optional) |
| 67 | if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { |
| 68 | require_once(dirname(__FILE__).'/lang/eng.php'); |
| 69 | $pdf->setLanguageArray($l); |
| 70 | } |
| 71 | |
| 72 | // --------------------------------------------------------- |
| 73 | |
| 74 | // set default font subsetting mode |
| 75 | $pdf->setFontSubsetting(true); |
| 76 | |
| 77 | // Set font |
| 78 | // dejavusans is a UTF-8 Unicode font, if you only need to |
| 79 | // print standard ASCII chars, you can use core fonts like |
| 80 | // helvetica or times to reduce file size. |
| 81 | $pdf->setFont('dejavusans', '', 14, '', true); |
| 82 | |
| 83 | // Add a page |
| 84 | // This method has several options, check the source code documentation for more information. |
| 85 | $pdf->AddPage(); |
| 86 | |
| 87 | // set text shadow effect |
| 88 | $pdf->setTextShadow(array('enabled'=>true, 'depth_w'=>0.2, 'depth_h'=>0.2, 'color'=>array(196,196,196), 'opacity'=>1, 'blend_mode'=>'Normal')); |
| 89 | |
| 90 | // Set some content to print |
| 91 | $html = <<<EOD |
| 92 | <h1>Welcome to <a href="http://www.tcpdf.org" style="text-decoration:none;background-color:#CC0000;color:black;"> <span style="color:black;">TC</span><span style="color:white;">PDF</span> </a>!</h1> |
| 93 | <i>This is the first example of TCPDF library.</i> |
| 94 | <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> |
| 95 | <p>Please check the source code documentation and other examples for further information.</p> |
| 96 | <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> |
| 97 | EOD; |
| 98 | |
| 99 | // Print text using writeHTMLCell() |
| 100 | $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true); |
| 101 | |
| 102 | // --------------------------------------------------------- |
| 103 | |
| 104 | // Close and output PDF document |
| 105 | // This method has several options, check the source code documentation for more information. |
| 106 | $pdf->Output('example_001.pdf', 'I'); |
| 107 | |
| 108 | //============================================================+ |
| 109 | // END OF FILE |
| 110 | //============================================================+ |
| 111 |