Commit 399ad60d94fbc96309da70e52d4f7a220e43c0c6
1 parent
1ffb74cc
Exists in
master
Refactoring para Coding Standards
Showing
1 changed file
with
576 additions
and
557 deletions
Show diff stats
ieducar/intranet/include/clsPDF.inc.php
1 | 1 | <?php |
2 | -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | |
3 | -* * | |
4 | -* @author Prefeitura Municipal de Itajaí * | |
5 | -* @updated 29/03/2007 * | |
6 | -* Pacote: i-PLB Software Público Livre e Brasileiro * | |
7 | -* * | |
8 | -* Copyright (C) 2006 PMI - Prefeitura Municipal de Itajaí * | |
9 | -* ctima@itajai.sc.gov.br * | |
10 | -* * | |
11 | -* Este programa é software livre, você pode redistribuí-lo e/ou * | |
12 | -* modificá-lo sob os termos da Licença Pública Geral GNU, conforme * | |
13 | -* publicada pela Free Software Foundation, tanto a versão 2 da * | |
14 | -* Licença como (a seu critério) qualquer versão mais nova. * | |
15 | -* * | |
16 | -* Este programa é distribuído na expectativa de ser útil, mas SEM * | |
17 | -* QUALQUER GARANTIA. Sem mesmo a garantia implícita de COMERCIALI- * | |
18 | -* ZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Con- * | |
19 | -* sulte a Licença Pública Geral GNU para obter mais detalhes. * | |
20 | -* * | |
21 | -* Você deve ter recebido uma cópia da Licença Pública Geral GNU * | |
22 | -* junto com este programa. Se não, escreva para a Free Software * | |
23 | -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * | |
24 | -* 02111-1307, USA. * | |
25 | -* * | |
26 | -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | |
2 | + | |
3 | + | |
27 | 4 | |
28 | 5 | class clsPDF |
29 | 6 | { |
30 | 7 | |
31 | - var $nome, | |
32 | - $titulo, | |
33 | - $palavrasChaves, | |
34 | - $largura, | |
35 | - $altura, | |
36 | - $numeroPagina, | |
37 | - $renderCapa, | |
38 | - $pagOpened=false; | |
39 | - | |
40 | - var $caminho, | |
41 | - $linkArquivo, | |
42 | - $depurar, | |
43 | - $pdf; | |
44 | - | |
45 | - var $topmargin, | |
46 | - $bottommargirn, | |
47 | - $leftmargin, | |
48 | - $rigthmargin; | |
49 | - | |
50 | - var $listagem, | |
51 | - $detalhe; | |
52 | - | |
53 | - var $owner = "PMI - Prefeitura Municipal de Itajaí"; | |
54 | - | |
55 | - function clsPDF($nome, $titulo, $tamanhoFolha, $palavrasChaves, $depurar=false, $reder=true) | |
56 | - { | |
57 | - $this->nome = $nome; | |
58 | - $this->titulo = $titulo; | |
59 | - $this->palavrasChaves = $palavrasChaves; | |
60 | - $this->depurar = $depurar; | |
61 | - $this->numeroPagina = -1; | |
62 | - $this->renderCapa = $reder; | |
63 | - $this->MakeTamPage($tamanhoFolha); | |
64 | - | |
65 | - $this->OpenFile(); | |
66 | - } | |
67 | - | |
68 | - function OpenFile() | |
69 | - { | |
70 | - $caminho = "tmp/"; | |
71 | - $lim_dir = opendir("tmp/"); | |
72 | - while ($lim_file = readdir($lim_dir)) | |
73 | - { | |
74 | - if ($lim_file != '.' && $lim_file != '..') | |
75 | - { | |
76 | - if (!(substr_count($lim_file, date('Y-m-d')))) | |
77 | - { | |
78 | - @unlink("tmp/".$lim_file); | |
79 | - } | |
80 | - } | |
81 | - } | |
82 | - $caminho .= date("Y-m-d")."-"; | |
83 | - list($usec, $sec) = explode(" ", microtime()); | |
84 | - $caminho .= substr(md5("{$usec}{$sec}"), 0, 8); | |
85 | - $caminho .= ".pdf"; | |
86 | - | |
87 | - $this->caminho = $caminho; | |
88 | - $this->LinkArquivo = $caminho; | |
89 | - | |
90 | - $this->pdf = PDF_new(); | |
91 | - pdf_set_parameter($this->pdf, "FontOutline", "monospaced=arquivos/fontes/FreeMonoBold.ttf"); | |
92 | - PDF_open_file($this->pdf, $this->caminho); | |
93 | - | |
94 | - PDF_set_info ($this->pdf, "Creator", $this->owner); | |
95 | - PDF_set_info ($this->pdf, "Author", $this->owner); | |
96 | - PDF_set_info ($this->pdf, "Title", $this->titulo); | |
97 | - | |
98 | - if ($this->depurar) | |
99 | - { | |
100 | - echo "<b>PDF:</b> Objeto criado!<br>"; | |
101 | - echo "<b>PDF:</b> O objeto foi criado no seguinte local -> ".$this->LinkArquivo."<br>"; | |
102 | - } | |
103 | - | |
104 | - $this->OpenPage(); | |
105 | - } | |
106 | - | |
107 | - function CloseFile() | |
108 | - { | |
109 | - $this->ClosePage(); | |
110 | - | |
111 | - PDF_close($this->pdf); | |
112 | - | |
113 | - PDF_delete($this->pdf); | |
114 | - | |
115 | - //@$buf = PDF_get_buffer( $this->pdf ); | |
116 | - | |
117 | - | |
118 | - //$len = strlen($buf); | |
119 | - | |
120 | - if ($this->depurar) | |
121 | - { | |
122 | - echo "<b>PDF:</b> Finalizando o arquivo com tamanho de -> {$len}<br>"; | |
123 | - } | |
124 | - | |
125 | - return $len; | |
126 | - } | |
127 | - | |
128 | - function GetLink() | |
129 | - { | |
130 | - return $this->LinkArquivo; | |
131 | - } | |
132 | - | |
133 | - function OpenPage() | |
134 | - { | |
135 | - if ($this->numeroPagina > -1) | |
136 | - { | |
137 | - //construção de pagina normal | |
138 | - $this->ClosePage(); | |
139 | - $this->numeroPagina++; | |
140 | - PDF_begin_page($this->pdf, $this->largura, $this->altura); | |
141 | - $this->pagOpened = true; | |
142 | - } | |
143 | - else | |
144 | - { | |
145 | - $this->numeroPagina++; | |
146 | - | |
147 | - if ($this->renderCapa) | |
148 | - { | |
149 | - $this->MakeCapa(); | |
150 | - } | |
151 | - } | |
152 | - } | |
153 | - | |
154 | - function ClosePage() | |
155 | - { | |
156 | - if ($this->pagOpened) | |
157 | - { | |
158 | - PDF_end_page($this->pdf); | |
159 | - $this->pagOpened = false; | |
160 | - } | |
161 | - if ($this->depurar) | |
162 | - { | |
163 | - echo "<b>PDF:</b> Finalizando pagina -> {$this->numeroPagina}<br>"; | |
164 | - } | |
165 | - } | |
166 | - | |
167 | - function MakeTamPage($tamanhoFolha) | |
168 | - { | |
169 | - $this->largura = 0; | |
170 | - $this->altura = 0; | |
171 | - | |
172 | - $this->topmargin = 50; | |
173 | - $this->bottommargirn = 50; | |
174 | - $this->leftmargin = 40; | |
175 | - $this->rigthmargin = 60; | |
176 | - | |
177 | - switch($tamanhoFolha) | |
178 | - { | |
179 | - case 'A0': $this->largura = 2380.0; $this->altura = 3368.0; break; | |
180 | - case 'A1': $this->largura = 1684.0; $this->altura = 2380.0; break; | |
181 | - case 'A2': $this->largura = 1190.0; $this->altura = 1684.0; break; | |
182 | - case 'A3': $this->largura = 842.0; $this->altura = 1190.0; break; | |
183 | - case 'A4': $this->largura = 595.0; $this->altura = 842.0; break; | |
184 | - case 'A4h': $this->largura = 595.0; $this->altura = 842.0; break; | |
185 | - case 'A5': $this->largura = 421.0; $this->altura = 595.0; break; | |
186 | - case 'A6': $this->largura = 297.0; $this->altura = 421.0; break; | |
187 | - case 'B5': $this->largura = 501.0; $this->altura = 709.0; break; | |
188 | - case 'letter': $this->largura = 612.0; $this->altura = 792.0; break; | |
189 | - case 'ledger': $this->largura = 1224.0; $this->altura = 792.0; break; | |
190 | - case 'p11x17': $this->largura = 792.0; $this->altura = 1224.0; break; | |
191 | - } | |
192 | - if ($this->depurar) | |
193 | - { | |
194 | - echo "<b>PDF:</b> Tamanho da pagina equivalente à -> {$tamanhoFolha}<br>"; | |
195 | - } | |
196 | - } | |
197 | - | |
198 | - function getTamPage() | |
199 | - { | |
200 | - return array( $this->largura, $this->altura ); | |
201 | - } | |
202 | - | |
203 | - function MakeCapa() | |
204 | - { | |
205 | - if ($this->depurar) | |
206 | - { | |
207 | - echo "<b>PDF:</b> Confeccionando capa para relatório. <br>"; | |
208 | - } | |
209 | - } | |
210 | - | |
211 | - | |
212 | - function SetFill($color="#FFFFFF", $transparency = "0" ) | |
213 | - { | |
214 | - if ( strlen($color) != 7 || $color[0] != '#' ) | |
215 | - { | |
216 | - if ($this->depurar) | |
217 | - { | |
218 | - echo "<b>PDF:</b> Não foi possivel setar o fundo. <br>"; | |
219 | - } | |
220 | - return false; | |
221 | - } | |
222 | - | |
223 | - $r = hexdec(substr($color, 1, 2)) / 255; | |
224 | - $g = hexdec(substr($color, 3, 2)) / 255; | |
225 | - $b = hexdec(substr($color, 5, 2)) / 255; | |
226 | - $a = $transparency; | |
227 | - | |
228 | - PDF_setcolor($this->pdf, 'fill', 'rgb', $r, $g, $b, 0); | |
229 | - | |
230 | - if ($this->depurar) | |
231 | - { | |
232 | - echo "<b>PDF:</b> Linha setada na cor -> {$color}. <br>"; | |
233 | - } | |
234 | - | |
235 | - return true; | |
236 | - } | |
237 | - | |
238 | - function SetBoth($color="#000000", $transparency = "0" ) | |
239 | - { | |
240 | - if ( strlen($color) != 7 || $color[0] != '#' ) | |
241 | - { | |
242 | - if ($this->depurar) | |
243 | - { | |
244 | - echo "<b>PDF:</b> Não foi possivel setar a linha. <br>"; | |
245 | - } | |
246 | - return false; | |
247 | - } | |
248 | - | |
249 | - $r = hexdec(substr($color, 1, 2)) / 255; | |
250 | - $g = hexdec(substr($color, 3, 2)) / 255; | |
251 | - $b = hexdec(substr($color, 5, 2)) / 255; | |
252 | - $a = $transparency; | |
253 | - | |
254 | - PDF_setcolor($this->pdf, 'both', 'rgb', $r, $g, $b, 0); | |
255 | - | |
256 | - if ($this->depurar) | |
257 | - { | |
258 | - echo "<b>PDF:</b> Fundo setado na cor -> {$color}. <br>"; | |
259 | - } | |
260 | - | |
261 | - return true; | |
262 | - } | |
263 | - | |
264 | - function SetLine( $largura ) | |
265 | - { | |
266 | - | |
267 | - PDF_setlinewidth($this->pdf, $largura); | |
268 | - | |
269 | - if ($this->depurar) | |
270 | - { | |
271 | - echo "<b>PDF:</b> Linha com largura -> {$largura}. <br>"; | |
272 | - } | |
273 | - } | |
274 | - | |
275 | - function SetFont($fonte, $tamanho) | |
276 | - { | |
277 | - | |
278 | - $f_user = ""; | |
279 | - switch ($fonte) | |
280 | - { | |
281 | - case 'normal': $f_user = 'Courier'; break; | |
282 | -// case 'arial': $f_user = 'Arial'; break; | |
283 | - case 'courier': $f_user = 'Courier-Bold'; break; | |
284 | - case 'courierItalico': $f_user = 'Courier-BoldOblique'; break; | |
285 | - case 'normalItalico': $f_user = 'Helvetica-BoldOblique'; break; | |
286 | - case 'times': $f_user = 'Times-Bold'; break; | |
287 | - case 'timesItalico': $f_user = 'Times-BoldItalic'; break; | |
288 | - case 'symbol': $f_user = 'ZapfDingbats'; break; | |
289 | - case 'monospaced': $f_user = 'monospaced'; break; | |
290 | -// case 'timesNormal': $f_user = 'Times-New-Roman'; break; | |
291 | - default: $f_user = 'Helvetica-Bold'; | |
292 | - } | |
293 | - $font = PDF_findfont($this->pdf, $f_user, "host", 0); | |
294 | - PDF_setfont($this->pdf, $font, $tamanho); | |
295 | - | |
296 | - if ($this->depurar) | |
297 | - { | |
298 | - echo "<b>PDF:</b> Fonte atual de uso: " . $f_user . "<br>"; | |
299 | - } | |
300 | - } | |
8 | + var | |
9 | + $nome, | |
10 | + $titulo, | |
11 | + $palavrasChaves, | |
12 | + $largura, | |
13 | + $altura, | |
14 | + $numeroPagina, | |
15 | + $renderCapa, | |
16 | + $pagOpened = FALSE; | |
17 | + | |
18 | + var | |
19 | + $caminho, | |
20 | + $linkArquivo, | |
21 | + $depurar, | |
22 | + $pdf; | |
23 | + | |
24 | + var | |
25 | + $topmargin, | |
26 | + $bottommargirn, | |
27 | + $leftmargin, | |
28 | + $rigthmargin; | |
29 | + | |
30 | + var | |
31 | + $listagem, | |
32 | + $detalhe; | |
33 | + | |
34 | + var $owner = "PMI - Prefeitura Municipal de Itajaí"; | |
35 | + | |
36 | + function clsPDF($nome, $titulo, $tamanhoFolha, $palavrasChaves, | |
37 | + $depurar = FALSE, $reder = TRUE) | |
38 | + { | |
39 | + $this->nome = $nome; | |
40 | + $this->titulo = $titulo; | |
41 | + $this->palavrasChaves = $palavrasChaves; | |
42 | + $this->depurar = $depurar; | |
43 | + $this->numeroPagina = -1; | |
44 | + $this->renderCapa = $reder; | |
45 | + $this->MakeTamPage($tamanhoFolha); | |
46 | + | |
47 | + $this->OpenFile(); | |
48 | + } | |
49 | + | |
50 | + function OpenFile() | |
51 | + { | |
52 | + $caminho = "tmp/"; | |
53 | + $lim_dir = opendir("tmp/"); | |
54 | + while ($lim_file = readdir($lim_dir)) | |
55 | + { | |
56 | + if ($lim_file != '.' && $lim_file != '..') | |
57 | + { | |
58 | + if (!(substr_count($lim_file, date('Y-m-d')))) | |
59 | + { | |
60 | + @unlink("tmp/".$lim_file); | |
61 | + } | |
62 | + } | |
63 | + } | |
64 | + $caminho .= date("Y-m-d")."-"; | |
65 | + list($usec, $sec) = explode(" ", microtime()); | |
66 | + $caminho .= substr(md5("{$usec}{$sec}"), 0, 8); | |
67 | + $caminho .= ".pdf"; | |
68 | + | |
69 | + $this->caminho = $caminho; | |
70 | + $this->LinkArquivo = $caminho; | |
71 | + | |
72 | + $this->pdf = PDF_new(); | |
73 | + pdf_set_parameter($this->pdf, "FontOutline", "monospaced=arquivos/fontes/FreeMonoBold.ttf"); | |
74 | + PDF_open_file($this->pdf, $this->caminho); | |
75 | + | |
76 | + PDF_set_info ($this->pdf, "Creator", $this->owner); | |
77 | + PDF_set_info ($this->pdf, "Author", $this->owner); | |
78 | + PDF_set_info ($this->pdf, "Title", $this->titulo); | |
79 | + | |
80 | + if ($this->depurar) | |
81 | + { | |
82 | + echo "<b>PDF:</b> Objeto criado!<br>"; | |
83 | + echo "<b>PDF:</b> O objeto foi criado no seguinte local -> ".$this->LinkArquivo."<br>"; | |
84 | + } | |
85 | + | |
86 | + $this->OpenPage(); | |
87 | + } | |
88 | + | |
89 | + function CloseFile() | |
90 | + { | |
91 | + $this->ClosePage(); | |
92 | + PDF_close($this->pdf); | |
93 | + PDF_delete($this->pdf); | |
94 | + | |
95 | + if ($this->depurar) { | |
96 | + echo "<b>PDF:</b> Finalizando o arquivo com tamanho de -> {$len}<br>"; | |
97 | + } | |
98 | + | |
99 | + return $len; | |
100 | + } | |
101 | + | |
102 | + function GetLink() | |
103 | + { | |
104 | + return $this->LinkArquivo; | |
105 | + } | |
106 | + | |
107 | + function OpenPage() | |
108 | + { | |
109 | + if ($this->numeroPagina > -1) { | |
110 | + // Construção de página normal | |
111 | + $this->ClosePage(); | |
112 | + $this->numeroPagina++; | |
113 | + PDF_begin_page($this->pdf, $this->largura, $this->altura); | |
114 | + $this->pagOpened = TRUE; | |
115 | + } | |
116 | + else { | |
117 | + $this->numeroPagina++; | |
118 | + | |
119 | + if ($this->renderCapa) { | |
120 | + $this->MakeCapa(); | |
121 | + } | |
122 | + } | |
123 | + } | |
124 | + | |
125 | + function ClosePage() | |
126 | + { | |
127 | + if ($this->pagOpened) { | |
128 | + PDF_end_page($this->pdf); | |
129 | + $this->pagOpened = FALSE; | |
130 | + } | |
131 | + | |
132 | + if ($this->depurar) { | |
133 | + echo "<b>PDF:</b> Finalizando pagina -> {$this->numeroPagina}<br>"; | |
134 | + } | |
135 | + } | |
136 | + | |
137 | + function MakeTamPage($tamanhoFolha) | |
138 | + { | |
139 | + $this->largura = 0; | |
140 | + $this->altura = 0; | |
141 | + | |
142 | + $this->topmargin = 50; | |
143 | + $this->bottommargirn = 50; | |
144 | + $this->leftmargin = 40; | |
145 | + $this->rigthmargin = 60; | |
146 | + | |
147 | + switch($tamanhoFolha) | |
148 | + { | |
149 | + case 'A0': | |
150 | + $this->largura = 2380.0; | |
151 | + $this->altura = 3368.0; | |
152 | + break; | |
153 | + case 'A1': | |
154 | + $this->largura = 1684.0; | |
155 | + $this->altura = 2380.0; | |
156 | + break; | |
157 | + case 'A2': | |
158 | + $this->largura = 1190.0; | |
159 | + $this->altura = 1684.0; | |
160 | + break; | |
161 | + case 'A3': | |
162 | + $this->largura = 842.0; | |
163 | + $this->altura = 1190.0; | |
164 | + break; | |
165 | + case 'A4': | |
166 | + $this->largura = 595.0; | |
167 | + $this->altura = 842.0; | |
168 | + break; | |
169 | + case 'A4h': | |
170 | + $this->largura = 595.0; | |
171 | + $this->altura = 842.0; | |
172 | + break; | |
173 | + case 'A5': | |
174 | + $this->largura = 421.0; | |
175 | + $this->altura = 595.0; | |
176 | + break; | |
177 | + case 'A6': | |
178 | + $this->largura = 297.0; | |
179 | + $this->altura = 421.0; | |
180 | + break; | |
181 | + case 'B5': | |
182 | + $this->largura = 501.0; | |
183 | + $this->altura = 709.0; | |
184 | + break; | |
185 | + case 'letter': | |
186 | + $this->largura = 612.0; | |
187 | + $this->altura = 792.0; | |
188 | + break; | |
189 | + case 'ledger': | |
190 | + $this->largura = 1224.0; | |
191 | + $this->altura = 792.0; | |
192 | + break; | |
193 | + case 'p11x17': | |
194 | + $this->largura = 792.0; | |
195 | + $this->altura = 1224.0; | |
196 | + break; | |
197 | + } | |
198 | + | |
199 | + if ($this->depurar) { | |
200 | + echo "<b>PDF:</b> Tamanho da pagina equivalente à -> {$tamanhoFolha}<br>"; | |
201 | + } | |
202 | + } | |
203 | + | |
204 | + function getTamPage() | |
205 | + { | |
206 | + return array($this->largura, $this->altura); | |
207 | + } | |
208 | + | |
209 | + function MakeCapa() | |
210 | + { | |
211 | + if ($this->depurar) { | |
212 | + echo "<b>PDF:</b> Confeccionando capa para relatório. <br>"; | |
213 | + } | |
214 | + } | |
215 | + | |
216 | + | |
217 | + function SetFill($color="#FFFFFF", $transparency = "0" ) | |
218 | + { | |
219 | + if (strlen($color) != 7 || $color[0] != '#') { | |
220 | + if ($this->depurar) { | |
221 | + echo "<b>PDF:</b> Não foi possivel setar o fundo. <br>"; | |
222 | + } | |
223 | + | |
224 | + return FALSE; | |
225 | + } | |
226 | + | |
227 | + $r = hexdec(substr($color, 1, 2)) / 255; | |
228 | + $g = hexdec(substr($color, 3, 2)) / 255; | |
229 | + $b = hexdec(substr($color, 5, 2)) / 255; | |
230 | + $a = $transparency; | |
231 | + | |
232 | + PDF_setcolor($this->pdf, 'fill', 'rgb', $r, $g, $b, 0); | |
233 | + | |
234 | + if ($this->depurar) { | |
235 | + echo "<b>PDF:</b> Linha setada na cor -> {$color}. <br>"; | |
236 | + } | |
237 | + | |
238 | + return TRUE; | |
239 | + } | |
240 | + | |
241 | + function SetBoth($color = '#000000', $transparency = '0') | |
242 | + { | |
243 | + if (strlen($color) != 7 || $color[0] != '#') { | |
244 | + if ($this->depurar) { | |
245 | + echo "<b>PDF:</b> Não foi possivel setar a linha. <br>"; | |
246 | + } | |
247 | + | |
248 | + return FALSE; | |
249 | + } | |
250 | + | |
251 | + $r = hexdec(substr($color, 1, 2)) / 255; | |
252 | + $g = hexdec(substr($color, 3, 2)) / 255; | |
253 | + $b = hexdec(substr($color, 5, 2)) / 255; | |
254 | + $a = $transparency; | |
255 | + | |
256 | + PDF_setcolor($this->pdf, 'both', 'rgb', $r, $g, $b, 0); | |
257 | + | |
258 | + if ($this->depurar) { | |
259 | + echo "<b>PDF:</b> Fundo setado na cor -> {$color}. <br>"; | |
260 | + } | |
261 | + | |
262 | + return TRUE; | |
263 | + } | |
264 | + | |
265 | + function SetLine($largura) | |
266 | + { | |
267 | + PDF_setlinewidth($this->pdf, $largura); | |
268 | + | |
269 | + if ($this->depurar) { | |
270 | + echo "<b>PDF:</b> Linha com largura -> {$largura}. <br>"; | |
271 | + } | |
272 | + } | |
273 | + | |
274 | + function SetFont($fonte, $tamanho) | |
275 | + { | |
276 | + $f_user = ''; | |
277 | + | |
278 | + switch ($fonte) | |
279 | + { | |
280 | + case 'normal': | |
281 | + $f_user = 'Courier'; | |
282 | + break; | |
283 | + case 'courier': | |
284 | + $f_user = 'Courier-Bold'; | |
285 | + break; | |
286 | + case 'courierItalico': | |
287 | + $f_user = 'Courier-BoldOblique'; | |
288 | + break; | |
289 | + case 'normalItalico': | |
290 | + $f_user = 'Helvetica-BoldOblique'; | |
291 | + break; | |
292 | + case 'times': | |
293 | + $f_user = 'Times-Bold'; | |
294 | + break; | |
295 | + case 'timesItalico': | |
296 | + $f_user = 'Times-BoldItalic'; | |
297 | + break; | |
298 | + case 'symbol': | |
299 | + $f_user = 'ZapfDingbats'; | |
300 | + break; | |
301 | + case 'monospaced': | |
302 | + $f_user = 'monospaced'; | |
303 | + break; | |
304 | + default: | |
305 | + $f_user = 'Helvetica-Bold'; | |
306 | + } | |
307 | + | |
308 | + $font = PDF_findfont($this->pdf, $f_user, 'host', 0); | |
309 | + PDF_setfont($this->pdf, $font, $tamanho); | |
310 | + | |
311 | + if ($this->depurar) { | |
312 | + echo "<b>PDF:</b> Fonte atual de uso: " . $f_user . "<br>"; | |
313 | + } | |
314 | + } | |
301 | 315 | |
302 | 316 | public function InsertJpng($tipo, $image, $x, $y, $tamanho) |
303 | 317 | { |
304 | 318 | $y = $this->altura - $y; |
305 | 319 | |
306 | - $im = pdf_open_image_file($this->pdf, $tipo, $image, "", 0); | |
320 | + $im = pdf_open_image_file($this->pdf, $tipo, $image, '', 0); | |
307 | 321 | |
308 | 322 | PDF_place_image($this->pdf, $im, $x, $y, $tamanho); |
309 | - $x = PDF_get_value($this->pdf, "imagewidth", $im); | |
310 | - $y = PDF_get_value($this->pdf, "imageheight", $im); | |
323 | + $x = PDF_get_value($this->pdf, 'imagewidth', $im); | |
324 | + $y = PDF_get_value($this->pdf, 'imageheight', $im); | |
311 | 325 | PDF_close_image($this->pdf, $im); |
312 | 326 | } |
313 | 327 | |
... | ... | @@ -342,262 +356,267 @@ class clsPDF |
342 | 356 | PDF_close_image($this->pdf, $im); |
343 | 357 | } |
344 | 358 | |
345 | - function LinkFor($type, $stringlink, $destino, $xo, $yo, $x, $y) | |
346 | - { | |
347 | - if ($type == "web") | |
348 | - { | |
349 | - PDF_add_weblink($this->pdf, $xo, $yo, $x, $y, $stringlink, $destino); | |
350 | - } | |
351 | - else if ($type == "file") | |
352 | - { | |
353 | - PDF_add_locallink($this->pdf, $xo, $yo, $x, $y, $stringlink, $destino); | |
354 | - } | |
355 | - } | |
356 | - | |
357 | - function MakeDetalhe() | |
358 | - { | |
359 | - return false; | |
360 | - } | |
361 | - | |
362 | - function MakeListagem() | |
363 | - { | |
364 | - return false; | |
365 | - } | |
366 | - | |
367 | - function Shape($tipo, $x, $y, $largura=0, $altura=0, $linha=0.001, $color="#000000", $color2="#FFFFFF") | |
368 | - { | |
369 | - $this->SetLine( $linha ); | |
370 | - $this->SetBoth( $color ); | |
371 | - $this->SetFill( $color2 ); | |
372 | - switch ($tipo) | |
373 | - { | |
374 | - case 'ret': | |
375 | - PDF_rect($this->pdf, $x, $y, $largura, $altura); | |
376 | - break; | |
377 | - case 'elipse': | |
378 | - PDF_circle($this->pdf, $x, $y, $largura); | |
379 | - break; | |
380 | - } | |
381 | - PDF_fill_stroke($this->pdf); | |
382 | - | |
383 | - if ($this->depurar) | |
384 | - { | |
385 | - echo "<b>PDF:</b> Adicionado um shape.<br>"; | |
386 | - } | |
387 | - } | |
388 | - | |
389 | - /** | |
390 | - * Funcao que desenha um quadrado (de cima para baixo, da esqueda para direita) | |
391 | - * recebe todas as variaveis de posicao (X,Y) em valores absolutos | |
392 | - * x,y = 0,0 é o topo esquerdo da pagina | |
393 | - * | |
394 | - * @param int $x_topleft | |
395 | - * @param int $y_topleft | |
396 | - * @param int $x_bottomright | |
397 | - * @param int $y_bottomright | |
398 | - * @param float $linha | |
399 | - * @param string $color | |
400 | - * @param string $color2 | |
401 | - */ | |
402 | - function quadrado_absoluto($x_topleft, $y_topleft, $x_bottomright, $y_bottomright, $linha=0.1, $color="#000000", $color2="#FFFFFF" ) | |
403 | - { | |
404 | - $altura = $y_bottomright - $y_topleft; | |
405 | - $largura = $x_bottomright - $x_topleft; | |
406 | - $this->quadrado_relativo( $x_topleft, $y_topleft, $largura, $altura, $linha, $color, $color2 ); | |
407 | - } | |
408 | - | |
409 | - /** | |
410 | - * Funcao que desenha um quadrado (de cima para baixo, da esqueda para direita) | |
411 | - * recebe todas as variaveis de posicao (X,Y) para o inicio da caixa | |
412 | - * recebe ainda os parametros altura e largura, relativos. | |
413 | - * 0,0 é o topo esquerdo da pagina | |
414 | - * | |
415 | - * @param int $x_topleft | |
416 | - * @param int $y_topleft | |
417 | - * @param int $largura | |
418 | - * @param int $altura | |
419 | - * @param float $linha | |
420 | - * @param string $color | |
421 | - * @param string $color2 | |
422 | - */ | |
423 | - function quadrado_relativo($x_topleft, $y_topleft, $largura, $altura, $linha=0.1, $color="#000000", $color2="#FFFFFF" ) | |
424 | - { | |
425 | - $this->Shape( 'ret', $x_topleft, $this->altura - $y_topleft - $altura, $largura, $altura, $linha, $color, $color2 ); | |
426 | - } | |
427 | - | |
428 | - function Line( $xo, $yo, $x, $y, $linha=2.001, $color1="#000000", $color2="#000000", $teck=true, $teck2 = true) | |
429 | - { | |
430 | - if ($teck2) | |
431 | - { | |
432 | - $this->SetLine( $linha ); | |
433 | - $this->SetBoth( $color1 ); | |
434 | - $this->SetFill( $color2 ); | |
435 | - } | |
436 | - PDF_moveto($this->pdf, $xo, $yo); | |
437 | - PDF_lineto($this->pdf, $x, $y); | |
438 | - | |
439 | - if ($teck) | |
440 | - { | |
441 | - PDF_stroke($this->pdf); | |
442 | - } | |
443 | - | |
444 | - if ($this->depurar) | |
445 | - { | |
446 | - echo "<b>PDF:</b> Adicionado uma linha.<br>"; | |
447 | - } | |
448 | - } | |
449 | - | |
450 | - /** | |
451 | - * Funcao que desenha uma linha (de cima para baixo, da esqueda para direita) | |
452 | - * recebe todas as variaveis de posicao (X,Y) em valores absolutos | |
453 | - * x,y = 0,0 é o topo esquerdo da pagina | |
454 | - * | |
455 | - * @param int $x_topleft | |
456 | - * @param int $y_topleft | |
457 | - * @param int $x_bottomright | |
458 | - * @param int $y_bottomright | |
459 | - * @param float $linha | |
460 | - * @param string $color | |
461 | - * @param string $color2 | |
462 | - */ | |
463 | - function linha_absoluta($x_topleft, $y_topleft, $x_bottomright, $y_bottomright, $linha=0.1, $color="#000000", $color2="#FFFFFF" ) | |
464 | - { | |
465 | - $this->Line( $x_topleft, $this->altura - $y_topleft, $x_bottomright, $this->altura - $y_bottomright, $linha, $color, $color2 ); | |
466 | - } | |
467 | - | |
468 | - /** | |
469 | - * Funcao que desenha uma linha (de cima para baixo, da esqueda para direita) | |
470 | - * recebe todas as variaveis de posicao (X,Y) para o inicio da linha | |
471 | - * recebe ainda os parametros altura e largura, relativos. | |
472 | - * 0,0 é o topo esquerdo da pagina | |
473 | - * | |
474 | - * @param int $x_topleft | |
475 | - * @param int $y_topleft | |
476 | - * @param int $largura | |
477 | - * @param int $altura | |
478 | - * @param float $linha | |
479 | - * @param string $color | |
480 | - * @param string $color2 | |
481 | - */ | |
482 | - function linha_relativa($x_topleft, $y_topleft, $largura, $altura, $linha=0.1, $color="#000000", $color2="#FFFFFF" ) | |
483 | - { | |
484 | - $this->Line( $x_topleft, $this->altura - $y_topleft, $x_topleft + $largura, $this->altura - $y_topleft - $altura, $linha, $color, $color2 ); | |
485 | - } | |
486 | - | |
487 | - | |
488 | - function Curve ($xo, $yo, $x, $y, $px1, $py1, $px2, $py2, $linha = 2.001, $color1 = "#000000", $color2 = "#000000") | |
489 | - { | |
490 | - if ($teck2) | |
491 | - { | |
492 | - $this->SetLine( $linha ); | |
493 | - $this->SetBoth( $color1 ); | |
494 | - $this->SetFill( $color2 ); | |
495 | - } | |
496 | - PDF_moveto($this->pdf, $xo, $yo); | |
497 | - PDF_curveto($this->pdf, $px1, $py1, $px2, $py2, $x, $y); | |
498 | - | |
499 | - if ($teck) | |
500 | - { | |
501 | - PDF_stroke($this->pdf); | |
502 | - } | |
503 | - | |
504 | - if ($this->depurar) | |
505 | - { | |
506 | - echo "<b>PDF:</b> Adicionado uma curva.<br>"; | |
507 | - } | |
508 | - } | |
509 | - | |
510 | - function Write($msg, $xo, $yo, $x, $y, $fonte='normal', $tamanho='10', $color="#888888", $align='center', $local='box') | |
511 | - { | |
512 | - $this->SetFont( $fonte, $tamanho ); | |
513 | - $this->SetBoth( $color ); | |
514 | - | |
515 | - switch ($local) | |
516 | - { | |
517 | - case 'xy': | |
518 | - PDF_show_xy($this->pdf, $msg, $xo, $yo); | |
519 | - break; | |
520 | - default: | |
521 | - // 'box' | |
522 | - $yo = $this->altura - $yo; | |
523 | - PDF_show_boxed($this->pdf, $msg, $xo, $yo, $x, $y, $align, ""); | |
524 | - } | |
525 | - if ($this->depurar) | |
526 | - { | |
527 | - echo "<b>PDF:</b> Adicionado o texto: <pre>$msg</pre><br>"; | |
528 | - } | |
529 | - } | |
530 | - | |
531 | - /** | |
532 | - * Funcao que escreve um texto na pagina (de cima para baixo, da esqueda para direita) | |
533 | - * recebe as variaveis de posicao (X,Y) para o inicio do texto em valores absolutos | |
534 | - * recebe ainda os parametros largura e altura, relativos | |
535 | - * x,y = 0,0 é o topo esquerdo da pagina | |
536 | - * | |
537 | - * @param string $texto | |
538 | - * @param int $x_topleft | |
539 | - * @param int $y_topleft | |
540 | - * @param int $largura | |
541 | - * @param int $altura | |
542 | - * @param string $fonte | |
543 | - * @param int $tamanho | |
544 | - * @param string $color | |
545 | - * @param string $align | |
546 | - * @param string $local | |
547 | - */ | |
548 | - function escreve_relativo( $texto, $x_topleft, $y_topleft, $largura, $altura, $fonte='arial', $tamanho='10', $color="#000000", $align='left' ) | |
549 | - { | |
550 | - $this->Write( $texto, $x_topleft, $y_topleft + $altura, $largura, $altura, $fonte, $tamanho, $color, $align ); | |
551 | - } | |
552 | - | |
553 | - /** | |
554 | - * Funcao que escreve um texto na pagina (de cima para baixo, da esqueda para direita) | |
555 | - * recebe todas as variaveis de posicao (X,Y) em valores absolutos | |
556 | - * x,y = 0,0 é o topo esquerdo da pagina | |
557 | - * | |
558 | - * @param string $texto | |
559 | - * @param int $x_topleft | |
560 | - * @param int $y_topleft | |
561 | - * @param int $x_bottomright | |
562 | - * @param int $y_bottomright | |
563 | - * @param string $fonte | |
564 | - * @param int $tamanho | |
565 | - * @param string $color | |
566 | - * @param string $align | |
567 | - * @param string $local | |
568 | - */ | |
569 | - function escreve_absoluto( $texto, $x_topleft, $y_topleft, $x_bottomright, $y_bottomright, $fonte='arial', $tamanho='10', $color="#000000", $align='left' ) | |
570 | - { | |
571 | - $this->Write( $texto, $x_topleft, $y_bottomright, $x_bottomright - $x_topleft, $y_bottomright - $y_topleft, $fonte, $tamanho, $color, $align ); | |
572 | -// echo "{$x_topleft}, {$y_bottomright}, " . ( $x_bottomright - $x_topleft ) . ", " . ( $y_bottomright - $y_topleft ) . "<br>"; | |
573 | - } | |
574 | - | |
575 | - function PagAgenda($texto, $dia_semana_v, $data_atual_v, $lembrete) | |
576 | - { | |
577 | - $this->OpenPage(); | |
578 | - $this->Shape('ret', 30, 30, $this->largura-60, $this->altura-60, 2); | |
579 | - $this->InsertJpng('jpeg', 'imagens/brasao.jpg', 40, 95, 0.1); | |
580 | - | |
581 | - $msg = $this->titulo; | |
582 | - $this->Write($msg, 40, 142, 300, 40, 'courier', 10, "#333333", "left"); | |
583 | - | |
584 | - $lembrete = "Lembrete:\r\n".$lembrete; | |
585 | - $this->Write($lembrete, 160, 150, 400, 115, 'courier', 8, "#333333", "left"); | |
586 | - | |
587 | - $this->printData($this->altura-140, $dia_semana_v, $data_atual_v, 140); | |
588 | - | |
589 | - $this->Write($texto, 40, $this->altura-30, $this->largura-80, $this->altura-180, 'courier', 10, "#333333", "left"); | |
590 | - | |
591 | - $this->ClosePage(); | |
592 | - } | |
593 | - | |
594 | - function printData($al, $dia_semana_v, $data_atual_v, $l) | |
595 | - { | |
596 | - $this->Shape('ret', 30, $al, $this->largura-60, 15, 2, "#000000", "#AAAAAA"); | |
597 | - $msg = "Dia: {$dia_semana_v} ({$data_atual_v})"; | |
598 | - $this->Write($msg, 34, $l, $this->largura-62, 15, 'courier', 10, "#333333", "left"); | |
599 | - } | |
600 | - | |
601 | -} | |
602 | - | |
603 | -?> | |
604 | 359 | \ No newline at end of file |
360 | + function LinkFor($type, $stringlink, $destino, $xo, $yo, $x, $y) | |
361 | + { | |
362 | + if ($type == 'web') { | |
363 | + PDF_add_weblink($this->pdf, $xo, $yo, $x, $y, $stringlink, $destino); | |
364 | + } | |
365 | + elseif ($type == 'file') { | |
366 | + PDF_add_locallink($this->pdf, $xo, $yo, $x, $y, $stringlink, $destino); | |
367 | + } | |
368 | + } | |
369 | + | |
370 | + function MakeDetalhe() | |
371 | + { | |
372 | + return FALSE; | |
373 | + } | |
374 | + | |
375 | + function MakeListagem() | |
376 | + { | |
377 | + return FALSE; | |
378 | + } | |
379 | + | |
380 | + function Shape($tipo, $x, $y, $largura=0, $altura=0, $linha=0.001, $color="#000000", $color2="#FFFFFF") | |
381 | + { | |
382 | + $this->SetLine($linha); | |
383 | + $this->SetBoth($color); | |
384 | + $this->SetFill($color2); | |
385 | + | |
386 | + switch ($tipo) { | |
387 | + case 'ret': | |
388 | + PDF_rect($this->pdf, $x, $y, $largura, $altura); | |
389 | + break; | |
390 | + case 'elipse': | |
391 | + PDF_circle($this->pdf, $x, $y, $largura); | |
392 | + break; | |
393 | + } | |
394 | + | |
395 | + PDF_fill_stroke($this->pdf); | |
396 | + | |
397 | + if ($this->depurar) { | |
398 | + echo '<b>PDF:</b> Adicionado um shape.<br>'; | |
399 | + } | |
400 | + } | |
401 | + | |
402 | + /** | |
403 | + * Funcao que desenha um quadrado (de cima para baixo, da esqueda para direita) | |
404 | + * recebe todas as variaveis de posicao (X,Y) em valores absolutos | |
405 | + * x,y = 0,0 é o topo esquerdo da pagina | |
406 | + * | |
407 | + * @param int $x_topleft | |
408 | + * @param int $y_topleft | |
409 | + * @param int $x_bottomright | |
410 | + * @param int $y_bottomright | |
411 | + * @param float $linha | |
412 | + * @param string $color | |
413 | + * @param string $color2 | |
414 | + */ | |
415 | + function quadrado_absoluto($x_topleft, $y_topleft, $x_bottomright, $y_bottomright, | |
416 | + $linha = 0.1, $color = '#000000', $color2 = '#FFFFFF') | |
417 | + { | |
418 | + $altura = $y_bottomright - $y_topleft; | |
419 | + $largura = $x_bottomright - $x_topleft; | |
420 | + $this->quadrado_relativo( $x_topleft, $y_topleft, $largura, $altura, $linha, | |
421 | + $color, $color2); | |
422 | + } | |
423 | + | |
424 | + /** | |
425 | + * Funcao que desenha um quadrado (de cima para baixo, da esqueda para direita) | |
426 | + * recebe todas as variaveis de posicao (X,Y) para o inicio da caixa | |
427 | + * recebe ainda os parametros altura e largura, relativos. | |
428 | + * 0,0 é o topo esquerdo da pagina | |
429 | + * | |
430 | + * @param int $x_topleft | |
431 | + * @param int $y_topleft | |
432 | + * @param int $largura | |
433 | + * @param int $altura | |
434 | + * @param float $linha | |
435 | + * @param string $color | |
436 | + * @param string $color2 | |
437 | + */ | |
438 | + function quadrado_relativo($x_topleft, $y_topleft, $largura, $altura, | |
439 | + $linha = 0.1, $color = '#000000', $color2 = '#FFFFFF') | |
440 | + { | |
441 | + $this->Shape('ret', $x_topleft, $this->altura - $y_topleft - $altura, $largura, | |
442 | + $altura, $linha, $color, $color2); | |
443 | + } | |
444 | + | |
445 | + function Line($xo, $yo, $x, $y, $linha = 2.001, $color1 = '#000000', | |
446 | + $color2 = '#000000', $teck = TRUE, $teck2 = TRUE) | |
447 | + { | |
448 | + if ($teck2) { | |
449 | + $this->SetLine($linha); | |
450 | + $this->SetBoth($color1); | |
451 | + $this->SetFill($color2); | |
452 | + } | |
453 | + | |
454 | + PDF_moveto($this->pdf, $xo, $yo); | |
455 | + PDF_lineto($this->pdf, $x, $y); | |
456 | + | |
457 | + if ($teck) { | |
458 | + PDF_stroke($this->pdf); | |
459 | + } | |
460 | + | |
461 | + if ($this->depurar) { | |
462 | + echo "<b>PDF:</b> Adicionado uma linha.<br>"; | |
463 | + } | |
464 | + } | |
465 | + | |
466 | + /** | |
467 | + * Funcao que desenha uma linha (de cima para baixo, da esqueda para direita) | |
468 | + * recebe todas as variaveis de posicao (X,Y) em valores absolutos | |
469 | + * x,y = 0,0 é o topo esquerdo da pagina | |
470 | + * | |
471 | + * @param int $x_topleft | |
472 | + * @param int $y_topleft | |
473 | + * @param int $x_bottomright | |
474 | + * @param int $y_bottomright | |
475 | + * @param float $linha | |
476 | + * @param string $color | |
477 | + * @param string $color2 | |
478 | + */ | |
479 | + function linha_absoluta($x_topleft, $y_topleft, $x_bottomright, $y_bottomright, | |
480 | + $linha = 0.1, $color = '#000000', $color2 = '#FFFFFF') | |
481 | + { | |
482 | + $this->Line($x_topleft, $this->altura - $y_topleft, $x_bottomright, | |
483 | + $this->altura - $y_bottomright, $linha, $color, $color2); | |
484 | + } | |
485 | + | |
486 | + /** | |
487 | + * Funcao que desenha uma linha (de cima para baixo, da esqueda para direita) | |
488 | + * recebe todas as variaveis de posicao (X,Y) para o inicio da linha | |
489 | + * recebe ainda os parametros altura e largura, relativos. | |
490 | + * 0,0 é o topo esquerdo da pagina | |
491 | + * | |
492 | + * @param int $x_topleft | |
493 | + * @param int $y_topleft | |
494 | + * @param int $largura | |
495 | + * @param int $altura | |
496 | + * @param float $linha | |
497 | + * @param string $color | |
498 | + * @param string $color2 | |
499 | + */ | |
500 | + function linha_relativa($x_topleft, $y_topleft, $largura, $altura, $linha = 0.1, | |
501 | + $color = '#000000', $color2 = '#FFFFFF') | |
502 | + { | |
503 | + $this->Line($x_topleft, $this->altura - $y_topleft, $x_topleft + $largura, | |
504 | + $this->altura - $y_topleft - $altura, $linha, $color, $color2); | |
505 | + } | |
506 | + | |
507 | + function Curve ($xo, $yo, $x, $y, $px1, $py1, $px2, $py2, $linha = 2.001, | |
508 | + $color1 = '#000000', $color2 = '#000000') | |
509 | + { | |
510 | + if ($teck2) { | |
511 | + $this->SetLine($linha); | |
512 | + $this->SetBoth($color1); | |
513 | + $this->SetFill($color2); | |
514 | + } | |
515 | + | |
516 | + PDF_moveto($this->pdf, $xo, $yo); | |
517 | + PDF_curveto($this->pdf, $px1, $py1, $px2, $py2, $x, $y); | |
518 | + | |
519 | + if ($teck) { | |
520 | + PDF_stroke($this->pdf); | |
521 | + } | |
522 | + | |
523 | + if ($this->depurar) { | |
524 | + echo '<b>PDF:</b> Adicionado uma curva.<br>'; | |
525 | + } | |
526 | + } | |
527 | + | |
528 | + function Write($msg, $xo, $yo, $x, $y, $fonte = 'normal', $tamanho = '10', | |
529 | + $color = '#888888', $align = 'center', $local = 'box') | |
530 | + { | |
531 | + $this->SetFont($fonte, $tamanho); | |
532 | + $this->SetBoth($color); | |
533 | + | |
534 | + switch ($local) { | |
535 | + case 'xy': | |
536 | + PDF_show_xy($this->pdf, $msg, $xo, $yo); | |
537 | + break; | |
538 | + default: | |
539 | + // 'box' | |
540 | + $yo = $this->altura - $yo; | |
541 | + PDF_show_boxed($this->pdf, $msg, $xo, $yo, $x, $y, $align, ''); | |
542 | + } | |
543 | + | |
544 | + if ($this->depurar) { | |
545 | + echo "<b>PDF:</b> Adicionado o texto: <pre>$msg</pre><br>"; | |
546 | + } | |
547 | + } | |
548 | + | |
549 | + /** | |
550 | + * Funcao que escreve um texto na pagina (de cima para baixo, da esqueda para direita) | |
551 | + * recebe as variaveis de posicao (X,Y) para o inicio do texto em valores absolutos | |
552 | + * recebe ainda os parametros largura e altura, relativos | |
553 | + * x,y = 0,0 é o topo esquerdo da pagina | |
554 | + * | |
555 | + * @param string $texto | |
556 | + * @param int $x_topleft | |
557 | + * @param int $y_topleft | |
558 | + * @param int $largura | |
559 | + * @param int $altura | |
560 | + * @param string $fonte | |
561 | + * @param int $tamanho | |
562 | + * @param string $color | |
563 | + * @param string $align | |
564 | + * @param string $local | |
565 | + */ | |
566 | + function escreve_relativo($texto, $x_topleft, $y_topleft, $largura, $altura, | |
567 | + $fonte = 'arial', $tamanho = '10', $color = '#000000', $align = 'left') | |
568 | + { | |
569 | + $this->Write($texto, $x_topleft, $y_topleft + $altura, $largura, $altura, | |
570 | + $fonte, $tamanho, $color, $align); | |
571 | + } | |
572 | + | |
573 | + /** | |
574 | + * Funcao que escreve um texto na pagina (de cima para baixo, da esqueda para direita) | |
575 | + * recebe todas as variaveis de posicao (X,Y) em valores absolutos | |
576 | + * x,y = 0,0 é o topo esquerdo da pagina | |
577 | + * | |
578 | + * @param string $texto | |
579 | + * @param int $x_topleft | |
580 | + * @param int $y_topleft | |
581 | + * @param int $x_bottomright | |
582 | + * @param int $y_bottomright | |
583 | + * @param string $fonte | |
584 | + * @param int $tamanho | |
585 | + * @param string $color | |
586 | + * @param string $align | |
587 | + * @param string $local | |
588 | + */ | |
589 | + function escreve_absoluto( $texto, $x_topleft, $y_topleft, $x_bottomright, | |
590 | + $y_bottomright, $fonte = 'arial', $tamanho = '10', $color = '#000000', $align = 'left') | |
591 | + { | |
592 | + $this->Write($texto, $x_topleft, $y_bottomright, $x_bottomright - $x_topleft, | |
593 | + $y_bottomright - $y_topleft, $fonte, $tamanho, $color, $align); | |
594 | + } | |
595 | + | |
596 | + function PagAgenda($texto, $dia_semana_v, $data_atual_v, $lembrete) | |
597 | + { | |
598 | + $this->OpenPage(); | |
599 | + $this->Shape('ret', 30, 30, $this->largura-60, $this->altura-60, 2); | |
600 | + $this->InsertJpng('jpeg', 'imagens/brasao.jpg', 40, 95, 0.1); | |
601 | + | |
602 | + $msg = $this->titulo; | |
603 | + $this->Write($msg, 40, 142, 300, 40, 'courier', 10, '#333333', 'left'); | |
604 | + | |
605 | + $lembrete = "Lembrete:\r\n".$lembrete; | |
606 | + | |
607 | + $this->Write($lembrete, 160, 150, 400, 115, 'courier', 8, '#333333', 'left'); | |
608 | + $this->printData($this->altura-140, $dia_semana_v, $data_atual_v, 140); | |
609 | + | |
610 | + $this->Write($texto, 40, $this->altura - 30, $this->largura - 80, | |
611 | + $this->altura - 180, 'courier', 10, '#333333', 'left'); | |
612 | + | |
613 | + $this->ClosePage(); | |
614 | + } | |
615 | + | |
616 | + function printData($al, $dia_semana_v, $data_atual_v, $l) | |
617 | + { | |
618 | + $this->Shape('ret', 30, $al, $this->largura-60, 15, 2, '#000000', '#AAAAAA'); | |
619 | + $msg = "Dia: {$dia_semana_v} ({$data_atual_v})"; | |
620 | + $this->Write($msg, 34, $l, $this->largura-62, 15, 'courier', 10, '#333333', 'left'); | |
621 | + } | |
622 | + | |
623 | +} | |
605 | 624 | \ No newline at end of file | ... | ... |