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_022.php
149 lines
| 1 | <?php |
| 2 | //============================================================+ |
| 3 | // File name : example_022.php |
| 4 | // Begin : 2008-03-04 |
| 5 | // Last Update : 2013-05-14 |
| 6 | // |
| 7 | // Description : Example 022 for TCPDF class |
| 8 | // CMYK colors |
| 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: CMYK colors. |
| 23 | * @author Nicola Asuni |
| 24 | * @since 2008-03-04 |
| 25 | * @group color |
| 26 | * @group pdf |
| 27 | */ |
| 28 | |
| 29 | // Include the main TCPDF library (search for installation path). |
| 30 | require_once('tcpdf_include.php'); |
| 31 | |
| 32 | // create new PDF document |
| 33 | $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); |
| 34 | |
| 35 | // set document information |
| 36 | $pdf->setCreator(PDF_CREATOR); |
| 37 | $pdf->setAuthor('Nicola Asuni'); |
| 38 | $pdf->setTitle('TCPDF Example 022'); |
| 39 | $pdf->setSubject('TCPDF Tutorial'); |
| 40 | $pdf->setKeywords('TCPDF, PDF, example, test, guide'); |
| 41 | |
| 42 | // set default header data |
| 43 | $pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 022', PDF_HEADER_STRING); |
| 44 | |
| 45 | // set header and footer fonts |
| 46 | $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); |
| 47 | $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); |
| 48 | |
| 49 | // set default monospaced font |
| 50 | $pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); |
| 51 | |
| 52 | // set margins |
| 53 | $pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); |
| 54 | $pdf->setHeaderMargin(PDF_MARGIN_HEADER); |
| 55 | $pdf->setFooterMargin(PDF_MARGIN_FOOTER); |
| 56 | |
| 57 | // set auto page breaks |
| 58 | $pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); |
| 59 | |
| 60 | // set image scale factor |
| 61 | $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); |
| 62 | |
| 63 | // set some language-dependent strings (optional) |
| 64 | if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { |
| 65 | require_once(dirname(__FILE__).'/lang/eng.php'); |
| 66 | $pdf->setLanguageArray($l); |
| 67 | } |
| 68 | |
| 69 | // --------------------------------------------------------- |
| 70 | |
| 71 | // check also the following methods: |
| 72 | // setDrawColorArray() |
| 73 | // setFillColorArray() |
| 74 | // setTextColorArray() |
| 75 | |
| 76 | // set font |
| 77 | $pdf->setFont('helvetica', 'B', 18); |
| 78 | |
| 79 | // add a page |
| 80 | $pdf->AddPage(); |
| 81 | |
| 82 | $pdf->Write(0, 'Example of CMYK, RGB and Grayscale colours', '', 0, 'L', true, 0, false, false, 0); |
| 83 | |
| 84 | // define style for border |
| 85 | $border_style = array('all' => array('width' => 2, 'cap' => 'square', 'join' => 'miter', 'dash' => 0, 'phase' => 0)); |
| 86 | |
| 87 | // --- CMYK ------------------------------------------------ |
| 88 | |
| 89 | $pdf->setDrawColor(50, 0, 0, 0); |
| 90 | $pdf->setFillColor(100, 0, 0, 0); |
| 91 | $pdf->setTextColor(100, 0, 0, 0); |
| 92 | $pdf->Rect(30, 60, 30, 30, 'DF', $border_style); |
| 93 | $pdf->Text(30, 92, 'Cyan'); |
| 94 | |
| 95 | $pdf->setDrawColor(0, 50, 0, 0); |
| 96 | $pdf->setFillColor(0, 100, 0, 0); |
| 97 | $pdf->setTextColor(0, 100, 0, 0); |
| 98 | $pdf->Rect(70, 60, 30, 30, 'DF', $border_style); |
| 99 | $pdf->Text(70, 92, 'Magenta'); |
| 100 | |
| 101 | $pdf->setDrawColor(0, 0, 50, 0); |
| 102 | $pdf->setFillColor(0, 0, 100, 0); |
| 103 | $pdf->setTextColor(0, 0, 100, 0); |
| 104 | $pdf->Rect(110, 60, 30, 30, 'DF', $border_style); |
| 105 | $pdf->Text(110, 92, 'Yellow'); |
| 106 | |
| 107 | $pdf->setDrawColor(0, 0, 0, 50); |
| 108 | $pdf->setFillColor(0, 0, 0, 100); |
| 109 | $pdf->setTextColor(0, 0, 0, 100); |
| 110 | $pdf->Rect(150, 60, 30, 30, 'DF', $border_style); |
| 111 | $pdf->Text(150, 92, 'Black'); |
| 112 | |
| 113 | // --- RGB ------------------------------------------------- |
| 114 | |
| 115 | $pdf->setDrawColor(255, 127, 127); |
| 116 | $pdf->setFillColor(255, 0, 0); |
| 117 | $pdf->setTextColor(255, 0, 0); |
| 118 | $pdf->Rect(30, 110, 30, 30, 'DF', $border_style); |
| 119 | $pdf->Text(30, 142, 'Red'); |
| 120 | |
| 121 | $pdf->setDrawColor(127, 255, 127); |
| 122 | $pdf->setFillColor(0, 255, 0); |
| 123 | $pdf->setTextColor(0, 255, 0); |
| 124 | $pdf->Rect(70, 110, 30, 30, 'DF', $border_style); |
| 125 | $pdf->Text(70, 142, 'Green'); |
| 126 | |
| 127 | $pdf->setDrawColor(127, 127, 255); |
| 128 | $pdf->setFillColor(0, 0, 255); |
| 129 | $pdf->setTextColor(0, 0, 255); |
| 130 | $pdf->Rect(110, 110, 30, 30, 'DF', $border_style); |
| 131 | $pdf->Text(110, 142, 'Blue'); |
| 132 | |
| 133 | // --- GRAY ------------------------------------------------ |
| 134 | |
| 135 | $pdf->setDrawColor(191); |
| 136 | $pdf->setFillColor(127); |
| 137 | $pdf->setTextColor(127); |
| 138 | $pdf->Rect(30, 160, 30, 30, 'DF', $border_style); |
| 139 | $pdf->Text(30, 192, 'Gray'); |
| 140 | |
| 141 | // --------------------------------------------------------- |
| 142 | |
| 143 | //Close and output PDF document |
| 144 | $pdf->Output('example_022.pdf', 'I'); |
| 145 | |
| 146 | //============================================================+ |
| 147 | // END OF FILE |
| 148 | //============================================================+ |
| 149 |