barcodes
4 years ago
config
5 years ago
data
5 years ago
images
5 years ago
lang
5 years ago
example_001.php
5 years ago
example_002.php
5 years ago
example_003.php
5 years ago
example_004.php
5 years ago
example_005.php
5 years ago
example_006.php
5 years ago
example_007.php
5 years ago
example_008.php
5 years ago
example_009.php
5 years ago
example_010.php
4 years ago
example_011.php
5 years ago
example_012.pdf
5 years ago
example_012.php
5 years ago
example_013.php
5 years ago
example_014.php
5 years ago
example_015.php
5 years ago
example_016.php
5 years ago
example_017.php
5 years ago
example_018.php
5 years ago
example_019.php
5 years ago
example_020.php
5 years ago
example_021.php
5 years ago
example_022.php
5 years ago
example_023.php
5 years ago
example_024.php
5 years ago
example_025.php
5 years ago
example_026.php
5 years ago
example_027.php
5 years ago
example_028.php
5 years ago
example_029.php
5 years ago
example_030.php
5 years ago
example_031.php
5 years ago
example_032.php
5 years ago
example_033.php
5 years ago
example_034.php
5 years ago
example_035.php
5 years ago
example_036.php
5 years ago
example_037.php
5 years ago
example_038.php
5 years ago
example_039.php
5 years ago
example_040.php
5 years ago
example_041.php
5 years ago
example_042.php
5 years ago
example_043.php
5 years ago
example_044.php
5 years ago
example_045.php
5 years ago
example_046.php
5 years ago
example_047.php
5 years ago
example_048.php
5 years ago
example_049.php
5 years ago
example_050.php
5 years ago
example_051.php
5 years ago
example_052.php
5 years ago
example_053.php
5 years ago
example_054.php
5 years ago
example_055.php
5 years ago
example_056.php
5 years ago
example_057.php
5 years ago
example_058.php
5 years ago
example_059.php
5 years ago
example_060.php
5 years ago
example_061.php
5 years ago
example_062.php
5 years ago
example_063.php
5 years ago
example_064.php
5 years ago
example_065.php
5 years ago
example_066.php
4 years ago
index.php
5 years ago
tcpdf_include.php
5 years ago
example_066.php
87 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Example 066 for TCPDF library |
| 5 | * |
| 6 | * @description Creates an example PDF/A-1b document using TCPDF |
| 7 | * @author Nicola Asuni - Tecnick.com LTD <info@tecnick.com> |
| 8 | * @license LGPL-3.0 |
| 9 | */ |
| 10 | |
| 11 | /** |
| 12 | * Creates an example PDF/A-1b document using TCPDF |
| 13 | * |
| 14 | * @abstract TCPDF - Example: PDF/A-1b mode |
| 15 | * @author Nicola Asuni |
| 16 | * @since 2021-03-26 |
| 17 | */ |
| 18 | |
| 19 | // Load the autoloader, move one folder back from examples |
| 20 | require_once __DIR__ . '/../vendor/autoload.php'; |
| 21 | |
| 22 | // create new PDF document |
| 23 | $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false, true); |
| 24 | |
| 25 | // set document information |
| 26 | $pdf->SetCreator(PDF_CREATOR); |
| 27 | $pdf->SetAuthor('Nicola Asuni'); |
| 28 | $pdf->SetTitle('TCPDF Example 066'); |
| 29 | $pdf->SetSubject('TCPDF Tutorial'); |
| 30 | $pdf->SetKeywords('TCPDF, PDF, example, test, guide'); |
| 31 | |
| 32 | // set default header data |
| 33 | $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 066', PDF_HEADER_STRING); |
| 34 | |
| 35 | // set header and footer fonts |
| 36 | $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); |
| 37 | $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); |
| 38 | |
| 39 | // set default monospaced font |
| 40 | $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); |
| 41 | |
| 42 | // set margins |
| 43 | $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); |
| 44 | $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); |
| 45 | $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); |
| 46 | |
| 47 | // set auto page breaks |
| 48 | $pdf->SetAutoPageBreak(true, PDF_MARGIN_BOTTOM); |
| 49 | |
| 50 | // set image scale factor |
| 51 | $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); |
| 52 | |
| 53 | // set some language-dependent strings (optional) |
| 54 | if (@file_exists(__DIR__ . '/lang/eng.php')) { |
| 55 | require_once __DIR__ . '/lang/eng.php'; |
| 56 | |
| 57 | $pdf->setLanguageArray($l); |
| 58 | } |
| 59 | |
| 60 | // --------------------------------------------------------- |
| 61 | |
| 62 | // set default font subsetting mode |
| 63 | $pdf->setFontSubsetting(true); |
| 64 | |
| 65 | // Set font |
| 66 | $pdf->SetFont('helvetica', '', 14, '', true); |
| 67 | |
| 68 | // Add a page |
| 69 | // This method has several options, check the source code documentation for more information. |
| 70 | $pdf->AddPage(); |
| 71 | |
| 72 | // Set some content to print |
| 73 | $html = <<<HTML |
| 74 | <h1>Example of <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> document in <span style="background-color:#99ccff;color:black;"> PDF/A-1b </span> mode.</h1> |
| 75 | <i>This document conforms to the standard <b>PDF/A-1b (ISO 19005-1:2005)</b>.</i> |
| 76 | <p>Please check the source code documentation and other examples for further information (<a href="http://www.tcpdf.org">http://www.tcpdf.org</a>).</p> |
| 77 | HTML; |
| 78 | |
| 79 | // Print text using writeHTMLCell() |
| 80 | $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true); |
| 81 | |
| 82 | // --------------------------------------------------------- |
| 83 | |
| 84 | // Close and output PDF document |
| 85 | // This method has several options, check the source code documentation for more information. |
| 86 | $pdf->Output('example_066.pdf', 'I'); |
| 87 |