1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
require_once('tcpdf_include.php');
|
29 |
|
|
|
30 |
|
|
|
31 |
|
|
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
|
32 |
|
|
|
33 |
|
|
|
34 |
|
|
$pdf->SetCreator(PDF_CREATOR);
|
35 |
|
|
$pdf->SetAuthor('Nicola Asuni');
|
36 |
|
|
$pdf->SetTitle('TCPDF Example 030');
|
37 |
|
|
$pdf->SetSubject('TCPDF Tutorial');
|
38 |
|
|
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
|
39 |
|
|
|
40 |
|
|
|
41 |
|
|
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 030', PDF_HEADER_STRING);
|
42 |
|
|
|
43 |
|
|
|
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 |
|
|
|
48 |
|
|
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
|
49 |
|
|
|
50 |
|
|
|
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 |
|
|
|
56 |
|
|
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
|
57 |
|
|
|
58 |
|
|
|
59 |
|
|
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
|
60 |
|
|
|
61 |
|
|
|
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 |
|
|
|
70 |
|
|
$pdf->SetFont('helvetica', 'B', 20);
|
71 |
|
|
|
72 |
|
|
|
73 |
|
|
|
74 |
|
|
|
75 |
|
|
$pdf->AddPage();
|
76 |
|
|
|
77 |
|
|
$pdf->Cell(0, 0, 'TCPDF Gradients', 0, 1, 'C', 0, '', 0, false, 'T', 'M');
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
$red = array(255, 0, 0);
|
81 |
|
|
$blue = array(0, 0, 200);
|
82 |
|
|
$yellow = array(255, 255, 0);
|
83 |
|
|
$green = array(0, 255, 0);
|
84 |
|
|
$white = array(255);
|
85 |
|
|
$black = array(0);
|
86 |
|
|
|
87 |
|
|
|
88 |
|
|
$coords = array(0, 0, 1, 0);
|
89 |
|
|
|
90 |
|
|
|
91 |
|
|
$pdf->LinearGradient(20, 45, 80, 80, $red, $blue, $coords);
|
92 |
|
|
|
93 |
|
|
|
94 |
|
|
$pdf->Text(20, 130, 'LinearGradient()');
|
95 |
|
|
|
96 |
|
|
|
97 |
|
|
$coords = array(0.5, 0.5, 1, 1, 1.2);
|
98 |
|
|
|
99 |
|
|
|
100 |
|
|
$pdf->RadialGradient(110, 45, 80, 80, $white, $black, $coords);
|
101 |
|
|
|
102 |
|
|
|
103 |
|
|
$pdf->Text(110, 130, 'RadialGradient()');
|
104 |
|
|
|
105 |
|
|
|
106 |
|
|
$pdf->CoonsPatchMesh(20, 155, 80, 80, $yellow, $blue, $green, $red);
|
107 |
|
|
|
108 |
|
|
|
109 |
|
|
$pdf->Text(20, 240, 'CoonsPatchMesh()');
|
110 |
|
|
|
111 |
|
|
|
112 |
|
|
$coords = array(
|
113 |
|
|
0.00,0.00, 0.33,0.20,
|
114 |
|
|
0.67,0.00, 1.00,0.00, 0.80,0.33,
|
115 |
|
|
0.80,0.67, 1.00,1.00, 0.67,0.80,
|
116 |
|
|
0.33,1.00, 0.00,1.00, 0.20,0.67,
|
117 |
|
|
0.00,0.33);
|
118 |
|
|
$coords_min = 0;
|
119 |
|
|
$coords_max = 1;
|
120 |
|
|
|
121 |
|
|
|
122 |
|
|
$pdf->CoonsPatchMesh(110, 155, 80, 80, $yellow, $blue, $green, $red, $coords, $coords_min, $coords_max);
|
123 |
|
|
|
124 |
|
|
|
125 |
|
|
$pdf->Text(110, 240, 'CoonsPatchMesh()');
|
126 |
|
|
|
127 |
|
|
|
128 |
|
|
$pdf->AddPage();
|
129 |
|
|
|
130 |
|
|
|
131 |
|
|
$patch_array[0]['f'] = 0;
|
132 |
|
|
$patch_array[0]['points'] = array(
|
133 |
|
|
0.00,0.00, 0.33,0.00,
|
134 |
|
|
0.67,0.00, 1.00,0.00, 1.00,0.33,
|
135 |
|
|
0.8,0.67, 1.00,1.00, 0.67,0.8,
|
136 |
|
|
0.33,1.80, 0.00,1.00, 0.00,0.67,
|
137 |
|
|
0.00,0.33);
|
138 |
|
|
$patch_array[0]['colors'][0] = array('r' => 255, 'g' => 255, 'b' => 0);
|
139 |
|
|
$patch_array[0]['colors'][1] = array('r' => 0, 'g' => 0, 'b' => 255);
|
140 |
|
|
$patch_array[0]['colors'][2] = array('r' => 0, 'g' => 255,'b' => 0);
|
141 |
|
|
$patch_array[0]['colors'][3] = array('r' => 255, 'g' => 0,'b' => 0);
|
142 |
|
|
|
143 |
|
|
|
144 |
|
|
$patch_array[1]['f'] = 2;
|
145 |
|
|
$patch_array[1]['points'] = array(
|
146 |
|
|
0.00,1.33,
|
147 |
|
|
0.00,1.67, 0.00,2.00, 0.33,2.00,
|
148 |
|
|
0.67,2.00, 1.00,2.00, 1.00,1.67,
|
149 |
|
|
1.5,1.33);
|
150 |
|
|
$patch_array[1]['colors'][0]=array('r' => 0, 'g' => 0, 'b' => 0);
|
151 |
|
|
$patch_array[1]['colors'][1]=array('r' => 255, 'g' => 0, 'b' => 255);
|
152 |
|
|
|
153 |
|
|
|
154 |
|
|
$patch_array[2]['f'] = 3;
|
155 |
|
|
$patch_array[2]['points'] = array(
|
156 |
|
|
1.33,0.80,
|
157 |
|
|
1.67,1.50, 2.00,1.00, 2.00,1.33,
|
158 |
|
|
2.00,1.67, 2.00,2.00, 1.67,2.00,
|
159 |
|
|
1.33,2.00);
|
160 |
|
|
$patch_array[2]['colors'][0] = array('r' => 0, 'g' => 255, 'b' => 255);
|
161 |
|
|
$patch_array[2]['colors'][1] = array('r' => 0, 'g' => 0, 'b' => 0);
|
162 |
|
|
|
163 |
|
|
|
164 |
|
|
$patch_array[3]['f'] = 1;
|
165 |
|
|
$patch_array[3]['points'] = array(
|
166 |
|
|
2.00,0.67,
|
167 |
|
|
2.00,0.33, 2.00,0.00, 1.67,0.00,
|
168 |
|
|
1.33,0.00, 1.00,0.00, 1.00,0.33,
|
169 |
|
|
0.8,0.67);
|
170 |
|
|
$patch_array[3]['colors'][0] = array('r' => 0, 'g' => 0, 'b' => 0);
|
171 |
|
|
$patch_array[3]['colors'][1] = array('r' => 0, 'g' => 0, 'b' => 255);
|
172 |
|
|
|
173 |
|
|
$coords_min = 0;
|
174 |
|
|
$coords_max = 2;
|
175 |
|
|
|
176 |
|
|
$pdf->CoonsPatchMesh(10, 45, 190, 200, '', '', '', '', $patch_array, $coords_min, $coords_max);
|
177 |
|
|
|
178 |
|
|
|
179 |
|
|
$pdf->Text(10, 250, 'CoonsPatchMesh()');
|
180 |
|
|
|
181 |
|
|
|
182 |
|
|
|
183 |
|
|
|
184 |
|
|
$pdf->Output('example_030.pdf', 'D');
|
185 |
|
|
|
186 |
|
|
|
187 |
|
|
|
188 |
|
|
|