[347] | 1 | <?php
|
---|
| 2 | //============================================================+
|
---|
| 3 | // File name : example_056.php
|
---|
| 4 | // Begin : 2010-03-26
|
---|
| 5 | // Last Update : 2013-09-30
|
---|
| 6 | //
|
---|
| 7 | // Description : Example 056 for TCPDF class
|
---|
| 8 | // Crop marks and color registration bars
|
---|
| 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: Crop marks and color registration bars
|
---|
| 23 | * @author Nicola Asuni
|
---|
| 24 | * @since 2010-03-26
|
---|
| 25 | */
|
---|
| 26 |
|
---|
| 27 | // Include the main TCPDF library (search for installation path).
|
---|
| 28 | require_once('tcpdf_include.php');
|
---|
| 29 |
|
---|
| 30 | // create new PDF document
|
---|
| 31 | $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
|
---|
| 32 |
|
---|
| 33 | // set document information
|
---|
| 34 | $pdf->SetCreator(PDF_CREATOR);
|
---|
| 35 | $pdf->SetAuthor('Nicola Asuni');
|
---|
| 36 | $pdf->SetTitle('TCPDF Example 056');
|
---|
| 37 | $pdf->SetSubject('TCPDF Tutorial');
|
---|
| 38 | $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
|
---|
| 39 |
|
---|
| 40 | // set default header data
|
---|
| 41 | $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 056', PDF_HEADER_STRING);
|
---|
| 42 |
|
---|
| 43 | // set header and footer fonts
|
---|
| 44 | $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
|
---|
| 45 | $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
|
---|
| 46 |
|
---|
| 47 | // set default monospaced font
|
---|
| 48 | $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
|
---|
| 49 |
|
---|
| 50 | // set margins
|
---|
| 51 | $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
|
---|
| 52 | $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
|
---|
| 53 | $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
|
---|
| 54 |
|
---|
| 55 | // set auto page breaks
|
---|
| 56 | $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
|
---|
| 57 |
|
---|
| 58 | // set image scale factor
|
---|
| 59 | $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
|
---|
| 60 |
|
---|
| 61 | // set some language-dependent strings (optional)
|
---|
| 62 | if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
|
---|
| 63 | require_once(dirname(__FILE__).'/lang/eng.php');
|
---|
| 64 | $pdf->setLanguageArray($l);
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 | // ---------------------------------------------------------
|
---|
| 68 |
|
---|
| 69 | // set font
|
---|
| 70 | $pdf->SetFont('helvetica', '', 18);
|
---|
| 71 |
|
---|
| 72 | // add a page
|
---|
| 73 | $pdf->AddPage();
|
---|
| 74 |
|
---|
| 75 | $pdf->Write(0, 'Example of Registration Marks, Crop Marks and Color Bars', '', 0, 'L', true, 0, false, false, 0);
|
---|
| 76 |
|
---|
| 77 | $pdf->Ln(5);
|
---|
| 78 |
|
---|
| 79 | // color registration bars
|
---|
| 80 |
|
---|
| 81 | // A,W,R,G,B,C,M,Y,K,RGB,CMYK,ALL,ALLSPOT,<SPOT_COLOR_NAME>
|
---|
| 82 | $pdf->colorRegistrationBar(50, 70, 40, 40, true, false, 'A,R,G,B,C,M,Y,K');
|
---|
| 83 | $pdf->colorRegistrationBar(90, 70, 40, 40, true, true, 'A,R,G,B,C,M,Y,K');
|
---|
| 84 | $pdf->colorRegistrationBar(50, 115, 80, 5, false, true, 'A,W,R,G,B,C,M,Y,K,ALL');
|
---|
| 85 | $pdf->colorRegistrationBar(135, 70, 5, 50, false, false, 'A,W,R,G,B,C,M,Y,K,ALL');
|
---|
| 86 |
|
---|
| 87 | // corner crop marks
|
---|
| 88 |
|
---|
| 89 | $pdf->cropMark(50, 70, 10, 10, 'TL');
|
---|
| 90 | $pdf->cropMark(140, 70, 10, 10, 'TR');
|
---|
| 91 | $pdf->cropMark(50, 120, 10, 10, 'BL');
|
---|
| 92 | $pdf->cropMark(140, 120, 10, 10, 'BR');
|
---|
| 93 |
|
---|
| 94 | // various crop marks
|
---|
| 95 |
|
---|
| 96 | $pdf->cropMark(95, 65, 5, 5, 'LEFT,TOP,RIGHT', array(255,0,0));
|
---|
| 97 | $pdf->cropMark(95, 125, 5, 5, 'LEFT,BOTTOM,RIGHT', array(255,0,0));
|
---|
| 98 |
|
---|
| 99 | $pdf->cropMark(45, 95, 5, 5, 'TL,BL', array(0,255,0));
|
---|
| 100 | $pdf->cropMark(145, 95, 5, 5, 'TR,BR', array(0,255,0));
|
---|
| 101 |
|
---|
| 102 | $pdf->cropMark(95, 140, 5, 5, 'A,D', array(0,0,255));
|
---|
| 103 |
|
---|
| 104 | // registration marks
|
---|
| 105 |
|
---|
| 106 | $pdf->registrationMark(40, 60, 5, false);
|
---|
| 107 | $pdf->registrationMark(150, 60, 5, true, array(0,0,0), array(255,255,0));
|
---|
| 108 | $pdf->registrationMark(40, 130, 5, true, array(0,0,0), array(255,255,0));
|
---|
| 109 | $pdf->registrationMark(150, 130, 5, false, array(100,100,100,100,'All'), array(0,0,0,0,'None'));
|
---|
| 110 |
|
---|
| 111 | // test registration bar with spot colors
|
---|
| 112 |
|
---|
| 113 | $pdf->AddSpotColor('My TCPDF Dark Green', 100, 50, 80, 45);
|
---|
| 114 | $pdf->AddSpotColor('My TCPDF Light Yellow', 0, 0, 55, 0);
|
---|
| 115 | $pdf->AddSpotColor('My TCPDF Black', 0, 0, 0, 100);
|
---|
| 116 | $pdf->AddSpotColor('My TCPDF Red', 30, 100, 90, 10);
|
---|
| 117 | $pdf->AddSpotColor('My TCPDF Green', 100, 30, 100, 0);
|
---|
| 118 | $pdf->AddSpotColor('My TCPDF Blue', 100, 60, 10, 5);
|
---|
| 119 | $pdf->AddSpotColor('My TCPDF Yellow', 0, 20, 100, 0);
|
---|
| 120 |
|
---|
| 121 | $pdf->colorRegistrationBar(50, 150, 80, 10, false, true, 'ALLSPOT');
|
---|
| 122 |
|
---|
| 123 | // CMYK registration mark
|
---|
| 124 | $pdf->registrationMarkCMYK(150, 155, 8);
|
---|
| 125 |
|
---|
| 126 | // ---------------------------------------------------------
|
---|
| 127 |
|
---|
| 128 | //Close and output PDF document
|
---|
| 129 | $pdf->Output('example_056.pdf', 'I');
|
---|
| 130 |
|
---|
| 131 | //============================================================+
|
---|
| 132 | // END OF FILE
|
---|
| 133 | //============================================================+
|
---|