@@ -64,9 +64,8 @@ discard block |
||
| 64 | 64 | * @param string $sPathLogo Caminho para o arquivo do logo |
| 65 | 65 | * @param string $sDestino Estabelece a direção do envio do documento PDF I-browser D-browser com download S- |
| 66 | 66 | * @param string $sDirPDF Caminho para o diretorio de armazenamento dos arquivos PDF |
| 67 | - * @param string $fonteDACTE Nome da fonte alternativa do DActe |
|
| 68 | 67 | * @param array $aEnd array com o endereço do emitente |
| 69 | - * @param number $mododebug 1-SIM e 0-Não (0 default) |
|
| 68 | + * @param integer $mododebug 1-SIM e 0-Não (0 default) |
|
| 70 | 69 | */ |
| 71 | 70 | public function __construct( |
| 72 | 71 | $docXML = '', |
@@ -142,7 +141,7 @@ discard block |
||
| 142 | 141 | * @param type $orientacao |
| 143 | 142 | * @param type $papel |
| 144 | 143 | * @param type $logoAlign |
| 145 | - * @return type |
|
| 144 | + * @return string |
|
| 146 | 145 | */ |
| 147 | 146 | public function monta($orientacao = '', $papel = 'A4', $logoAlign = 'C', $classPDF = false) |
| 148 | 147 | { |
@@ -244,10 +243,10 @@ discard block |
||
| 244 | 243 | |
| 245 | 244 | /** |
| 246 | 245 | * header |
| 247 | - * @param type $x |
|
| 248 | - * @param type $y |
|
| 249 | - * @param type $pag |
|
| 250 | - * @return type |
|
| 246 | + * @param integer $x |
|
| 247 | + * @param integer $y |
|
| 248 | + * @param integer $pag |
|
| 249 | + * @return double |
|
| 251 | 250 | */ |
| 252 | 251 | private function headerCCe($x, $y, $pag) |
| 253 | 252 | { |
@@ -437,7 +436,7 @@ discard block |
||
| 437 | 436 | |
| 438 | 437 | /** |
| 439 | 438 | * footer |
| 440 | - * @param type $x |
|
| 439 | + * @param integer $x |
|
| 441 | 440 | * @param type $y |
| 442 | 441 | */ |
| 443 | 442 | private function footerCCe($x, $y) |
@@ -15,7 +15,6 @@ |
||
| 15 | 15 | * @author Roberto L. Machado <linux.rlm at gmail dot com> |
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | -use Exception; |
|
| 19 | 18 | use NFePHP\DA\Legacy\Dom; |
| 20 | 19 | use NFePHP\DA\Legacy\Pdf; |
| 21 | 20 | use NFePHP\DA\Legacy\Common; |
@@ -56,18 +56,18 @@ |
||
| 56 | 56 | private $infCanc; |
| 57 | 57 | private $retCancCte; |
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - *__construct |
|
| 61 | - * @param string $docXML Arquivo XML da cce |
|
| 62 | - * @param string $sOrientacao (Opcional) Orientação da impressão P-retrato L-Paisagem |
|
| 63 | - * @param string $sPapel Tamanho do papel (Ex. A4) |
|
| 64 | - * @param string $sPathLogo Caminho para o arquivo do logo |
|
| 65 | - * @param string $sDestino Estabelece a direção do envio do documento PDF I-browser D-browser com download S- |
|
| 66 | - * @param string $sDirPDF Caminho para o diretorio de armazenamento dos arquivos PDF |
|
| 67 | - * @param string $fonteDACTE Nome da fonte alternativa do DActe |
|
| 68 | - * @param array $aEnd array com o endereço do emitente |
|
| 69 | - * @param number $mododebug 1-SIM e 0-Não (0 default) |
|
| 70 | - */ |
|
| 59 | + /** |
|
| 60 | + *__construct |
|
| 61 | + * @param string $docXML Arquivo XML da cce |
|
| 62 | + * @param string $sOrientacao (Opcional) Orientação da impressão P-retrato L-Paisagem |
|
| 63 | + * @param string $sPapel Tamanho do papel (Ex. A4) |
|
| 64 | + * @param string $sPathLogo Caminho para o arquivo do logo |
|
| 65 | + * @param string $sDestino Estabelece a direção do envio do documento PDF I-browser D-browser com download S- |
|
| 66 | + * @param string $sDirPDF Caminho para o diretorio de armazenamento dos arquivos PDF |
|
| 67 | + * @param string $fonteDACTE Nome da fonte alternativa do DActe |
|
| 68 | + * @param array $aEnd array com o endereço do emitente |
|
| 69 | + * @param number $mododebug 1-SIM e 0-Não (0 default) |
|
| 70 | + */ |
|
| 71 | 71 | public function __construct( |
| 72 | 72 | $docXML = '', |
| 73 | 73 | $sOrientacao = '', |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | } |
| 128 | 128 | $this->id = str_replace('ID', '', $this->infCanc->getAttribute("Id")); |
| 129 | 129 | $this->chCTe = $this->infCanc->getElementsByTagName("chCTe")->item(0)->nodeValue; |
| 130 | - $this->aEnd['CNPJ']=substr($this->chCTe, 6, 14); |
|
| 130 | + $this->aEnd['CNPJ'] = substr($this->chCTe, 6, 14); |
|
| 131 | 131 | $this->tpAmb = $this->infCanc->getElementsByTagName("tpAmb")->item(0)->nodeValue; |
| 132 | 132 | $this->xJust = $this->infCanc->getElementsByTagName("xJust")->item(0)->nodeValue; |
| 133 | 133 | $this->dhEvento = $this->retCancCTe->getElementsByTagName("dhRecbto")->item(0)->nodeValue; |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | $this->orientacao = $orientacao; |
| 180 | 180 | $this->papel = $papel; |
| 181 | 181 | $this->logoAlign = $logoAlign; |
| 182 | - if ($classPDF!==false) { |
|
| 182 | + if ($classPDF !== false) { |
|
| 183 | 183 | $this->pdf = $classPDF; |
| 184 | 184 | } else { |
| 185 | 185 | $this->pdf = new Pdf($this->orientacao, 'mm', $this->papel); |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | // posição inicial do relatorio |
| 192 | 192 | $xInic = 1; |
| 193 | 193 | $yInic = 1; |
| 194 | - if ($this->papel =='A4') { |
|
| 194 | + if ($this->papel == 'A4') { |
|
| 195 | 195 | $maxW = 210; |
| 196 | 196 | $maxH = 297; |
| 197 | 197 | } |
@@ -202,15 +202,15 @@ discard block |
||
| 202 | 202 | // posição inicial do relatorio |
| 203 | 203 | $xInic = 5; |
| 204 | 204 | $yInic = 5; |
| 205 | - if ($papel =='A4') { |
|
| 205 | + if ($papel == 'A4') { |
|
| 206 | 206 | $maxH = 210; |
| 207 | 207 | $maxW = 297; |
| 208 | 208 | } |
| 209 | 209 | } |
| 210 | 210 | //largura imprimivel em mm |
| 211 | - $this->wPrint = $maxW-($margEsq+$xInic); |
|
| 211 | + $this->wPrint = $maxW - ($margEsq + $xInic); |
|
| 212 | 212 | //comprimento imprimivel em mm |
| 213 | - $this->hPrint = $maxH-($margSup+$yInic); |
|
| 213 | + $this->hPrint = $maxH - ($margSup + $yInic); |
|
| 214 | 214 | // estabelece contagem de paginas |
| 215 | 215 | $this->pdf->aliasNbPages(); |
| 216 | 216 | // fixa as margens |
@@ -230,12 +230,12 @@ discard block |
||
| 230 | 230 | //coloca o cabeçalho |
| 231 | 231 | $y = $this->headerCCe($x, $y, $pag); |
| 232 | 232 | //coloca os dados da CCe |
| 233 | - $y = $this->bodyCCe($x, $y+15); |
|
| 233 | + $y = $this->bodyCCe($x, $y + 15); |
|
| 234 | 234 | //coloca os dados da CCe |
| 235 | - $y = $this->footerCCe($x, $y+$this->hPrint-20); |
|
| 235 | + $y = $this->footerCCe($x, $y + $this->hPrint - 20); |
|
| 236 | 236 | //retorna o ID do evento |
| 237 | - if ($classPDF!==false) { |
|
| 238 | - $aR = ['id'=>$this->id,'classe_PDF'=>$this->pdf]; |
|
| 237 | + if ($classPDF !== false) { |
|
| 238 | + $aR = ['id'=>$this->id, 'classe_PDF'=>$this->pdf]; |
|
| 239 | 239 | return $aR; |
| 240 | 240 | } else { |
| 241 | 241 | return $this->id; |
@@ -256,14 +256,14 @@ discard block |
||
| 256 | 256 | $maxW = $this->wPrint; |
| 257 | 257 | //############################################################# |
| 258 | 258 | //coluna esquerda identificação do emitente |
| 259 | - $w = round($maxW*0.41, 0);// 80; |
|
| 259 | + $w = round($maxW * 0.41, 0); // 80; |
|
| 260 | 260 | if ($this->orientacao == 'P') { |
| 261 | - $aFont = array('font'=>$this->fontePadrao,'size'=>6,'style'=>'I'); |
|
| 261 | + $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'); |
|
| 262 | 262 | } else { |
| 263 | - $aFont = array('font'=>$this->fontePadrao,'size'=>8,'style'=>'B'); |
|
| 263 | + $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'); |
|
| 264 | 264 | } |
| 265 | 265 | $w1 = $w; |
| 266 | - $h=32; |
|
| 266 | + $h = 32; |
|
| 267 | 267 | $oldY += $h; |
| 268 | 268 | $this->pdf->textBox($x, $y, $w, $h); |
| 269 | 269 | $texto = 'IDENTIFICAÇÃO DO EMITENTE'; |
@@ -271,147 +271,147 @@ discard block |
||
| 271 | 271 | if (is_file($this->logomarca)) { |
| 272 | 272 | $logoInfo = getimagesize($this->logomarca); |
| 273 | 273 | //largura da imagem em mm |
| 274 | - $logoWmm = ($logoInfo[0]/72)*25.4; |
|
| 274 | + $logoWmm = ($logoInfo[0] / 72) * 25.4; |
|
| 275 | 275 | //altura da imagem em mm |
| 276 | - $logoHmm = ($logoInfo[1]/72)*25.4; |
|
| 277 | - if ($this->logoAlign=='L') { |
|
| 278 | - $nImgW = round($w/3, 0); |
|
| 279 | - $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0); |
|
| 280 | - $xImg = $x+1; |
|
| 281 | - $yImg = round(($h-$nImgH)/2, 0)+$y; |
|
| 276 | + $logoHmm = ($logoInfo[1] / 72) * 25.4; |
|
| 277 | + if ($this->logoAlign == 'L') { |
|
| 278 | + $nImgW = round($w / 3, 0); |
|
| 279 | + $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0); |
|
| 280 | + $xImg = $x + 1; |
|
| 281 | + $yImg = round(($h - $nImgH) / 2, 0) + $y; |
|
| 282 | 282 | //estabelecer posições do texto |
| 283 | - $x1 = round($xImg + $nImgW +1, 0); |
|
| 284 | - $y1 = round($h/3+$y, 0); |
|
| 285 | - $tw = round(2*$w/3, 0); |
|
| 283 | + $x1 = round($xImg + $nImgW + 1, 0); |
|
| 284 | + $y1 = round($h / 3 + $y, 0); |
|
| 285 | + $tw = round(2 * $w / 3, 0); |
|
| 286 | 286 | } |
| 287 | - if ($this->logoAlign=='C') { |
|
| 288 | - $nImgH = round($h/3, 0); |
|
| 289 | - $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0); |
|
| 290 | - $xImg = round(($w-$nImgW)/2+$x, 0); |
|
| 291 | - $yImg = $y+3; |
|
| 287 | + if ($this->logoAlign == 'C') { |
|
| 288 | + $nImgH = round($h / 3, 0); |
|
| 289 | + $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0); |
|
| 290 | + $xImg = round(($w - $nImgW) / 2 + $x, 0); |
|
| 291 | + $yImg = $y + 3; |
|
| 292 | 292 | $x1 = $x; |
| 293 | 293 | $y1 = round($yImg + $nImgH + 1, 0); |
| 294 | 294 | $tw = $w; |
| 295 | 295 | } |
| 296 | - if ($this->logoAlign=='R') { |
|
| 297 | - $nImgW = round($w/3, 0); |
|
| 298 | - $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0); |
|
| 299 | - $xImg = round($x+($w-(1+$nImgW)), 0); |
|
| 300 | - $yImg = round(($h-$nImgH)/2, 0)+$y; |
|
| 296 | + if ($this->logoAlign == 'R') { |
|
| 297 | + $nImgW = round($w / 3, 0); |
|
| 298 | + $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0); |
|
| 299 | + $xImg = round($x + ($w - (1 + $nImgW)), 0); |
|
| 300 | + $yImg = round(($h - $nImgH) / 2, 0) + $y; |
|
| 301 | 301 | $x1 = $x; |
| 302 | - $y1 = round($h/3+$y, 0); |
|
| 303 | - $tw = round(2*$w/3, 0); |
|
| 302 | + $y1 = round($h / 3 + $y, 0); |
|
| 303 | + $tw = round(2 * $w / 3, 0); |
|
| 304 | 304 | } |
| 305 | 305 | $this->pdf->image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, 'jpeg'); |
| 306 | 306 | } else { |
| 307 | 307 | $x1 = $x; |
| 308 | - $y1 = round($h/3+$y, 0); |
|
| 308 | + $y1 = round($h / 3 + $y, 0); |
|
| 309 | 309 | $tw = $w; |
| 310 | 310 | } |
| 311 | 311 | //Nome emitente |
| 312 | - $aFont = array('font'=>$this->fontePadrao,'size'=>12,'style'=>'B'); |
|
| 313 | - $texto = (isset($this->aEnd['razao'])?$this->aEnd['razao']:''); |
|
| 312 | + $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B'); |
|
| 313 | + $texto = (isset($this->aEnd['razao']) ? $this->aEnd['razao'] : ''); |
|
| 314 | 314 | $this->pdf->textBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, ''); |
| 315 | 315 | //endereço |
| 316 | - $y1 = $y1+6; |
|
| 317 | - $aFont = array('font'=>$this->fontePadrao,'size'=>8,'style'=>''); |
|
| 318 | - $lgr = (isset($this->aEnd['logradouro'])?$this->aEnd['logradouro']:''); |
|
| 319 | - $nro = (isset($this->aEnd['numero'])?$this->aEnd['numero']:''); |
|
| 320 | - $cpl = (isset($this->aEnd['complemento'])?$this->aEnd['complemento']:''); |
|
| 321 | - $bairro = (isset($this->aEnd['bairro'])?$this->aEnd['bairro']:''); |
|
| 322 | - $CEP = (isset($this->aEnd['CEP'])?$this->aEnd['CEP']:''); |
|
| 316 | + $y1 = $y1 + 6; |
|
| 317 | + $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>''); |
|
| 318 | + $lgr = (isset($this->aEnd['logradouro']) ? $this->aEnd['logradouro'] : ''); |
|
| 319 | + $nro = (isset($this->aEnd['numero']) ? $this->aEnd['numero'] : ''); |
|
| 320 | + $cpl = (isset($this->aEnd['complemento']) ? $this->aEnd['complemento'] : ''); |
|
| 321 | + $bairro = (isset($this->aEnd['bairro']) ? $this->aEnd['bairro'] : ''); |
|
| 322 | + $CEP = (isset($this->aEnd['CEP']) ? $this->aEnd['CEP'] : ''); |
|
| 323 | 323 | $CEP = $this->format($CEP, "#####-###"); |
| 324 | - $mun = (isset($this->aEnd['municipio'])?$this->aEnd['municipio']:''); |
|
| 325 | - $UF = (isset($this->aEnd['UF'])?$this->aEnd['UF']:''); |
|
| 326 | - $fone = (isset($this->aEnd['telefone'])?$this->aEnd['telefone']:''); |
|
| 327 | - $email = (isset($this->aEnd['email'])?$this->aEnd['email']:''); |
|
| 324 | + $mun = (isset($this->aEnd['municipio']) ? $this->aEnd['municipio'] : ''); |
|
| 325 | + $UF = (isset($this->aEnd['UF']) ? $this->aEnd['UF'] : ''); |
|
| 326 | + $fone = (isset($this->aEnd['telefone']) ? $this->aEnd['telefone'] : ''); |
|
| 327 | + $email = (isset($this->aEnd['email']) ? $this->aEnd['email'] : ''); |
|
| 328 | 328 | $foneLen = strlen($fone); |
| 329 | 329 | if ($foneLen > 0) { |
| 330 | - $fone2 = substr($fone, 0, $foneLen-4); |
|
| 331 | - $fone1 = substr($fone, 0, $foneLen-8); |
|
| 330 | + $fone2 = substr($fone, 0, $foneLen - 4); |
|
| 331 | + $fone1 = substr($fone, 0, $foneLen - 8); |
|
| 332 | 332 | $fone = '(' . $fone1 . ') ' . substr($fone2, -4) . '-' . substr($fone, -4); |
| 333 | 333 | } else { |
| 334 | 334 | $fone = ''; |
| 335 | 335 | } |
| 336 | 336 | if ($email != '') { |
| 337 | - $email = 'Email: '.$email; |
|
| 337 | + $email = 'Email: ' . $email; |
|
| 338 | 338 | } |
| 339 | 339 | $texto = ""; |
| 340 | - $tmp_txt=trim(($lgr!=''?"$lgr, ":'').($nro!=0?$nro:"SN").($cpl!=''?" - $cpl":'')); |
|
| 341 | - $tmp_txt=($tmp_txt=='SN'?'':$tmp_txt); |
|
| 342 | - $texto .= ($texto!='' && $tmp_txt!=''?"\n":'').$tmp_txt; |
|
| 343 | - $tmp_txt=trim($bairro . ($bairro!='' && $CEP!=''?" - ":'') . $CEP); |
|
| 344 | - $texto .= ($texto!='' && $tmp_txt!=''?"\n":'').$tmp_txt; |
|
| 345 | - $tmp_txt=$mun; |
|
| 346 | - $tmp_txt.=($tmp_txt!='' && $UF!=''?" - ":'').$UF; |
|
| 347 | - $tmp_txt.=($tmp_txt!='' && $fone!=''?" - ":'').$fone; |
|
| 348 | - $texto .= ($texto!='' && $tmp_txt!=''?"\n":'').$tmp_txt; |
|
| 349 | - $tmp_txt=$email; |
|
| 350 | - $texto .= ($texto!='' && $tmp_txt!=''?"\n":'').$tmp_txt; |
|
| 351 | - $this->pdf->textBox($x1, $y1-2, $tw, 8, $texto, $aFont, 'T', 'C', 0, ''); |
|
| 340 | + $tmp_txt = trim(($lgr != '' ? "$lgr, " : '') . ($nro != 0 ? $nro : "SN") . ($cpl != '' ? " - $cpl" : '')); |
|
| 341 | + $tmp_txt = ($tmp_txt == 'SN' ? '' : $tmp_txt); |
|
| 342 | + $texto .= ($texto != '' && $tmp_txt != '' ? "\n" : '') . $tmp_txt; |
|
| 343 | + $tmp_txt = trim($bairro . ($bairro != '' && $CEP != '' ? " - " : '') . $CEP); |
|
| 344 | + $texto .= ($texto != '' && $tmp_txt != '' ? "\n" : '') . $tmp_txt; |
|
| 345 | + $tmp_txt = $mun; |
|
| 346 | + $tmp_txt .= ($tmp_txt != '' && $UF != '' ? " - " : '') . $UF; |
|
| 347 | + $tmp_txt .= ($tmp_txt != '' && $fone != '' ? " - " : '') . $fone; |
|
| 348 | + $texto .= ($texto != '' && $tmp_txt != '' ? "\n" : '') . $tmp_txt; |
|
| 349 | + $tmp_txt = $email; |
|
| 350 | + $texto .= ($texto != '' && $tmp_txt != '' ? "\n" : '') . $tmp_txt; |
|
| 351 | + $this->pdf->textBox($x1, $y1 - 2, $tw, 8, $texto, $aFont, 'T', 'C', 0, ''); |
|
| 352 | 352 | //################################################## |
| 353 | 353 | $w2 = round($maxW - $w, 0); |
| 354 | 354 | $x += $w; |
| 355 | 355 | $this->pdf->textBox($x, $y, $w2, $h); |
| 356 | 356 | $y1 = $y + $h; |
| 357 | - $aFont = array('font'=>$this->fontePadrao,'size'=>16,'style'=>'B'); |
|
| 358 | - $this->pdf->textBox($x, $y+2, $w2, 8, 'Representação Gráfica de ProtCancCTe', $aFont, 'T', 'C', 0, ''); |
|
| 359 | - $aFont = array('font'=>$this->fontePadrao,'size'=>12,'style'=>'I'); |
|
| 360 | - $this->pdf->textBox($x, $y+7, $w2, 8, '(Protocolo Cancelamento de CTe)', $aFont, 'T', 'C', 0, ''); |
|
| 357 | + $aFont = array('font'=>$this->fontePadrao, 'size'=>16, 'style'=>'B'); |
|
| 358 | + $this->pdf->textBox($x, $y + 2, $w2, 8, 'Representação Gráfica de ProtCancCTe', $aFont, 'T', 'C', 0, ''); |
|
| 359 | + $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'I'); |
|
| 360 | + $this->pdf->textBox($x, $y + 7, $w2, 8, '(Protocolo Cancelamento de CTe)', $aFont, 'T', 'C', 0, ''); |
|
| 361 | 361 | $tsHora = $this->toTimestamp($this->dhEvento); |
| 362 | - $texto = 'Criado em : '. date('d/m/Y H:i:s', $tsHora); |
|
| 363 | - $this->pdf->textBox($x, $y+20, $w2, 8, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 362 | + $texto = 'Criado em : ' . date('d/m/Y H:i:s', $tsHora); |
|
| 363 | + $this->pdf->textBox($x, $y + 20, $w2, 8, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 364 | 364 | $tsHora = $this->toTimestamp($this->dhRegEvento); |
| 365 | - $texto = 'Prococolo: '.$this->nProt.' - Registrado na SEFAZ em: '.date('d/m/Y H:i:s', $tsHora); |
|
| 366 | - $this->pdf->textBox($x, $y+25, $w2, 8, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 365 | + $texto = 'Prococolo: ' . $this->nProt . ' - Registrado na SEFAZ em: ' . date('d/m/Y H:i:s', $tsHora); |
|
| 366 | + $this->pdf->textBox($x, $y + 25, $w2, 8, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 367 | 367 | //#################################################### |
| 368 | 368 | $x = $oldX; |
| 369 | 369 | $this->pdf->textBox($x, $y1, $maxW, 33); |
| 370 | - $sY = $y1+23; |
|
| 370 | + $sY = $y1 + 23; |
|
| 371 | 371 | $texto = 'De acordo com as determinações legais vigentes, vimos por meio desta ' |
| 372 | 372 | . 'comunicar-lhe que o Conhecimento de Transporte Eletrônico, abaixo ' |
| 373 | 373 | . 'referenciada, encontra-se cancelada, solicitamos que sejam aplicadas ' |
| 374 | 374 | . 'essas correções ao executar seus lançamentos fiscais.'; |
| 375 | - $aFont = array('font'=>$this->fontePadrao,'size'=>10,'style'=>''); |
|
| 376 | - $this->pdf->textBox($x+5, $y1, $maxW-5, 20, $texto, $aFont, 'T', 'L', 0, '', false); |
|
| 375 | + $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>''); |
|
| 376 | + $this->pdf->textBox($x + 5, $y1, $maxW - 5, 20, $texto, $aFont, 'T', 'L', 0, '', false); |
|
| 377 | 377 | //############################################ |
| 378 | 378 | $x = $oldX; |
| 379 | 379 | $y = $y1; |
| 380 | 380 | $numNF = substr($this->chCTe, 25, 9); |
| 381 | 381 | $serie = substr($this->chCTe, 22, 3); |
| 382 | 382 | $numNF = $this->format($numNF, "###.###.###"); |
| 383 | - $texto = "Conhecimento: " . $numNF .' - Série: '.$serie; |
|
| 384 | - $this->pdf->textBox($x+2, $y+11, $w2, 8, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 383 | + $texto = "Conhecimento: " . $numNF . ' - Série: ' . $serie; |
|
| 384 | + $this->pdf->textBox($x + 2, $y + 11, $w2, 8, $texto, $aFont, 'T', 'L', 0, ''); |
|
| 385 | 385 | $bW = 87; |
| 386 | 386 | $bH = 15; |
| 387 | 387 | $x = 55; |
| 388 | - $y = $y1+10; |
|
| 388 | + $y = $y1 + 10; |
|
| 389 | 389 | $w = $maxW; |
| 390 | 390 | $this->pdf->setFillColor(0, 0, 0); |
| 391 | - $this->pdf->code128($x+(($w-$bW)/2), $y+2, $this->chCTe, $bW, $bH); |
|
| 391 | + $this->pdf->code128($x + (($w - $bW) / 2), $y + 2, $this->chCTe, $bW, $bH); |
|
| 392 | 392 | $this->pdf->setFillColor(255, 255, 255); |
| 393 | - $y1 = $y+2+$bH; |
|
| 394 | - $aFont = array('font'=>$this->fontePadrao,'size'=>10,'style'=>''); |
|
| 393 | + $y1 = $y + 2 + $bH; |
|
| 394 | + $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>''); |
|
| 395 | 395 | $texto = $this->format($this->chCTe, $this->formatoChave); |
| 396 | - $this->pdf->textBox($x, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
| 396 | + $this->pdf->textBox($x, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
| 397 | 397 | $retVal = $sY; |
| 398 | 398 | //indicar sem valor |
| 399 | 399 | if ($this->tpAmb != 1) { |
| 400 | 400 | $x = 10; |
| 401 | 401 | if ($this->orientacao == 'P') { |
| 402 | - $y = round($this->hPrint*2/3, 0); |
|
| 402 | + $y = round($this->hPrint * 2 / 3, 0); |
|
| 403 | 403 | } else { |
| 404 | - $y = round($this->hPrint/2, 0); |
|
| 404 | + $y = round($this->hPrint / 2, 0); |
|
| 405 | 405 | } |
| 406 | 406 | $h = 5; |
| 407 | - $w = $maxW-(2*$x); |
|
| 407 | + $w = $maxW - (2 * $x); |
|
| 408 | 408 | $this->pdf->setTextColor(90, 90, 90); |
| 409 | 409 | $texto = "SEM VALOR FISCAL"; |
| 410 | - $aFont = array('font'=>$this->fontePadrao,'size'=>48,'style'=>'B'); |
|
| 410 | + $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'); |
|
| 411 | 411 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
| 412 | - $aFont = array('font'=>$this->fontePadrao,'size'=>30,'style'=>'B'); |
|
| 412 | + $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B'); |
|
| 413 | 413 | $texto = "AMBIENTE DE HOMOLOGAÇÃO"; |
| 414 | - $this->pdf->textBox($x, $y+14, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
|
| 414 | + $this->pdf->textBox($x, $y + 14, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
|
| 415 | 415 | $this->pdf->setTextColor(0, 0, 0); |
| 416 | 416 | } |
| 417 | 417 | return $retVal; |
@@ -426,13 +426,13 @@ discard block |
||
| 426 | 426 | { |
| 427 | 427 | $maxW = $this->wPrint; |
| 428 | 428 | $texto = 'JUSTIFICATIVA DO CANCELAMENTO'; |
| 429 | - $aFont = array('font'=>$this->fontePadrao,'size'=>10,'style'=>'B'); |
|
| 429 | + $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'); |
|
| 430 | 430 | $this->pdf->textBox($x, $y, $maxW, 5, $texto, $aFont, 'T', 'L', 0, '', false); |
| 431 | 431 | $y += 5; |
| 432 | 432 | $this->pdf->textBox($x, $y, $maxW, 210); |
| 433 | 433 | $texto = $this->xJust; |
| 434 | - $aFont = array('font'=>$this->fontePadrao,'size'=>12,'style'=>'B'); |
|
| 435 | - $this->pdf->textBox($x+2, $y+2, $maxW-2, 150, $texto, $aFont, 'T', 'L', 0, '', false); |
|
| 434 | + $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B'); |
|
| 435 | + $this->pdf->textBox($x + 2, $y + 2, $maxW - 2, 150, $texto, $aFont, 'T', 'L', 0, '', false); |
|
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | /** |
@@ -449,17 +449,17 @@ discard block |
||
| 449 | 449 | . "validade fiscal.\n O Protocolo deve ser recebido e mantido" |
| 450 | 450 | . " em arquivo eletrônico XML e pode ser consultada através dos" |
| 451 | 451 | . " Portais das SEFAZ."; |
| 452 | - $aFont = array('font'=>$this->fontePadrao,'size'=>10,'style'=>'I'); |
|
| 452 | + $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'I'); |
|
| 453 | 453 | $this->pdf->textBox($x, $y, $w, 20, $texto, $aFont, 'T', 'C', 0, '', false); |
| 454 | - $y = $this->hPrint -4; |
|
| 455 | - $texto = "Impresso em ". date('d/m/Y H:i:s'); |
|
| 456 | - $w = $this->wPrint-4; |
|
| 457 | - $aFont = array('font'=>$this->fontePadrao,'size'=>6,'style'=>'I'); |
|
| 454 | + $y = $this->hPrint - 4; |
|
| 455 | + $texto = "Impresso em " . date('d/m/Y H:i:s'); |
|
| 456 | + $w = $this->wPrint - 4; |
|
| 457 | + $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'); |
|
| 458 | 458 | $this->pdf->textBox($x, $y, $w, 4, $texto, $aFont, 'T', 'L', 0, ''); |
| 459 | 459 | $texto = "DaCanccteNFePHP ver. " |
| 460 | 460 | . $this->version |
| 461 | 461 | . " Powered by NFePHP (GNU/GPLv3 GNU/LGPLv3) © www.nfephp.org"; |
| 462 | - $aFont = array('font'=>$this->fontePadrao,'size'=>6,'style'=>'I'); |
|
| 462 | + $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'); |
|
| 463 | 463 | $this->pdf->textBox($x, $y, $w, 4, $texto, $aFont, 'T', 'R', 0, 'http://www.nfephp.org'); |
| 464 | 464 | } |
| 465 | 465 | |
@@ -7,6 +7,9 @@ discard block |
||
| 7 | 7 | * Author: Olivier PLATHEY * |
| 8 | 8 | *******************************************************************************/ |
| 9 | 9 | |
| 10 | +/** |
|
| 11 | + * @param string $enc |
|
| 12 | + */ |
|
| 10 | 13 | function readMap($enc) |
| 11 | 14 | { |
| 12 | 15 | //Read a map file |
@@ -159,6 +162,9 @@ discard block |
||
| 159 | 162 | return $fm; |
| 160 | 163 | } |
| 161 | 164 | |
| 165 | +/** |
|
| 166 | + * @param boolean $symbolic |
|
| 167 | + */ |
|
| 162 | 168 | function makeFontDescriptor($fm, $symbolic) |
| 163 | 169 | { |
| 164 | 170 | //Ascent |
@@ -263,6 +269,11 @@ discard block |
||
| 263 | 269 | return rtrim($s); |
| 264 | 270 | } |
| 265 | 271 | |
| 272 | +/** |
|
| 273 | + * @param string $file |
|
| 274 | + * @param string $s |
|
| 275 | + * @param string $mode |
|
| 276 | + */ |
|
| 266 | 277 | function saveToFile($file, $s, $mode) |
| 267 | 278 | { |
| 268 | 279 | $f = fopen($file, 'w'.$mode); |
@@ -10,23 +10,23 @@ discard block |
||
| 10 | 10 | function readMap($enc) |
| 11 | 11 | { |
| 12 | 12 | //Read a map file |
| 13 | - $file = dirname(__FILE__).'/'.strtolower($enc).'.map'; |
|
| 13 | + $file = dirname(__FILE__) . '/' . strtolower($enc) . '.map'; |
|
| 14 | 14 | $a = file($file); |
| 15 | 15 | if (empty($a)) { |
| 16 | - die('<b>Error:</b> encoding not found: '.$enc); |
|
| 16 | + die('<b>Error:</b> encoding not found: ' . $enc); |
|
| 17 | 17 | } |
| 18 | 18 | $cc2gn = array(); |
| 19 | 19 | foreach ($a as $l) { |
| 20 | - if ($l[0]=='!') { |
|
| 20 | + if ($l[0] == '!') { |
|
| 21 | 21 | $e = preg_split('/[ \\t]+/', rtrim($l)); |
| 22 | 22 | $cc = hexdec(substr($e[0], 1)); |
| 23 | 23 | $gn = $e[2]; |
| 24 | 24 | $cc2gn[$cc] = $gn; |
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | - for ($i=0; $i<=255; $i++) { |
|
| 27 | + for ($i = 0; $i <= 255; $i++) { |
|
| 28 | 28 | if (!isset($cc2gn[$i])) { |
| 29 | - $cc2gn[$i]='.notdef'; |
|
| 29 | + $cc2gn[$i] = '.notdef'; |
|
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | return $cc2gn; |
@@ -78,14 +78,14 @@ discard block |
||
| 78 | 78 | ]; |
| 79 | 79 | foreach ($a as $l) { |
| 80 | 80 | $e = explode(' ', rtrim($l)); |
| 81 | - if (count($e)<2) { |
|
| 81 | + if (count($e) < 2) { |
|
| 82 | 82 | continue; |
| 83 | 83 | } |
| 84 | 84 | $code = $e[0]; |
| 85 | 85 | $param = $e[1]; |
| 86 | 86 | if ($code == 'C') { |
| 87 | 87 | //Character metrics |
| 88 | - $cc = (int)$e[1]; |
|
| 88 | + $cc = (int) $e[1]; |
|
| 89 | 89 | $w = $e[4]; |
| 90 | 90 | $gn = $e[7]; |
| 91 | 91 | if (substr($gn, -4) == '20AC') { |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | //Fix incorrect glyph name |
| 96 | 96 | foreach ($map as $c => $n) { |
| 97 | 97 | if ($n == $fix[$gn]) { |
| 98 | - $map[$c]=$gn; |
|
| 98 | + $map[$c] = $gn; |
|
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | } else { |
| 106 | 106 | $widths[$gn] = $w; |
| 107 | 107 | if ($gn == 'X') { |
| 108 | - $fm['CapXHeight']=$e[13]; |
|
| 108 | + $fm['CapXHeight'] = $e[13]; |
|
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | if ($gn == '.notdef') { |
@@ -116,23 +116,23 @@ discard block |
||
| 116 | 116 | } elseif ($code == 'Weight') { |
| 117 | 117 | $fm['Weight'] = $param; |
| 118 | 118 | } elseif ($code == 'ItalicAngle') { |
| 119 | - $fm['ItalicAngle'] = (double)$param; |
|
| 119 | + $fm['ItalicAngle'] = (double) $param; |
|
| 120 | 120 | } elseif ($code == 'Ascender') { |
| 121 | - $fm['Ascender'] = (int)$param; |
|
| 121 | + $fm['Ascender'] = (int) $param; |
|
| 122 | 122 | } elseif ($code == 'Descender') { |
| 123 | - $fm['Descender'] = (int)$param; |
|
| 123 | + $fm['Descender'] = (int) $param; |
|
| 124 | 124 | } elseif ($code == 'UnderlineThickness') { |
| 125 | - $fm['UnderlineThickness'] = (int)$param; |
|
| 125 | + $fm['UnderlineThickness'] = (int) $param; |
|
| 126 | 126 | } elseif ($code == 'UnderlinePosition') { |
| 127 | - $fm['UnderlinePosition'] = (int)$param; |
|
| 127 | + $fm['UnderlinePosition'] = (int) $param; |
|
| 128 | 128 | } elseif ($code == 'IsFixedPitch') { |
| 129 | 129 | $fm['IsFixedPitch'] = ($param == 'true'); |
| 130 | 130 | } elseif ($code == 'FontBBox') { |
| 131 | 131 | $fm['FontBBox'] = array($e[1], $e[2], $e[3], $e[4]); |
| 132 | 132 | } elseif ($code == 'CapHeight') { |
| 133 | - $fm['CapHeight'] = (int)$param; |
|
| 133 | + $fm['CapHeight'] = (int) $param; |
|
| 134 | 134 | } elseif ($code == 'StdVW') { |
| 135 | - $fm['StdVW'] = (int)$param; |
|
| 135 | + $fm['StdVW'] = (int) $param; |
|
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | if (!isset($fm['FontName'])) { |
@@ -146,9 +146,9 @@ discard block |
||
| 146 | 146 | $widths['Delta'] = $widths['increment']; |
| 147 | 147 | } |
| 148 | 148 | //Order widths according to map |
| 149 | - for ($i=0; $i<=255; $i++) { |
|
| 149 | + for ($i = 0; $i <= 255; $i++) { |
|
| 150 | 150 | if (!isset($widths[$map[$i]])) { |
| 151 | - echo '<b>Warning:</b> character '.$map[$i].' is missing<br>'; |
|
| 151 | + echo '<b>Warning:</b> character ' . $map[$i] . ' is missing<br>'; |
|
| 152 | 152 | $widths[$i] = $widths['.notdef']; |
| 153 | 153 | } else { |
| 154 | 154 | $widths[$i] = $widths[$map[$i]]; |
@@ -162,11 +162,11 @@ discard block |
||
| 162 | 162 | function makeFontDescriptor($fm, $symbolic) |
| 163 | 163 | { |
| 164 | 164 | //Ascent |
| 165 | - $asc=(isset($fm['Ascender']) ? $fm['Ascender'] : 1000); |
|
| 166 | - $fd = "array('Ascent'=>".$asc; |
|
| 165 | + $asc = (isset($fm['Ascender']) ? $fm['Ascender'] : 1000); |
|
| 166 | + $fd = "array('Ascent'=>" . $asc; |
|
| 167 | 167 | //Descent |
| 168 | 168 | $desc = (isset($fm['Descender']) ? $fm['Descender'] : -200); |
| 169 | - $fd .= ",'Descent'=>".$desc; |
|
| 169 | + $fd .= ",'Descent'=>" . $desc; |
|
| 170 | 170 | //CapHeight |
| 171 | 171 | if (isset($fm['CapHeight'])) { |
| 172 | 172 | $ch = $fm['CapHeight']; |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | } else { |
| 176 | 176 | $ch = $asc; |
| 177 | 177 | } |
| 178 | - $fd .= ",'CapHeight'=>".$ch; |
|
| 178 | + $fd .= ",'CapHeight'=>" . $ch; |
|
| 179 | 179 | //Flags |
| 180 | 180 | $flags = 0; |
| 181 | 181 | if (isset($fm['IsFixedPitch']) && $fm['IsFixedPitch']) { |
@@ -185,22 +185,22 @@ discard block |
||
| 185 | 185 | $flags += 1 << 2; |
| 186 | 186 | } |
| 187 | 187 | if (!$symbolic) { |
| 188 | - $flags += 1<< 5; |
|
| 188 | + $flags += 1 << 5; |
|
| 189 | 189 | } |
| 190 | - if (isset($fm['ItalicAngle']) && $fm['ItalicAngle']!=0) { |
|
| 190 | + if (isset($fm['ItalicAngle']) && $fm['ItalicAngle'] != 0) { |
|
| 191 | 191 | $flags += 1 << 6; |
| 192 | 192 | } |
| 193 | - $fd.=",'Flags'=>".$flags; |
|
| 193 | + $fd .= ",'Flags'=>" . $flags; |
|
| 194 | 194 | //FontBBox |
| 195 | 195 | if (isset($fm['FontBBox'])) { |
| 196 | 196 | $fbb = $fm['FontBBox']; |
| 197 | 197 | } else { |
| 198 | - $fbb = array(0,$desc-100,1000,$asc+100); |
|
| 198 | + $fbb = array(0, $desc - 100, 1000, $asc + 100); |
|
| 199 | 199 | } |
| 200 | - $fd .= ",'FontBBox'=>'[".$fbb[0].' '.$fbb[1].' '.$fbb[2].' '.$fbb[3]."]'"; |
|
| 200 | + $fd .= ",'FontBBox'=>'[" . $fbb[0] . ' ' . $fbb[1] . ' ' . $fbb[2] . ' ' . $fbb[3] . "]'"; |
|
| 201 | 201 | //ItalicAngle |
| 202 | 202 | $ia = (isset($fm['ItalicAngle']) ? $fm['ItalicAngle'] : 0); |
| 203 | - $fd .= ",'ItalicAngle'=>".$ia; |
|
| 203 | + $fd .= ",'ItalicAngle'=>" . $ia; |
|
| 204 | 204 | //StemV |
| 205 | 205 | if (isset($fm['StdVW'])) { |
| 206 | 206 | $stemv = $fm['StdVW']; |
@@ -209,10 +209,10 @@ discard block |
||
| 209 | 209 | } else { |
| 210 | 210 | $stemv = 70; |
| 211 | 211 | } |
| 212 | - $fd .= ",'StemV'=>".$stemv; |
|
| 212 | + $fd .= ",'StemV'=>" . $stemv; |
|
| 213 | 213 | //MissingWidth |
| 214 | 214 | if (isset($fm['MissingWidth'])) { |
| 215 | - $fd .= ",'MissingWidth'=>".$fm['MissingWidth']; |
|
| 215 | + $fd .= ",'MissingWidth'=>" . $fm['MissingWidth']; |
|
| 216 | 216 | } |
| 217 | 217 | $fd .= ')'; |
| 218 | 218 | return $fd; |
@@ -223,21 +223,21 @@ discard block |
||
| 223 | 223 | //Make character width array |
| 224 | 224 | $s = "array(\n\t"; |
| 225 | 225 | $cw = $fm['Widths']; |
| 226 | - for ($i=0; $i<=255; $i++) { |
|
| 226 | + for ($i = 0; $i <= 255; $i++) { |
|
| 227 | 227 | if (chr($i) == "'") { |
| 228 | 228 | $s .= "'\\''"; |
| 229 | 229 | } elseif (chr($i) == "\\") { |
| 230 | 230 | $s .= "'\\\\'"; |
| 231 | 231 | } elseif ($i >= 32 && $i <= 126) { |
| 232 | - $s .= "'".chr($i)."'"; |
|
| 232 | + $s .= "'" . chr($i) . "'"; |
|
| 233 | 233 | } else { |
| 234 | 234 | $s .= "chr($i)"; |
| 235 | 235 | } |
| 236 | - $s .= '=>'.$fm['Widths'][$i]; |
|
| 236 | + $s .= '=>' . $fm['Widths'][$i]; |
|
| 237 | 237 | if ($i < 255) { |
| 238 | 238 | $s .= ','; |
| 239 | 239 | } |
| 240 | - if (($i+1)%22==0) { |
|
| 240 | + if (($i + 1) % 22 == 0) { |
|
| 241 | 241 | $s .= "\n\t"; |
| 242 | 242 | } |
| 243 | 243 | } |
@@ -251,13 +251,13 @@ discard block |
||
| 251 | 251 | $ref = readMap('cp1252'); |
| 252 | 252 | $s = ''; |
| 253 | 253 | $last = 0; |
| 254 | - for ($i=32; $i<=255; $i++) { |
|
| 255 | - if ($map[$i]!=$ref[$i]) { |
|
| 256 | - if ($i!=$last+1) { |
|
| 257 | - $s .= $i.' '; |
|
| 254 | + for ($i = 32; $i <= 255; $i++) { |
|
| 255 | + if ($map[$i] != $ref[$i]) { |
|
| 256 | + if ($i != $last + 1) { |
|
| 257 | + $s .= $i . ' '; |
|
| 258 | 258 | } |
| 259 | 259 | $last = $i; |
| 260 | - $s .= '/'.$map[$i].' '; |
|
| 260 | + $s .= '/' . $map[$i] . ' '; |
|
| 261 | 261 | } |
| 262 | 262 | } |
| 263 | 263 | return rtrim($s); |
@@ -265,9 +265,9 @@ discard block |
||
| 265 | 265 | |
| 266 | 266 | function saveToFile($file, $s, $mode) |
| 267 | 267 | { |
| 268 | - $f = fopen($file, 'w'.$mode); |
|
| 268 | + $f = fopen($file, 'w' . $mode); |
|
| 269 | 269 | if (!$f) { |
| 270 | - die('Can\'t write to file '.$file); |
|
| 270 | + die('Can\'t write to file ' . $file); |
|
| 271 | 271 | } |
| 272 | 272 | fwrite($f, $s, strlen($s)); |
| 273 | 273 | fclose($f); |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | //Check if font license allows embedding |
| 291 | 291 | $f = fopen($file, 'rb'); |
| 292 | 292 | if (!$f) { |
| 293 | - die('<b>Error:</b> Can\'t open '.$file); |
|
| 293 | + die('<b>Error:</b> Can\'t open ' . $file); |
|
| 294 | 294 | } |
| 295 | 295 | //Extract number of tables |
| 296 | 296 | fseek($f, 4, SEEK_CUR); |
@@ -298,8 +298,8 @@ discard block |
||
| 298 | 298 | fseek($f, 6, SEEK_CUR); |
| 299 | 299 | //Seek OS/2 table |
| 300 | 300 | $found = false; |
| 301 | - for ($i=0; $i<$nb; $i++) { |
|
| 302 | - if (fread($f, 4)=='OS/2') { |
|
| 301 | + for ($i = 0; $i < $nb; $i++) { |
|
| 302 | + if (fread($f, 4) == 'OS/2') { |
|
| 303 | 303 | $found = true; |
| 304 | 304 | break; |
| 305 | 305 | } |
@@ -315,9 +315,9 @@ discard block |
||
| 315 | 315 | //Extract fsType flags |
| 316 | 316 | fseek($f, 8, SEEK_CUR); |
| 317 | 317 | $fsType = readShort($f); |
| 318 | - $rl = ($fsType & 0x02)!=0; |
|
| 319 | - $pp = ($fsType & 0x04)!=0; |
|
| 320 | - $e = ($fsType & 0x08)!=0; |
|
| 318 | + $rl = ($fsType & 0x02) != 0; |
|
| 319 | + $pp = ($fsType & 0x04) != 0; |
|
| 320 | + $e = ($fsType & 0x08) != 0; |
|
| 321 | 321 | fclose($f); |
| 322 | 322 | if ($rl && !$pp && !$e) { |
| 323 | 323 | echo '<b>Warning:</b> font license does not allow embedding'; |
@@ -341,71 +341,71 @@ discard block |
||
| 341 | 341 | if ($enc) { |
| 342 | 342 | $map = readMap($enc); |
| 343 | 343 | foreach ($patch as $cc => $gn) { |
| 344 | - $map[$cc]=$gn; |
|
| 344 | + $map[$cc] = $gn; |
|
| 345 | 345 | } |
| 346 | 346 | } else { |
| 347 | - $map=array(); |
|
| 347 | + $map = array(); |
|
| 348 | 348 | } |
| 349 | 349 | if (!file_exists($afmfile)) { |
| 350 | - die('<b>Error:</b> AFM file not found: '.$afmfile); |
|
| 350 | + die('<b>Error:</b> AFM file not found: ' . $afmfile); |
|
| 351 | 351 | } |
| 352 | 352 | $fm = readAFM($afmfile, $map); |
| 353 | 353 | if ($enc) { |
| 354 | 354 | $diff = makeFontEncoding($map); |
| 355 | 355 | } else { |
| 356 | - $diff=''; |
|
| 356 | + $diff = ''; |
|
| 357 | 357 | } |
| 358 | 358 | $fd = makeFontDescriptor($fm, empty($map)); |
| 359 | 359 | //Find font type |
| 360 | 360 | if ($fontfile) { |
| 361 | 361 | $ext = strtolower(substr($fontfile, -3)); |
| 362 | 362 | if ($ext == 'ttf') { |
| 363 | - $type='TrueType'; |
|
| 363 | + $type = 'TrueType'; |
|
| 364 | 364 | } elseif ($ext == 'pfb') { |
| 365 | 365 | $type = 'Type1'; |
| 366 | 366 | } else { |
| 367 | - die('<b>Error:</b> unrecognized font file extension: '.$ext); |
|
| 367 | + die('<b>Error:</b> unrecognized font file extension: ' . $ext); |
|
| 368 | 368 | } |
| 369 | 369 | } else { |
| 370 | - if ($type!='TrueType' && $type!='Type1') { |
|
| 371 | - die('<b>Error:</b> incorrect font type: '.$type); |
|
| 370 | + if ($type != 'TrueType' && $type != 'Type1') { |
|
| 371 | + die('<b>Error:</b> incorrect font type: ' . $type); |
|
| 372 | 372 | } |
| 373 | 373 | } |
| 374 | 374 | //Start generation |
| 375 | - $s = '<?php'."\n"; |
|
| 376 | - $s .= '$type=\''.$type."';\n"; |
|
| 377 | - $s .= '$name=\''.$fm['FontName']."';\n"; |
|
| 378 | - $s .= '$desc='.$fd.";\n"; |
|
| 375 | + $s = '<?php' . "\n"; |
|
| 376 | + $s .= '$type=\'' . $type . "';\n"; |
|
| 377 | + $s .= '$name=\'' . $fm['FontName'] . "';\n"; |
|
| 378 | + $s .= '$desc=' . $fd . ";\n"; |
|
| 379 | 379 | if (!isset($fm['UnderlinePosition'])) { |
| 380 | 380 | $fm['UnderlinePosition'] = -100; |
| 381 | 381 | } |
| 382 | 382 | if (!isset($fm['UnderlineThickness'])) { |
| 383 | 383 | $fm['UnderlineThickness'] = 50; |
| 384 | 384 | } |
| 385 | - $s .= '$up='.$fm['UnderlinePosition'].";\n"; |
|
| 386 | - $s .= '$ut='.$fm['UnderlineThickness'].";\n"; |
|
| 385 | + $s .= '$up=' . $fm['UnderlinePosition'] . ";\n"; |
|
| 386 | + $s .= '$ut=' . $fm['UnderlineThickness'] . ";\n"; |
|
| 387 | 387 | $w = makeWidthArray($fm); |
| 388 | - $s .= '$cw='.$w.";\n"; |
|
| 389 | - $s .= '$enc=\''.$enc."';\n"; |
|
| 390 | - $s.= '$diff=\''.$diff."';\n"; |
|
| 388 | + $s .= '$cw=' . $w . ";\n"; |
|
| 389 | + $s .= '$enc=\'' . $enc . "';\n"; |
|
| 390 | + $s .= '$diff=\'' . $diff . "';\n"; |
|
| 391 | 391 | $basename = substr(basename($afmfile), 0, -4); |
| 392 | 392 | if ($fontfile) { |
| 393 | 393 | //Embedded font |
| 394 | 394 | if (!file_exists($fontfile)) { |
| 395 | - die('<b>Error:</b> font file not found: '.$fontfile); |
|
| 395 | + die('<b>Error:</b> font file not found: ' . $fontfile); |
|
| 396 | 396 | } |
| 397 | - if ($type=='TrueType') { |
|
| 397 | + if ($type == 'TrueType') { |
|
| 398 | 398 | checkTTF($fontfile); |
| 399 | 399 | } |
| 400 | 400 | $f = fopen($fontfile, 'rb'); |
| 401 | 401 | if (!$f) { |
| 402 | - die('<b>Error:</b> Can\'t open '.$fontfile); |
|
| 402 | + die('<b>Error:</b> Can\'t open ' . $fontfile); |
|
| 403 | 403 | } |
| 404 | 404 | $file = fread($f, filesize($fontfile)); |
| 405 | 405 | fclose($f); |
| 406 | 406 | if ($type == 'Type1') { |
| 407 | 407 | //Find first two sections and discard third one |
| 408 | - $header = (ord($file[0])==128); |
|
| 408 | + $header = (ord($file[0]) == 128); |
|
| 409 | 409 | if ($header) { |
| 410 | 410 | //Strip first binary header |
| 411 | 411 | $file = substr($file, 6); |
@@ -414,38 +414,38 @@ discard block |
||
| 414 | 414 | if (!$pos) { |
| 415 | 415 | die('<b>Error:</b> font file does not seem to be valid Type1'); |
| 416 | 416 | } |
| 417 | - $size1 = $pos+6; |
|
| 418 | - if ($header && ord($file[$size1])==128) { |
|
| 417 | + $size1 = $pos + 6; |
|
| 418 | + if ($header && ord($file[$size1]) == 128) { |
|
| 419 | 419 | //Strip second binary header |
| 420 | - $file = substr($file, 0, $size1).substr($file, $size1+6); |
|
| 420 | + $file = substr($file, 0, $size1) . substr($file, $size1 + 6); |
|
| 421 | 421 | } |
| 422 | 422 | $pos = strpos($file, '00000000'); |
| 423 | 423 | if (!$pos) { |
| 424 | 424 | die('<b>Error:</b> font file does not seem to be valid Type1'); |
| 425 | 425 | } |
| 426 | - $size2 = $pos-$size1; |
|
| 427 | - $file = substr($file, 0, $size1+$size2); |
|
| 426 | + $size2 = $pos - $size1; |
|
| 427 | + $file = substr($file, 0, $size1 + $size2); |
|
| 428 | 428 | } |
| 429 | 429 | if (function_exists('gzcompress')) { |
| 430 | - $cmp=$basename.'.z'; |
|
| 430 | + $cmp = $basename . '.z'; |
|
| 431 | 431 | saveToFile($cmp, gzcompress($file), 'b'); |
| 432 | - $s .= '$file=\''.$cmp."';\n"; |
|
| 433 | - echo 'Font file compressed ('.$cmp.')<br>'; |
|
| 432 | + $s .= '$file=\'' . $cmp . "';\n"; |
|
| 433 | + echo 'Font file compressed (' . $cmp . ')<br>'; |
|
| 434 | 434 | } else { |
| 435 | - $s .= '$file=\''.basename($fontfile)."';\n"; |
|
| 435 | + $s .= '$file=\'' . basename($fontfile) . "';\n"; |
|
| 436 | 436 | echo '<b>Notice:</b> font file could not be compressed (zlib extension not available)<br>'; |
| 437 | 437 | } |
| 438 | 438 | if ($type == 'Type1') { |
| 439 | - $s .= '$size1='.$size1.";\n"; |
|
| 440 | - $s .= '$size2='.$size2.";\n"; |
|
| 439 | + $s .= '$size1=' . $size1 . ";\n"; |
|
| 440 | + $s .= '$size2=' . $size2 . ";\n"; |
|
| 441 | 441 | } else { |
| 442 | - $s .= '$originalsize='.filesize($fontfile).";\n"; |
|
| 442 | + $s .= '$originalsize=' . filesize($fontfile) . ";\n"; |
|
| 443 | 443 | } |
| 444 | 444 | } else { |
| 445 | 445 | //Not embedded font |
| 446 | - $s .= '$file='."'';\n"; |
|
| 446 | + $s .= '$file=' . "'';\n"; |
|
| 447 | 447 | } |
| 448 | - $s.="?>\n"; |
|
| 449 | - saveToFile($basename.'.php', $s, 't'); |
|
| 450 | - echo 'Font definition file generated ('.$basename.'.php'.')<br>'; |
|
| 448 | + $s .= "?>\n"; |
|
| 449 | + saveToFile($basename . '.php', $s, 't'); |
|
| 450 | + echo 'Font definition file generated (' . $basename . '.php' . ')<br>'; |
|
| 451 | 451 | } |
@@ -15,8 +15,6 @@ |
||
| 15 | 15 | * @author Roberto L. Machado <linux.rlm at gmail dot com> |
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | -use Exception; |
|
| 19 | -use NFePHP\DA\Legacy\Dom; |
|
| 20 | 18 | use NFePHP\DA\Legacy\Pdf; |
| 21 | 19 | use NFePHP\DA\Legacy\Common; |
| 22 | 20 | |
@@ -99,6 +99,9 @@ discard block |
||
| 99 | 99 | return $this->debugmode; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | + /** |
|
| 103 | + * @param string $xml |
|
| 104 | + */ |
|
| 102 | 105 | protected function loadDoc($xml) |
| 103 | 106 | { |
| 104 | 107 | $this->dom = new \DomDocument; |
@@ -246,7 +249,7 @@ discard block |
||
| 246 | 249 | * @param integer $x |
| 247 | 250 | * @param integer $y |
| 248 | 251 | * @param integer $pag |
| 249 | - * @return integer |
|
| 252 | + * @return double |
|
| 250 | 253 | */ |
| 251 | 254 | private function header( |
| 252 | 255 | $x, |
@@ -511,7 +514,7 @@ discard block |
||
| 511 | 514 | * @param string $nome |
| 512 | 515 | * @param string $destino |
| 513 | 516 | * @param string $printer |
| 514 | - * @return type |
|
| 517 | + * @return string |
|
| 515 | 518 | */ |
| 516 | 519 | public function printDAEventoCTe($nome = '', $destino = 'I', $printer = '') |
| 517 | 520 | { |
@@ -259,7 +259,7 @@ |
||
| 259 | 259 | $maxW = $this->wPrint; |
| 260 | 260 | //#################################################################################### |
| 261 | 261 | //coluna esquerda identificação do emitente |
| 262 | - $w = round($maxW * 0.41, 0);// 80; |
|
| 262 | + $w = round($maxW * 0.41, 0); // 80; |
|
| 263 | 263 | if ($this->orientacao == 'P') { |
| 264 | 264 | $aFont = array('font' => $this->fontePadrao, 'size' => 6, 'style' => 'I'); |
| 265 | 265 | } else { |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | -for ($i=0; $i<=255; $i++) { |
|
| 3 | - $fpdf_charwidths['courier'][chr($i)]=600; |
|
| 2 | +for ($i = 0; $i <= 255; $i++) { |
|
| 3 | + $fpdf_charwidths['courier'][chr($i)] = 600; |
|
| 4 | 4 | } |
| 5 | -$fpdf_charwidths['courierB']=$fpdf_charwidths['courier']; |
|
| 6 | -$fpdf_charwidths['courierI']=$fpdf_charwidths['courier']; |
|
| 7 | -$fpdf_charwidths['courierBI']=$fpdf_charwidths['courier']; |
|
| 5 | +$fpdf_charwidths['courierB'] = $fpdf_charwidths['courier']; |
|
| 6 | +$fpdf_charwidths['courierI'] = $fpdf_charwidths['courier']; |
|
| 7 | +$fpdf_charwidths['courierBI'] = $fpdf_charwidths['courier']; |
|
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | if (substr($xmlString, 0, 1) != '<') { |
| 36 | 36 | throw new InvalidArgumentException($msg); |
| 37 | 37 | } |
| 38 | - if (! $this->loadXML($xmlString, LIBXML_NOBLANKS | LIBXML_NOEMPTYTAG)) { |
|
| 38 | + if (!$this->loadXML($xmlString, LIBXML_NOBLANKS | LIBXML_NOEMPTYTAG)) { |
|
| 39 | 39 | throw new InvalidArgumentException($msg); |
| 40 | 40 | } |
| 41 | 41 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | if (empty($node)) { |
| 77 | 77 | return ''; |
| 78 | 78 | } |
| 79 | - $texto = ! empty($node->getElementsByTagName($name)->item(0)->nodeValue) ? |
|
| 79 | + $texto = !empty($node->getElementsByTagName($name)->item(0)->nodeValue) ? |
|
| 80 | 80 | $node->getElementsByTagName($name)->item(0)->nodeValue : ''; |
| 81 | 81 | return html_entity_decode($texto, ENT_QUOTES, 'UTF-8'); |
| 82 | 82 | } |
@@ -105,9 +105,9 @@ discard block |
||
| 105 | 105 | public function getChave($nodeName = 'infNFe') |
| 106 | 106 | { |
| 107 | 107 | $node = $this->getElementsByTagName($nodeName)->item(0); |
| 108 | - if (! empty($node)) { |
|
| 108 | + if (!empty($node)) { |
|
| 109 | 109 | $chaveId = $node->getAttribute("Id"); |
| 110 | - $chave = preg_replace('/[^0-9]/', '', $chaveId); |
|
| 110 | + $chave = preg_replace('/[^0-9]/', '', $chaveId); |
|
| 111 | 111 | return $chave; |
| 112 | 112 | } |
| 113 | 113 | return ''; |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | public function addArrayChild(&$parent, $arr) |
| 198 | 198 | { |
| 199 | 199 | $num = 0; |
| 200 | - if (! empty($arr) && ! empty($parent)) { |
|
| 200 | + if (!empty($arr) && !empty($parent)) { |
|
| 201 | 201 | foreach ($arr as $node) { |
| 202 | 202 | $this->appChild($parent, $node, ''); |
| 203 | 203 | $num++; |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | |
| 68 | 68 | /** |
| 69 | 69 | * getValue |
| 70 | - * @param DOMElement $node |
|
| 70 | + * @param \DOMNode $node |
|
| 71 | 71 | * @param string $name |
| 72 | 72 | * @return string |
| 73 | 73 | */ |
@@ -15,7 +15,6 @@ |
||
| 15 | 15 | * @author Roberto L. Machado <linux.rlm at gmail dot com> |
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | -use Exception; |
|
| 19 | 18 | use NFePHP\DA\Legacy\Dom; |
| 20 | 19 | use NFePHP\DA\Legacy\Pdf; |
| 21 | 20 | use NFePHP\DA\Legacy\Common; |
@@ -122,6 +122,9 @@ discard block |
||
| 122 | 122 | return $this->pdf->getPdf(); |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | + /** |
|
| 126 | + * @param string $xml |
|
| 127 | + */ |
|
| 125 | 128 | protected function loadDoc($xml) |
| 126 | 129 | { |
| 127 | 130 | $this->dom = new Dom(); |
@@ -241,9 +244,9 @@ discard block |
||
| 241 | 244 | |
| 242 | 245 | /** |
| 243 | 246 | * header |
| 244 | - * @param number $x |
|
| 245 | - * @param number $y |
|
| 246 | - * @param number $pag |
|
| 247 | + * @param integer $x |
|
| 248 | + * @param integer $y |
|
| 249 | + * @param integer $pag |
|
| 247 | 250 | * @return number |
| 248 | 251 | */ |
| 249 | 252 | private function header($x, $y, $pag) |
@@ -474,8 +477,8 @@ discard block |
||
| 474 | 477 | /** |
| 475 | 478 | * body |
| 476 | 479 | * |
| 477 | - * @param number $x |
|
| 478 | - * @param number $y |
|
| 480 | + * @param integer $x |
|
| 481 | + * @param double $y |
|
| 479 | 482 | */ |
| 480 | 483 | private function body($x, $y) |
| 481 | 484 | { |
@@ -501,7 +504,7 @@ discard block |
||
| 501 | 504 | /** |
| 502 | 505 | * footer |
| 503 | 506 | * |
| 504 | - * @param number $x |
|
| 507 | + * @param integer $x |
|
| 505 | 508 | * @param number $y |
| 506 | 509 | */ |
| 507 | 510 | private function footer($x, $y) |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | $this->retEvento = $this->dom->getElementsByTagName("retEvento")->item(0); |
| 133 | 133 | $this->rinfEvento = $this->retEvento->getElementsByTagName("infEvento")->item(0); |
| 134 | 134 | $this->tpEvento = $this->infEvento->getElementsByTagName("tpEvento")->item(0)->nodeValue; |
| 135 | - if (!in_array($this->tpEvento, ['110110','110111'])) { |
|
| 135 | + if (!in_array($this->tpEvento, ['110110', '110111'])) { |
|
| 136 | 136 | $this->errMsg = 'Evento não implementado ' . $tpEvento . ' !!'; |
| 137 | 137 | $this->errStatus = true; |
| 138 | 138 | return false; |
@@ -152,11 +152,9 @@ discard block |
||
| 152 | 152 | $this->cStat = $this->rinfEvento->getElementsByTagName("cStat")->item(0)->nodeValue; |
| 153 | 153 | $this->xMotivo = $this->rinfEvento->getElementsByTagName("xMotivo")->item(0)->nodeValue; |
| 154 | 154 | $this->CNPJDest = !empty($this->rinfEvento->getElementsByTagName("CNPJDest")->item(0)->nodeValue) ? |
| 155 | - $this->rinfEvento->getElementsByTagName("CNPJDest")->item(0)->nodeValue : |
|
| 156 | - ''; |
|
| 155 | + $this->rinfEvento->getElementsByTagName("CNPJDest")->item(0)->nodeValue : ''; |
|
| 157 | 156 | $this->CPFDest = !empty($this->rinfEvento->getElementsByTagName("CPFDest")->item(0)->nodeValue) ? |
| 158 | - $this->rinfEvento->getElementsByTagName("CPFDest")->item(0)->nodeValue : |
|
| 159 | - ''; |
|
| 157 | + $this->rinfEvento->getElementsByTagName("CPFDest")->item(0)->nodeValue : ''; |
|
| 160 | 158 | $this->dhRegEvento = $this->rinfEvento->getElementsByTagName("dhRegEvento")->item(0)->nodeValue; |
| 161 | 159 | $this->nProt = $this->rinfEvento->getElementsByTagName("nProt")->item(0)->nodeValue; |
| 162 | 160 | } |
@@ -255,9 +253,9 @@ discard block |
||
| 255 | 253 | // coluna esquerda identificação do emitente |
| 256 | 254 | $w = round($maxW * 0.41, 0); // 80; |
| 257 | 255 | if ($this->orientacao == 'P') { |
| 258 | - $aFont = ['font' => $this->fontePadrao,'size' => 6,'style' => 'I']; |
|
| 256 | + $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => 'I']; |
|
| 259 | 257 | } else { |
| 260 | - $aFont = ['font' => $this->fontePadrao,'size' => 8,'style' => 'B']; |
|
| 258 | + $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'B']; |
|
| 261 | 259 | } |
| 262 | 260 | $w1 = $w; |
| 263 | 261 | $h = 32; |
@@ -410,7 +408,7 @@ discard block |
||
| 410 | 408 | . 'abaixo referenciada, está cancelada, solicitamos que sejam ' |
| 411 | 409 | . 'aplicadas essas correções ao executar seus lançamentos fiscais.'; |
| 412 | 410 | } |
| 413 | - $aFont = ['font' => $this->fontePadrao,'size' => 10,'style' => '']; |
|
| 411 | + $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => '']; |
|
| 414 | 412 | $this->pdf->textBox($x + 5, $y1, $maxW - 5, 20, $texto, $aFont, 'T', 'L', 0, '', false); |
| 415 | 413 | // ############################################ |
| 416 | 414 | $x = $oldX; |
@@ -421,7 +419,7 @@ discard block |
||
| 421 | 419 | if ($this->CPFDest != '') { |
| 422 | 420 | $texto = 'CPF do Destinatário: ' . $this->formatField($this->CPFDest, "###.###.###-##"); |
| 423 | 421 | } |
| 424 | - $aFont = ['font' => $this->fontePadrao,'size' => 12,'style' => 'B']; |
|
| 422 | + $aFont = ['font' => $this->fontePadrao, 'size' => 12, 'style' => 'B']; |
|
| 425 | 423 | $this->pdf->textBox($x + 2, $y + 13, $w2, 8, $texto, $aFont, 'T', 'L', 0, ''); |
| 426 | 424 | $numNF = substr($this->chNFe, 25, 9); |
| 427 | 425 | $serie = substr($this->chNFe, 22, 3); |
@@ -437,7 +435,7 @@ discard block |
||
| 437 | 435 | $this->pdf->code128($x + (($w - $bW) / 2), $y + 2, $this->chNFe, $bW, $bH); |
| 438 | 436 | $this->pdf->setFillColor(255, 255, 255); |
| 439 | 437 | $y1 = $y + 2 + $bH; |
| 440 | - $aFont = ['font' => $this->fontePadrao,'size' => 10,'style' => '']; |
|
| 438 | + $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => '']; |
|
| 441 | 439 | $texto = $this->formatField($this->chNFe, $this->formatoChave); |
| 442 | 440 | $this->pdf->textBox($x, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, ''); |
| 443 | 441 | $retVal = $sY + 2; |
@@ -445,7 +443,7 @@ discard block |
||
| 445 | 443 | $x = $oldX; |
| 446 | 444 | $this->pdf->textBox($x, $sY, $maxW, 15); |
| 447 | 445 | $texto = $this->xCondUso; |
| 448 | - $aFont = ['font' => $this->fontePadrao,'size' => 8,'style' => 'I']; |
|
| 446 | + $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'I']; |
|
| 449 | 447 | $this->pdf->textBox($x + 2, $sY + 2, $maxW - 2, 15, $texto, $aFont, 'T', 'L', 0, '', false); |
| 450 | 448 | $retVal = $sY + 2; |
| 451 | 449 | } |
@@ -461,9 +459,9 @@ discard block |
||
| 461 | 459 | $w = $maxW - (2 * $x); |
| 462 | 460 | $this->pdf->setTextColor(90, 90, 90); |
| 463 | 461 | $texto = "SEM VALOR FISCAL"; |
| 464 | - $aFont = ['font' => $this->fontePadrao,'size' => 48,'style' => 'B']; |
|
| 462 | + $aFont = ['font' => $this->fontePadrao, 'size' => 48, 'style' => 'B']; |
|
| 465 | 463 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
| 466 | - $aFont = ['font' => $this->fontePadrao,'size' => 30,'style' => 'B']; |
|
| 464 | + $aFont = ['font' => $this->fontePadrao, 'size' => 30, 'style' => 'B']; |
|
| 467 | 465 | $texto = "AMBIENTE DE HOMOLOGAÇÃO"; |
| 468 | 466 | $this->pdf->textBox($x, $y + 14, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
| 469 | 467 | $this->pdf->setTextColor(0, 0, 0); |
@@ -485,7 +483,7 @@ discard block |
||
| 485 | 483 | } else { |
| 486 | 484 | $texto = 'JUSTIFICATIVA DO CANCELAMENTO'; |
| 487 | 485 | } |
| 488 | - $aFont = ['font' => $this->fontePadrao,'size' => 10,'style' => 'B']; |
|
| 486 | + $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B']; |
|
| 489 | 487 | $this->pdf->textBox($x, $y, $maxW, 5, $texto, $aFont, 'T', 'L', 0, '', false); |
| 490 | 488 | $y += 5; |
| 491 | 489 | $this->pdf->textBox($x, $y, $maxW, 190); |
@@ -494,7 +492,7 @@ discard block |
||
| 494 | 492 | } elseif ($this->tpEvento == '110111') { |
| 495 | 493 | $texto = $this->xJust; |
| 496 | 494 | } |
| 497 | - $aFont = ['font' => $this->fontePadrao,'size' => 12,'style' => 'B']; |
|
| 495 | + $aFont = ['font' => $this->fontePadrao, 'size' => 12, 'style' => 'B']; |
|
| 498 | 496 | $this->pdf->textBox($x + 2, $y + 2, $maxW - 2, 150, $texto, $aFont, 'T', 'L', 0, '', false); |
| 499 | 497 | } |
| 500 | 498 | |
@@ -519,15 +517,15 @@ discard block |
||
| 519 | 517 | . "eletrônico XML e pode ser consultada através dos Portais " |
| 520 | 518 | . "das SEFAZ."; |
| 521 | 519 | } |
| 522 | - $aFont = ['font' => $this->fontePadrao,'size' => 10,'style' => 'I']; |
|
| 520 | + $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'I']; |
|
| 523 | 521 | $this->pdf->textBox($x, $y, $w, 20, $texto, $aFont, 'T', 'C', 0, '', false); |
| 524 | 522 | $y = $this->hPrint - 4; |
| 525 | 523 | $texto = "Impresso em " . date('d/m/Y H:i:s'); |
| 526 | 524 | $w = $this->wPrint - 4; |
| 527 | - $aFont = ['font' => $this->fontePadrao,'size' => 6,'style' => 'I']; |
|
| 525 | + $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => 'I']; |
|
| 528 | 526 | $this->pdf->textBox($x, $y, $w, 4, $texto, $aFont, 'T', 'L', 0, ''); |
| 529 | - $texto = $this->creditos . " Powered by NFePHP®"; |
|
| 530 | - $aFont = ['font' => $this->fontePadrao,'size' => 6,'style' => 'I']; |
|
| 527 | + $texto = $this->creditos . " Powered by NFePHP®"; |
|
| 528 | + $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => 'I']; |
|
| 531 | 529 | $this->pdf->textBox($x, $y, $w, 4, $texto, $aFont, 'T', 'R', 0, 'http://www.nfephp.org'); |
| 532 | 530 | } |
| 533 | 531 | } |
@@ -13,7 +13,6 @@ |
||
| 13 | 13 | * @link http://github.com/nfephp-org/sped-da for the canonical source repository |
| 14 | 14 | * @author Roberto Spadim <roberto at spadim dot com dot br> |
| 15 | 15 | */ |
| 16 | -use Exception; |
|
| 17 | 16 | use InvalidArgumentException; |
| 18 | 17 | use NFePHP\DA\Legacy\Dom; |
| 19 | 18 | use NFePHP\DA\Legacy\Pdf; |
@@ -94,9 +94,9 @@ discard block |
||
| 94 | 94 | * |
| 95 | 95 | * @param string $docXML |
| 96 | 96 | * @param string $sPathLogo |
| 97 | - * @param string $mododebug |
|
| 97 | + * @param integer $mododebug |
|
| 98 | 98 | * @param string $idToken |
| 99 | - * @param string $Token |
|
| 99 | + * @param string $emitToken |
|
| 100 | 100 | */ |
| 101 | 101 | public function __construct( |
| 102 | 102 | $docXML = '', |
@@ -1074,6 +1074,9 @@ discard block |
||
| 1074 | 1074 | return $texto; |
| 1075 | 1075 | } |
| 1076 | 1076 | |
| 1077 | + /** |
|
| 1078 | + * @param string $tBand |
|
| 1079 | + */ |
|
| 1077 | 1080 | protected static function getCardName($tBand) |
| 1078 | 1081 | { |
| 1079 | 1082 | switch ($tBand) { |
@@ -27,11 +27,11 @@ discard block |
||
| 27 | 27 | protected $paperwidth = 80; |
| 28 | 28 | protected $creditos; |
| 29 | 29 | protected $xml; // string XML NFe |
| 30 | - protected $logomarca=''; // path para logomarca em jpg |
|
| 31 | - protected $formatoChave="#### #### #### #### #### #### #### #### #### #### ####"; |
|
| 32 | - protected $debugMode=0; //ativa ou desativa o modo de debug |
|
| 30 | + protected $logomarca = ''; // path para logomarca em jpg |
|
| 31 | + protected $formatoChave = "#### #### #### #### #### #### #### #### #### #### ####"; |
|
| 32 | + protected $debugMode = 0; //ativa ou desativa o modo de debug |
|
| 33 | 33 | protected $tpImp; //ambiente |
| 34 | - protected $fontePadrao='Times'; |
|
| 34 | + protected $fontePadrao = 'Times'; |
|
| 35 | 35 | protected $nfeProc; |
| 36 | 36 | protected $nfe; |
| 37 | 37 | protected $infNFe; |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | $this->textoAdic = ''; |
| 201 | 201 | if (isset($this->infAdic)) { |
| 202 | 202 | $this->textoAdic .= !empty($this->infAdic->getElementsByTagName('infCpl')->item(0)->nodeValue) ? |
| 203 | - 'Inf. Contribuinte: '. |
|
| 203 | + 'Inf. Contribuinte: ' . |
|
| 204 | 204 | trim($this->anfaveaDANFE($this->infAdic->getElementsByTagName('infCpl')->item(0)->nodeValue)) : ''; |
| 205 | 205 | if (!empty($this->textoAdic)) { |
| 206 | 206 | $this->textoAdic = str_replace(";", "\n", $this->textoAdic); |
@@ -241,10 +241,10 @@ discard block |
||
| 241 | 241 | //total inicial de paginas |
| 242 | 242 | $totPag = 1; |
| 243 | 243 | //largura imprimivel em mm: largura da folha menos as margens esq/direita |
| 244 | - $this->wPrint = $maxW-($margEsq*2); |
|
| 244 | + $this->wPrint = $maxW - ($margEsq * 2); |
|
| 245 | 245 | //comprimento (altura) imprimivel em mm: altura da folha menos as margens |
| 246 | 246 | //superior e inferior |
| 247 | - $this->hPrint = $maxH-$margSup-$margInf; |
|
| 247 | + $this->hPrint = $maxH - $margSup - $margInf; |
|
| 248 | 248 | // estabelece contagem de paginas |
| 249 | 249 | $this->pdf->aliasNbPages(); |
| 250 | 250 | $this->pdf->setMargins($margEsq, $margSup); // fixa as margens |
@@ -255,11 +255,11 @@ discard block |
||
| 255 | 255 | $this->pdf->setLineWidth(0.1); // define a largura da linha |
| 256 | 256 | $this->pdf->setTextColor(0, 0, 0); |
| 257 | 257 | $this->pdf->textBox(0, 0, $maxW, $maxH); // POR QUE PRECISO DESA LINHA? |
| 258 | - $hcabecalho = 27;//para cabeçalho (dados emitente mais logomarca) (FIXO) |
|
| 259 | - $hcabecalhoSecundario = 10 + 3;//para cabeçalho secundário (cabeçalho sefaz) (FIXO) |
|
| 260 | - $hprodutos = $hLinha + ($qtdItens * $hMaxLinha) ;//box poduto |
|
| 258 | + $hcabecalho = 27; //para cabeçalho (dados emitente mais logomarca) (FIXO) |
|
| 259 | + $hcabecalhoSecundario = 10 + 3; //para cabeçalho secundário (cabeçalho sefaz) (FIXO) |
|
| 260 | + $hprodutos = $hLinha + ($qtdItens * $hMaxLinha); //box poduto |
|
| 261 | 261 | $hTotal = 12; //box total (FIXO) |
| 262 | - $hpagamentos = $hLinha + ($qtdPgto * $hLinha) + 3;//para pagamentos |
|
| 262 | + $hpagamentos = $hLinha + ($qtdPgto * $hLinha) + 3; //para pagamentos |
|
| 263 | 263 | if (!empty($this->vTroco)) { |
| 264 | 264 | $hpagamentos += $hLinha; |
| 265 | 265 | } |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal; |
| 293 | 293 | $y = $this->pagamentosDANFE($x, $y, $hpagamentos); |
| 294 | 294 | //COLOCA MENSAGEM FISCAL |
| 295 | - $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal+ $hpagamentos; |
|
| 295 | + $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal + $hpagamentos; |
|
| 296 | 296 | $y = $this->fiscalDANFE($x, $y, $hmsgfiscal); |
| 297 | 297 | //COLOCA CONSUMIDOR |
| 298 | 298 | $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal + $hpagamentos + $hmsgfiscal; |
@@ -320,14 +320,14 @@ discard block |
||
| 320 | 320 | $emitIM = $this->getTagValue($this->emit, "IM"); |
| 321 | 321 | $emitFone = $this->getTagValue($this->enderEmit, "fone"); |
| 322 | 322 | $foneLen = strlen($emitFone); |
| 323 | - if ($foneLen>0) { |
|
| 323 | + if ($foneLen > 0) { |
|
| 324 | 324 | $ddd = substr($emitFone, 0, 2); |
| 325 | 325 | $fone1 = substr($emitFone, -8); |
| 326 | 326 | $digito9 = ' '; |
| 327 | 327 | if ($foneLen == 11) { |
| 328 | 328 | $digito9 = substr($emitFone, 2, 1); |
| 329 | 329 | } |
| 330 | - $emitFone = ' - ('.$ddd.') '.$digito9. ' ' . substr($fone1, 0, 4) . '-' . substr($fone1, -4); |
|
| 330 | + $emitFone = ' - (' . $ddd . ') ' . $digito9 . ' ' . substr($fone1, 0, 4) . '-' . substr($fone1, -4); |
|
| 331 | 331 | } else { |
| 332 | 332 | $emitFone = ''; |
| 333 | 333 | } |
@@ -341,19 +341,19 @@ discard block |
||
| 341 | 341 | // CONFIGURAÇÃO DE POSIÇÃO |
| 342 | 342 | $margemInterna = $this->margemInterna; |
| 343 | 343 | $maxW = $this->wPrint; |
| 344 | - $h = $h-($margemInterna); |
|
| 344 | + $h = $h - ($margemInterna); |
|
| 345 | 345 | //COLOCA LOGOMARCA |
| 346 | 346 | if (!empty($this->logomarca)) { |
| 347 | 347 | $xImg = $margemInterna; |
| 348 | 348 | $yImg = $margemInterna + 1; |
| 349 | 349 | $type = (substr($this->logomarca, 0, 7) === 'data://') ? 'jpg' : null; |
| 350 | 350 | $this->pdf->image($this->logomarca, $xImg, $yImg, 30, 22.5, $type); |
| 351 | - $xRs = ($maxW*0.4) + $margemInterna; |
|
| 352 | - $wRs = ($maxW*0.6); |
|
| 351 | + $xRs = ($maxW * 0.4) + $margemInterna; |
|
| 352 | + $wRs = ($maxW * 0.6); |
|
| 353 | 353 | $alignEmit = 'L'; |
| 354 | 354 | } else { |
| 355 | 355 | $xRs = $margemInterna; |
| 356 | - $wRs = ($maxW*1); |
|
| 356 | + $wRs = ($maxW * 1); |
|
| 357 | 357 | $alignEmit = 'L'; |
| 358 | 358 | } |
| 359 | 359 | //COLOCA RAZÃO SOCIAL |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | { |
| 374 | 374 | $margemInterna = $this->margemInterna; |
| 375 | 375 | $maxW = $this->wPrint; |
| 376 | - $w = ($maxW*1); |
|
| 376 | + $w = ($maxW * 1); |
|
| 377 | 377 | $hBox1 = 7; |
| 378 | 378 | $texto = "DANFE NFC-e\nDocumento Auxiliar da Nota Fiscal de Consumidor Eletrônica"; |
| 379 | 379 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'); |
@@ -390,13 +390,13 @@ discard block |
||
| 390 | 390 | $margemInterna = $this->margemInterna; |
| 391 | 391 | $maxW = $this->wPrint; |
| 392 | 392 | $qtdItens = $this->det->length; |
| 393 | - $w = ($maxW*1); |
|
| 393 | + $w = ($maxW * 1); |
|
| 394 | 394 | $hLinha = $this->hLinha; |
| 395 | 395 | $aFontCabProdutos = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'); |
| 396 | - $wBoxCod = $w*0.17; |
|
| 396 | + $wBoxCod = $w * 0.17; |
|
| 397 | 397 | $texto = "CÓDIGO"; |
| 398 | 398 | $this->pdf->textBox($x, $y, $wBoxCod, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false); |
| 399 | - $wBoxDescricao = $w*0.43; |
|
| 399 | + $wBoxDescricao = $w * 0.43; |
|
| 400 | 400 | $xBoxDescricao = $wBoxCod + $x; |
| 401 | 401 | $texto = "DESCRICÃO"; |
| 402 | 402 | $this->pdf->textBox( |
@@ -412,19 +412,19 @@ discard block |
||
| 412 | 412 | '', |
| 413 | 413 | false |
| 414 | 414 | ); |
| 415 | - $wBoxQt = $w*0.08; |
|
| 415 | + $wBoxQt = $w * 0.08; |
|
| 416 | 416 | $xBoxQt = $wBoxDescricao + $xBoxDescricao; |
| 417 | 417 | $texto = "QT"; |
| 418 | 418 | $this->pdf->textBox($xBoxQt, $y, $wBoxQt, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false); |
| 419 | - $wBoxUn = $w*0.06; |
|
| 419 | + $wBoxUn = $w * 0.06; |
|
| 420 | 420 | $xBoxUn = $wBoxQt + $xBoxQt; |
| 421 | 421 | $texto = "UN"; |
| 422 | 422 | $this->pdf->textBox($xBoxUn, $y, $wBoxUn, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false); |
| 423 | - $wBoxVl = $w*0.13; |
|
| 423 | + $wBoxVl = $w * 0.13; |
|
| 424 | 424 | $xBoxVl = $wBoxUn + $xBoxUn; |
| 425 | 425 | $texto = "VALOR"; |
| 426 | 426 | $this->pdf->textBox($xBoxVl, $y, $wBoxVl, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false); |
| 427 | - $wBoxTotal = $w*0.13; |
|
| 427 | + $wBoxTotal = $w * 0.13; |
|
| 428 | 428 | $xBoxTotal = $wBoxVl + $xBoxVl; |
| 429 | 429 | $texto = "TOTAL"; |
| 430 | 430 | $this->pdf->textBox($xBoxTotal, $y, $wBoxTotal, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false); |
@@ -444,9 +444,9 @@ discard block |
||
| 444 | 444 | $vUnCom = number_format($this->getTagValue($prod, "vUnCom"), 2, ",", "."); |
| 445 | 445 | $vProd = number_format($this->getTagValue($prod, "vProd"), 2, ",", "."); |
| 446 | 446 | //COLOCA PRODUTO |
| 447 | - $yBoxProd = $y + $hLinha + ($cont*$hMaxLinha); |
|
| 447 | + $yBoxProd = $y + $hLinha + ($cont * $hMaxLinha); |
|
| 448 | 448 | //COLOCA PRODUTO CÓDIGO |
| 449 | - $wBoxCod = $w*0.17; |
|
| 449 | + $wBoxCod = $w * 0.17; |
|
| 450 | 450 | $texto = $cProd; |
| 451 | 451 | $this->pdf->textBox( |
| 452 | 452 | $x, |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | false |
| 463 | 463 | ); |
| 464 | 464 | //COLOCA PRODUTO DESCRIÇÃO |
| 465 | - $wBoxDescricao = $w*0.43; |
|
| 465 | + $wBoxDescricao = $w * 0.43; |
|
| 466 | 466 | $xBoxDescricao = $wBoxCod + $x; |
| 467 | 467 | $texto = $xProd; |
| 468 | 468 | $this->pdf->textBox( |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | false |
| 480 | 480 | ); |
| 481 | 481 | //COLOCA PRODUTO QUANTIDADE |
| 482 | - $wBoxQt = $w*0.08; |
|
| 482 | + $wBoxQt = $w * 0.08; |
|
| 483 | 483 | $xBoxQt = $wBoxDescricao + $xBoxDescricao; |
| 484 | 484 | $texto = $qCom; |
| 485 | 485 | $this->pdf->textBox( |
@@ -496,7 +496,7 @@ discard block |
||
| 496 | 496 | false |
| 497 | 497 | ); |
| 498 | 498 | //COLOCA PRODUTO UNIDADE |
| 499 | - $wBoxUn = $w*0.06; |
|
| 499 | + $wBoxUn = $w * 0.06; |
|
| 500 | 500 | $xBoxUn = $wBoxQt + $xBoxQt; |
| 501 | 501 | $texto = $uCom; |
| 502 | 502 | $this->pdf->textBox( |
@@ -513,7 +513,7 @@ discard block |
||
| 513 | 513 | false |
| 514 | 514 | ); |
| 515 | 515 | //COLOCA PRODUTO VL UNITÁRIO |
| 516 | - $wBoxVl = $w*0.13; |
|
| 516 | + $wBoxVl = $w * 0.13; |
|
| 517 | 517 | $xBoxVl = $wBoxUn + $xBoxUn; |
| 518 | 518 | $texto = $vUnCom; |
| 519 | 519 | $this->pdf->textBox( |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | false |
| 531 | 531 | ); |
| 532 | 532 | //COLOCA PRODUTO VL TOTAL |
| 533 | - $wBoxTotal = $w*0.13; |
|
| 533 | + $wBoxTotal = $w * 0.13; |
|
| 534 | 534 | $xBoxTotal = $wBoxVl + $xBoxVl; |
| 535 | 535 | $texto = $vProd; |
| 536 | 536 | $this->pdf->textBox( |
@@ -557,8 +557,8 @@ discard block |
||
| 557 | 557 | $margemInterna = $this->margemInterna; |
| 558 | 558 | $maxW = $this->wPrint; |
| 559 | 559 | $hLinha = 3; |
| 560 | - $wColEsq = ($maxW*0.7); |
|
| 561 | - $wColDir = ($maxW*0.3); |
|
| 560 | + $wColEsq = ($maxW * 0.7); |
|
| 561 | + $wColDir = ($maxW * 0.3); |
|
| 562 | 562 | $xValor = $x + $wColEsq; |
| 563 | 563 | $qtdItens = $this->det->length; |
| 564 | 564 | $vProd = $this->getTagValue($this->ICMSTot, "vProd"); |
@@ -579,28 +579,28 @@ discard block |
||
| 579 | 579 | $texto = "R$ " . number_format($vProd, 2, ",", "."); |
| 580 | 580 | $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B']; |
| 581 | 581 | $this->pdf->textBox($xValor, $yTotal, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false); |
| 582 | - $yDesconto = $y + ($hLinha*2); |
|
| 582 | + $yDesconto = $y + ($hLinha * 2); |
|
| 583 | 583 | $texto = "Descontos"; |
| 584 | 584 | $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B']; |
| 585 | 585 | $this->pdf->textBox($x, $yDesconto, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false); |
| 586 | 586 | $texto = "R$ " . $vDesc; |
| 587 | 587 | $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B']; |
| 588 | 588 | $this->pdf->textBox($xValor, $yDesconto, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false); |
| 589 | - $yFrete= $y + ($hLinha*3); |
|
| 589 | + $yFrete = $y + ($hLinha * 3); |
|
| 590 | 590 | $texto = "Frete"; |
| 591 | 591 | $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B']; |
| 592 | 592 | $this->pdf->textBox($x, $yFrete, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false); |
| 593 | 593 | $texto = "R$ " . $vFrete; |
| 594 | 594 | $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B']; |
| 595 | 595 | $this->pdf->textBox($xValor, $yFrete, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false); |
| 596 | - $yTotalFinal = $y + ($hLinha*4); |
|
| 596 | + $yTotalFinal = $y + ($hLinha * 4); |
|
| 597 | 597 | $texto = "Total"; |
| 598 | 598 | $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B']; |
| 599 | 599 | $this->pdf->textBox($x, $yTotalFinal, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false); |
| 600 | 600 | $texto = "R$ " . $vNF; |
| 601 | 601 | $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B']; |
| 602 | 602 | $this->pdf->textBox($xValor, $yTotalFinal, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false); |
| 603 | - $yTotalFinal = $y + ($hLinha*5); |
|
| 603 | + $yTotalFinal = $y + ($hLinha * 5); |
|
| 604 | 604 | $texto = "Informação dos Tributos Totais Incidentes"; |
| 605 | 605 | $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'']; |
| 606 | 606 | $this->pdf->textBox($x, $yTotalFinal, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false); |
@@ -615,16 +615,16 @@ discard block |
||
| 615 | 615 | $margemInterna = $this->margemInterna; |
| 616 | 616 | $maxW = $this->wPrint; |
| 617 | 617 | $qtdPgto = $this->pag->length; |
| 618 | - $w = ($maxW*1); |
|
| 618 | + $w = ($maxW * 1); |
|
| 619 | 619 | $hLinha = $this->hLinha; |
| 620 | - $wColEsq = ($maxW*0.7); |
|
| 621 | - $wColDir = ($maxW*0.3); |
|
| 620 | + $wColEsq = ($maxW * 0.7); |
|
| 621 | + $wColDir = ($maxW * 0.3); |
|
| 622 | 622 | $xValor = $x + $wColEsq; |
| 623 | 623 | $aFontPgto = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'); |
| 624 | - $wBoxEsq = $w*0.7; |
|
| 624 | + $wBoxEsq = $w * 0.7; |
|
| 625 | 625 | $texto = "FORMA DE PAGAMENTO"; |
| 626 | 626 | $this->pdf->textBox($x, $y, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false); |
| 627 | - $wBoxDir = $w*0.3; |
|
| 627 | + $wBoxDir = $w * 0.3; |
|
| 628 | 628 | $xBoxDescricao = $x + $wBoxEsq; |
| 629 | 629 | $texto = "VALOR PAGO"; |
| 630 | 630 | $this->pdf->textBox($xBoxDescricao, $y, $wBoxDir, $hLinha, $texto, $aFontPgto, 'T', 'R', 0, '', false); |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | $tBandNome = self::getCardName($tBand); |
| 647 | 647 | } |
| 648 | 648 | //COLOCA PRODUTO |
| 649 | - $yBoxProd = $y + $hLinha + ($cont*$hLinha); |
|
| 649 | + $yBoxProd = $y + $hLinha + ($cont * $hLinha); |
|
| 650 | 650 | //COLOCA PRODUTO CÓDIGO |
| 651 | 651 | $texto = $tPagNome; |
| 652 | 652 | $this->pdf->textBox($x, $yBoxProd, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false); |
@@ -670,7 +670,7 @@ discard block |
||
| 670 | 670 | } |
| 671 | 671 | |
| 672 | 672 | if (!empty($this->vTroco)) { |
| 673 | - $yBoxProd = $y + $hLinha + ($cont*$hLinha); |
|
| 673 | + $yBoxProd = $y + $hLinha + ($cont * $hLinha); |
|
| 674 | 674 | //COLOCA PRODUTO CÓDIGO |
| 675 | 675 | $texto = 'Troco'; |
| 676 | 676 | $this->pdf->textBox($x, $yBoxProd, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false); |
@@ -699,7 +699,7 @@ discard block |
||
| 699 | 699 | $y += 6; |
| 700 | 700 | $margemInterna = $this->margemInterna; |
| 701 | 701 | $maxW = $this->wPrint; |
| 702 | - $w = ($maxW*1); |
|
| 702 | + $w = ($maxW * 1); |
|
| 703 | 703 | $hLinha = $this->hLinha; |
| 704 | 704 | $aFontTit = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B']; |
| 705 | 705 | $aFontTex = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'']; |
@@ -731,19 +731,19 @@ discard block |
||
| 731 | 731 | $dhEmiLocalFormat = $dhEmilocal->format('d/m/Y H:i:s'); |
| 732 | 732 | $texto = "ÁREA DE MENSAGEM FISCAL"; |
| 733 | 733 | $this->pdf->textBox($x, $y, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false); |
| 734 | - $yTex1 = $y + ($hLinha*1); |
|
| 735 | - $hTex1 = $hLinha*2; |
|
| 736 | - $texto = "Número " . $nNF . " Série " . $serieNF . " " .$dhEmiLocalFormat . " - Via Consumidor"; |
|
| 734 | + $yTex1 = $y + ($hLinha * 1); |
|
| 735 | + $hTex1 = $hLinha * 2; |
|
| 736 | + $texto = "Número " . $nNF . " Série " . $serieNF . " " . $dhEmiLocalFormat . " - Via Consumidor"; |
|
| 737 | 737 | $this->pdf->textBox($x, $yTex1, $w, $hTex1, $texto, $aFontTex, 'C', 'C', 0, '', false); |
| 738 | - $yTex2 = $y + ($hLinha*3); |
|
| 739 | - $hTex2 = $hLinha*2; |
|
| 738 | + $yTex2 = $y + ($hLinha * 3); |
|
| 739 | + $hTex2 = $hLinha * 2; |
|
| 740 | 740 | |
| 741 | 741 | $texto = !empty($this->urlChave) ? "Consulte pela Chave de Acesso em " . $this->urlChave : ''; |
| 742 | 742 | $this->pdf->textBox($x, $yTex2, $w, $hTex2, $texto, $aFontTex, 'C', 'C', 0, '', false); |
| 743 | 743 | $texto = "CHAVE DE ACESSO"; |
| 744 | - $yTit2 = $y + ($hLinha*5); |
|
| 744 | + $yTit2 = $y + ($hLinha * 5); |
|
| 745 | 745 | $this->pdf->textBox($x, $yTit2, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false); |
| 746 | - $yTex3 = $y + ($hLinha*6); |
|
| 746 | + $yTex3 = $y + ($hLinha * 6); |
|
| 747 | 747 | $texto = $chNFe; |
| 748 | 748 | $this->pdf->textBox($x, $yTex3, $w, $hLinha, $texto, $aFontTex, 'C', 'C', 0, '', false); |
| 749 | 749 | } |
@@ -753,7 +753,7 @@ discard block |
||
| 753 | 753 | $y += 6; |
| 754 | 754 | $margemInterna = $this->margemInterna; |
| 755 | 755 | $maxW = $this->wPrint; |
| 756 | - $w = ($maxW*1); |
|
| 756 | + $w = ($maxW * 1); |
|
| 757 | 757 | $hLinha = $this->hLinha; |
| 758 | 758 | $aFontTit = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B']; |
| 759 | 759 | $aFontTex = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'']; |
@@ -769,7 +769,7 @@ discard block |
||
| 769 | 769 | $consCNPJ = !empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue) |
| 770 | 770 | ? $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue |
| 771 | 771 | : ''; |
| 772 | - $cDest = $consCPF.$consCNPJ.$considEstrangeiro; //documentos do consumidor |
|
| 772 | + $cDest = $consCPF . $consCNPJ . $considEstrangeiro; //documentos do consumidor |
|
| 773 | 773 | $enderDest = $this->dest->getElementsByTagName("enderDest")->item(0); |
| 774 | 774 | $consNome = $this->getTagValue($this->dest, "xNome"); |
| 775 | 775 | $consLgr = $this->getTagValue($enderDest, "xLgr"); |
@@ -809,8 +809,8 @@ discard block |
||
| 809 | 809 | $yTex1 = $y + $hLinha; |
| 810 | 810 | $texto = $consNome; |
| 811 | 811 | if (!empty($consDoc)) { |
| 812 | - $texto .= " - ". $consDoc . "\n" . $consEnd; |
|
| 813 | - $this->pdf->textBox($x, $yTex1, $w, $hLinha*3, $texto, $aFontTex, 'C', 'C', 0, '', false); |
|
| 812 | + $texto .= " - " . $consDoc . "\n" . $consEnd; |
|
| 813 | + $this->pdf->textBox($x, $yTex1, $w, $hLinha * 3, $texto, $aFontTex, 'C', 'C', 0, '', false); |
|
| 814 | 814 | } |
| 815 | 815 | } else { |
| 816 | 816 | $yTex1 = $y + $hLinha; |
@@ -824,7 +824,7 @@ discard block |
||
| 824 | 824 | $y += 6; |
| 825 | 825 | $margemInterna = $this->margemInterna; |
| 826 | 826 | $maxW = $this->wPrint; |
| 827 | - $w = ($maxW*1)+4; |
|
| 827 | + $w = ($maxW * 1) + 4; |
|
| 828 | 828 | $hLinha = $this->hLinha; |
| 829 | 829 | $hBoxLinha = $this->hBoxLinha; |
| 830 | 830 | $aFontTit = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'); |
@@ -833,7 +833,7 @@ discard block |
||
| 833 | 833 | $nProt = ''; |
| 834 | 834 | if (isset($this->nfeProc)) { |
| 835 | 835 | $nProt = $this->getTagValue($this->nfeProc, "nProt"); |
| 836 | - $dhRecbto = $this->getTagValue($this->nfeProc, "dhRecbto"); |
|
| 836 | + $dhRecbto = $this->getTagValue($this->nfeProc, "dhRecbto"); |
|
| 837 | 837 | } |
| 838 | 838 | $barcode = new Barcode(); |
| 839 | 839 | $bobj = $barcode->getBarcodeObj( |
@@ -847,15 +847,15 @@ discard block |
||
| 847 | 847 | $qrcode = $bobj->getPngData(); |
| 848 | 848 | $wQr = 50; |
| 849 | 849 | $hQr = 50; |
| 850 | - $yQr = ($y+$margemInterna); |
|
| 851 | - $xQr = ($w/2) - ($wQr/2); |
|
| 850 | + $yQr = ($y + $margemInterna); |
|
| 851 | + $xQr = ($w / 2) - ($wQr / 2); |
|
| 852 | 852 | // prepare a base64 encoded "data url" |
| 853 | 853 | $pic = 'data://text/plain;base64,' . base64_encode($qrcode); |
| 854 | 854 | $info = getimagesize($pic); |
| 855 | 855 | $this->pdf->image($pic, $xQr, $yQr, $wQr, $hQr, 'PNG'); |
| 856 | 856 | $dt = new DateTime($dhRecbto); |
| 857 | - $yQr = ($yQr+$hQr+$margemInterna); |
|
| 858 | - $this->pdf->textBox($x, $yQr, $w-4, $hBoxLinha, "Protocolo de Autorização: " . $nProt . "\n" |
|
| 857 | + $yQr = ($yQr + $hQr + $margemInterna); |
|
| 858 | + $this->pdf->textBox($x, $yQr, $w - 4, $hBoxLinha, "Protocolo de Autorização: " . $nProt . "\n" |
|
| 859 | 859 | . $dt->format('d/m/Y H:i:s'), $aFontTex, 'C', 'C', 0, '', false); |
| 860 | 860 | } |
| 861 | 861 | |
@@ -875,7 +875,7 @@ discard block |
||
| 875 | 875 | } |
| 876 | 876 | $heigthText = $this->pdf->textBox($x, $y, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false); |
| 877 | 877 | // seta o textbox do texto adicional |
| 878 | - $this->pdf->textBox($x, $y+3, $w-2, $hLinha-3, $this->textoAdic, $aFontTex, 'T', 'L', 0, '', false); |
|
| 878 | + $this->pdf->textBox($x, $y + 3, $w - 2, $hLinha - 3, $this->textoAdic, $aFontTex, 'T', 'L', 0, '', false); |
|
| 879 | 879 | } |
| 880 | 880 | |
| 881 | 881 | /** |
@@ -901,7 +901,7 @@ discard block |
||
| 901 | 901 | if ($startPos === false) { |
| 902 | 902 | return $cdata; |
| 903 | 903 | } |
| 904 | - for ($x=$len; $x>0; $x--) { |
|
| 904 | + for ($x = $len; $x > 0; $x--) { |
|
| 905 | 905 | if (substr($cdata, $x, 1) == '>') { |
| 906 | 906 | $endPos = $x; |
| 907 | 907 | break; |
@@ -912,15 +912,15 @@ discard block |
||
| 912 | 912 | } else { |
| 913 | 913 | $parte1 = ''; |
| 914 | 914 | } |
| 915 | - $parte2 = substr($cdata, $startPos, $endPos-$startPos+1); |
|
| 915 | + $parte2 = substr($cdata, $startPos, $endPos - $startPos + 1); |
|
| 916 | 916 | if ($endPos < $len) { |
| 917 | 917 | $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1); |
| 918 | 918 | } else { |
| 919 | 919 | $parte3 = ''; |
| 920 | 920 | } |
| 921 | - $texto = trim($parte1).' '.trim($parte3); |
|
| 921 | + $texto = trim($parte1) . ' ' . trim($parte3); |
|
| 922 | 922 | if (strpos($parte2, '<CDATA>') === false) { |
| 923 | - $cdata = '<CDATA>'.$parte2.'</CDATA>'; |
|
| 923 | + $cdata = '<CDATA>' . $parte2 . '</CDATA>'; |
|
| 924 | 924 | } else { |
| 925 | 925 | $cdata = $parte2; |
| 926 | 926 | } |
@@ -992,15 +992,15 @@ discard block |
||
| 992 | 992 | //grupo CADATA infCpl |
| 993 | 993 | $t = $dom->getElementsByTagName('transmissor')->item(0); |
| 994 | 994 | $r = $dom->getElementsByTagName('receptor')->item(0); |
| 995 | - $versao = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ? |
|
| 996 | - 'Versao:'.$dom->getElementsByTagName('versao')->item(0)->nodeValue.' ' : ''; |
|
| 997 | - $especieNF = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ? |
|
| 998 | - 'Especie:'.$dom->getElementsByTagName('especieNF')->item(0)->nodeValue.' ' : ''; |
|
| 999 | - $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ? |
|
| 1000 | - 'Entrega:'.$dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue.' ' : ''; |
|
| 1001 | - $dca = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ? |
|
| 1002 | - 'dca:'.$dom->getElementsByTagName('dca')->item(0)->nodeValue.' ' : ''; |
|
| 1003 | - $texto .= "".$versao.$especieNF.$fabEntrega.$dca; |
|
| 995 | + $versao = !empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ? |
|
| 996 | + 'Versao:' . $dom->getElementsByTagName('versao')->item(0)->nodeValue . ' ' : ''; |
|
| 997 | + $especieNF = !empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ? |
|
| 998 | + 'Especie:' . $dom->getElementsByTagName('especieNF')->item(0)->nodeValue . ' ' : ''; |
|
| 999 | + $fabEntrega = !empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ? |
|
| 1000 | + 'Entrega:' . $dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue . ' ' : ''; |
|
| 1001 | + $dca = !empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ? |
|
| 1002 | + 'dca:' . $dom->getElementsByTagName('dca')->item(0)->nodeValue . ' ' : ''; |
|
| 1003 | + $texto .= "" . $versao . $especieNF . $fabEntrega . $dca; |
|
| 1004 | 1004 | if (isset($t)) { |
| 1005 | 1005 | if ($t->hasAttributes()) { |
| 1006 | 1006 | $texto .= " Transmissor "; |
@@ -6,129 +6,129 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | class Pdf extends Fpdf |
| 8 | 8 | { |
| 9 | - private $t128; // tabela de codigos 128 |
|
| 10 | - private $abcSet=""; // conjunto de caracteres legiveis em 128 |
|
| 11 | - private $aSet=""; // grupo A do conjunto de de caracteres legiveis |
|
| 12 | - private $bSet=""; // grupo B do conjunto de caracteres legiveis |
|
| 13 | - private $cSet=""; // grupo C do conjunto de caracteres legiveis |
|
| 14 | - private $setFrom; // converter de |
|
| 15 | - private $setTo; // converter para |
|
| 16 | - private $jStart = ["A"=>103, "B"=>104, "C"=>105]; // Caracteres de seleção do grupo 128 |
|
| 17 | - private $jSwap = ["A"=>101, "B"=>100, "C"=>99]; // Caracteres de troca de grupo |
|
| 9 | + private $t128; // tabela de codigos 128 |
|
| 10 | + private $abcSet = ""; // conjunto de caracteres legiveis em 128 |
|
| 11 | + private $aSet = ""; // grupo A do conjunto de de caracteres legiveis |
|
| 12 | + private $bSet = ""; // grupo B do conjunto de caracteres legiveis |
|
| 13 | + private $cSet = ""; // grupo C do conjunto de caracteres legiveis |
|
| 14 | + private $setFrom; // converter de |
|
| 15 | + private $setTo; // converter para |
|
| 16 | + private $jStart = ["A"=>103, "B"=>104, "C"=>105]; // Caracteres de seleção do grupo 128 |
|
| 17 | + private $jSwap = ["A"=>101, "B"=>100, "C"=>99]; // Caracteres de troca de grupo |
|
| 18 | 18 | |
| 19 | 19 | public function __construct($orientation = 'P', $unit = 'mm', $format = 'A4') |
| 20 | 20 | { |
| 21 | 21 | //passar parametros para a classe principal |
| 22 | 22 | parent::__construct($orientation, $unit, $format); |
| 23 | 23 | // composição dos caracteres do barcode 128 |
| 24 | - $this->t128[] = array(2, 1, 2, 2, 2, 2); //0 : [ ] |
|
| 25 | - $this->t128[] = array(2, 2, 2, 1, 2, 2); //1 : [!] |
|
| 26 | - $this->t128[] = array(2, 2, 2, 2, 2, 1); //2 : ["] |
|
| 27 | - $this->t128[] = array(1, 2, 1, 2, 2, 3); //3 : [#] |
|
| 28 | - $this->t128[] = array(1, 2, 1, 3, 2, 2); //4 : [$] |
|
| 29 | - $this->t128[] = array(1, 3, 1, 2, 2, 2); //5 : [%] |
|
| 30 | - $this->t128[] = array(1, 2, 2, 2, 1, 3); //6 : [&] |
|
| 31 | - $this->t128[] = array(1, 2, 2, 3, 1, 2); //7 : ['] |
|
| 32 | - $this->t128[] = array(1, 3, 2, 2, 1, 2); //8 : [(] |
|
| 33 | - $this->t128[] = array(2, 2, 1, 2, 1, 3); //9 : [)] |
|
| 34 | - $this->t128[] = array(2, 2, 1, 3, 1, 2); //10 : [*] |
|
| 35 | - $this->t128[] = array(2, 3, 1, 2, 1, 2); //11 : [+] |
|
| 36 | - $this->t128[] = array(1, 1, 2, 2, 3, 2); //12 : [,] |
|
| 37 | - $this->t128[] = array(1, 2, 2, 1, 3, 2); //13 : [-] |
|
| 38 | - $this->t128[] = array(1, 2, 2, 2, 3, 1); //14 : [.] |
|
| 39 | - $this->t128[] = array(1, 1, 3, 2, 2, 2); //15 : [/] |
|
| 40 | - $this->t128[] = array(1, 2, 3, 1, 2, 2); //16 : [0] |
|
| 41 | - $this->t128[] = array(1, 2, 3, 2, 2, 1); //17 : [1] |
|
| 42 | - $this->t128[] = array(2, 2, 3, 2, 1, 1); //18 : [2] |
|
| 43 | - $this->t128[] = array(2, 2, 1, 1, 3, 2); //19 : [3] |
|
| 44 | - $this->t128[] = array(2, 2, 1, 2, 3, 1); //20 : [4] |
|
| 45 | - $this->t128[] = array(2, 1, 3, 2, 1, 2); //21 : [5] |
|
| 46 | - $this->t128[] = array(2, 2, 3, 1, 1, 2); //22 : [6] |
|
| 47 | - $this->t128[] = array(3, 1, 2, 1, 3, 1); //23 : [7] |
|
| 48 | - $this->t128[] = array(3, 1, 1, 2, 2, 2); //24 : [8] |
|
| 49 | - $this->t128[] = array(3, 2, 1, 1, 2, 2); //25 : [9] |
|
| 50 | - $this->t128[] = array(3, 2, 1, 2, 2, 1); //26 : [:] |
|
| 51 | - $this->t128[] = array(3, 1, 2, 2, 1, 2); //27 : [;] |
|
| 52 | - $this->t128[] = array(3, 2, 2, 1, 1, 2); //28 : [<] |
|
| 53 | - $this->t128[] = array(3, 2, 2, 2, 1, 1); //29 : [=] |
|
| 54 | - $this->t128[] = array(2, 1, 2, 1, 2, 3); //30 : [>] |
|
| 55 | - $this->t128[] = array(2, 1, 2, 3, 2, 1); //31 : [?] |
|
| 56 | - $this->t128[] = array(2, 3, 2, 1, 2, 1); //32 : [@] |
|
| 57 | - $this->t128[] = array(1, 1, 1, 3, 2, 3); //33 : [A] |
|
| 58 | - $this->t128[] = array(1, 3, 1, 1, 2, 3); //34 : [B] |
|
| 59 | - $this->t128[] = array(1, 3, 1, 3, 2, 1); //35 : [C] |
|
| 60 | - $this->t128[] = array(1, 1, 2, 3, 1, 3); //36 : [D] |
|
| 61 | - $this->t128[] = array(1, 3, 2, 1, 1, 3); //37 : [E] |
|
| 62 | - $this->t128[] = array(1, 3, 2, 3, 1, 1); //38 : [F] |
|
| 63 | - $this->t128[] = array(2, 1, 1, 3, 1, 3); //39 : [G] |
|
| 64 | - $this->t128[] = array(2, 3, 1, 1, 1, 3); //40 : [H] |
|
| 65 | - $this->t128[] = array(2, 3, 1, 3, 1, 1); //41 : [I] |
|
| 66 | - $this->t128[] = array(1, 1, 2, 1, 3, 3); //42 : [J] |
|
| 67 | - $this->t128[] = array(1, 1, 2, 3, 3, 1); //43 : [K] |
|
| 68 | - $this->t128[] = array(1, 3, 2, 1, 3, 1); //44 : [L] |
|
| 69 | - $this->t128[] = array(1, 1, 3, 1, 2, 3); //45 : [M] |
|
| 70 | - $this->t128[] = array(1, 1, 3, 3, 2, 1); //46 : [N] |
|
| 71 | - $this->t128[] = array(1, 3, 3, 1, 2, 1); //47 : [O] |
|
| 72 | - $this->t128[] = array(3, 1, 3, 1, 2, 1); //48 : [P] |
|
| 73 | - $this->t128[] = array(2, 1, 1, 3, 3, 1); //49 : [Q] |
|
| 74 | - $this->t128[] = array(2, 3, 1, 1, 3, 1); //50 : [R] |
|
| 75 | - $this->t128[] = array(2, 1, 3, 1, 1, 3); //51 : [S] |
|
| 76 | - $this->t128[] = array(2, 1, 3, 3, 1, 1); //52 : [T] |
|
| 77 | - $this->t128[] = array(2, 1, 3, 1, 3, 1); //53 : [U] |
|
| 78 | - $this->t128[] = array(3, 1, 1, 1, 2, 3); //54 : [V] |
|
| 79 | - $this->t128[] = array(3, 1, 1, 3, 2, 1); //55 : [W] |
|
| 80 | - $this->t128[] = array(3, 3, 1, 1, 2, 1); //56 : [X] |
|
| 81 | - $this->t128[] = array(3, 1, 2, 1, 1, 3); //57 : [Y] |
|
| 82 | - $this->t128[] = array(3, 1, 2, 3, 1, 1); //58 : [Z] |
|
| 83 | - $this->t128[] = array(3, 3, 2, 1, 1, 1); //59 : [[] |
|
| 84 | - $this->t128[] = array(3, 1, 4, 1, 1, 1); //60 : [\] |
|
| 85 | - $this->t128[] = array(2, 2, 1, 4, 1, 1); //61 : []] |
|
| 86 | - $this->t128[] = array(4, 3, 1, 1, 1, 1); //62 : [^] |
|
| 87 | - $this->t128[] = array(1, 1, 1, 2, 2, 4); //63 : [_] |
|
| 88 | - $this->t128[] = array(1, 1, 1, 4, 2, 2); //64 : [`] |
|
| 89 | - $this->t128[] = array(1, 2, 1, 1, 2, 4); //65 : [a] |
|
| 90 | - $this->t128[] = array(1, 2, 1, 4, 2, 1); //66 : [b] |
|
| 91 | - $this->t128[] = array(1, 4, 1, 1, 2, 2); //67 : [c] |
|
| 92 | - $this->t128[] = array(1, 4, 1, 2, 2, 1); //68 : [d] |
|
| 93 | - $this->t128[] = array(1, 1, 2, 2, 1, 4); //69 : [e] |
|
| 94 | - $this->t128[] = array(1, 1, 2, 4, 1, 2); //70 : [f] |
|
| 95 | - $this->t128[] = array(1, 2, 2, 1, 1, 4); //71 : [g] |
|
| 96 | - $this->t128[] = array(1, 2, 2, 4, 1, 1); //72 : [h] |
|
| 97 | - $this->t128[] = array(1, 4, 2, 1, 1, 2); //73 : [i] |
|
| 98 | - $this->t128[] = array(1, 4, 2, 2, 1, 1); //74 : [j] |
|
| 99 | - $this->t128[] = array(2, 4, 1, 2, 1, 1); //75 : [k] |
|
| 100 | - $this->t128[] = array(2, 2, 1, 1, 1, 4); //76 : [l] |
|
| 101 | - $this->t128[] = array(4, 1, 3, 1, 1, 1); //77 : [m] |
|
| 102 | - $this->t128[] = array(2, 4, 1, 1, 1, 2); //78 : [n] |
|
| 103 | - $this->t128[] = array(1, 3, 4, 1, 1, 1); //79 : [o] |
|
| 104 | - $this->t128[] = array(1, 1, 1, 2, 4, 2); //80 : [p] |
|
| 105 | - $this->t128[] = array(1, 2, 1, 1, 4, 2); //81 : [q] |
|
| 106 | - $this->t128[] = array(1, 2, 1, 2, 4, 1); //82 : [r] |
|
| 107 | - $this->t128[] = array(1, 1, 4, 2, 1, 2); //83 : [s] |
|
| 108 | - $this->t128[] = array(1, 2, 4, 1, 1, 2); //84 : [t] |
|
| 109 | - $this->t128[] = array(1, 2, 4, 2, 1, 1); //85 : [u] |
|
| 110 | - $this->t128[] = array(4, 1, 1, 2, 1, 2); //86 : [v] |
|
| 111 | - $this->t128[] = array(4, 2, 1, 1, 1, 2); //87 : [w] |
|
| 112 | - $this->t128[] = array(4, 2, 1, 2, 1, 1); //88 : [x] |
|
| 113 | - $this->t128[] = array(2, 1, 2, 1, 4, 1); //89 : [y] |
|
| 114 | - $this->t128[] = array(2, 1, 4, 1, 2, 1); //90 : [z] |
|
| 115 | - $this->t128[] = array(4, 1, 2, 1, 2, 1); //91 : [{] |
|
| 116 | - $this->t128[] = array(1, 1, 1, 1, 4, 3); //92 : [|] |
|
| 117 | - $this->t128[] = array(1, 1, 1, 3, 4, 1); //93 : [}] |
|
| 118 | - $this->t128[] = array(1, 3, 1, 1, 4, 1); //94 : [~] |
|
| 119 | - $this->t128[] = array(1, 1, 4, 1, 1, 3); //95 : [DEL] |
|
| 120 | - $this->t128[] = array(1, 1, 4, 3, 1, 1); //96 : [FNC3] |
|
| 121 | - $this->t128[] = array(4, 1, 1, 1, 1, 3); //97 : [FNC2] |
|
| 122 | - $this->t128[] = array(4, 1, 1, 3, 1, 1); //98 : [SHIFT] |
|
| 123 | - $this->t128[] = array(1, 1, 3, 1, 4, 1); //99 : [Cswap] |
|
| 124 | - $this->t128[] = array(1, 1, 4, 1, 3, 1); //100 : [Bswap] |
|
| 125 | - $this->t128[] = array(3, 1, 1, 1, 4, 1); //101 : [Aswap] |
|
| 126 | - $this->t128[] = array(4, 1, 1, 1, 3, 1); //102 : [FNC1] |
|
| 127 | - $this->t128[] = array(2, 1, 1, 4, 1, 2); //103 : [Astart] |
|
| 128 | - $this->t128[] = array(2, 1, 1, 2, 1, 4); //104 : [Bstart] |
|
| 129 | - $this->t128[] = array(2, 1, 1, 2, 3, 2); //105 : [Cstart] |
|
| 130 | - $this->t128[] = array(2, 3, 3, 1, 1, 1); //106 : [STOP] |
|
| 131 | - $this->t128[] = array(2, 1); //107 : [END BAR] |
|
| 24 | + $this->t128[] = array(2, 1, 2, 2, 2, 2); //0 : [ ] |
|
| 25 | + $this->t128[] = array(2, 2, 2, 1, 2, 2); //1 : [!] |
|
| 26 | + $this->t128[] = array(2, 2, 2, 2, 2, 1); //2 : ["] |
|
| 27 | + $this->t128[] = array(1, 2, 1, 2, 2, 3); //3 : [#] |
|
| 28 | + $this->t128[] = array(1, 2, 1, 3, 2, 2); //4 : [$] |
|
| 29 | + $this->t128[] = array(1, 3, 1, 2, 2, 2); //5 : [%] |
|
| 30 | + $this->t128[] = array(1, 2, 2, 2, 1, 3); //6 : [&] |
|
| 31 | + $this->t128[] = array(1, 2, 2, 3, 1, 2); //7 : ['] |
|
| 32 | + $this->t128[] = array(1, 3, 2, 2, 1, 2); //8 : [(] |
|
| 33 | + $this->t128[] = array(2, 2, 1, 2, 1, 3); //9 : [)] |
|
| 34 | + $this->t128[] = array(2, 2, 1, 3, 1, 2); //10 : [*] |
|
| 35 | + $this->t128[] = array(2, 3, 1, 2, 1, 2); //11 : [+] |
|
| 36 | + $this->t128[] = array(1, 1, 2, 2, 3, 2); //12 : [,] |
|
| 37 | + $this->t128[] = array(1, 2, 2, 1, 3, 2); //13 : [-] |
|
| 38 | + $this->t128[] = array(1, 2, 2, 2, 3, 1); //14 : [.] |
|
| 39 | + $this->t128[] = array(1, 1, 3, 2, 2, 2); //15 : [/] |
|
| 40 | + $this->t128[] = array(1, 2, 3, 1, 2, 2); //16 : [0] |
|
| 41 | + $this->t128[] = array(1, 2, 3, 2, 2, 1); //17 : [1] |
|
| 42 | + $this->t128[] = array(2, 2, 3, 2, 1, 1); //18 : [2] |
|
| 43 | + $this->t128[] = array(2, 2, 1, 1, 3, 2); //19 : [3] |
|
| 44 | + $this->t128[] = array(2, 2, 1, 2, 3, 1); //20 : [4] |
|
| 45 | + $this->t128[] = array(2, 1, 3, 2, 1, 2); //21 : [5] |
|
| 46 | + $this->t128[] = array(2, 2, 3, 1, 1, 2); //22 : [6] |
|
| 47 | + $this->t128[] = array(3, 1, 2, 1, 3, 1); //23 : [7] |
|
| 48 | + $this->t128[] = array(3, 1, 1, 2, 2, 2); //24 : [8] |
|
| 49 | + $this->t128[] = array(3, 2, 1, 1, 2, 2); //25 : [9] |
|
| 50 | + $this->t128[] = array(3, 2, 1, 2, 2, 1); //26 : [:] |
|
| 51 | + $this->t128[] = array(3, 1, 2, 2, 1, 2); //27 : [;] |
|
| 52 | + $this->t128[] = array(3, 2, 2, 1, 1, 2); //28 : [<] |
|
| 53 | + $this->t128[] = array(3, 2, 2, 2, 1, 1); //29 : [=] |
|
| 54 | + $this->t128[] = array(2, 1, 2, 1, 2, 3); //30 : [>] |
|
| 55 | + $this->t128[] = array(2, 1, 2, 3, 2, 1); //31 : [?] |
|
| 56 | + $this->t128[] = array(2, 3, 2, 1, 2, 1); //32 : [@] |
|
| 57 | + $this->t128[] = array(1, 1, 1, 3, 2, 3); //33 : [A] |
|
| 58 | + $this->t128[] = array(1, 3, 1, 1, 2, 3); //34 : [B] |
|
| 59 | + $this->t128[] = array(1, 3, 1, 3, 2, 1); //35 : [C] |
|
| 60 | + $this->t128[] = array(1, 1, 2, 3, 1, 3); //36 : [D] |
|
| 61 | + $this->t128[] = array(1, 3, 2, 1, 1, 3); //37 : [E] |
|
| 62 | + $this->t128[] = array(1, 3, 2, 3, 1, 1); //38 : [F] |
|
| 63 | + $this->t128[] = array(2, 1, 1, 3, 1, 3); //39 : [G] |
|
| 64 | + $this->t128[] = array(2, 3, 1, 1, 1, 3); //40 : [H] |
|
| 65 | + $this->t128[] = array(2, 3, 1, 3, 1, 1); //41 : [I] |
|
| 66 | + $this->t128[] = array(1, 1, 2, 1, 3, 3); //42 : [J] |
|
| 67 | + $this->t128[] = array(1, 1, 2, 3, 3, 1); //43 : [K] |
|
| 68 | + $this->t128[] = array(1, 3, 2, 1, 3, 1); //44 : [L] |
|
| 69 | + $this->t128[] = array(1, 1, 3, 1, 2, 3); //45 : [M] |
|
| 70 | + $this->t128[] = array(1, 1, 3, 3, 2, 1); //46 : [N] |
|
| 71 | + $this->t128[] = array(1, 3, 3, 1, 2, 1); //47 : [O] |
|
| 72 | + $this->t128[] = array(3, 1, 3, 1, 2, 1); //48 : [P] |
|
| 73 | + $this->t128[] = array(2, 1, 1, 3, 3, 1); //49 : [Q] |
|
| 74 | + $this->t128[] = array(2, 3, 1, 1, 3, 1); //50 : [R] |
|
| 75 | + $this->t128[] = array(2, 1, 3, 1, 1, 3); //51 : [S] |
|
| 76 | + $this->t128[] = array(2, 1, 3, 3, 1, 1); //52 : [T] |
|
| 77 | + $this->t128[] = array(2, 1, 3, 1, 3, 1); //53 : [U] |
|
| 78 | + $this->t128[] = array(3, 1, 1, 1, 2, 3); //54 : [V] |
|
| 79 | + $this->t128[] = array(3, 1, 1, 3, 2, 1); //55 : [W] |
|
| 80 | + $this->t128[] = array(3, 3, 1, 1, 2, 1); //56 : [X] |
|
| 81 | + $this->t128[] = array(3, 1, 2, 1, 1, 3); //57 : [Y] |
|
| 82 | + $this->t128[] = array(3, 1, 2, 3, 1, 1); //58 : [Z] |
|
| 83 | + $this->t128[] = array(3, 3, 2, 1, 1, 1); //59 : [[] |
|
| 84 | + $this->t128[] = array(3, 1, 4, 1, 1, 1); //60 : [\] |
|
| 85 | + $this->t128[] = array(2, 2, 1, 4, 1, 1); //61 : []] |
|
| 86 | + $this->t128[] = array(4, 3, 1, 1, 1, 1); //62 : [^] |
|
| 87 | + $this->t128[] = array(1, 1, 1, 2, 2, 4); //63 : [_] |
|
| 88 | + $this->t128[] = array(1, 1, 1, 4, 2, 2); //64 : [`] |
|
| 89 | + $this->t128[] = array(1, 2, 1, 1, 2, 4); //65 : [a] |
|
| 90 | + $this->t128[] = array(1, 2, 1, 4, 2, 1); //66 : [b] |
|
| 91 | + $this->t128[] = array(1, 4, 1, 1, 2, 2); //67 : [c] |
|
| 92 | + $this->t128[] = array(1, 4, 1, 2, 2, 1); //68 : [d] |
|
| 93 | + $this->t128[] = array(1, 1, 2, 2, 1, 4); //69 : [e] |
|
| 94 | + $this->t128[] = array(1, 1, 2, 4, 1, 2); //70 : [f] |
|
| 95 | + $this->t128[] = array(1, 2, 2, 1, 1, 4); //71 : [g] |
|
| 96 | + $this->t128[] = array(1, 2, 2, 4, 1, 1); //72 : [h] |
|
| 97 | + $this->t128[] = array(1, 4, 2, 1, 1, 2); //73 : [i] |
|
| 98 | + $this->t128[] = array(1, 4, 2, 2, 1, 1); //74 : [j] |
|
| 99 | + $this->t128[] = array(2, 4, 1, 2, 1, 1); //75 : [k] |
|
| 100 | + $this->t128[] = array(2, 2, 1, 1, 1, 4); //76 : [l] |
|
| 101 | + $this->t128[] = array(4, 1, 3, 1, 1, 1); //77 : [m] |
|
| 102 | + $this->t128[] = array(2, 4, 1, 1, 1, 2); //78 : [n] |
|
| 103 | + $this->t128[] = array(1, 3, 4, 1, 1, 1); //79 : [o] |
|
| 104 | + $this->t128[] = array(1, 1, 1, 2, 4, 2); //80 : [p] |
|
| 105 | + $this->t128[] = array(1, 2, 1, 1, 4, 2); //81 : [q] |
|
| 106 | + $this->t128[] = array(1, 2, 1, 2, 4, 1); //82 : [r] |
|
| 107 | + $this->t128[] = array(1, 1, 4, 2, 1, 2); //83 : [s] |
|
| 108 | + $this->t128[] = array(1, 2, 4, 1, 1, 2); //84 : [t] |
|
| 109 | + $this->t128[] = array(1, 2, 4, 2, 1, 1); //85 : [u] |
|
| 110 | + $this->t128[] = array(4, 1, 1, 2, 1, 2); //86 : [v] |
|
| 111 | + $this->t128[] = array(4, 2, 1, 1, 1, 2); //87 : [w] |
|
| 112 | + $this->t128[] = array(4, 2, 1, 2, 1, 1); //88 : [x] |
|
| 113 | + $this->t128[] = array(2, 1, 2, 1, 4, 1); //89 : [y] |
|
| 114 | + $this->t128[] = array(2, 1, 4, 1, 2, 1); //90 : [z] |
|
| 115 | + $this->t128[] = array(4, 1, 2, 1, 2, 1); //91 : [{] |
|
| 116 | + $this->t128[] = array(1, 1, 1, 1, 4, 3); //92 : [|] |
|
| 117 | + $this->t128[] = array(1, 1, 1, 3, 4, 1); //93 : [}] |
|
| 118 | + $this->t128[] = array(1, 3, 1, 1, 4, 1); //94 : [~] |
|
| 119 | + $this->t128[] = array(1, 1, 4, 1, 1, 3); //95 : [DEL] |
|
| 120 | + $this->t128[] = array(1, 1, 4, 3, 1, 1); //96 : [FNC3] |
|
| 121 | + $this->t128[] = array(4, 1, 1, 1, 1, 3); //97 : [FNC2] |
|
| 122 | + $this->t128[] = array(4, 1, 1, 3, 1, 1); //98 : [SHIFT] |
|
| 123 | + $this->t128[] = array(1, 1, 3, 1, 4, 1); //99 : [Cswap] |
|
| 124 | + $this->t128[] = array(1, 1, 4, 1, 3, 1); //100 : [Bswap] |
|
| 125 | + $this->t128[] = array(3, 1, 1, 1, 4, 1); //101 : [Aswap] |
|
| 126 | + $this->t128[] = array(4, 1, 1, 1, 3, 1); //102 : [FNC1] |
|
| 127 | + $this->t128[] = array(2, 1, 1, 4, 1, 2); //103 : [Astart] |
|
| 128 | + $this->t128[] = array(2, 1, 1, 2, 1, 4); //104 : [Bstart] |
|
| 129 | + $this->t128[] = array(2, 1, 1, 2, 3, 2); //105 : [Cstart] |
|
| 130 | + $this->t128[] = array(2, 3, 3, 1, 1, 1); //106 : [STOP] |
|
| 131 | + $this->t128[] = array(2, 1); //107 : [END BAR] |
|
| 132 | 132 | for ($i = 32; $i <= 95; $i++) { // conjunto de caracteres |
| 133 | 133 | $this->abcSet .= chr($i); |
| 134 | 134 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | $this->abcSet .= chr($i); |
| 143 | 143 | $this->bSet .= chr($i); |
| 144 | 144 | } |
| 145 | - $this->cSet="0123456789"; |
|
| 145 | + $this->cSet = "0123456789"; |
|
| 146 | 146 | for ($i = 0; $i < 96; $i++) { |
| 147 | 147 | // convertendo grupos A & B |
| 148 | 148 | if (isset($this->setFrom["A"])) { |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | $this->setFrom["B"] .= chr($i + 32); |
| 153 | 153 | } |
| 154 | 154 | if (isset($this->setTo["A"])) { |
| 155 | - $this->setTo["A"] .= chr(($i < 32) ? $i+64 : $i-32); |
|
| 155 | + $this->setTo["A"] .= chr(($i < 32) ? $i + 64 : $i - 32); |
|
| 156 | 156 | } |
| 157 | 157 | if (isset($this->setTo["A"])) { |
| 158 | 158 | $this->setTo["B"] .= chr($i); |
@@ -165,21 +165,21 @@ discard block |
||
| 165 | 165 | */ |
| 166 | 166 | public function code128($x, $y, $code, $w, $h) |
| 167 | 167 | { |
| 168 | - $Aguid=""; |
|
| 169 | - $Bguid=""; |
|
| 170 | - $Cguid=""; |
|
| 171 | - for ($i=0; $i < strlen($code); $i++) { |
|
| 172 | - $needle=substr($code, $i, 1); |
|
| 173 | - $Aguid .= ((strpos($this->aSet, $needle)===false) ? "N" : "O"); |
|
| 174 | - $Bguid .= ((strpos($this->bSet, $needle)===false) ? "N" : "O"); |
|
| 175 | - $Cguid .= ((strpos($this->cSet, $needle)===false) ? "N" : "O"); |
|
| 168 | + $Aguid = ""; |
|
| 169 | + $Bguid = ""; |
|
| 170 | + $Cguid = ""; |
|
| 171 | + for ($i = 0; $i < strlen($code); $i++) { |
|
| 172 | + $needle = substr($code, $i, 1); |
|
| 173 | + $Aguid .= ((strpos($this->aSet, $needle) === false) ? "N" : "O"); |
|
| 174 | + $Bguid .= ((strpos($this->bSet, $needle) === false) ? "N" : "O"); |
|
| 175 | + $Cguid .= ((strpos($this->cSet, $needle) === false) ? "N" : "O"); |
|
| 176 | 176 | } |
| 177 | 177 | $SminiC = "OOOO"; |
| 178 | 178 | $IminiC = 4; |
| 179 | 179 | $crypt = ""; |
| 180 | 180 | while ($code > "") { |
| 181 | 181 | $i = strpos($Cguid, $SminiC); |
| 182 | - if ($i!==false) { |
|
| 182 | + if ($i !== false) { |
|
| 183 | 183 | $Aguid [$i] = "N"; |
| 184 | 184 | $Bguid [$i] = "N"; |
| 185 | 185 | } |
@@ -189,10 +189,10 @@ discard block |
||
| 189 | 189 | if ($made === false) { |
| 190 | 190 | $made = strlen($Cguid); |
| 191 | 191 | } |
| 192 | - if (fmod($made, 2)==1) { |
|
| 192 | + if (fmod($made, 2) == 1) { |
|
| 193 | 193 | $made--; |
| 194 | 194 | } |
| 195 | - for ($i=0; $i < $made; $i += 2) { |
|
| 195 | + for ($i = 0; $i < $made; $i += 2) { |
|
| 196 | 196 | $crypt .= chr(strval(substr($code, $i, 2))); |
| 197 | 197 | } |
| 198 | 198 | $jeu = "C"; |
@@ -205,8 +205,8 @@ discard block |
||
| 205 | 205 | if ($madeB === false) { |
| 206 | 206 | $madeB = strlen($Bguid); |
| 207 | 207 | } |
| 208 | - $made = (($madeA < $madeB) ? $madeB : $madeA ); |
|
| 209 | - $jeu = (($madeA < $madeB) ? "B" : "A" ); |
|
| 208 | + $made = (($madeA < $madeB) ? $madeB : $madeA); |
|
| 209 | + $jeu = (($madeA < $madeB) ? "B" : "A"); |
|
| 210 | 210 | $jeuguid = $jeu . "guid"; |
| 211 | 211 | $crypt .= chr(($crypt > "") ? $this->jSwap["$jeu"] : $this->jStart["$jeu"]); |
| 212 | 212 | $crypt .= strtr(substr($code, 0, $made), $this->setFrom[$jeu], $this->setTo[$jeu]); |
@@ -217,18 +217,18 @@ discard block |
||
| 217 | 217 | $Cguid = substr($Cguid, $made); |
| 218 | 218 | } |
| 219 | 219 | $check = ord($crypt[0]); |
| 220 | - for ($i=0; $i<strlen($crypt); $i++) { |
|
| 220 | + for ($i = 0; $i < strlen($crypt); $i++) { |
|
| 221 | 221 | $check += (ord($crypt[$i]) * $i); |
| 222 | 222 | } |
| 223 | 223 | $check %= 103; |
| 224 | 224 | $crypt .= chr($check) . chr(106) . chr(107); |
| 225 | 225 | $i = (strlen($crypt) * 11) - 8; |
| 226 | - $modul = $w/$i; |
|
| 227 | - for ($i=0; $i<strlen($crypt); $i++) { |
|
| 226 | + $modul = $w / $i; |
|
| 227 | + for ($i = 0; $i < strlen($crypt); $i++) { |
|
| 228 | 228 | $c = $this->t128[ord($crypt[$i])]; |
| 229 | - for ($j=0; $j<count($c); $j++) { |
|
| 230 | - $this->Rect($x, $y, $c[$j]*$modul, $h, "F"); |
|
| 231 | - $x += ($c[$j++]+$c[$j])*$modul; |
|
| 229 | + for ($j = 0; $j < count($c); $j++) { |
|
| 230 | + $this->Rect($x, $y, $c[$j] * $modul, $h, "F"); |
|
| 231 | + $x += ($c[$j++] + $c[$j]) * $modul; |
|
| 232 | 232 | } |
| 233 | 233 | } |
| 234 | 234 | } |
@@ -252,11 +252,11 @@ discard block |
||
| 252 | 252 | } |
| 253 | 253 | $this->angle = $angle; |
| 254 | 254 | if ($angle != 0) { |
| 255 | - $angle *= M_PI/180; |
|
| 255 | + $angle *= M_PI / 180; |
|
| 256 | 256 | $c = cos($angle); |
| 257 | 257 | $s = sin($angle); |
| 258 | - $cx =$x*$this->k; |
|
| 259 | - $cy = ($this->h-$y)*$this->k; |
|
| 258 | + $cx = $x * $this->k; |
|
| 259 | + $cy = ($this->h - $y) * $this->k; |
|
| 260 | 260 | $this->out( |
| 261 | 261 | sprintf( |
| 262 | 262 | 'q %.5F %.5F %.5F %.5F %.2F %.2F cm 1 0 0 1 %.2F %.2F cm', |
@@ -294,40 +294,40 @@ discard block |
||
| 294 | 294 | } else { |
| 295 | 295 | $op = 'S'; |
| 296 | 296 | } |
| 297 | - $MyArc = 4/3 * (sqrt(2) - 1); |
|
| 298 | - $this->out(sprintf('%.2F %.2F m', ($x+$r)*$k, ($hp-$y)*$k)); |
|
| 299 | - $xc = $x+$w-$r; |
|
| 300 | - $yc = $y+$r; |
|
| 301 | - $this->out(sprintf('%.2F %.2F l', $xc*$k, ($hp-$y)*$k)); |
|
| 302 | - if (strpos($corners, '2')===false) { |
|
| 303 | - $this->out(sprintf('%.2F %.2F l', ($x+$w)*$k, ($hp-$y)*$k)); |
|
| 297 | + $MyArc = 4 / 3 * (sqrt(2) - 1); |
|
| 298 | + $this->out(sprintf('%.2F %.2F m', ($x + $r) * $k, ($hp - $y) * $k)); |
|
| 299 | + $xc = $x + $w - $r; |
|
| 300 | + $yc = $y + $r; |
|
| 301 | + $this->out(sprintf('%.2F %.2F l', $xc * $k, ($hp - $y) * $k)); |
|
| 302 | + if (strpos($corners, '2') === false) { |
|
| 303 | + $this->out(sprintf('%.2F %.2F l', ($x + $w) * $k, ($hp - $y) * $k)); |
|
| 304 | 304 | } else { |
| 305 | - $this->arc($xc + $r*$MyArc, $yc - $r, $xc + $r, $yc - $r*$MyArc, $xc + $r, $yc); |
|
| 305 | + $this->arc($xc + $r * $MyArc, $yc - $r, $xc + $r, $yc - $r * $MyArc, $xc + $r, $yc); |
|
| 306 | 306 | } |
| 307 | - $xc = $x+$w-$r; |
|
| 308 | - $yc = $y+$h-$r; |
|
| 309 | - $this->out(sprintf('%.2F %.2F l', ($x+$w)*$k, ($hp-$yc)*$k)); |
|
| 310 | - if (strpos($corners, '3')===false) { |
|
| 311 | - $this->out(sprintf('%.2F %.2F l', ($x+$w)*$k, ($hp-($y+$h))*$k)); |
|
| 307 | + $xc = $x + $w - $r; |
|
| 308 | + $yc = $y + $h - $r; |
|
| 309 | + $this->out(sprintf('%.2F %.2F l', ($x + $w) * $k, ($hp - $yc) * $k)); |
|
| 310 | + if (strpos($corners, '3') === false) { |
|
| 311 | + $this->out(sprintf('%.2F %.2F l', ($x + $w) * $k, ($hp - ($y + $h)) * $k)); |
|
| 312 | 312 | } else { |
| 313 | - $this->arc($xc + $r, $yc + $r*$MyArc, $xc + $r*$MyArc, $yc + $r, $xc, $yc + $r); |
|
| 313 | + $this->arc($xc + $r, $yc + $r * $MyArc, $xc + $r * $MyArc, $yc + $r, $xc, $yc + $r); |
|
| 314 | 314 | } |
| 315 | - $xc = $x+$r; |
|
| 316 | - $yc = $y+$h-$r; |
|
| 317 | - $this->out(sprintf('%.2F %.2F l', $xc*$k, ($hp-($y+$h))*$k)); |
|
| 318 | - if (strpos($corners, '4')===false) { |
|
| 319 | - $this->out(sprintf('%.2F %.2F l', ($x)*$k, ($hp-($y+$h))*$k)); |
|
| 315 | + $xc = $x + $r; |
|
| 316 | + $yc = $y + $h - $r; |
|
| 317 | + $this->out(sprintf('%.2F %.2F l', $xc * $k, ($hp - ($y + $h)) * $k)); |
|
| 318 | + if (strpos($corners, '4') === false) { |
|
| 319 | + $this->out(sprintf('%.2F %.2F l', ($x) * $k, ($hp - ($y + $h)) * $k)); |
|
| 320 | 320 | } else { |
| 321 | - $this->arc($xc - $r*$MyArc, $yc + $r, $xc - $r, $yc + $r*$MyArc, $xc - $r, $yc); |
|
| 321 | + $this->arc($xc - $r * $MyArc, $yc + $r, $xc - $r, $yc + $r * $MyArc, $xc - $r, $yc); |
|
| 322 | 322 | } |
| 323 | - $xc = $x+$r ; |
|
| 324 | - $yc = $y+$r; |
|
| 325 | - $this->out(sprintf('%.2F %.2F l', ($x)*$k, ($hp-$yc)*$k)); |
|
| 326 | - if (strpos($corners, '1')===false) { |
|
| 327 | - $this->out(sprintf('%.2F %.2F l', ($x)*$k, ($hp-$y)*$k)); |
|
| 328 | - $this->out(sprintf('%.2F %.2F l', ($x+$r)*$k, ($hp-$y)*$k)); |
|
| 323 | + $xc = $x + $r; |
|
| 324 | + $yc = $y + $r; |
|
| 325 | + $this->out(sprintf('%.2F %.2F l', ($x) * $k, ($hp - $yc) * $k)); |
|
| 326 | + if (strpos($corners, '1') === false) { |
|
| 327 | + $this->out(sprintf('%.2F %.2F l', ($x) * $k, ($hp - $y) * $k)); |
|
| 328 | + $this->out(sprintf('%.2F %.2F l', ($x + $r) * $k, ($hp - $y) * $k)); |
|
| 329 | 329 | } else { |
| 330 | - $this->arc($xc - $r, $yc - $r*$MyArc, $xc - $r*$MyArc, $yc - $r, $xc, $yc - $r); |
|
| 330 | + $this->arc($xc - $r, $yc - $r * $MyArc, $xc - $r * $MyArc, $yc - $r, $xc, $yc - $r); |
|
| 331 | 331 | } |
| 332 | 332 | $this->out($op); |
| 333 | 333 | } |
@@ -347,12 +347,12 @@ discard block |
||
| 347 | 347 | $this->out( |
| 348 | 348 | sprintf( |
| 349 | 349 | '%.2F %.2F %.2F %.2F %.2F %.2F c ', |
| 350 | - $x1*$this->k, |
|
| 351 | - ($h-$y1)*$this->k, |
|
| 352 | - $x2*$this->k, |
|
| 353 | - ($h-$y2)*$this->k, |
|
| 354 | - $x3*$this->k, |
|
| 355 | - ($h-$y3)*$this->k |
|
| 350 | + $x1 * $this->k, |
|
| 351 | + ($h - $y1) * $this->k, |
|
| 352 | + $x2 * $this->k, |
|
| 353 | + ($h - $y2) * $this->k, |
|
| 354 | + $x3 * $this->k, |
|
| 355 | + ($h - $y3) * $this->k |
|
| 356 | 356 | ) |
| 357 | 357 | ); |
| 358 | 358 | } |
@@ -369,26 +369,26 @@ discard block |
||
| 369 | 369 | public function dashedRect($x1, $y1, $x2, $y2, $width = 1, $nb = 15) |
| 370 | 370 | { |
| 371 | 371 | $this->setLineWidth($width); |
| 372 | - $longueur = abs($x1-$x2); |
|
| 373 | - $hauteur = abs($y1-$y2); |
|
| 372 | + $longueur = abs($x1 - $x2); |
|
| 373 | + $hauteur = abs($y1 - $y2); |
|
| 374 | 374 | if ($longueur > $hauteur) { |
| 375 | - $Pointilles = ($longueur/$nb)/2; |
|
| 375 | + $Pointilles = ($longueur / $nb) / 2; |
|
| 376 | 376 | } else { |
| 377 | - $Pointilles = ($hauteur/$nb)/2; |
|
| 377 | + $Pointilles = ($hauteur / $nb) / 2; |
|
| 378 | 378 | } |
| 379 | - for ($i=$x1; $i<=$x2; $i+=$Pointilles+$Pointilles) { |
|
| 380 | - for ($j=$i; $j<=($i+$Pointilles); $j++) { |
|
| 381 | - if ($j<=($x2-1)) { |
|
| 382 | - $this->line($j, $y1, $j+1, $y1); |
|
| 383 | - $this->line($j, $y2, $j+1, $y2); |
|
| 379 | + for ($i = $x1; $i <= $x2; $i += $Pointilles + $Pointilles) { |
|
| 380 | + for ($j = $i; $j <= ($i + $Pointilles); $j++) { |
|
| 381 | + if ($j <= ($x2 - 1)) { |
|
| 382 | + $this->line($j, $y1, $j + 1, $y1); |
|
| 383 | + $this->line($j, $y2, $j + 1, $y2); |
|
| 384 | 384 | } |
| 385 | 385 | } |
| 386 | 386 | } |
| 387 | - for ($i=$y1; $i<=$y2; $i+=$Pointilles+$Pointilles) { |
|
| 388 | - for ($j=$i; $j<=($i+$Pointilles); $j++) { |
|
| 389 | - if ($j<=($y2-1)) { |
|
| 390 | - $this->line($x1, $j, $x1, $j+1); |
|
| 391 | - $this->line($x2, $j, $x2, $j+1); |
|
| 387 | + for ($i = $y1; $i <= $y2; $i += $Pointilles + $Pointilles) { |
|
| 388 | + for ($j = $i; $j <= ($i + $Pointilles); $j++) { |
|
| 389 | + if ($j <= ($y2 - 1)) { |
|
| 390 | + $this->line($x1, $j, $x1, $j + 1); |
|
| 391 | + $this->line($x2, $j, $x2, $j + 1); |
|
| 392 | 392 | } |
| 393 | 393 | } |
| 394 | 394 | } |
@@ -409,16 +409,16 @@ discard block |
||
| 409 | 409 | $yi = $this->getY(); |
| 410 | 410 | $hrow = $this->fontSize; |
| 411 | 411 | $textrows = $this->drawRows($w, $hrow, $strText, 0, $align, 0, 0, 0); |
| 412 | - $maxrows = floor($h/$this->fontSize); |
|
| 412 | + $maxrows = floor($h / $this->fontSize); |
|
| 413 | 413 | $rows = min($textrows, $maxrows); |
| 414 | 414 | $dy = 0; |
| 415 | 415 | if (strtoupper($valign) == 'M') { |
| 416 | - $dy = ($h-$rows*$this->fontSize)/2; |
|
| 416 | + $dy = ($h - $rows * $this->fontSize) / 2; |
|
| 417 | 417 | } |
| 418 | 418 | if (strtoupper($valign) == 'B') { |
| 419 | - $dy = $h-$rows*$this->fontSize; |
|
| 419 | + $dy = $h - $rows * $this->fontSize; |
|
| 420 | 420 | } |
| 421 | - $this->setY($yi+$dy); |
|
| 421 | + $this->setY($yi + $dy); |
|
| 422 | 422 | $this->setX($xi); |
| 423 | 423 | $this->drawRows($w, $hrow, $strText, 0, $align, false, $rows, 1); |
| 424 | 424 | if ($border) { |
@@ -440,17 +440,17 @@ discard block |
||
| 440 | 440 | */ |
| 441 | 441 | private function drawRows($w, $h, $txt, $border = 0, $align = 'J', $fill = false, $maxline = 0, $prn = 0) |
| 442 | 442 | { |
| 443 | - $cw =& $this->currentFont['cw']; |
|
| 443 | + $cw = & $this->currentFont['cw']; |
|
| 444 | 444 | if ($w == 0) { |
| 445 | - $w = $this->w-$this->rMargin-$this->x; |
|
| 445 | + $w = $this->w - $this->rMargin - $this->x; |
|
| 446 | 446 | } |
| 447 | - $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize; |
|
| 447 | + $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize; |
|
| 448 | 448 | $s = str_replace("\r", '', $txt); |
| 449 | 449 | $nb = strlen($s); |
| 450 | - if ($nb > 0 && $s[$nb-1] == "\n") { |
|
| 450 | + if ($nb > 0 && $s[$nb - 1] == "\n") { |
|
| 451 | 451 | $nb--; |
| 452 | 452 | } |
| 453 | - $b=0; |
|
| 453 | + $b = 0; |
|
| 454 | 454 | if ($border) { |
| 455 | 455 | if ($border == 1) { |
| 456 | 456 | $border = 'LTRB'; |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | if (is_int(strpos($border, 'R'))) { |
| 465 | 465 | $b2 .= 'R'; |
| 466 | 466 | } |
| 467 | - $b = is_int(strpos($border, 'T')) ? $b2.'T' : $b2; |
|
| 467 | + $b = is_int(strpos($border, 'T')) ? $b2 . 'T' : $b2; |
|
| 468 | 468 | } |
| 469 | 469 | } |
| 470 | 470 | $sep = -1; |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | } |
| 484 | 484 | } |
| 485 | 485 | if ($prn == 1) { |
| 486 | - $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill); |
|
| 486 | + $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill); |
|
| 487 | 487 | } |
| 488 | 488 | $i++; |
| 489 | 489 | $sep = -1; |
@@ -517,19 +517,19 @@ discard block |
||
| 517 | 517 | } |
| 518 | 518 | } |
| 519 | 519 | if ($prn == 1) { |
| 520 | - $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill); |
|
| 520 | + $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill); |
|
| 521 | 521 | } |
| 522 | 522 | } else { |
| 523 | 523 | if ($align == 'J') { |
| 524 | - $this->ws = ($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0; |
|
| 524 | + $this->ws = ($ns > 1) ? ($wmax - $ls) / 1000 * $this->FontSize / ($ns - 1) : 0; |
|
| 525 | 525 | if ($prn == 1) { |
| 526 | - $this->out(sprintf('%.3F Tw', $this->ws*$this->k)); |
|
| 526 | + $this->out(sprintf('%.3F Tw', $this->ws * $this->k)); |
|
| 527 | 527 | } |
| 528 | 528 | } |
| 529 | 529 | if ($prn == 1) { |
| 530 | - $this->cell($w, $h, substr($s, $j, $sep-$j), $b, 2, $align, $fill); |
|
| 530 | + $this->cell($w, $h, substr($s, $j, $sep - $j), $b, 2, $align, $fill); |
|
| 531 | 531 | } |
| 532 | - $i = $sep+1; |
|
| 532 | + $i = $sep + 1; |
|
| 533 | 533 | } |
| 534 | 534 | $sep = -1; |
| 535 | 535 | $j = $i; |
@@ -556,7 +556,7 @@ discard block |
||
| 556 | 556 | $b .= 'B'; |
| 557 | 557 | } |
| 558 | 558 | if ($prn == 1) { |
| 559 | - $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill); |
|
| 559 | + $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill); |
|
| 560 | 560 | } |
| 561 | 561 | $this->x = $this->lMargin; |
| 562 | 562 | return $nl; |
@@ -585,27 +585,27 @@ discard block |
||
| 585 | 585 | $wordwidth = $this->getStringWidth($word); |
| 586 | 586 | if ($wordwidth > $maxwidth) { |
| 587 | 587 | // Word is too long, we cut it |
| 588 | - for ($i=0; $i<strlen($word); $i++) { |
|
| 588 | + for ($i = 0; $i < strlen($word); $i++) { |
|
| 589 | 589 | $wordwidth = $this->getStringWidth(substr($word, $i, 1)); |
| 590 | 590 | if ($width + $wordwidth <= $maxwidth) { |
| 591 | 591 | $width += $wordwidth; |
| 592 | 592 | $text .= substr($word, $i, 1); |
| 593 | 593 | } else { |
| 594 | 594 | $width = $wordwidth; |
| 595 | - $text = rtrim($text)."\n".substr($word, $i, 1); |
|
| 595 | + $text = rtrim($text) . "\n" . substr($word, $i, 1); |
|
| 596 | 596 | $count++; |
| 597 | 597 | } |
| 598 | 598 | } |
| 599 | 599 | } elseif ($width + $wordwidth <= $maxwidth) { |
| 600 | 600 | $width += $wordwidth + $space; |
| 601 | - $text .= $word.' '; |
|
| 601 | + $text .= $word . ' '; |
|
| 602 | 602 | } else { |
| 603 | 603 | $width = $wordwidth + $space; |
| 604 | - $text = rtrim($text)."\n".$word.' '; |
|
| 604 | + $text = rtrim($text) . "\n" . $word . ' '; |
|
| 605 | 605 | $count++; |
| 606 | 606 | } |
| 607 | 607 | } |
| 608 | - $text = rtrim($text)."\n"; |
|
| 608 | + $text = rtrim($text) . "\n"; |
|
| 609 | 609 | $count++; |
| 610 | 610 | } |
| 611 | 611 | $text = rtrim($text); |
@@ -637,21 +637,21 @@ discard block |
||
| 637 | 637 | $scale = false, |
| 638 | 638 | $force = true |
| 639 | 639 | ) { |
| 640 | - $str_width=$this->getStringWidth($txt); |
|
| 640 | + $str_width = $this->getStringWidth($txt); |
|
| 641 | 641 | if ($w == 0) { |
| 642 | - $w = $this->w-$this->rMargin-$this->x; |
|
| 642 | + $w = $this->w - $this->rMargin - $this->x; |
|
| 643 | 643 | } |
| 644 | - $ratio = ($w-$this->cMargin*2)/$str_width; |
|
| 644 | + $ratio = ($w - $this->cMargin * 2) / $str_width; |
|
| 645 | 645 | $fit = ($ratio < 1 || ($ratio > 1 && $force)); |
| 646 | 646 | if ($fit) { |
| 647 | 647 | if ($scale) { |
| 648 | 648 | //Calcula a escala horizontal |
| 649 | - $horiz_scale = $ratio*100.0; |
|
| 649 | + $horiz_scale = $ratio * 100.0; |
|
| 650 | 650 | //Ajusta a escala horizontal |
| 651 | 651 | $this->out(sprintf('BT %.2F Tz ET', $horiz_scale)); |
| 652 | 652 | } else { |
| 653 | 653 | //Calcula o espaçamento de caracteres em pontos |
| 654 | - $char_space = ($w-$this->cMargin*2-$str_width)/max($this->_MBGetStringLength($txt)-1, 1)*$this->k; |
|
| 654 | + $char_space = ($w - $this->cMargin * 2 - $str_width) / max($this->_MBGetStringLength($txt) - 1, 1) * $this->k; |
|
| 655 | 655 | //Ajusta o espaçamento de caracteres |
| 656 | 656 | $this->out(sprintf('BT %.2F Tc ET', $char_space)); |
| 657 | 657 | } |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | $this->cell($w, $h, $txt, $border, $ln, $align, $fill, $link); |
| 663 | 663 | //Reseta o espaçamento de caracteres e a escala horizontal |
| 664 | 664 | if ($fit) { |
| 665 | - $this->out('BT '.($scale ? '100 Tz' : '0 Tc').' ET'); |
|
| 665 | + $this->out('BT ' . ($scale ? '100 Tz' : '0 Tc') . ' ET'); |
|
| 666 | 666 | } |
| 667 | 667 | } |
| 668 | 668 | |
@@ -757,7 +757,7 @@ discard block |
||
| 757 | 757 | $len = 0; |
| 758 | 758 | $nbbytes = strlen($s); |
| 759 | 759 | for ($i = 0; $i < $nbbytes; $i++) { |
| 760 | - if (ord($s[$i])<128) { |
|
| 760 | + if (ord($s[$i]) < 128) { |
|
| 761 | 761 | $len++; |
| 762 | 762 | } else { |
| 763 | 763 | $len++; |
@@ -783,11 +783,11 @@ discard block |
||
| 783 | 783 | { |
| 784 | 784 | $this->setDrawColor(110); |
| 785 | 785 | $this->setLineWidth($h); |
| 786 | - $wDash = ($w/$n)/2; |
|
| 787 | - for ($i=$x; $i<=$x+$w; $i += $wDash+$wDash) { |
|
| 788 | - for ($j=$i; $j<= ($i+$wDash); $j++) { |
|
| 789 | - if ($j <= ($x+$w-1)) { |
|
| 790 | - $this->line($j, $y, $j+1, $y); |
|
| 786 | + $wDash = ($w / $n) / 2; |
|
| 787 | + for ($i = $x; $i <= $x + $w; $i += $wDash + $wDash) { |
|
| 788 | + for ($j = $i; $j <= ($i + $wDash); $j++) { |
|
| 789 | + if ($j <= ($x + $w - 1)) { |
|
| 790 | + $this->line($j, $y, $j + 1, $y); |
|
| 791 | 791 | } |
| 792 | 792 | } |
| 793 | 793 | } |
@@ -812,7 +812,7 @@ discard block |
||
| 812 | 812 | $y = $aux; |
| 813 | 813 | } |
| 814 | 814 | while ($y < $yfinal && $n > 0) { |
| 815 | - $this->line($x, $y, $x, $y+1); |
|
| 815 | + $this->line($x, $y, $x, $y + 1); |
|
| 816 | 816 | $y += 3; |
| 817 | 817 | $n--; |
| 818 | 818 | } |
@@ -794,15 +794,15 @@ |
||
| 794 | 794 | $this->setDrawColor(0); |
| 795 | 795 | } |
| 796 | 796 | |
| 797 | - /** |
|
| 798 | - * Desenha uma linha vertical tracejada com o FPDF |
|
| 799 | - * @param number $x Posição horizontal inicial, em mm |
|
| 800 | - * @param number $y Posição vertical inicial, em mm |
|
| 801 | - * @param number $w Espessura da linha, em mm |
|
| 802 | - * @param number $yfinal posição final |
|
| 803 | - * @param number $n Numero de traços na seção da linha com o comprimento $w |
|
| 804 | - * @return none |
|
| 805 | - */ |
|
| 797 | + /** |
|
| 798 | + * Desenha uma linha vertical tracejada com o FPDF |
|
| 799 | + * @param number $x Posição horizontal inicial, em mm |
|
| 800 | + * @param number $y Posição vertical inicial, em mm |
|
| 801 | + * @param number $w Espessura da linha, em mm |
|
| 802 | + * @param number $yfinal posição final |
|
| 803 | + * @param number $n Numero de traços na seção da linha com o comprimento $w |
|
| 804 | + * @return none |
|
| 805 | + */ |
|
| 806 | 806 | public function dashedVLine($x, $y, $w, $yfinal, $n) |
| 807 | 807 | { |
| 808 | 808 | $this->setLineWidth($w); |
@@ -162,6 +162,8 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | /** |
| 164 | 164 | * Imprime barcode 128 |
| 165 | + * @param double $x |
|
| 166 | + * @param integer $h |
|
| 165 | 167 | */ |
| 166 | 168 | public function code128($x, $y, $code, $w, $h) |
| 167 | 169 | { |
@@ -235,9 +237,9 @@ discard block |
||
| 235 | 237 | |
| 236 | 238 | /** |
| 237 | 239 | * Rotaciona para impressão paisagem (landscape) |
| 238 | - * @param number $angle |
|
| 239 | - * @param number $x |
|
| 240 | - * @param number $y |
|
| 240 | + * @param integer $angle |
|
| 241 | + * @param integer $x |
|
| 242 | + * @param integer $y |
|
| 241 | 243 | */ |
| 242 | 244 | public function rotate($angle, $x = -1, $y = -1) |
| 243 | 245 | { |
@@ -279,7 +281,7 @@ discard block |
||
| 279 | 281 | * @param number $y |
| 280 | 282 | * @param number $w |
| 281 | 283 | * @param number $h |
| 282 | - * @param number $r |
|
| 284 | + * @param double $r |
|
| 283 | 285 | * @param string $corners |
| 284 | 286 | * @param string $style |
| 285 | 287 | */ |
@@ -334,12 +336,12 @@ discard block |
||
| 334 | 336 | |
| 335 | 337 | /** |
| 336 | 338 | * Desenha o arco para arredondar o canto do retangulo |
| 337 | - * @param number $x1 |
|
| 338 | - * @param number $y1 |
|
| 339 | - * @param number $x2 |
|
| 340 | - * @param number $y2 |
|
| 341 | - * @param number $x3 |
|
| 342 | - * @param number $y3 |
|
| 339 | + * @param double $x1 |
|
| 340 | + * @param double $y1 |
|
| 341 | + * @param double $x2 |
|
| 342 | + * @param double $y2 |
|
| 343 | + * @param double $x3 |
|
| 344 | + * @param double $y3 |
|
| 343 | 345 | */ |
| 344 | 346 | private function arc($x1, $y1, $x2, $y2, $x3, $y3) |
| 345 | 347 | { |
@@ -363,8 +365,8 @@ discard block |
||
| 363 | 365 | * @param number $y1 |
| 364 | 366 | * @param number $x2 |
| 365 | 367 | * @param number $y2 |
| 366 | - * @param number $width |
|
| 367 | - * @param number $nb |
|
| 368 | + * @param integer $width |
|
| 369 | + * @param integer $nb |
|
| 368 | 370 | */ |
| 369 | 371 | public function dashedRect($x1, $y1, $x2, $y2, $width = 1, $nb = 15) |
| 370 | 372 | { |
@@ -431,11 +433,11 @@ discard block |
||
| 431 | 433 | * @param number $w |
| 432 | 434 | * @param number $h |
| 433 | 435 | * @param string $txt |
| 434 | - * @param string $border |
|
| 436 | + * @param integer $border |
|
| 435 | 437 | * @param string $align |
| 436 | 438 | * @param boolean $fill |
| 437 | - * @param number $maxline |
|
| 438 | - * @param number $prn |
|
| 439 | + * @param integer $maxline |
|
| 440 | + * @param integer $prn |
|
| 439 | 441 | * @return int |
| 440 | 442 | */ |
| 441 | 443 | private function drawRows($w, $h, $txt, $border = 0, $align = 'J', $fill = false, $maxline = 0, $prn = 0) |
@@ -564,7 +566,7 @@ discard block |
||
| 564 | 566 | |
| 565 | 567 | /** |
| 566 | 568 | * Quebra o texto para caber na caixa |
| 567 | - * @param type $text |
|
| 569 | + * @param string $text |
|
| 568 | 570 | * @param type $maxwidth |
| 569 | 571 | * @return int |
| 570 | 572 | */ |
@@ -615,10 +617,10 @@ discard block |
||
| 615 | 617 | /** |
| 616 | 618 | * Celula com escala horizontal caso o texto seja muito largo |
| 617 | 619 | * @param number $w |
| 618 | - * @param number $h |
|
| 620 | + * @param integer $h |
|
| 619 | 621 | * @param string $txt |
| 620 | - * @param number $border |
|
| 621 | - * @param number $ln |
|
| 622 | + * @param integer $border |
|
| 623 | + * @param integer $ln |
|
| 622 | 624 | * @param string $align |
| 623 | 625 | * @param boolean $fill |
| 624 | 626 | * @param string $link |
@@ -669,10 +671,10 @@ discard block |
||
| 669 | 671 | /** |
| 670 | 672 | * Celula com escalamento horizontal somente se necessário |
| 671 | 673 | * @param number $w |
| 672 | - * @param number $h |
|
| 674 | + * @param integer $h |
|
| 673 | 675 | * @param string $txt |
| 674 | - * @param number $border |
|
| 675 | - * @param number $ln |
|
| 676 | + * @param integer $border |
|
| 677 | + * @param integer $ln |
|
| 676 | 678 | * @param string $align |
| 677 | 679 | * @param boolean $fill |
| 678 | 680 | * @param string $link |
@@ -685,10 +687,10 @@ discard block |
||
| 685 | 687 | /** |
| 686 | 688 | * Celula com escalamento forçado |
| 687 | 689 | * @param number $w |
| 688 | - * @param number $h |
|
| 690 | + * @param integer $h |
|
| 689 | 691 | * @param string $txt |
| 690 | - * @param number $border |
|
| 691 | - * @param number $ln |
|
| 692 | + * @param integer $border |
|
| 693 | + * @param integer $ln |
|
| 692 | 694 | * @param string $align |
| 693 | 695 | * @param boolean $fill |
| 694 | 696 | * @param string $link |
@@ -709,10 +711,10 @@ discard block |
||
| 709 | 711 | /** |
| 710 | 712 | * Celula com espaçamento de caracteres somente se necessário |
| 711 | 713 | * @param number $w |
| 712 | - * @param number $h |
|
| 714 | + * @param integer $h |
|
| 713 | 715 | * @param string $txt |
| 714 | - * @param number $border |
|
| 715 | - * @param number $ln |
|
| 716 | + * @param integer $border |
|
| 717 | + * @param integer $ln |
|
| 716 | 718 | * @param string $align |
| 717 | 719 | * @param boolean $fill |
| 718 | 720 | * @param string $link |
@@ -725,10 +727,10 @@ discard block |
||
| 725 | 727 | /** |
| 726 | 728 | * Celula com espaçamento de caracteres forçado |
| 727 | 729 | * @param number $w |
| 728 | - * @param number $h |
|
| 730 | + * @param integer $h |
|
| 729 | 731 | * @param string $txt |
| 730 | - * @param number $border |
|
| 731 | - * @param number $ln |
|
| 732 | + * @param integer $border |
|
| 733 | + * @param integer $ln |
|
| 732 | 734 | * @param string $align |
| 733 | 735 | * @param boolean $fill |
| 734 | 736 | * @param string $link |
@@ -775,8 +777,8 @@ discard block |
||
| 775 | 777 | * @param number $x Posição horizontal inicial, em mm |
| 776 | 778 | * @param number $y Posição vertical inicial, em mm |
| 777 | 779 | * @param number $w Comprimento da linha, em mm |
| 778 | - * @param number $h Espessura da linha, em mm |
|
| 779 | - * @param number $n Numero de traços na seção da linha com o comprimento $w |
|
| 780 | + * @param double $h Espessura da linha, em mm |
|
| 781 | + * @param integer $n Numero de traços na seção da linha com o comprimento $w |
|
| 780 | 782 | * @return none |
| 781 | 783 | */ |
| 782 | 784 | public function dashedHLine($x, $y, $w, $h, $n) |
@@ -796,11 +798,11 @@ discard block |
||
| 796 | 798 | |
| 797 | 799 | /** |
| 798 | 800 | * Desenha uma linha vertical tracejada com o FPDF |
| 799 | - * @param number $x Posição horizontal inicial, em mm |
|
| 801 | + * @param integer $x Posição horizontal inicial, em mm |
|
| 800 | 802 | * @param number $y Posição vertical inicial, em mm |
| 801 | - * @param number $w Espessura da linha, em mm |
|
| 802 | - * @param number $yfinal posição final |
|
| 803 | - * @param number $n Numero de traços na seção da linha com o comprimento $w |
|
| 803 | + * @param double $w Espessura da linha, em mm |
|
| 804 | + * @param double $yfinal posição final |
|
| 805 | + * @param integer $n Numero de traços na seção da linha com o comprimento $w |
|
| 804 | 806 | * @return none |
| 805 | 807 | */ |
| 806 | 808 | public function dashedVLine($x, $y, $w, $yfinal, $n) |
@@ -850,14 +852,14 @@ discard block |
||
| 850 | 852 | * @param array $aFont Matriz com as informações para formatação do texto com fonte, tamanho e estilo |
| 851 | 853 | * @param string $vAlign Alinhamento vertical do texto, T-topo C-centro B-base |
| 852 | 854 | * @param string $hAlign Alinhamento horizontal do texto, L-esquerda, C-centro, R-direita |
| 853 | - * @param boolean $border TRUE ou 1 desenha a borda, FALSE ou 0 Sem borda |
|
| 855 | + * @param integer $border TRUE ou 1 desenha a borda, FALSE ou 0 Sem borda |
|
| 854 | 856 | * @param string $link Insere um hiperlink |
| 855 | 857 | * @param boolean $force Se for true força a caixa com uma unica linha e para isso atera o tamanho do |
| 856 | 858 | * fonte até caber no espaço, se falso mantem o tamanho do fonte e usa quantas linhas forem necessárias |
| 857 | 859 | * e para isso atera o tamanho do fonte até caber no espaço, |
| 858 | 860 | * se falso mantem o tamanho do fonte e usa quantas linhas forem necessárias |
| 859 | - * @param number $hmax |
|
| 860 | - * @param number $vOffSet incremento forçado na na posição Y |
|
| 861 | + * @param integer $hmax |
|
| 862 | + * @param integer $vOffSet incremento forçado na na posição Y |
|
| 861 | 863 | * @return number $height Qual a altura necessária para desenhar esta textBox |
| 862 | 864 | */ |
| 863 | 865 | public function textBox( |
@@ -979,20 +981,20 @@ discard block |
||
| 979 | 981 | * 'size'=>10,'style='B'),'C','L',FALSE,'http://www.nfephp.org') |
| 980 | 982 | * @param number $x Posição horizontal da caixa, canto esquerdo superior |
| 981 | 983 | * @param number $y Posição vertical da caixa, canto esquerdo superior |
| 982 | - * @param number $w Largura da caixa |
|
| 983 | - * @param number $h Altura da caixa |
|
| 984 | + * @param double $w Largura da caixa |
|
| 985 | + * @param integer $h Altura da caixa |
|
| 984 | 986 | * @param string $text Conteúdo da caixa |
| 985 | 987 | * @param array $aFont Matriz com as informações para formatação do texto com fonte, tamanho e estilo |
| 986 | 988 | * @param string $vAlign Alinhamento vertical do texto, T-topo C-centro B-base |
| 987 | 989 | * @param string $hAlign Alinhamento horizontal do texto, L-esquerda, C-centro, R-direita |
| 988 | - * @param boolean $border TRUE ou 1 desenha a borda, FALSE ou 0 Sem borda |
|
| 990 | + * @param integer $border TRUE ou 1 desenha a borda, FALSE ou 0 Sem borda |
|
| 989 | 991 | * @param string $link Insere um hiperlink |
| 990 | 992 | * @param boolean $force Se for true força a caixa com uma unica linha e para isso atera o tamanho do |
| 991 | 993 | * fonte até caber no espaço, se falso mantem o tamanho do fonte e usa quantas linhas forem necessárias |
| 992 | 994 | * linha e para isso atera o tamanho do fonte até caber no espaço, |
| 993 | 995 | * se falso mantem o tamanho do fonte e usa quantas linhas forem necessárias |
| 994 | - * @param number $hmax |
|
| 995 | - * @param number $vOffSet incremento forçado na na posição Y |
|
| 996 | + * @param integer $hmax |
|
| 997 | + * @param integer $vOffSet incremento forçado na na posição Y |
|
| 996 | 998 | * @return number $height Qual a altura necessária para desenhar esta textBox |
| 997 | 999 | */ |
| 998 | 1000 | public function textBox90( |
@@ -170,6 +170,9 @@ discard block |
||
| 170 | 170 | $this->pdfVersion='1.3'; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | + /** |
|
| 174 | + * @param integer $right |
|
| 175 | + */ |
|
| 173 | 176 | public function setMargins($left, $top, $right = null) |
| 174 | 177 | { |
| 175 | 178 | //Set left, top and right margins |
@@ -202,6 +205,9 @@ discard block |
||
| 202 | 205 | $this->rMargin = $margin; |
| 203 | 206 | } |
| 204 | 207 | |
| 208 | + /** |
|
| 209 | + * @param boolean $auto |
|
| 210 | + */ |
|
| 205 | 211 | public function setAutoPageBreak($auto, $margin = 0) |
| 206 | 212 | { |
| 207 | 213 | //Set auto page break mode and triggering margin |
@@ -210,6 +216,9 @@ discard block |
||
| 210 | 216 | $this->pageBreakTrigger = $this->h-$margin; |
| 211 | 217 | } |
| 212 | 218 | |
| 219 | + /** |
|
| 220 | + * @param string $zoom |
|
| 221 | + */ |
|
| 213 | 222 | public function setDisplayMode($zoom, $layout = 'continuous') |
| 214 | 223 | { |
| 215 | 224 | //Set display mode in viewer |
@@ -225,6 +234,9 @@ discard block |
||
| 225 | 234 | } |
| 226 | 235 | } |
| 227 | 236 | |
| 237 | + /** |
|
| 238 | + * @param boolean $compress |
|
| 239 | + */ |
|
| 228 | 240 | public function setCompression($compress) |
| 229 | 241 | { |
| 230 | 242 | //Set page compression |
@@ -286,6 +298,9 @@ discard block |
||
| 286 | 298 | $this->aliasNbPages=$alias; |
| 287 | 299 | } |
| 288 | 300 | |
| 301 | + /** |
|
| 302 | + * @param string $msg |
|
| 303 | + */ |
|
| 289 | 304 | public function error($msg) |
| 290 | 305 | { |
| 291 | 306 | throw new Exception($msg); |
@@ -401,6 +416,11 @@ discard block |
||
| 401 | 416 | return $this->page; |
| 402 | 417 | } |
| 403 | 418 | |
| 419 | + /** |
|
| 420 | + * @param integer $r |
|
| 421 | + * @param integer $g |
|
| 422 | + * @param integer $b |
|
| 423 | + */ |
|
| 404 | 424 | public function setDrawColor($r, $g = null, $b = null) |
| 405 | 425 | { |
| 406 | 426 | //Set color for all stroking operations |
@@ -414,6 +434,11 @@ discard block |
||
| 414 | 434 | } |
| 415 | 435 | } |
| 416 | 436 | |
| 437 | + /** |
|
| 438 | + * @param integer $r |
|
| 439 | + * @param integer $g |
|
| 440 | + * @param integer $b |
|
| 441 | + */ |
|
| 417 | 442 | public function setFillColor($r, $g = null, $b = null) |
| 418 | 443 | { |
| 419 | 444 | //Set color for all filling operations |
@@ -428,6 +453,11 @@ discard block |
||
| 428 | 453 | } |
| 429 | 454 | } |
| 430 | 455 | |
| 456 | + /** |
|
| 457 | + * @param integer $r |
|
| 458 | + * @param integer $g |
|
| 459 | + * @param integer $b |
|
| 460 | + */ |
|
| 431 | 461 | public function settextColor($r, $g = null, $b = null) |
| 432 | 462 | { |
| 433 | 463 | //Set color for text |
@@ -497,6 +527,9 @@ discard block |
||
| 497 | 527 | ); |
| 498 | 528 | } |
| 499 | 529 | |
| 530 | + /** |
|
| 531 | + * @param string $family |
|
| 532 | + */ |
|
| 500 | 533 | public function addFont($family, $style = '', $file = '') |
| 501 | 534 | { |
| 502 | 535 | //Add a TrueType or Type1 font |
@@ -654,6 +687,10 @@ discard block |
||
| 654 | 687 | $this->links[$link] = [$page, $y]; |
| 655 | 688 | } |
| 656 | 689 | |
| 690 | + /** |
|
| 691 | + * @param double $y |
|
| 692 | + * @param string $link |
|
| 693 | + */ |
|
| 657 | 694 | public function link($x, $y, $w, $h, $link) |
| 658 | 695 | { |
| 659 | 696 | //Put a link on the page |
@@ -666,6 +703,11 @@ discard block |
||
| 666 | 703 | ]; |
| 667 | 704 | } |
| 668 | 705 | |
| 706 | + /** |
|
| 707 | + * @param double $x |
|
| 708 | + * @param double $y |
|
| 709 | + * @param string $txt |
|
| 710 | + */ |
|
| 669 | 711 | public function text($x, $y, $txt) |
| 670 | 712 | { |
| 671 | 713 | //Output a string |
@@ -990,6 +1032,9 @@ discard block |
||
| 990 | 1032 | } |
| 991 | 1033 | } |
| 992 | 1034 | |
| 1035 | + /** |
|
| 1036 | + * @param string $file |
|
| 1037 | + */ |
|
| 993 | 1038 | public function image($file, $x = null, $y = null, $w = 0, $h = 0, $type = '', $link = '') |
| 994 | 1039 | { |
| 995 | 1040 | //Put an image on the page |
@@ -1195,6 +1240,9 @@ discard block |
||
| 1195 | 1240 | } |
| 1196 | 1241 | |
| 1197 | 1242 | |
| 1243 | + /** |
|
| 1244 | + * @param string $format |
|
| 1245 | + */ |
|
| 1198 | 1246 | protected function getpageformat($format) |
| 1199 | 1247 | { |
| 1200 | 1248 | $format=strtolower($format); |
@@ -1215,6 +1263,10 @@ discard block |
||
| 1215 | 1263 | } |
| 1216 | 1264 | |
| 1217 | 1265 | |
| 1266 | + /** |
|
| 1267 | + * @param string $orientation |
|
| 1268 | + * @param string $format |
|
| 1269 | + */ |
|
| 1218 | 1270 | protected function beginPage($orientation, $format) |
| 1219 | 1271 | { |
| 1220 | 1272 | $this->page++; |
@@ -1360,6 +1412,9 @@ discard block |
||
| 1360 | 1412 | } |
| 1361 | 1413 | |
| 1362 | 1414 | |
| 1415 | + /** |
|
| 1416 | + * @param string $file |
|
| 1417 | + */ |
|
| 1363 | 1418 | protected function parsePNG($file) |
| 1364 | 1419 | { |
| 1365 | 1420 | //Extract info from a PNG file |
@@ -9,64 +9,64 @@ discard block |
||
| 9 | 9 | const FPDF_VERSION = '1.6'; |
| 10 | 10 | const FPDF_FONTPATH = '/font/'; |
| 11 | 11 | |
| 12 | - public $page; //current page number |
|
| 13 | - public $n; //current object number |
|
| 14 | - public $offsets; //array of object offsets |
|
| 15 | - public $buffer; //buffer holding in-memory PDF |
|
| 16 | - public $pages; //array containing pages |
|
| 17 | - public $state; //current document state |
|
| 18 | - public $compress; //compression flag |
|
| 19 | - public $k; //scale factor (number of points in user unit) |
|
| 20 | - public $defOrientation; //default orientation |
|
| 21 | - public $curOrientation; //current orientation |
|
| 22 | - public $pageFormats; //available page formats |
|
| 23 | - public $defPageFormat; //default page format |
|
| 24 | - public $curPageFormat; //current page format |
|
| 25 | - public $pageSizes; //array storing non-default page sizes |
|
| 12 | + public $page; //current page number |
|
| 13 | + public $n; //current object number |
|
| 14 | + public $offsets; //array of object offsets |
|
| 15 | + public $buffer; //buffer holding in-memory PDF |
|
| 16 | + public $pages; //array containing pages |
|
| 17 | + public $state; //current document state |
|
| 18 | + public $compress; //compression flag |
|
| 19 | + public $k; //scale factor (number of points in user unit) |
|
| 20 | + public $defOrientation; //default orientation |
|
| 21 | + public $curOrientation; //current orientation |
|
| 22 | + public $pageFormats; //available page formats |
|
| 23 | + public $defPageFormat; //default page format |
|
| 24 | + public $curPageFormat; //current page format |
|
| 25 | + public $pageSizes; //array storing non-default page sizes |
|
| 26 | 26 | public $wPt; |
| 27 | - public $hPt; //dimensions of current page in points |
|
| 27 | + public $hPt; //dimensions of current page in points |
|
| 28 | 28 | public $w; |
| 29 | - public $h; //dimensions of current page in user unit |
|
| 30 | - public $lMargin; //left margin |
|
| 31 | - public $tMargin; //top margin |
|
| 32 | - public $rMargin; //right margin |
|
| 33 | - public $bMargin; //page break margin |
|
| 34 | - public $cMargin; //cell margin |
|
| 29 | + public $h; //dimensions of current page in user unit |
|
| 30 | + public $lMargin; //left margin |
|
| 31 | + public $tMargin; //top margin |
|
| 32 | + public $rMargin; //right margin |
|
| 33 | + public $bMargin; //page break margin |
|
| 34 | + public $cMargin; //cell margin |
|
| 35 | 35 | public $x; |
| 36 | - public $y; //current position in user unit |
|
| 37 | - public $lasth; //height of last printed cell |
|
| 38 | - public $lineWidth; //line width in user unit |
|
| 39 | - public $coreFonts; //array of standard font names |
|
| 40 | - public $fonts; //array of used fonts |
|
| 41 | - public $fontFiles; //array of font files |
|
| 42 | - public $diffs; //array of encoding differences |
|
| 43 | - public $fontFamily; //current font family |
|
| 44 | - public $fontStyle; //current font style |
|
| 45 | - public $underline; //underlining flag |
|
| 46 | - public $currentFont; //current font info |
|
| 47 | - public $fontSizePt; //current font size in points |
|
| 48 | - public $fontSize; //current font size in user unit |
|
| 49 | - public $drawColor; //commands for drawing color |
|
| 50 | - public $fillColor; //commands for filling color |
|
| 51 | - public $textColor; //commands for text color |
|
| 52 | - public $colorFlag; //indicates whether fill and text colors are different |
|
| 53 | - public $ws; //word spacing |
|
| 54 | - public $images; //array of used images |
|
| 55 | - public $PageLinks; //array of links in pages |
|
| 56 | - public $links; //array of internal links |
|
| 57 | - public $autoPageBreak; //automatic page breaking |
|
| 58 | - public $pageBreakTrigger; //threshold used to trigger page breaks |
|
| 59 | - public $inHeader; //flag set when processing header |
|
| 60 | - public $inFooter; //flag set when processing footer |
|
| 61 | - public $zoomMode; //zoom display mode |
|
| 62 | - public $layoutMode; //layout display mode |
|
| 63 | - public $title; //title |
|
| 64 | - public $subject; //subject |
|
| 65 | - public $author; //author |
|
| 66 | - public $keywords; //keywords |
|
| 67 | - public $creator; //creator |
|
| 68 | - public $aliasNbPages; //alias for total number of pages |
|
| 69 | - public $pdfVersion; //PDF version number |
|
| 36 | + public $y; //current position in user unit |
|
| 37 | + public $lasth; //height of last printed cell |
|
| 38 | + public $lineWidth; //line width in user unit |
|
| 39 | + public $coreFonts; //array of standard font names |
|
| 40 | + public $fonts; //array of used fonts |
|
| 41 | + public $fontFiles; //array of font files |
|
| 42 | + public $diffs; //array of encoding differences |
|
| 43 | + public $fontFamily; //current font family |
|
| 44 | + public $fontStyle; //current font style |
|
| 45 | + public $underline; //underlining flag |
|
| 46 | + public $currentFont; //current font info |
|
| 47 | + public $fontSizePt; //current font size in points |
|
| 48 | + public $fontSize; //current font size in user unit |
|
| 49 | + public $drawColor; //commands for drawing color |
|
| 50 | + public $fillColor; //commands for filling color |
|
| 51 | + public $textColor; //commands for text color |
|
| 52 | + public $colorFlag; //indicates whether fill and text colors are different |
|
| 53 | + public $ws; //word spacing |
|
| 54 | + public $images; //array of used images |
|
| 55 | + public $PageLinks; //array of links in pages |
|
| 56 | + public $links; //array of internal links |
|
| 57 | + public $autoPageBreak; //automatic page breaking |
|
| 58 | + public $pageBreakTrigger; //threshold used to trigger page breaks |
|
| 59 | + public $inHeader; //flag set when processing header |
|
| 60 | + public $inFooter; //flag set when processing footer |
|
| 61 | + public $zoomMode; //zoom display mode |
|
| 62 | + public $layoutMode; //layout display mode |
|
| 63 | + public $title; //title |
|
| 64 | + public $subject; //subject |
|
| 65 | + public $author; //author |
|
| 66 | + public $keywords; //keywords |
|
| 67 | + public $creator; //creator |
|
| 68 | + public $aliasNbPages; //alias for total number of pages |
|
| 69 | + public $pdfVersion; //PDF version number |
|
| 70 | 70 | |
| 71 | 71 | public function __construct($orientation = 'P', $unit = 'mm', $format = 'A4') |
| 72 | 72 | { |
@@ -117,21 +117,21 @@ discard block |
||
| 117 | 117 | if ($unit == 'pt') { |
| 118 | 118 | $this->k = 1; |
| 119 | 119 | } elseif ($unit == 'mm') { |
| 120 | - $this->k = 72/25.4; |
|
| 120 | + $this->k = 72 / 25.4; |
|
| 121 | 121 | } elseif ($unit == 'cm') { |
| 122 | - $this->k = 72/2.54; |
|
| 122 | + $this->k = 72 / 2.54; |
|
| 123 | 123 | } elseif ($unit == 'in') { |
| 124 | 124 | $this->k = 72; |
| 125 | 125 | } else { |
| 126 | - $this->error('Incorrect unit: '.$unit); |
|
| 126 | + $this->error('Incorrect unit: ' . $unit); |
|
| 127 | 127 | } |
| 128 | 128 | //Page format |
| 129 | 129 | $this->pageFormats = [ |
| 130 | - 'a3' => [841.89,1190.55], |
|
| 131 | - 'a4' => [595.28,841.89], |
|
| 132 | - 'a5' => [420.94,595.28], |
|
| 133 | - 'letter' => [612,792], |
|
| 134 | - 'legal' => [612,1008] |
|
| 130 | + 'a3' => [841.89, 1190.55], |
|
| 131 | + 'a4' => [595.28, 841.89], |
|
| 132 | + 'a5' => [420.94, 595.28], |
|
| 133 | + 'letter' => [612, 792], |
|
| 134 | + 'legal' => [612, 1008] |
|
| 135 | 135 | ]; |
| 136 | 136 | if (is_string($format)) { |
| 137 | 137 | $format = $this->getpageformat($format); |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | //Page orientation |
| 142 | 142 | $orientation = strtolower($orientation); |
| 143 | 143 | if ($orientation == 'p' || $orientation == 'portrait') { |
| 144 | - $this->defOrientation='P'; |
|
| 144 | + $this->defOrientation = 'P'; |
|
| 145 | 145 | $this->w = $this->defPageFormat[0]; |
| 146 | 146 | $this->h = $this->defPageFormat[1]; |
| 147 | 147 | } elseif ($orientation == 'l' || $orientation == 'landscape') { |
@@ -149,26 +149,26 @@ discard block |
||
| 149 | 149 | $this->w = $this->defPageFormat[1]; |
| 150 | 150 | $this->h = $this->defPageFormat[0]; |
| 151 | 151 | } else { |
| 152 | - $this->error('Incorrect orientation: '.$orientation); |
|
| 152 | + $this->error('Incorrect orientation: ' . $orientation); |
|
| 153 | 153 | } |
| 154 | 154 | $this->curOrientation = $this->defOrientation; |
| 155 | - $this->wPt = $this->w*$this->k; |
|
| 156 | - $this->hPt = $this->h*$this->k; |
|
| 155 | + $this->wPt = $this->w * $this->k; |
|
| 156 | + $this->hPt = $this->h * $this->k; |
|
| 157 | 157 | //Page margins (1 cm) |
| 158 | - $margin = 28.35/$this->k; |
|
| 158 | + $margin = 28.35 / $this->k; |
|
| 159 | 159 | $this->setMargins($margin, $margin); |
| 160 | 160 | //Interior cell margin (1 mm) |
| 161 | - $this->cMargin = $margin/10; |
|
| 161 | + $this->cMargin = $margin / 10; |
|
| 162 | 162 | //Line width (0.2 mm) |
| 163 | - $this->lineWidth = .567/$this->k; |
|
| 163 | + $this->lineWidth = .567 / $this->k; |
|
| 164 | 164 | //Automatic page break |
| 165 | - $this->setAutoPageBreak(true, 2*$margin); |
|
| 165 | + $this->setAutoPageBreak(true, 2 * $margin); |
|
| 166 | 166 | //Full width display mode |
| 167 | 167 | $this->setDisplayMode('fullwidth'); |
| 168 | 168 | //Enable compression |
| 169 | 169 | $this->setCompression(true); |
| 170 | 170 | //Set default PDF version number |
| 171 | - $this->pdfVersion='1.3'; |
|
| 171 | + $this->pdfVersion = '1.3'; |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | public function setMargins($left, $top, $right = null) |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | if ($right === null) { |
| 180 | 180 | $right = $left; |
| 181 | 181 | } |
| 182 | - $this->rMargin=$right; |
|
| 182 | + $this->rMargin = $right; |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | public function setLeftMargin($margin) |
@@ -208,21 +208,21 @@ discard block |
||
| 208 | 208 | //Set auto page break mode and triggering margin |
| 209 | 209 | $this->autoPageBreak = $auto; |
| 210 | 210 | $this->bMargin = $margin; |
| 211 | - $this->pageBreakTrigger = $this->h-$margin; |
|
| 211 | + $this->pageBreakTrigger = $this->h - $margin; |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | public function setDisplayMode($zoom, $layout = 'continuous') |
| 215 | 215 | { |
| 216 | 216 | //Set display mode in viewer |
| 217 | - if ($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom)) { |
|
| 217 | + if ($zoom == 'fullpage' || $zoom == 'fullwidth' || $zoom == 'real' || $zoom == 'default' || !is_string($zoom)) { |
|
| 218 | 218 | $this->zoomMode = $zoom; |
| 219 | 219 | } else { |
| 220 | - $this->error('Incorrect zoom display mode: '.$zoom); |
|
| 220 | + $this->error('Incorrect zoom display mode: ' . $zoom); |
|
| 221 | 221 | } |
| 222 | - if ($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default') { |
|
| 222 | + if ($layout == 'single' || $layout == 'continuous' || $layout == 'two' || $layout == 'default') { |
|
| 223 | 223 | $this->layoutMode = $layout; |
| 224 | 224 | } else { |
| 225 | - $this->error('Incorrect layout display mode: '.$layout); |
|
| 225 | + $this->error('Incorrect layout display mode: ' . $layout); |
|
| 226 | 226 | } |
| 227 | 227 | } |
| 228 | 228 | |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | if ($isUTF8) { |
| 261 | 261 | $author = $this->utf8Toutf16($author); |
| 262 | 262 | } |
| 263 | - $this->author=$author; |
|
| 263 | + $this->author = $author; |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | public function setKeywords($keywords, $isUTF8 = false) |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | public function aliasNbPages($alias = '{nb}') |
| 285 | 285 | { |
| 286 | 286 | //Define an alias for total number of pages |
| 287 | - $this->aliasNbPages=$alias; |
|
| 287 | + $this->aliasNbPages = $alias; |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | public function error($msg) |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | $this->open(); |
| 324 | 324 | } |
| 325 | 325 | $family = $this->fontFamily; |
| 326 | - $style = $this->fontStyle.($this->underline ? 'U' : ''); |
|
| 326 | + $style = $this->fontStyle . ($this->underline ? 'U' : ''); |
|
| 327 | 327 | $size = $this->fontSizePt; |
| 328 | 328 | $lw = $this->lineWidth; |
| 329 | 329 | $dc = $this->drawColor; |
@@ -344,14 +344,14 @@ discard block |
||
| 344 | 344 | $this->out('2 J'); |
| 345 | 345 | //Set line width |
| 346 | 346 | $this->lineWidth = $lw; |
| 347 | - $this->out(sprintf('%.2F w', $lw*$this->k)); |
|
| 347 | + $this->out(sprintf('%.2F w', $lw * $this->k)); |
|
| 348 | 348 | //Set font |
| 349 | 349 | if ($family) { |
| 350 | 350 | $this->setFont($family, $style, $size); |
| 351 | 351 | } |
| 352 | 352 | //Set colors |
| 353 | 353 | $this->drawColor = $dc; |
| 354 | - if ($dc!='0 G') { |
|
| 354 | + if ($dc != '0 G') { |
|
| 355 | 355 | $this->out($dc); |
| 356 | 356 | } |
| 357 | 357 | $this->fillColor = $fc; |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | //Restore line width |
| 368 | 368 | if ($this->lineWidth != $lw) { |
| 369 | 369 | $this->lineWidth = $lw; |
| 370 | - $this->out(sprintf('%.2F w', $lw*$this->k)); |
|
| 370 | + $this->out(sprintf('%.2F w', $lw * $this->k)); |
|
| 371 | 371 | } |
| 372 | 372 | //Restore font |
| 373 | 373 | if ($family) { |
@@ -405,10 +405,10 @@ discard block |
||
| 405 | 405 | public function setDrawColor($r, $g = null, $b = null) |
| 406 | 406 | { |
| 407 | 407 | //Set color for all stroking operations |
| 408 | - if (($r==0 && $g==0 && $b==0) || $g===null) { |
|
| 409 | - $this->drawColor = sprintf('%.3F G', $r/255); |
|
| 408 | + if (($r == 0 && $g == 0 && $b == 0) || $g === null) { |
|
| 409 | + $this->drawColor = sprintf('%.3F G', $r / 255); |
|
| 410 | 410 | } else { |
| 411 | - $this->drawColor = sprintf('%.3F %.3F %.3F RG', $r/255, $g/255, $b/255); |
|
| 411 | + $this->drawColor = sprintf('%.3F %.3F %.3F RG', $r / 255, $g / 255, $b / 255); |
|
| 412 | 412 | } |
| 413 | 413 | if ($this->page > 0) { |
| 414 | 414 | $this->out($this->drawColor); |
@@ -418,10 +418,10 @@ discard block |
||
| 418 | 418 | public function setFillColor($r, $g = null, $b = null) |
| 419 | 419 | { |
| 420 | 420 | //Set color for all filling operations |
| 421 | - if (($r==0 && $g==0 && $b==0) || $g===null) { |
|
| 422 | - $this->fillColor = sprintf('%.3F g', $r/255); |
|
| 421 | + if (($r == 0 && $g == 0 && $b == 0) || $g === null) { |
|
| 422 | + $this->fillColor = sprintf('%.3F g', $r / 255); |
|
| 423 | 423 | } else { |
| 424 | - $this->fillColor = sprintf('%.3F %.3F %.3F rg', $r/255, $g/255, $b/255); |
|
| 424 | + $this->fillColor = sprintf('%.3F %.3F %.3F rg', $r / 255, $g / 255, $b / 255); |
|
| 425 | 425 | } |
| 426 | 426 | $this->colorFlag = ($this->fillColor != $this->textColor); |
| 427 | 427 | if ($this->page > 0) { |
@@ -432,10 +432,10 @@ discard block |
||
| 432 | 432 | public function settextColor($r, $g = null, $b = null) |
| 433 | 433 | { |
| 434 | 434 | //Set color for text |
| 435 | - if (($r==0 && $g==0 && $b==0) || $g===null) { |
|
| 436 | - $this->textColor = sprintf('%.3F g', $r/255); |
|
| 435 | + if (($r == 0 && $g == 0 && $b == 0) || $g === null) { |
|
| 436 | + $this->textColor = sprintf('%.3F g', $r / 255); |
|
| 437 | 437 | } else { |
| 438 | - $this->textColor = sprintf('%.3F %.3F %.3F rg', $r/255, $g/255, $b/255); |
|
| 438 | + $this->textColor = sprintf('%.3F %.3F %.3F rg', $r / 255, $g / 255, $b / 255); |
|
| 439 | 439 | } |
| 440 | 440 | $this->colorFlag = ($this->fillColor != $this->textColor); |
| 441 | 441 | } |
@@ -443,14 +443,14 @@ discard block |
||
| 443 | 443 | public function getStringWidth($s) |
| 444 | 444 | { |
| 445 | 445 | //Get width of a string in the current font |
| 446 | - $s = (string)$s; |
|
| 447 | - $cw =& $this->currentFont['cw']; |
|
| 446 | + $s = (string) $s; |
|
| 447 | + $cw = & $this->currentFont['cw']; |
|
| 448 | 448 | $w = 0; |
| 449 | 449 | $l = strlen($s); |
| 450 | - for ($i=0; $i<$l; $i++) { |
|
| 450 | + for ($i = 0; $i < $l; $i++) { |
|
| 451 | 451 | $w += $cw[$s[$i]]; |
| 452 | 452 | } |
| 453 | - return $w*$this->fontSize/1000; |
|
| 453 | + return $w * $this->fontSize / 1000; |
|
| 454 | 454 | } |
| 455 | 455 | |
| 456 | 456 | public function setLineWidth($width) |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | //Set line width |
| 459 | 459 | $this->lineWidth = $width; |
| 460 | 460 | if ($this->page > 0) { |
| 461 | - $this->out(sprintf('%.2F w', $width*$this->k)); |
|
| 461 | + $this->out(sprintf('%.2F w', $width * $this->k)); |
|
| 462 | 462 | } |
| 463 | 463 | } |
| 464 | 464 | |
@@ -468,10 +468,10 @@ discard block |
||
| 468 | 468 | $this->out( |
| 469 | 469 | sprintf( |
| 470 | 470 | '%.2F %.2F m %.2F %.2F l S', |
| 471 | - $x1*$this->k, |
|
| 472 | - ($this->h-$y1)*$this->k, |
|
| 473 | - $x2*$this->k, |
|
| 474 | - ($this->h-$y2)*$this->k |
|
| 471 | + $x1 * $this->k, |
|
| 472 | + ($this->h - $y1) * $this->k, |
|
| 473 | + $x2 * $this->k, |
|
| 474 | + ($this->h - $y2) * $this->k |
|
| 475 | 475 | ) |
| 476 | 476 | ); |
| 477 | 477 | } |
@@ -489,10 +489,10 @@ discard block |
||
| 489 | 489 | $this->out( |
| 490 | 490 | sprintf( |
| 491 | 491 | '%.2F %.2F %.2F %.2F re %s', |
| 492 | - $x*$this->k, |
|
| 493 | - ($this->h-$y)*$this->k, |
|
| 494 | - $w*$this->k, |
|
| 495 | - -$h*$this->k, |
|
| 492 | + $x * $this->k, |
|
| 493 | + ($this->h - $y) * $this->k, |
|
| 494 | + $w * $this->k, |
|
| 495 | + -$h * $this->k, |
|
| 496 | 496 | $op |
| 497 | 497 | ) |
| 498 | 498 | ); |
@@ -503,24 +503,24 @@ discard block |
||
| 503 | 503 | //Add a TrueType or Type1 font |
| 504 | 504 | $family = strtolower($family); |
| 505 | 505 | if ($file == '') { |
| 506 | - $file = str_replace(' ', '', $family).strtolower($style).'.php'; |
|
| 506 | + $file = str_replace(' ', '', $family) . strtolower($style) . '.php'; |
|
| 507 | 507 | } |
| 508 | - if ($family=='arial') { |
|
| 509 | - $family='helvetica'; |
|
| 508 | + if ($family == 'arial') { |
|
| 509 | + $family = 'helvetica'; |
|
| 510 | 510 | } |
| 511 | 511 | $style = strtoupper($style); |
| 512 | 512 | if ($style == 'IB') { |
| 513 | 513 | $style = 'BI'; |
| 514 | 514 | } |
| 515 | - $fontkey = $family.$style; |
|
| 515 | + $fontkey = $family . $style; |
|
| 516 | 516 | if (isset($this->fonts[$fontkey])) { |
| 517 | 517 | return; |
| 518 | 518 | } |
| 519 | - include $this->getFontPath().$file; |
|
| 519 | + include $this->getFontPath() . $file; |
|
| 520 | 520 | if (!isset($name)) { |
| 521 | 521 | $this->error('Could not include font definition file'); |
| 522 | 522 | } |
| 523 | - $i = count($this->fonts)+1; |
|
| 523 | + $i = count($this->fonts) + 1; |
|
| 524 | 524 | $this->fonts[$fontkey] = [ |
| 525 | 525 | 'i'=>$i, |
| 526 | 526 | 'type'=>$type, |
@@ -536,20 +536,20 @@ discard block |
||
| 536 | 536 | //Search existing encodings |
| 537 | 537 | $d = 0; |
| 538 | 538 | $nb = count($this->diffs); |
| 539 | - for ($i=1; $i<=$nb; $i++) { |
|
| 539 | + for ($i = 1; $i <= $nb; $i++) { |
|
| 540 | 540 | if ($this->diffs[$i] == $diff) { |
| 541 | 541 | $d = $i; |
| 542 | 542 | break; |
| 543 | 543 | } |
| 544 | 544 | } |
| 545 | 545 | if ($d == 0) { |
| 546 | - $d = $nb+1; |
|
| 546 | + $d = $nb + 1; |
|
| 547 | 547 | $this->diffs[$d] = $diff; |
| 548 | 548 | } |
| 549 | 549 | $this->fonts[$fontkey]['diff'] = $d; |
| 550 | 550 | } |
| 551 | 551 | if ($file) { |
| 552 | - if ($type=='TrueType') { |
|
| 552 | + if ($type == 'TrueType') { |
|
| 553 | 553 | $this->fontFiles[$file] = ['length1'=>$originalsize]; |
| 554 | 554 | } else { |
| 555 | 555 | $this->fontFiles[$file] = ['length1'=>$size1, 'length2'=>$size2]; |
@@ -584,39 +584,39 @@ discard block |
||
| 584 | 584 | $size = $this->fontSizePt; |
| 585 | 585 | } |
| 586 | 586 | //Test if font is already selected |
| 587 | - if ($this->fontFamily==$family && $this->fontStyle==$style && $this->fontSizePt==$size) { |
|
| 587 | + if ($this->fontFamily == $family && $this->fontStyle == $style && $this->fontSizePt == $size) { |
|
| 588 | 588 | return; |
| 589 | 589 | } |
| 590 | 590 | //Test if used for the first time |
| 591 | - $fontkey = $family.$style; |
|
| 591 | + $fontkey = $family . $style; |
|
| 592 | 592 | if (!isset($this->fonts[$fontkey])) { |
| 593 | 593 | //Check if one of the standard fonts |
| 594 | 594 | if (isset($this->coreFonts[$fontkey])) { |
| 595 | 595 | if (!isset($fpdf_charwidths[$fontkey])) { |
| 596 | 596 | //Load metric file |
| 597 | - $file=$family; |
|
| 598 | - if ($family=='times' || $family=='helvetica') { |
|
| 597 | + $file = $family; |
|
| 598 | + if ($family == 'times' || $family == 'helvetica') { |
|
| 599 | 599 | $file .= strtolower($style); |
| 600 | 600 | } |
| 601 | - include $this->getFontPath().$file.'.php'; |
|
| 601 | + include $this->getFontPath() . $file . '.php'; |
|
| 602 | 602 | if (!isset($fpdf_charwidths[$fontkey])) { |
| 603 | 603 | $this->error('Could not include font metric file'); |
| 604 | 604 | } |
| 605 | 605 | } |
| 606 | - $i = count($this->fonts)+1; |
|
| 606 | + $i = count($this->fonts) + 1; |
|
| 607 | 607 | $name = $this->coreFonts[$fontkey]; |
| 608 | 608 | $cw = $fpdf_charwidths[$fontkey]; |
| 609 | 609 | $this->fonts[$fontkey] = ['i'=>$i, 'type'=>'core', 'name'=>$name, 'up'=>-100, 'ut'=>50, 'cw'=>$cw]; |
| 610 | 610 | } else { |
| 611 | - $this->error('Undefined font: '.$family.' '.$style); |
|
| 611 | + $this->error('Undefined font: ' . $family . ' ' . $style); |
|
| 612 | 612 | } |
| 613 | 613 | } |
| 614 | 614 | //Select it |
| 615 | 615 | $this->fontFamily = $family; |
| 616 | 616 | $this->fontStyle = $style; |
| 617 | 617 | $this->fontSizePt = $size; |
| 618 | - $this->fontSize = $size/$this->k; |
|
| 619 | - $this->currentFont =& $this->fonts[$fontkey]; |
|
| 618 | + $this->fontSize = $size / $this->k; |
|
| 619 | + $this->currentFont = & $this->fonts[$fontkey]; |
|
| 620 | 620 | if ($this->page > 0) { |
| 621 | 621 | $this->out(sprintf('BT /F%d %.2F Tf ET', $this->currentFont['i'], $this->fontSizePt)); |
| 622 | 622 | } |
@@ -629,7 +629,7 @@ discard block |
||
| 629 | 629 | return; |
| 630 | 630 | } |
| 631 | 631 | $this->fontSizePt = $size; |
| 632 | - $this->fontSize = $size/$this->k; |
|
| 632 | + $this->fontSize = $size / $this->k; |
|
| 633 | 633 | if ($this->page > 0) { |
| 634 | 634 | $this->out(sprintf('BT /F%d %.2F Tf ET', $this->currentFont['i'], $this->fontSizePt)); |
| 635 | 635 | } |
@@ -638,7 +638,7 @@ discard block |
||
| 638 | 638 | public function addlink() |
| 639 | 639 | { |
| 640 | 640 | //Create a new internal link |
| 641 | - $n = count($this->links)+1; |
|
| 641 | + $n = count($this->links) + 1; |
|
| 642 | 642 | $this->links[$n] = [0, 0]; |
| 643 | 643 | return $n; |
| 644 | 644 | } |
@@ -659,10 +659,10 @@ discard block |
||
| 659 | 659 | { |
| 660 | 660 | //Put a link on the page |
| 661 | 661 | $this->PageLinks[$this->page][] = [ |
| 662 | - $x*$this->k, |
|
| 663 | - $this->hPt-$y*$this->k, |
|
| 664 | - $w*$this->k, |
|
| 665 | - $h*$this->k, |
|
| 662 | + $x * $this->k, |
|
| 663 | + $this->hPt - $y * $this->k, |
|
| 664 | + $w * $this->k, |
|
| 665 | + $h * $this->k, |
|
| 666 | 666 | $link |
| 667 | 667 | ]; |
| 668 | 668 | } |
@@ -670,12 +670,12 @@ discard block |
||
| 670 | 670 | public function text($x, $y, $txt) |
| 671 | 671 | { |
| 672 | 672 | //Output a string |
| 673 | - $s = sprintf('BT %.2F %.2F Td (%s) Tj ET', $x*$this->k, ($this->h-$y)*$this->k, $this->escape($txt)); |
|
| 674 | - if ($this->underline && $txt!='') { |
|
| 675 | - $s .= ' '.$this->doUnderLine($x, $y, $txt); |
|
| 673 | + $s = sprintf('BT %.2F %.2F Td (%s) Tj ET', $x * $this->k, ($this->h - $y) * $this->k, $this->escape($txt)); |
|
| 674 | + if ($this->underline && $txt != '') { |
|
| 675 | + $s .= ' ' . $this->doUnderLine($x, $y, $txt); |
|
| 676 | 676 | } |
| 677 | 677 | if ($this->colorFlag) { |
| 678 | - $s = 'q '.$this->textColor.' '.$s.' Q'; |
|
| 678 | + $s = 'q ' . $this->textColor . ' ' . $s . ' Q'; |
|
| 679 | 679 | } |
| 680 | 680 | $this->out($s); |
| 681 | 681 | } |
@@ -690,7 +690,7 @@ discard block |
||
| 690 | 690 | { |
| 691 | 691 | //Output a cell |
| 692 | 692 | $k = $this->k; |
| 693 | - if ($this->y+$h > $this->pageBreakTrigger |
|
| 693 | + if ($this->y + $h > $this->pageBreakTrigger |
|
| 694 | 694 | && !$this->InHeader |
| 695 | 695 | && !$this->InFooter |
| 696 | 696 | && $this->acceptPageBreak() |
@@ -706,77 +706,77 @@ discard block |
||
| 706 | 706 | $this->x = $x; |
| 707 | 707 | if ($ws > 0) { |
| 708 | 708 | $this->ws = $ws; |
| 709 | - $this->out(sprintf('%.3F Tw', $ws*$k)); |
|
| 709 | + $this->out(sprintf('%.3F Tw', $ws * $k)); |
|
| 710 | 710 | } |
| 711 | 711 | } |
| 712 | 712 | if ($w == 0) { |
| 713 | - $w = $this->w-$this->rMargin-$this->x; |
|
| 713 | + $w = $this->w - $this->rMargin - $this->x; |
|
| 714 | 714 | } |
| 715 | - $s=''; |
|
| 716 | - if ($fill || $border==1) { |
|
| 715 | + $s = ''; |
|
| 716 | + if ($fill || $border == 1) { |
|
| 717 | 717 | if ($fill) { |
| 718 | - $op=($border==1) ? 'B' : 'f'; |
|
| 718 | + $op = ($border == 1) ? 'B' : 'f'; |
|
| 719 | 719 | } else { |
| 720 | - $op='S'; |
|
| 720 | + $op = 'S'; |
|
| 721 | 721 | } |
| 722 | - $s=sprintf('%.2F %.2F %.2F %.2F re %s ', $this->x*$k, ($this->h-$this->y)*$k, $w*$k, -$h*$k, $op); |
|
| 722 | + $s = sprintf('%.2F %.2F %.2F %.2F re %s ', $this->x * $k, ($this->h - $this->y) * $k, $w * $k, -$h * $k, $op); |
|
| 723 | 723 | } |
| 724 | 724 | if (is_string($border)) { |
| 725 | 725 | $x = $this->x; |
| 726 | 726 | $y = $this->y; |
| 727 | 727 | if (strpos($border, 'L') !== false) { |
| 728 | - $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', $x*$k, ($this->h-$y)*$k, $x*$k, ($this->h-($y+$h))*$k); |
|
| 728 | + $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', $x * $k, ($this->h - $y) * $k, $x * $k, ($this->h - ($y + $h)) * $k); |
|
| 729 | 729 | } |
| 730 | 730 | if (strpos($border, 'T') !== false) { |
| 731 | - $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', $x*$k, ($this->h-$y)*$k, ($x+$w)*$k, ($this->h-$y)*$k); |
|
| 731 | + $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', $x * $k, ($this->h - $y) * $k, ($x + $w) * $k, ($this->h - $y) * $k); |
|
| 732 | 732 | } |
| 733 | 733 | if (strpos($border, 'R') !== false) { |
| 734 | 734 | $s .= sprintf( |
| 735 | 735 | '%.2F %.2F m %.2F %.2F l S ', |
| 736 | - ($x+$w)*$k, |
|
| 737 | - ($this->h-$y)*$k, |
|
| 738 | - ($x+$w)*$k, |
|
| 739 | - ($this->h-($y+$h))*$k |
|
| 736 | + ($x + $w) * $k, |
|
| 737 | + ($this->h - $y) * $k, |
|
| 738 | + ($x + $w) * $k, |
|
| 739 | + ($this->h - ($y + $h)) * $k |
|
| 740 | 740 | ); |
| 741 | 741 | } |
| 742 | 742 | if (strpos($border, 'B') !== false) { |
| 743 | 743 | $s .= sprintf( |
| 744 | 744 | '%.2F %.2F m %.2F %.2F l S ', |
| 745 | - $x*$k, |
|
| 746 | - ($this->h-($y+$h))*$k, |
|
| 747 | - ($x+$w)*$k, |
|
| 748 | - ($this->h-($y+$h))*$k |
|
| 745 | + $x * $k, |
|
| 746 | + ($this->h - ($y + $h)) * $k, |
|
| 747 | + ($x + $w) * $k, |
|
| 748 | + ($this->h - ($y + $h)) * $k |
|
| 749 | 749 | ); |
| 750 | 750 | } |
| 751 | 751 | } |
| 752 | 752 | if ($txt !== '') { |
| 753 | 753 | if ($align == 'R') { |
| 754 | - $dx = $w-$this->cMargin-$this->getStringWidth($txt); |
|
| 754 | + $dx = $w - $this->cMargin - $this->getStringWidth($txt); |
|
| 755 | 755 | } elseif ($align == 'C') { |
| 756 | - $dx = ($w-$this->getStringWidth($txt))/2; |
|
| 756 | + $dx = ($w - $this->getStringWidth($txt)) / 2; |
|
| 757 | 757 | } else { |
| 758 | 758 | $dx = $this->cMargin; |
| 759 | 759 | } |
| 760 | 760 | if ($this->colorFlag) { |
| 761 | - $s .= 'q '.$this->textColor.' '; |
|
| 761 | + $s .= 'q ' . $this->textColor . ' '; |
|
| 762 | 762 | } |
| 763 | 763 | $txt2 = str_replace(')', '\\)', str_replace('(', '\\(', str_replace('\\', '\\\\', $txt))); |
| 764 | 764 | $s .= sprintf( |
| 765 | 765 | 'BT %.2F %.2F Td (%s) Tj ET', |
| 766 | - ($this->x+$dx)*$k, |
|
| 767 | - ($this->h-($this->y+.5*$h+.3*$this->fontSize))*$k, |
|
| 766 | + ($this->x + $dx) * $k, |
|
| 767 | + ($this->h - ($this->y + .5 * $h + .3 * $this->fontSize)) * $k, |
|
| 768 | 768 | $txt2 |
| 769 | 769 | ); |
| 770 | 770 | if ($this->underline) { |
| 771 | - $s .= ' '.$this->doUnderLine($this->x+$dx, $this->y+.5*$h+.3*$this->fontSize, $txt); |
|
| 771 | + $s .= ' ' . $this->doUnderLine($this->x + $dx, $this->y + .5 * $h + .3 * $this->fontSize, $txt); |
|
| 772 | 772 | } |
| 773 | 773 | if ($this->colorFlag) { |
| 774 | - $s.=' Q'; |
|
| 774 | + $s .= ' Q'; |
|
| 775 | 775 | } |
| 776 | 776 | if ($link) { |
| 777 | 777 | $this->link( |
| 778 | - $this->x+$dx, |
|
| 779 | - $this->y+.5*$h-.5*$this->fontSize, |
|
| 778 | + $this->x + $dx, |
|
| 779 | + $this->y + .5 * $h - .5 * $this->fontSize, |
|
| 780 | 780 | $this->getStringWidth($txt), |
| 781 | 781 | $this->fontSize, |
| 782 | 782 | $link |
@@ -801,14 +801,14 @@ discard block |
||
| 801 | 801 | public function multicell($w, $h, $txt, $border = 0, $align = 'J', $fill = false) |
| 802 | 802 | { |
| 803 | 803 | //Output text with automatic or explicit line breaks |
| 804 | - $cw =& $this->currentFont['cw']; |
|
| 804 | + $cw = & $this->currentFont['cw']; |
|
| 805 | 805 | if ($w == 0) { |
| 806 | - $w = $this->w-$this->rMargin-$this->x; |
|
| 806 | + $w = $this->w - $this->rMargin - $this->x; |
|
| 807 | 807 | } |
| 808 | - $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize; |
|
| 808 | + $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize; |
|
| 809 | 809 | $s = str_replace("\r", '', $txt); |
| 810 | 810 | $nb = strlen($s); |
| 811 | - if ($nb>0 && $s[$nb-1] == "\n") { |
|
| 811 | + if ($nb > 0 && $s[$nb - 1] == "\n") { |
|
| 812 | 812 | $nb--; |
| 813 | 813 | } |
| 814 | 814 | $b = 0; |
@@ -825,7 +825,7 @@ discard block |
||
| 825 | 825 | if (strpos($border, 'R') !== false) { |
| 826 | 826 | $b2 .= 'R'; |
| 827 | 827 | } |
| 828 | - $b=(strpos($border, 'T') !== false) ? $b2.'T' : $b2; |
|
| 828 | + $b = (strpos($border, 'T') !== false) ? $b2 . 'T' : $b2; |
|
| 829 | 829 | } |
| 830 | 830 | } |
| 831 | 831 | $sep = -1; |
@@ -834,7 +834,7 @@ discard block |
||
| 834 | 834 | $l = 0; |
| 835 | 835 | $ns = 0; |
| 836 | 836 | $nl = 1; |
| 837 | - while ($i<$nb) { |
|
| 837 | + while ($i < $nb) { |
|
| 838 | 838 | //Get next character |
| 839 | 839 | $c = $s[$i]; |
| 840 | 840 | if ($c == "\n") { |
@@ -843,7 +843,7 @@ discard block |
||
| 843 | 843 | $this->ws = 0; |
| 844 | 844 | $this->out('0 Tw'); |
| 845 | 845 | } |
| 846 | - $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill); |
|
| 846 | + $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill); |
|
| 847 | 847 | $i++; |
| 848 | 848 | $sep = -1; |
| 849 | 849 | $j = $i; |
@@ -851,7 +851,7 @@ discard block |
||
| 851 | 851 | $ns = 0; |
| 852 | 852 | $nl++; |
| 853 | 853 | if ($border && $nl == 2) { |
| 854 | - $b=$b2; |
|
| 854 | + $b = $b2; |
|
| 855 | 855 | } |
| 856 | 856 | continue; |
| 857 | 857 | } |
@@ -871,14 +871,14 @@ discard block |
||
| 871 | 871 | $this->ws = 0; |
| 872 | 872 | $this->out('0 Tw'); |
| 873 | 873 | } |
| 874 | - $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill); |
|
| 874 | + $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill); |
|
| 875 | 875 | } else { |
| 876 | - if ($align=='J') { |
|
| 877 | - $this->ws = ($ns>1) ? ($wmax-$ls)/1000*$this->fontSize/($ns-1) : 0; |
|
| 878 | - $this->out(sprintf('%.3F Tw', $this->ws*$this->k)); |
|
| 876 | + if ($align == 'J') { |
|
| 877 | + $this->ws = ($ns > 1) ? ($wmax - $ls) / 1000 * $this->fontSize / ($ns - 1) : 0; |
|
| 878 | + $this->out(sprintf('%.3F Tw', $this->ws * $this->k)); |
|
| 879 | 879 | } |
| 880 | - $this->cell($w, $h, substr($s, $j, $sep-$j), $b, 2, $align, $fill); |
|
| 881 | - $i = $sep+1; |
|
| 880 | + $this->cell($w, $h, substr($s, $j, $sep - $j), $b, 2, $align, $fill); |
|
| 881 | + $i = $sep + 1; |
|
| 882 | 882 | } |
| 883 | 883 | $sep = -1; |
| 884 | 884 | $j = $i; |
@@ -897,10 +897,10 @@ discard block |
||
| 897 | 897 | $this->ws = 0; |
| 898 | 898 | $this->out('0 Tw'); |
| 899 | 899 | } |
| 900 | - if ($border && strpos($border, 'B')!==false) { |
|
| 900 | + if ($border && strpos($border, 'B') !== false) { |
|
| 901 | 901 | $b .= 'B'; |
| 902 | 902 | } |
| 903 | - $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill); |
|
| 903 | + $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill); |
|
| 904 | 904 | $this->x = $this->lMargin; |
| 905 | 905 | } |
| 906 | 906 | |
@@ -908,9 +908,9 @@ discard block |
||
| 908 | 908 | public function write($h, $txt, $link = '') |
| 909 | 909 | { |
| 910 | 910 | //Output text in flowing mode |
| 911 | - $cw =& $this->currentFont['cw']; |
|
| 912 | - $w = $this->w-$this->rMargin-$this->x; |
|
| 913 | - $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize; |
|
| 911 | + $cw = & $this->currentFont['cw']; |
|
| 912 | + $w = $this->w - $this->rMargin - $this->x; |
|
| 913 | + $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize; |
|
| 914 | 914 | $s = str_replace("\r", '', $txt); |
| 915 | 915 | $nb = strlen($s); |
| 916 | 916 | $sep = -1; |
@@ -920,18 +920,18 @@ discard block |
||
| 920 | 920 | $nl = 1; |
| 921 | 921 | while ($i < $nb) { |
| 922 | 922 | //Get next character |
| 923 | - $c=$s[$i]; |
|
| 924 | - if ($c=="\n") { |
|
| 923 | + $c = $s[$i]; |
|
| 924 | + if ($c == "\n") { |
|
| 925 | 925 | //Explicit line break |
| 926 | - $this->cell($w, $h, substr($s, $j, $i-$j), 0, 2, '', 0, $link); |
|
| 926 | + $this->cell($w, $h, substr($s, $j, $i - $j), 0, 2, '', 0, $link); |
|
| 927 | 927 | $i++; |
| 928 | 928 | $sep = -1; |
| 929 | 929 | $j = $i; |
| 930 | 930 | $l = 0; |
| 931 | 931 | if ($nl == 1) { |
| 932 | 932 | $this->x = $this->lMargin; |
| 933 | - $w = $this->w-$this->rMargin-$this->x; |
|
| 934 | - $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize; |
|
| 933 | + $w = $this->w - $this->rMargin - $this->x; |
|
| 934 | + $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize; |
|
| 935 | 935 | } |
| 936 | 936 | $nl++; |
| 937 | 937 | continue; |
@@ -947,8 +947,8 @@ discard block |
||
| 947 | 947 | //Move to next line |
| 948 | 948 | $this->x = $this->lMargin; |
| 949 | 949 | $this->y += $h; |
| 950 | - $w = $this->w-$this->rMargin-$this->x; |
|
| 951 | - $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize; |
|
| 950 | + $w = $this->w - $this->rMargin - $this->x; |
|
| 951 | + $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize; |
|
| 952 | 952 | $i++; |
| 953 | 953 | $nl++; |
| 954 | 954 | continue; |
@@ -956,18 +956,18 @@ discard block |
||
| 956 | 956 | if ($i == $j) { |
| 957 | 957 | $i++; |
| 958 | 958 | } |
| 959 | - $this->cell($w, $h, substr($s, $j, $i-$j), 0, 2, '', 0, $link); |
|
| 959 | + $this->cell($w, $h, substr($s, $j, $i - $j), 0, 2, '', 0, $link); |
|
| 960 | 960 | } else { |
| 961 | - $this->cell($w, $h, substr($s, $j, $sep-$j), 0, 2, '', 0, $link); |
|
| 962 | - $i = $sep+1; |
|
| 961 | + $this->cell($w, $h, substr($s, $j, $sep - $j), 0, 2, '', 0, $link); |
|
| 962 | + $i = $sep + 1; |
|
| 963 | 963 | } |
| 964 | 964 | $sep = -1; |
| 965 | 965 | $j = $i; |
| 966 | 966 | $l = 0; |
| 967 | 967 | if ($nl == 1) { |
| 968 | 968 | $this->x = $this->lMargin; |
| 969 | - $w = $this->w-$this->rMargin-$this->x; |
|
| 970 | - $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize; |
|
| 969 | + $w = $this->w - $this->rMargin - $this->x; |
|
| 970 | + $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize; |
|
| 971 | 971 | } |
| 972 | 972 | $nl++; |
| 973 | 973 | } else { |
@@ -976,7 +976,7 @@ discard block |
||
| 976 | 976 | } |
| 977 | 977 | //Last chunk |
| 978 | 978 | if ($i != $j) { |
| 979 | - $this->cell($l/1000*$this->fontSize, $h, substr($s, $j), 0, 0, '', 0, $link); |
|
| 979 | + $this->cell($l / 1000 * $this->fontSize, $h, substr($s, $j), 0, 0, '', 0, $link); |
|
| 980 | 980 | } |
| 981 | 981 | } |
| 982 | 982 | |
@@ -999,20 +999,20 @@ discard block |
||
| 999 | 999 | if ($type == '') { |
| 1000 | 1000 | $pos = strrpos($file, '.'); |
| 1001 | 1001 | if (!$pos) { |
| 1002 | - $this->error('Image file has no extension and no type was specified: '.$file); |
|
| 1002 | + $this->error('Image file has no extension and no type was specified: ' . $file); |
|
| 1003 | 1003 | } |
| 1004 | - $type = substr($file, $pos+1); |
|
| 1004 | + $type = substr($file, $pos + 1); |
|
| 1005 | 1005 | } |
| 1006 | 1006 | $type = strtolower($type); |
| 1007 | 1007 | if ($type == 'jpeg') { |
| 1008 | 1008 | $type = 'jpg'; |
| 1009 | 1009 | } |
| 1010 | - $mtd = 'parse'.strtoupper($type); |
|
| 1010 | + $mtd = 'parse' . strtoupper($type); |
|
| 1011 | 1011 | if (!method_exists($this, $mtd)) { |
| 1012 | - $this->error('Unsupported image type: '.$type); |
|
| 1012 | + $this->error('Unsupported image type: ' . $type); |
|
| 1013 | 1013 | } |
| 1014 | 1014 | $info = $this->$mtd($file); |
| 1015 | - $info['i'] = count($this->images)+1; |
|
| 1015 | + $info['i'] = count($this->images) + 1; |
|
| 1016 | 1016 | $this->images[$file] = $info; |
| 1017 | 1017 | } else { |
| 1018 | 1018 | $info = $this->images[$file]; |
@@ -1020,16 +1020,16 @@ discard block |
||
| 1020 | 1020 | //Automatic width and height calculation if needed |
| 1021 | 1021 | if ($w == 0 && $h == 0) { |
| 1022 | 1022 | //Put image at 72 dpi |
| 1023 | - $w = $info['w']/$this->k; |
|
| 1024 | - $h = $info['h']/$this->k; |
|
| 1023 | + $w = $info['w'] / $this->k; |
|
| 1024 | + $h = $info['h'] / $this->k; |
|
| 1025 | 1025 | } elseif ($w == 0) { |
| 1026 | - $w = $h*$info['w']/$info['h']; |
|
| 1026 | + $w = $h * $info['w'] / $info['h']; |
|
| 1027 | 1027 | } elseif ($h == 0) { |
| 1028 | - $h = $w*$info['h']/$info['w']; |
|
| 1028 | + $h = $w * $info['h'] / $info['w']; |
|
| 1029 | 1029 | } |
| 1030 | 1030 | //Flowing mode |
| 1031 | 1031 | if ($y === null) { |
| 1032 | - if ($this->y+$h > $this->pageBreakTrigger |
|
| 1032 | + if ($this->y + $h > $this->pageBreakTrigger |
|
| 1033 | 1033 | && !$this->inHeader |
| 1034 | 1034 | && !$this->inFooter |
| 1035 | 1035 | && $this->acceptPageBreak() |
@@ -1048,10 +1048,10 @@ discard block |
||
| 1048 | 1048 | $this->out( |
| 1049 | 1049 | sprintf( |
| 1050 | 1050 | 'q %.2F 0 0 %.2F %.2F %.2F cm /I%d Do Q', |
| 1051 | - $w*$this->k, |
|
| 1052 | - $h*$this->k, |
|
| 1053 | - $x*$this->k, |
|
| 1054 | - ($this->h-($y+$h))*$this->k, |
|
| 1051 | + $w * $this->k, |
|
| 1052 | + $h * $this->k, |
|
| 1053 | + $x * $this->k, |
|
| 1054 | + ($this->h - ($y + $h)) * $this->k, |
|
| 1055 | 1055 | $info['i'] |
| 1056 | 1056 | ) |
| 1057 | 1057 | ); |
@@ -1074,7 +1074,7 @@ discard block |
||
| 1074 | 1074 | if ($x >= 0) { |
| 1075 | 1075 | $this->x = $x; |
| 1076 | 1076 | } else { |
| 1077 | - $this->x = $this->w+$x; |
|
| 1077 | + $this->x = $this->w + $x; |
|
| 1078 | 1078 | } |
| 1079 | 1079 | } |
| 1080 | 1080 | |
@@ -1093,7 +1093,7 @@ discard block |
||
| 1093 | 1093 | if ($y >= 0) { |
| 1094 | 1094 | $this->y = $y; |
| 1095 | 1095 | } else { |
| 1096 | - $this->y = $this->h+$y; |
|
| 1096 | + $this->y = $this->h + $y; |
|
| 1097 | 1097 | } |
| 1098 | 1098 | } |
| 1099 | 1099 | |
@@ -1140,8 +1140,8 @@ discard block |
||
| 1140 | 1140 | if (headers_sent()) { |
| 1141 | 1141 | $this->error('Some data has already been output, can\'t send PDF file'); |
| 1142 | 1142 | } |
| 1143 | - header('Content-Length: '.strlen($this->buffer)); |
|
| 1144 | - header('Content-Disposition: inline; filename="'.$name.'"'); |
|
| 1143 | + header('Content-Length: ' . strlen($this->buffer)); |
|
| 1144 | + header('Content-Disposition: inline; filename="' . $name . '"'); |
|
| 1145 | 1145 | header('Cache-Control: private, max-age=0, must-revalidate'); |
| 1146 | 1146 | header('Pragma: public'); |
| 1147 | 1147 | ini_set('zlib.output_compression', '0'); |
@@ -1157,8 +1157,8 @@ discard block |
||
| 1157 | 1157 | if (headers_sent()) { |
| 1158 | 1158 | $this->error('Some data has already been output, can\'t send PDF file'); |
| 1159 | 1159 | } |
| 1160 | - header('Content-Length: '.strlen($this->buffer)); |
|
| 1161 | - header('Content-Disposition: attachment; filename="'.$name.'"'); |
|
| 1160 | + header('Content-Length: ' . strlen($this->buffer)); |
|
| 1161 | + header('Content-Disposition: attachment; filename="' . $name . '"'); |
|
| 1162 | 1162 | header('Cache-Control: private, max-age=0, must-revalidate'); |
| 1163 | 1163 | header('Pragma: public'); |
| 1164 | 1164 | ini_set('zlib.output_compression', '0'); |
@@ -1166,9 +1166,9 @@ discard block |
||
| 1166 | 1166 | break; |
| 1167 | 1167 | case 'F': |
| 1168 | 1168 | //Save to local file |
| 1169 | - $f=fopen($name, 'wb'); |
|
| 1169 | + $f = fopen($name, 'wb'); |
|
| 1170 | 1170 | if (!$f) { |
| 1171 | - $this->error('Unable to create output file: '.$name); |
|
| 1171 | + $this->error('Unable to create output file: ' . $name); |
|
| 1172 | 1172 | } |
| 1173 | 1173 | fwrite($f, $this->buffer, strlen($this->buffer)); |
| 1174 | 1174 | fclose($f); |
@@ -1177,7 +1177,7 @@ discard block |
||
| 1177 | 1177 | //Return as a string |
| 1178 | 1178 | return $this->buffer; |
| 1179 | 1179 | default: |
| 1180 | - $this->error('Incorrect output destination: '.$dest); |
|
| 1180 | + $this->error('Incorrect output destination: ' . $dest); |
|
| 1181 | 1181 | } |
| 1182 | 1182 | return ''; |
| 1183 | 1183 | } |
@@ -1186,7 +1186,7 @@ discard block |
||
| 1186 | 1186 | protected function dochecks() |
| 1187 | 1187 | { |
| 1188 | 1188 | //Check availability of %F |
| 1189 | - if (sprintf('%.1F', 1.0)!='1.0') { |
|
| 1189 | + if (sprintf('%.1F', 1.0) != '1.0') { |
|
| 1190 | 1190 | $this->error('This version of PHP is not supported'); |
| 1191 | 1191 | } |
| 1192 | 1192 | //Check mbstring overloading |
@@ -1198,12 +1198,12 @@ discard block |
||
| 1198 | 1198 | |
| 1199 | 1199 | protected function getpageformat($format) |
| 1200 | 1200 | { |
| 1201 | - $format=strtolower($format); |
|
| 1201 | + $format = strtolower($format); |
|
| 1202 | 1202 | if (!isset($this->pageFormats[$format])) { |
| 1203 | - $this->error('Unknown page format: '.$format); |
|
| 1203 | + $this->error('Unknown page format: ' . $format); |
|
| 1204 | 1204 | } |
| 1205 | - $a=$this->pageFormats[$format]; |
|
| 1206 | - return [$a[0]/$this->k, $a[1]/$this->k]; |
|
| 1205 | + $a = $this->pageFormats[$format]; |
|
| 1206 | + return [$a[0] / $this->k, $a[1] / $this->k]; |
|
| 1207 | 1207 | } |
| 1208 | 1208 | |
| 1209 | 1209 | |
@@ -1231,12 +1231,12 @@ discard block |
||
| 1231 | 1231 | $format = $this->defPageFormat; |
| 1232 | 1232 | } else { |
| 1233 | 1233 | if (is_string($format)) { |
| 1234 | - $format=$this->getpageformat($format); |
|
| 1234 | + $format = $this->getpageformat($format); |
|
| 1235 | 1235 | } |
| 1236 | 1236 | } |
| 1237 | 1237 | if ($orientation != $this->curOrientation |
| 1238 | - || $format[0]!=$this->curPageFormat[0] |
|
| 1239 | - || $format[1]!=$this->curPageFormat[1] |
|
| 1238 | + || $format[0] != $this->curPageFormat[0] |
|
| 1239 | + || $format[1] != $this->curPageFormat[1] |
|
| 1240 | 1240 | ) { |
| 1241 | 1241 | //New size |
| 1242 | 1242 | if ($orientation == 'P') { |
@@ -1246,9 +1246,9 @@ discard block |
||
| 1246 | 1246 | $this->w = $format[1]; |
| 1247 | 1247 | $this->h = $format[0]; |
| 1248 | 1248 | } |
| 1249 | - $this->wPt = $this->w*$this->k; |
|
| 1250 | - $this->hPt = $this->h*$this->k; |
|
| 1251 | - $this->pageBreakTrigger = $this->h-$this->bMargin; |
|
| 1249 | + $this->wPt = $this->w * $this->k; |
|
| 1250 | + $this->hPt = $this->h * $this->k; |
|
| 1251 | + $this->pageBreakTrigger = $this->h - $this->bMargin; |
|
| 1252 | 1252 | $this->curOrientation = $orientation; |
| 1253 | 1253 | $this->curPageFormat = $format; |
| 1254 | 1254 | } |
@@ -1281,7 +1281,7 @@ discard block |
||
| 1281 | 1281 | protected function textString($s) |
| 1282 | 1282 | { |
| 1283 | 1283 | //Format a text string |
| 1284 | - return '('.$this->escape($s).')'; |
|
| 1284 | + return '(' . $this->escape($s) . ')'; |
|
| 1285 | 1285 | } |
| 1286 | 1286 | |
| 1287 | 1287 | |
@@ -1297,16 +1297,16 @@ discard block |
||
| 1297 | 1297 | //3-byte character |
| 1298 | 1298 | $c2 = ord($s[$i++]); |
| 1299 | 1299 | $c3 = ord($s[$i++]); |
| 1300 | - $res .= chr((($c1 & 0x0F)<<4) + (($c2 & 0x3C)>>2)); |
|
| 1301 | - $res .= chr((($c2 & 0x03)<<6) + ($c3 & 0x3F)); |
|
| 1300 | + $res .= chr((($c1 & 0x0F) << 4) + (($c2 & 0x3C) >> 2)); |
|
| 1301 | + $res .= chr((($c2 & 0x03) << 6) + ($c3 & 0x3F)); |
|
| 1302 | 1302 | } elseif ($c1 >= 192) { |
| 1303 | 1303 | //2-byte character |
| 1304 | 1304 | $c2 = ord($s[$i++]); |
| 1305 | - $res .= chr(($c1 & 0x1C)>>2); |
|
| 1306 | - $res .= chr((($c1 & 0x03)<<6) + ($c2 & 0x3F)); |
|
| 1305 | + $res .= chr(($c1 & 0x1C) >> 2); |
|
| 1306 | + $res .= chr((($c1 & 0x03) << 6) + ($c2 & 0x3F)); |
|
| 1307 | 1307 | } else { |
| 1308 | 1308 | //Single-byte character |
| 1309 | - $res .= "\0".chr($c1); |
|
| 1309 | + $res .= "\0" . chr($c1); |
|
| 1310 | 1310 | } |
| 1311 | 1311 | } |
| 1312 | 1312 | return $res; |
@@ -1318,13 +1318,13 @@ discard block |
||
| 1318 | 1318 | //Underline text |
| 1319 | 1319 | $up = $this->currentFont['up']; |
| 1320 | 1320 | $ut = $this->currentFont['ut']; |
| 1321 | - $w = $this->getStringWidth($txt)+$this->ws*substr_count($txt, ' '); |
|
| 1321 | + $w = $this->getStringWidth($txt) + $this->ws * substr_count($txt, ' '); |
|
| 1322 | 1322 | return sprintf( |
| 1323 | 1323 | '%.2F %.2F %.2F %.2F re f', |
| 1324 | - $x*$this->k, |
|
| 1325 | - ($this->h-($y-$up/1000*$this->fontSize))*$this->k, |
|
| 1326 | - $w*$this->k, |
|
| 1327 | - -$ut/1000*$this->fontSizePt |
|
| 1324 | + $x * $this->k, |
|
| 1325 | + ($this->h - ($y - $up / 1000 * $this->fontSize)) * $this->k, |
|
| 1326 | + $w * $this->k, |
|
| 1327 | + -$ut / 1000 * $this->fontSizePt |
|
| 1328 | 1328 | ); |
| 1329 | 1329 | } |
| 1330 | 1330 | |
@@ -1334,17 +1334,17 @@ discard block |
||
| 1334 | 1334 | //Extract info from a JPEG file |
| 1335 | 1335 | $a = getImageSize($file); |
| 1336 | 1336 | if (!$a) { |
| 1337 | - $this->error('Missing or incorrect image file: '.$file); |
|
| 1337 | + $this->error('Missing or incorrect image file: ' . $file); |
|
| 1338 | 1338 | } |
| 1339 | - if ($a[2]!=2) { |
|
| 1340 | - $this->error('Not a JPEG file: '.$file); |
|
| 1339 | + if ($a[2] != 2) { |
|
| 1340 | + $this->error('Not a JPEG file: ' . $file); |
|
| 1341 | 1341 | } |
| 1342 | 1342 | if (!isset($a['channels']) || $a['channels'] == 3) { |
| 1343 | 1343 | $colspace = 'DeviceRGB'; |
| 1344 | 1344 | } elseif ($a['channels'] == 4) { |
| 1345 | 1345 | $colspace = 'DeviceCMYK'; |
| 1346 | 1346 | } else { |
| 1347 | - $colspace='DeviceGray'; |
|
| 1347 | + $colspace = 'DeviceGray'; |
|
| 1348 | 1348 | } |
| 1349 | 1349 | $bpc = isset($a['bits']) ? $a['bits'] : 8; |
| 1350 | 1350 | //Read whole file |
@@ -1363,22 +1363,22 @@ discard block |
||
| 1363 | 1363 | //Extract info from a PNG file |
| 1364 | 1364 | $f = fopen($file, 'rb'); |
| 1365 | 1365 | if (!$f) { |
| 1366 | - $this->error('Can\'t open image file: '.$file); |
|
| 1366 | + $this->error('Can\'t open image file: ' . $file); |
|
| 1367 | 1367 | } |
| 1368 | 1368 | //Check signature |
| 1369 | - if ($this->readstream($f, 8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10)) { |
|
| 1370 | - $this->error('Not a PNG file: '.$file); |
|
| 1369 | + if ($this->readstream($f, 8) != chr(137) . 'PNG' . chr(13) . chr(10) . chr(26) . chr(10)) { |
|
| 1370 | + $this->error('Not a PNG file: ' . $file); |
|
| 1371 | 1371 | } |
| 1372 | 1372 | //Read header chunk |
| 1373 | 1373 | $this->readstream($f, 4); |
| 1374 | - if ($this->readstream($f, 4)!='IHDR') { |
|
| 1375 | - $this->error('Incorrect PNG file: '.$file); |
|
| 1374 | + if ($this->readstream($f, 4) != 'IHDR') { |
|
| 1375 | + $this->error('Incorrect PNG file: ' . $file); |
|
| 1376 | 1376 | } |
| 1377 | 1377 | $w = $this->readint($f); |
| 1378 | 1378 | $h = $this->readint($f); |
| 1379 | 1379 | $bpc = ord($this->readstream($f, 1)); |
| 1380 | - if ($bpc>8) { |
|
| 1381 | - $this->error('16-bit depth not supported: '.$file); |
|
| 1380 | + if ($bpc > 8) { |
|
| 1381 | + $this->error('16-bit depth not supported: ' . $file); |
|
| 1382 | 1382 | } |
| 1383 | 1383 | $ct = ord($this->readstream($f, 1)); |
| 1384 | 1384 | if ($ct == 0) { |
@@ -1388,20 +1388,20 @@ discard block |
||
| 1388 | 1388 | } elseif ($ct == 3) { |
| 1389 | 1389 | $colspace = 'Indexed'; |
| 1390 | 1390 | } else { |
| 1391 | - $this->error('Alpha channel not supported: '.$file); |
|
| 1391 | + $this->error('Alpha channel not supported: ' . $file); |
|
| 1392 | 1392 | } |
| 1393 | 1393 | if (ord($this->readstream($f, 1)) != 0) { |
| 1394 | - $this->error('Unknown compression method: '.$file); |
|
| 1394 | + $this->error('Unknown compression method: ' . $file); |
|
| 1395 | 1395 | } |
| 1396 | 1396 | if (ord($this->readstream($f, 1)) != 0) { |
| 1397 | - $this->error('Unknown filter method: '.$file); |
|
| 1397 | + $this->error('Unknown filter method: ' . $file); |
|
| 1398 | 1398 | } |
| 1399 | 1399 | if (ord($this->readstream($f, 1)) != 0) { |
| 1400 | - $this->error('Interlacing not supported: '.$file); |
|
| 1400 | + $this->error('Interlacing not supported: ' . $file); |
|
| 1401 | 1401 | } |
| 1402 | 1402 | $this->readstream($f, 4); |
| 1403 | 1403 | $parms = '/DecodeParms <</Predictor 15 /Colors ' |
| 1404 | - . ($ct==2 ? 3 : 1) |
|
| 1404 | + . ($ct == 2 ? 3 : 1) |
|
| 1405 | 1405 | . ' /BitsPerComponent ' |
| 1406 | 1406 | . $bpc |
| 1407 | 1407 | . ' /Columns ' |
@@ -1439,11 +1439,11 @@ discard block |
||
| 1439 | 1439 | } elseif ($type == 'IEND') { |
| 1440 | 1440 | break; |
| 1441 | 1441 | } else { |
| 1442 | - $this->readstream($f, $n+4); |
|
| 1442 | + $this->readstream($f, $n + 4); |
|
| 1443 | 1443 | } |
| 1444 | 1444 | } while ($n); |
| 1445 | 1445 | if ($colspace == 'Indexed' && empty($pal)) { |
| 1446 | - $this->error('Missing palette in '.$file); |
|
| 1446 | + $this->error('Missing palette in ' . $file); |
|
| 1447 | 1447 | } |
| 1448 | 1448 | fclose($f); |
| 1449 | 1449 | return [ |
@@ -1463,9 +1463,9 @@ discard block |
||
| 1463 | 1463 | protected function readstream($f, $n) |
| 1464 | 1464 | { |
| 1465 | 1465 | //Read n bytes from stream |
| 1466 | - $res=''; |
|
| 1466 | + $res = ''; |
|
| 1467 | 1467 | while ($n > 0 && !feof($f)) { |
| 1468 | - $s=fread($f, $n); |
|
| 1468 | + $s = fread($f, $n); |
|
| 1469 | 1469 | if ($s === false) { |
| 1470 | 1470 | $this->error('Error while reading stream'); |
| 1471 | 1471 | } |
@@ -1498,7 +1498,7 @@ discard block |
||
| 1498 | 1498 | } |
| 1499 | 1499 | $im = imagecreatefromgif($file); |
| 1500 | 1500 | if (!$im) { |
| 1501 | - $this->error('Missing or incorrect image file: '.$file); |
|
| 1501 | + $this->error('Missing or incorrect image file: ' . $file); |
|
| 1502 | 1502 | } |
| 1503 | 1503 | imageinterlace($im, 0); |
| 1504 | 1504 | $tmp = tempnam('.', 'gif'); |
@@ -1509,7 +1509,7 @@ discard block |
||
| 1509 | 1509 | $this->error('Error while saving to temporary file'); |
| 1510 | 1510 | } |
| 1511 | 1511 | imagedestroy($im); |
| 1512 | - $info=$this->parsePNG($tmp); |
|
| 1512 | + $info = $this->parsePNG($tmp); |
|
| 1513 | 1513 | unlink($tmp); |
| 1514 | 1514 | return $info; |
| 1515 | 1515 | } |
@@ -1520,7 +1520,7 @@ discard block |
||
| 1520 | 1520 | //Begin a new object |
| 1521 | 1521 | $this->n++; |
| 1522 | 1522 | $this->offsets[$this->n] = strlen($this->buffer); |
| 1523 | - $this->out($this->n.' 0 obj'); |
|
| 1523 | + $this->out($this->n . ' 0 obj'); |
|
| 1524 | 1524 | } |
| 1525 | 1525 | |
| 1526 | 1526 | |
@@ -1536,9 +1536,9 @@ discard block |
||
| 1536 | 1536 | { |
| 1537 | 1537 | //Add a line to the document |
| 1538 | 1538 | if ($this->state == 2) { |
| 1539 | - $this->pages[$this->page].=$s."\n"; |
|
| 1539 | + $this->pages[$this->page] .= $s . "\n"; |
|
| 1540 | 1540 | } else { |
| 1541 | - $this->buffer .= $s."\n"; |
|
| 1541 | + $this->buffer .= $s . "\n"; |
|
| 1542 | 1542 | } |
| 1543 | 1543 | } |
| 1544 | 1544 | |
@@ -1548,19 +1548,19 @@ discard block |
||
| 1548 | 1548 | $nb = $this->page; |
| 1549 | 1549 | if (!empty($this->aliasNbPages)) { |
| 1550 | 1550 | //Replace number of pages |
| 1551 | - for ($n=1; $n<=$nb; $n++) { |
|
| 1551 | + for ($n = 1; $n <= $nb; $n++) { |
|
| 1552 | 1552 | $this->pages[$n] = str_replace($this->aliasNbPages, $nb, $this->pages[$n]); |
| 1553 | 1553 | } |
| 1554 | 1554 | } |
| 1555 | 1555 | if ($this->defOrientation == 'P') { |
| 1556 | - $wPt = $this->defPageFormat[0]*$this->k; |
|
| 1557 | - $hPt = $this->defPageFormat[1]*$this->k; |
|
| 1556 | + $wPt = $this->defPageFormat[0] * $this->k; |
|
| 1557 | + $hPt = $this->defPageFormat[1] * $this->k; |
|
| 1558 | 1558 | } else { |
| 1559 | - $wPt = $this->defPageFormat[1]*$this->k; |
|
| 1560 | - $hPt = $this->defPageFormat[0]*$this->k; |
|
| 1559 | + $wPt = $this->defPageFormat[1] * $this->k; |
|
| 1560 | + $hPt = $this->defPageFormat[0] * $this->k; |
|
| 1561 | 1561 | } |
| 1562 | 1562 | $filter = ($this->compress) ? '/Filter /FlateDecode ' : ''; |
| 1563 | - for ($n=1; $n<=$nb; $n++) { |
|
| 1563 | + for ($n = 1; $n <= $nb; $n++) { |
|
| 1564 | 1564 | //Page |
| 1565 | 1565 | $this->newObj(); |
| 1566 | 1566 | $this->out('<</Type /Page'); |
@@ -1573,37 +1573,37 @@ discard block |
||
| 1573 | 1573 | //Links |
| 1574 | 1574 | $annots = '/Annots ['; |
| 1575 | 1575 | foreach ($this->PageLinks[$n] as $pl) { |
| 1576 | - $rect = sprintf('%.2F %.2F %.2F %.2F', $pl[0], $pl[1], $pl[0]+$pl[2], $pl[1]-$pl[3]); |
|
| 1577 | - $annots .= '<</Type /Annot /Subtype /Link /Rect ['.$rect.'] /Border [0 0 0] '; |
|
| 1576 | + $rect = sprintf('%.2F %.2F %.2F %.2F', $pl[0], $pl[1], $pl[0] + $pl[2], $pl[1] - $pl[3]); |
|
| 1577 | + $annots .= '<</Type /Annot /Subtype /Link /Rect [' . $rect . '] /Border [0 0 0] '; |
|
| 1578 | 1578 | if (is_string($pl[4])) { |
| 1579 | - $annots .= '/A <</S /URI /URI '.$this->textString($pl[4]).'>>>>'; |
|
| 1579 | + $annots .= '/A <</S /URI /URI ' . $this->textString($pl[4]) . '>>>>'; |
|
| 1580 | 1580 | } else { |
| 1581 | 1581 | $l = $this->links[$pl[4]]; |
| 1582 | 1582 | $h = isset($this->PageSizes[$l[0]]) ? $this->PageSizes[$l[0]][1] : $hPt; |
| 1583 | - $annots .= sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>', 1+2*$l[0], $h-$l[1]*$this->k); |
|
| 1583 | + $annots .= sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>', 1 + 2 * $l[0], $h - $l[1] * $this->k); |
|
| 1584 | 1584 | } |
| 1585 | 1585 | } |
| 1586 | - $this->out($annots.']'); |
|
| 1586 | + $this->out($annots . ']'); |
|
| 1587 | 1587 | } |
| 1588 | - $this->out('/Contents '.($this->n+1).' 0 R>>'); |
|
| 1588 | + $this->out('/Contents ' . ($this->n + 1) . ' 0 R>>'); |
|
| 1589 | 1589 | $this->out('endobj'); |
| 1590 | 1590 | //Page content |
| 1591 | - $p=($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n]; |
|
| 1591 | + $p = ($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n]; |
|
| 1592 | 1592 | $this->newObj(); |
| 1593 | - $this->out('<<'.$filter.'/Length '.strlen($p).'>>'); |
|
| 1593 | + $this->out('<<' . $filter . '/Length ' . strlen($p) . '>>'); |
|
| 1594 | 1594 | $this->putStream($p); |
| 1595 | 1595 | $this->out('endobj'); |
| 1596 | 1596 | } |
| 1597 | 1597 | //Pages root |
| 1598 | - $this->offsets[1]=strlen($this->buffer); |
|
| 1598 | + $this->offsets[1] = strlen($this->buffer); |
|
| 1599 | 1599 | $this->out('1 0 obj'); |
| 1600 | 1600 | $this->out('<</Type /Pages'); |
| 1601 | 1601 | $kids = '/Kids ['; |
| 1602 | - for ($i=0; $i<$nb; $i++) { |
|
| 1603 | - $kids .= (3+2*$i).' 0 R '; |
|
| 1602 | + for ($i = 0; $i < $nb; $i++) { |
|
| 1603 | + $kids .= (3 + 2 * $i) . ' 0 R '; |
|
| 1604 | 1604 | } |
| 1605 | - $this->out($kids.']'); |
|
| 1606 | - $this->out('/Count '.$nb); |
|
| 1605 | + $this->out($kids . ']'); |
|
| 1606 | + $this->out('/Count ' . $nb); |
|
| 1607 | 1607 | $this->out(sprintf('/MediaBox [0 0 %.2F %.2F]', $wPt, $hPt)); |
| 1608 | 1608 | $this->out('>>'); |
| 1609 | 1609 | $this->out('endobj'); |
@@ -1616,41 +1616,41 @@ discard block |
||
| 1616 | 1616 | foreach ($this->diffs as $diff) { |
| 1617 | 1617 | //Encodings |
| 1618 | 1618 | $this->newObj(); |
| 1619 | - $this->out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$diff.']>>'); |
|
| 1619 | + $this->out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences [' . $diff . ']>>'); |
|
| 1620 | 1620 | $this->out('endobj'); |
| 1621 | 1621 | } |
| 1622 | 1622 | foreach ($this->fontFiles as $file => $info) { |
| 1623 | 1623 | //Font file embedding |
| 1624 | 1624 | $this->newObj(); |
| 1625 | - $this->fontFiles[$file]['n']=$this->n; |
|
| 1626 | - $font=''; |
|
| 1627 | - $f = fopen($this->getFontPath().$file, 'rb', 1); |
|
| 1625 | + $this->fontFiles[$file]['n'] = $this->n; |
|
| 1626 | + $font = ''; |
|
| 1627 | + $f = fopen($this->getFontPath() . $file, 'rb', 1); |
|
| 1628 | 1628 | if (!$f) { |
| 1629 | 1629 | $this->error('Font file not found'); |
| 1630 | 1630 | } |
| 1631 | 1631 | while (!feof($f)) { |
| 1632 | - $font.=fread($f, 8192); |
|
| 1632 | + $font .= fread($f, 8192); |
|
| 1633 | 1633 | } |
| 1634 | 1634 | fclose($f); |
| 1635 | - $compressed = (substr($file, -2)=='.z'); |
|
| 1635 | + $compressed = (substr($file, -2) == '.z'); |
|
| 1636 | 1636 | if (!$compressed && isset($info['length2'])) { |
| 1637 | - $header = (ord($font[0])==128); |
|
| 1637 | + $header = (ord($font[0]) == 128); |
|
| 1638 | 1638 | if ($header) { |
| 1639 | 1639 | //Strip first binary header |
| 1640 | 1640 | $font = substr($font, 6); |
| 1641 | 1641 | } |
| 1642 | 1642 | if ($header && ord($font[$info['length1']]) == 128) { |
| 1643 | 1643 | //Strip second binary header |
| 1644 | - $font = substr($font, 0, $info['length1']).substr($font, $info['length1']+6); |
|
| 1644 | + $font = substr($font, 0, $info['length1']) . substr($font, $info['length1'] + 6); |
|
| 1645 | 1645 | } |
| 1646 | 1646 | } |
| 1647 | - $this->out('<</Length '.strlen($font)); |
|
| 1647 | + $this->out('<</Length ' . strlen($font)); |
|
| 1648 | 1648 | if ($compressed) { |
| 1649 | 1649 | $this->out('/Filter /FlateDecode'); |
| 1650 | 1650 | } |
| 1651 | - $this->out('/Length1 '.$info['length1']); |
|
| 1651 | + $this->out('/Length1 ' . $info['length1']); |
|
| 1652 | 1652 | if (isset($info['length2'])) { |
| 1653 | - $this->out('/Length2 '.$info['length2'].' /Length3 0'); |
|
| 1653 | + $this->out('/Length2 ' . $info['length2'] . ' /Length3 0'); |
|
| 1654 | 1654 | } |
| 1655 | 1655 | $this->out('>>'); |
| 1656 | 1656 | $this->putStream($font); |
@@ -1658,32 +1658,32 @@ discard block |
||
| 1658 | 1658 | } |
| 1659 | 1659 | foreach ($this->fonts as $k => $font) { |
| 1660 | 1660 | //Font objects |
| 1661 | - $this->fonts[$k]['n']=$this->n+1; |
|
| 1661 | + $this->fonts[$k]['n'] = $this->n + 1; |
|
| 1662 | 1662 | $type = $font['type']; |
| 1663 | 1663 | $name = $font['name']; |
| 1664 | 1664 | if ($type == 'core') { |
| 1665 | 1665 | //Standard font |
| 1666 | 1666 | $this->newObj(); |
| 1667 | 1667 | $this->out('<</Type /Font'); |
| 1668 | - $this->out('/BaseFont /'.$name); |
|
| 1668 | + $this->out('/BaseFont /' . $name); |
|
| 1669 | 1669 | $this->out('/Subtype /Type1'); |
| 1670 | 1670 | if ($name != 'Symbol' && $name != 'ZapfDingbats') { |
| 1671 | 1671 | $this->out('/Encoding /WinAnsiEncoding'); |
| 1672 | 1672 | } |
| 1673 | 1673 | $this->out('>>'); |
| 1674 | 1674 | $this->out('endobj'); |
| 1675 | - } elseif ($type=='Type1' || $type=='TrueType') { |
|
| 1675 | + } elseif ($type == 'Type1' || $type == 'TrueType') { |
|
| 1676 | 1676 | //Additional Type1 or TrueType font |
| 1677 | 1677 | $this->newObj(); |
| 1678 | 1678 | $this->out('<</Type /Font'); |
| 1679 | - $this->out('/BaseFont /'.$name); |
|
| 1680 | - $this->out('/Subtype /'.$type); |
|
| 1679 | + $this->out('/BaseFont /' . $name); |
|
| 1680 | + $this->out('/Subtype /' . $type); |
|
| 1681 | 1681 | $this->out('/FirstChar 32 /LastChar 255'); |
| 1682 | - $this->out('/Widths '.($this->n+1).' 0 R'); |
|
| 1683 | - $this->out('/FontDescriptor '.($this->n+2).' 0 R'); |
|
| 1682 | + $this->out('/Widths ' . ($this->n + 1) . ' 0 R'); |
|
| 1683 | + $this->out('/FontDescriptor ' . ($this->n + 2) . ' 0 R'); |
|
| 1684 | 1684 | if ($font['enc']) { |
| 1685 | 1685 | if (isset($font['diff'])) { |
| 1686 | - $this->out('/Encoding '.($nf+$font['diff']).' 0 R'); |
|
| 1686 | + $this->out('/Encoding ' . ($nf + $font['diff']) . ' 0 R'); |
|
| 1687 | 1687 | } else { |
| 1688 | 1688 | $this->out('/Encoding /WinAnsiEncoding'); |
| 1689 | 1689 | } |
@@ -1692,30 +1692,30 @@ discard block |
||
| 1692 | 1692 | $this->out('endobj'); |
| 1693 | 1693 | //Widths |
| 1694 | 1694 | $this->newObj(); |
| 1695 | - $cw =& $font['cw']; |
|
| 1695 | + $cw = & $font['cw']; |
|
| 1696 | 1696 | $s = '['; |
| 1697 | - for ($i=32; $i<=255; $i++) { |
|
| 1698 | - $s .= $cw[chr($i)].' '; |
|
| 1697 | + for ($i = 32; $i <= 255; $i++) { |
|
| 1698 | + $s .= $cw[chr($i)] . ' '; |
|
| 1699 | 1699 | } |
| 1700 | - $this->out($s.']'); |
|
| 1700 | + $this->out($s . ']'); |
|
| 1701 | 1701 | $this->out('endobj'); |
| 1702 | 1702 | //Descriptor |
| 1703 | 1703 | $this->newObj(); |
| 1704 | - $s='<</Type /FontDescriptor /FontName /'.$name; |
|
| 1704 | + $s = '<</Type /FontDescriptor /FontName /' . $name; |
|
| 1705 | 1705 | foreach ($font['desc'] as $k => $v) { |
| 1706 | - $s .= ' /'.$k.' '.$v; |
|
| 1706 | + $s .= ' /' . $k . ' ' . $v; |
|
| 1707 | 1707 | } |
| 1708 | - $file=$font['file']; |
|
| 1708 | + $file = $font['file']; |
|
| 1709 | 1709 | if ($file) { |
| 1710 | - $s .= ' /FontFile'.($type=='Type1' ? '' : '2').' '.$this->fontFiles[$file]['n'].' 0 R'; |
|
| 1710 | + $s .= ' /FontFile' . ($type == 'Type1' ? '' : '2') . ' ' . $this->fontFiles[$file]['n'] . ' 0 R'; |
|
| 1711 | 1711 | } |
| 1712 | - $this->out($s.'>>'); |
|
| 1712 | + $this->out($s . '>>'); |
|
| 1713 | 1713 | $this->out('endobj'); |
| 1714 | 1714 | } else { |
| 1715 | 1715 | //Allow for additional types |
| 1716 | - $mtd='_put'.strtolower($type); |
|
| 1716 | + $mtd = '_put' . strtolower($type); |
|
| 1717 | 1717 | if (!method_exists($this, $mtd)) { |
| 1718 | - $this->error('Unsupported font type: '.$type); |
|
| 1718 | + $this->error('Unsupported font type: ' . $type); |
|
| 1719 | 1719 | } |
| 1720 | 1720 | $this->$mtd($font); |
| 1721 | 1721 | } |
@@ -1733,39 +1733,39 @@ discard block |
||
| 1733 | 1733 | $this->images[$file]['n'] = $this->n; |
| 1734 | 1734 | $this->out('<</Type /XObject'); |
| 1735 | 1735 | $this->out('/Subtype /Image'); |
| 1736 | - $this->out('/Width '.$info['w']); |
|
| 1737 | - $this->out('/Height '.$info['h']); |
|
| 1738 | - if ($info['cs']=='Indexed') { |
|
| 1739 | - $this->out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]'); |
|
| 1736 | + $this->out('/Width ' . $info['w']); |
|
| 1737 | + $this->out('/Height ' . $info['h']); |
|
| 1738 | + if ($info['cs'] == 'Indexed') { |
|
| 1739 | + $this->out('/ColorSpace [/Indexed /DeviceRGB ' . (strlen($info['pal']) / 3 - 1) . ' ' . ($this->n + 1) . ' 0 R]'); |
|
| 1740 | 1740 | } else { |
| 1741 | - $this->out('/ColorSpace /'.$info['cs']); |
|
| 1742 | - if ($info['cs']=='DeviceCMYK') { |
|
| 1741 | + $this->out('/ColorSpace /' . $info['cs']); |
|
| 1742 | + if ($info['cs'] == 'DeviceCMYK') { |
|
| 1743 | 1743 | $this->out('/Decode [1 0 1 0 1 0 1 0]'); |
| 1744 | 1744 | } |
| 1745 | 1745 | } |
| 1746 | - $this->out('/BitsPerComponent '.$info['bpc']); |
|
| 1746 | + $this->out('/BitsPerComponent ' . $info['bpc']); |
|
| 1747 | 1747 | if (isset($info['f'])) { |
| 1748 | - $this->out('/Filter /'.$info['f']); |
|
| 1748 | + $this->out('/Filter /' . $info['f']); |
|
| 1749 | 1749 | } |
| 1750 | 1750 | if (isset($info['parms'])) { |
| 1751 | 1751 | $this->out($info['parms']); |
| 1752 | 1752 | } |
| 1753 | 1753 | if (isset($info['trns']) && is_array($info['trns'])) { |
| 1754 | 1754 | $trns = ''; |
| 1755 | - for ($i=0; $i<count($info['trns']); $i++) { |
|
| 1756 | - $trns.=$info['trns'][$i].' '.$info['trns'][$i].' '; |
|
| 1755 | + for ($i = 0; $i < count($info['trns']); $i++) { |
|
| 1756 | + $trns .= $info['trns'][$i] . ' ' . $info['trns'][$i] . ' '; |
|
| 1757 | 1757 | } |
| 1758 | - $this->out('/Mask ['.$trns.']'); |
|
| 1758 | + $this->out('/Mask [' . $trns . ']'); |
|
| 1759 | 1759 | } |
| 1760 | - $this->out('/Length '.strlen($info['data']).'>>'); |
|
| 1760 | + $this->out('/Length ' . strlen($info['data']) . '>>'); |
|
| 1761 | 1761 | $this->putStream($info['data']); |
| 1762 | 1762 | unset($this->images[$file]['data']); |
| 1763 | 1763 | $this->out('endobj'); |
| 1764 | 1764 | //Palette |
| 1765 | 1765 | if ($info['cs'] == 'Indexed') { |
| 1766 | 1766 | $this->newObj(); |
| 1767 | - $pal=($this->compress) ? gzcompress($info['pal']) : $info['pal']; |
|
| 1768 | - $this->out('<<'.$filter.'/Length '.strlen($pal).'>>'); |
|
| 1767 | + $pal = ($this->compress) ? gzcompress($info['pal']) : $info['pal']; |
|
| 1768 | + $this->out('<<' . $filter . '/Length ' . strlen($pal) . '>>'); |
|
| 1769 | 1769 | $this->putStream($pal); |
| 1770 | 1770 | $this->out('endobj'); |
| 1771 | 1771 | } |
@@ -1775,7 +1775,7 @@ discard block |
||
| 1775 | 1775 | protected function putXobjectDict() |
| 1776 | 1776 | { |
| 1777 | 1777 | foreach ($this->images as $image) { |
| 1778 | - $this->out('/I'.$image['i'].' '.$image['n'].' 0 R'); |
|
| 1778 | + $this->out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); |
|
| 1779 | 1779 | } |
| 1780 | 1780 | } |
| 1781 | 1781 | |
@@ -1784,7 +1784,7 @@ discard block |
||
| 1784 | 1784 | $this->out('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); |
| 1785 | 1785 | $this->out('/Font <<'); |
| 1786 | 1786 | foreach ($this->fonts as $font) { |
| 1787 | - $this->out('/F'.$font['i'].' '.$font['n'].' 0 R'); |
|
| 1787 | + $this->out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); |
|
| 1788 | 1788 | } |
| 1789 | 1789 | $this->out('>>'); |
| 1790 | 1790 | $this->out('/XObject <<'); |
@@ -1807,57 +1807,57 @@ discard block |
||
| 1807 | 1807 | |
| 1808 | 1808 | protected function putInfo() |
| 1809 | 1809 | { |
| 1810 | - $this->out('/Producer '.$this->textString('FPDF '. self::FPDF_VERSION)); |
|
| 1810 | + $this->out('/Producer ' . $this->textString('FPDF ' . self::FPDF_VERSION)); |
|
| 1811 | 1811 | if (!empty($this->title)) { |
| 1812 | - $this->out('/Title '.$this->textString($this->title)); |
|
| 1812 | + $this->out('/Title ' . $this->textString($this->title)); |
|
| 1813 | 1813 | } |
| 1814 | 1814 | if (!empty($this->subject)) { |
| 1815 | - $this->out('/Subject '.$this->textString($this->subject)); |
|
| 1815 | + $this->out('/Subject ' . $this->textString($this->subject)); |
|
| 1816 | 1816 | } |
| 1817 | 1817 | if (!empty($this->author)) { |
| 1818 | - $this->out('/Author '.$this->textString($this->author)); |
|
| 1818 | + $this->out('/Author ' . $this->textString($this->author)); |
|
| 1819 | 1819 | } |
| 1820 | 1820 | if (!empty($this->keywords)) { |
| 1821 | - $this->out('/Keywords '.$this->textString($this->keywords)); |
|
| 1821 | + $this->out('/Keywords ' . $this->textString($this->keywords)); |
|
| 1822 | 1822 | } |
| 1823 | 1823 | if (!empty($this->creator)) { |
| 1824 | - $this->out('/Creator '.$this->textString($this->creator)); |
|
| 1824 | + $this->out('/Creator ' . $this->textString($this->creator)); |
|
| 1825 | 1825 | } |
| 1826 | - $this->out('/CreationDate '.$this->textString('D:'.@date('YmdHis'))); |
|
| 1826 | + $this->out('/CreationDate ' . $this->textString('D:' . @date('YmdHis'))); |
|
| 1827 | 1827 | } |
| 1828 | 1828 | |
| 1829 | 1829 | protected function putCatalog() |
| 1830 | 1830 | { |
| 1831 | 1831 | $this->out('/Type /Catalog'); |
| 1832 | 1832 | $this->out('/Pages 1 0 R'); |
| 1833 | - if ($this->zoomMode=='fullpage') { |
|
| 1833 | + if ($this->zoomMode == 'fullpage') { |
|
| 1834 | 1834 | $this->out('/OpenAction [3 0 R /Fit]'); |
| 1835 | - } elseif ($this->zoomMode=='fullwidth') { |
|
| 1835 | + } elseif ($this->zoomMode == 'fullwidth') { |
|
| 1836 | 1836 | $this->out('/OpenAction [3 0 R /FitH null]'); |
| 1837 | - } elseif ($this->zoomMode=='real') { |
|
| 1837 | + } elseif ($this->zoomMode == 'real') { |
|
| 1838 | 1838 | $this->out('/OpenAction [3 0 R /XYZ null null 1]'); |
| 1839 | 1839 | } elseif (!is_string($this->zoomMode)) { |
| 1840 | - $this->out('/OpenAction [3 0 R /XYZ null null '.($this->zoomMode/100).']'); |
|
| 1840 | + $this->out('/OpenAction [3 0 R /XYZ null null ' . ($this->zoomMode / 100) . ']'); |
|
| 1841 | 1841 | } |
| 1842 | - if ($this->layoutMode=='single') { |
|
| 1842 | + if ($this->layoutMode == 'single') { |
|
| 1843 | 1843 | $this->out('/PageLayout /SinglePage'); |
| 1844 | - } elseif ($this->layoutMode=='continuous') { |
|
| 1844 | + } elseif ($this->layoutMode == 'continuous') { |
|
| 1845 | 1845 | $this->out('/PageLayout /OneColumn'); |
| 1846 | - } elseif ($this->layoutMode=='two') { |
|
| 1846 | + } elseif ($this->layoutMode == 'two') { |
|
| 1847 | 1847 | $this->out('/PageLayout /TwoColumnLeft'); |
| 1848 | 1848 | } |
| 1849 | 1849 | } |
| 1850 | 1850 | |
| 1851 | 1851 | protected function putHeader() |
| 1852 | 1852 | { |
| 1853 | - $this->out('%PDF-'.$this->pdfVersion); |
|
| 1853 | + $this->out('%PDF-' . $this->pdfVersion); |
|
| 1854 | 1854 | } |
| 1855 | 1855 | |
| 1856 | 1856 | protected function putTrailer() |
| 1857 | 1857 | { |
| 1858 | - $this->out('/Size '.($this->n+1)); |
|
| 1859 | - $this->out('/Root '.$this->n.' 0 R'); |
|
| 1860 | - $this->out('/Info '.($this->n-1).' 0 R'); |
|
| 1858 | + $this->out('/Size ' . ($this->n + 1)); |
|
| 1859 | + $this->out('/Root ' . $this->n . ' 0 R'); |
|
| 1860 | + $this->out('/Info ' . ($this->n - 1) . ' 0 R'); |
|
| 1861 | 1861 | } |
| 1862 | 1862 | |
| 1863 | 1863 | protected function endDoc() |
@@ -1878,11 +1878,11 @@ discard block |
||
| 1878 | 1878 | $this->out('>>'); |
| 1879 | 1879 | $this->out('endobj'); |
| 1880 | 1880 | //Cross-ref |
| 1881 | - $o=strlen($this->buffer); |
|
| 1881 | + $o = strlen($this->buffer); |
|
| 1882 | 1882 | $this->out('xref'); |
| 1883 | - $this->out('0 '.($this->n+1)); |
|
| 1883 | + $this->out('0 ' . ($this->n + 1)); |
|
| 1884 | 1884 | $this->out('0000000000 65535 f '); |
| 1885 | - for ($i=1; $i<=$this->n; $i++) { |
|
| 1885 | + for ($i = 1; $i <= $this->n; $i++) { |
|
| 1886 | 1886 | $this->out(sprintf('%010d 00000 n ', $this->offsets[$i])); |
| 1887 | 1887 | } |
| 1888 | 1888 | //Trailer |
@@ -1893,6 +1893,6 @@ discard block |
||
| 1893 | 1893 | $this->out('startxref'); |
| 1894 | 1894 | $this->out($o); |
| 1895 | 1895 | $this->out('%%EOF'); |
| 1896 | - $this->state=3; |
|
| 1896 | + $this->state = 3; |
|
| 1897 | 1897 | } |
| 1898 | 1898 | } |