@@ -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']; |
|
@@ -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 | } |
@@ -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++; |
@@ -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); |
@@ -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,14 +585,14 @@ 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 | } |
@@ -605,7 +605,7 @@ discard block |
||
| 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 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | $this->retEvento = $this->dom->getElementsByTagName("retEvento")->item(0); |
| 116 | 116 | $this->rinfEvento = $this->retEvento->getElementsByTagName("infEvento")->item(0); |
| 117 | 117 | $this->tpEvento = $this->infEvento->getElementsByTagName("tpEvento")->item(0)->nodeValue; |
| 118 | - if (!in_array($this->tpEvento, ['110110','110111'])) { |
|
| 118 | + if (!in_array($this->tpEvento, ['110110', '110111'])) { |
|
| 119 | 119 | $this->errMsg = 'Evento não implementado ' . $tpEvento . ' !!'; |
| 120 | 120 | $this->errStatus = true; |
| 121 | 121 | return false; |
@@ -135,11 +135,9 @@ discard block |
||
| 135 | 135 | $this->cStat = $this->rinfEvento->getElementsByTagName("cStat")->item(0)->nodeValue; |
| 136 | 136 | $this->xMotivo = $this->rinfEvento->getElementsByTagName("xMotivo")->item(0)->nodeValue; |
| 137 | 137 | $this->CNPJDest = !empty($this->rinfEvento->getElementsByTagName("CNPJDest")->item(0)->nodeValue) ? |
| 138 | - $this->rinfEvento->getElementsByTagName("CNPJDest")->item(0)->nodeValue : |
|
| 139 | - ''; |
|
| 138 | + $this->rinfEvento->getElementsByTagName("CNPJDest")->item(0)->nodeValue : ''; |
|
| 140 | 139 | $this->CPFDest = !empty($this->rinfEvento->getElementsByTagName("CPFDest")->item(0)->nodeValue) ? |
| 141 | - $this->rinfEvento->getElementsByTagName("CPFDest")->item(0)->nodeValue : |
|
| 142 | - ''; |
|
| 140 | + $this->rinfEvento->getElementsByTagName("CPFDest")->item(0)->nodeValue : ''; |
|
| 143 | 141 | $this->dhRegEvento = $this->rinfEvento->getElementsByTagName("dhRegEvento")->item(0)->nodeValue; |
| 144 | 142 | $this->nProt = $this->rinfEvento->getElementsByTagName("nProt")->item(0)->nodeValue; |
| 145 | 143 | } |
@@ -234,9 +232,9 @@ discard block |
||
| 234 | 232 | // coluna esquerda identificação do emitente |
| 235 | 233 | $w = round($maxW * 0.41, 0); // 80; |
| 236 | 234 | if ($this->orientacao == 'P') { |
| 237 | - $aFont = ['font' => $this->fontePadrao,'size' => 6,'style' => 'I']; |
|
| 235 | + $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => 'I']; |
|
| 238 | 236 | } else { |
| 239 | - $aFont = ['font' => $this->fontePadrao,'size' => 8,'style' => 'B']; |
|
| 237 | + $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'B']; |
|
| 240 | 238 | } |
| 241 | 239 | $w1 = $w; |
| 242 | 240 | $h = 32; |
@@ -389,7 +387,7 @@ discard block |
||
| 389 | 387 | . 'abaixo referenciada, está cancelada, solicitamos que sejam ' |
| 390 | 388 | . 'aplicadas essas correções ao executar seus lançamentos fiscais.'; |
| 391 | 389 | } |
| 392 | - $aFont = ['font' => $this->fontePadrao,'size' => 10,'style' => '']; |
|
| 390 | + $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => '']; |
|
| 393 | 391 | $this->pdf->textBox($x + 5, $y1, $maxW - 5, 20, $texto, $aFont, 'T', 'L', 0, '', false); |
| 394 | 392 | // ############################################ |
| 395 | 393 | $x = $oldX; |
@@ -400,7 +398,7 @@ discard block |
||
| 400 | 398 | if ($this->CPFDest != '') { |
| 401 | 399 | $texto = 'CPF do Destinatário: ' . $this->formatField($this->CPFDest, "###.###.###-##"); |
| 402 | 400 | } |
| 403 | - $aFont = ['font' => $this->fontePadrao,'size' => 12,'style' => 'B']; |
|
| 401 | + $aFont = ['font' => $this->fontePadrao, 'size' => 12, 'style' => 'B']; |
|
| 404 | 402 | $this->pdf->textBox($x + 2, $y + 13, $w2, 8, $texto, $aFont, 'T', 'L', 0, ''); |
| 405 | 403 | $numNF = substr($this->chNFe, 25, 9); |
| 406 | 404 | $serie = substr($this->chNFe, 22, 3); |
@@ -416,7 +414,7 @@ discard block |
||
| 416 | 414 | $this->pdf->code128($x + (($w - $bW) / 2), $y + 2, $this->chNFe, $bW, $bH); |
| 417 | 415 | $this->pdf->setFillColor(255, 255, 255); |
| 418 | 416 | $y1 = $y + 2 + $bH; |
| 419 | - $aFont = ['font' => $this->fontePadrao,'size' => 10,'style' => '']; |
|
| 417 | + $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => '']; |
|
| 420 | 418 | $texto = $this->formatField($this->chNFe, $this->formatoChave); |
| 421 | 419 | $this->pdf->textBox($x, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, ''); |
| 422 | 420 | $retVal = $sY + 2; |
@@ -424,7 +422,7 @@ discard block |
||
| 424 | 422 | $x = $oldX; |
| 425 | 423 | $this->pdf->textBox($x, $sY, $maxW, 15); |
| 426 | 424 | $texto = $this->xCondUso; |
| 427 | - $aFont = ['font' => $this->fontePadrao,'size' => 8,'style' => 'I']; |
|
| 425 | + $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'I']; |
|
| 428 | 426 | $this->pdf->textBox($x + 2, $sY + 2, $maxW - 2, 15, $texto, $aFont, 'T', 'L', 0, '', false); |
| 429 | 427 | $retVal = $sY + 2; |
| 430 | 428 | } |
@@ -440,9 +438,9 @@ discard block |
||
| 440 | 438 | $w = $maxW - (2 * $x); |
| 441 | 439 | $this->pdf->setTextColor(90, 90, 90); |
| 442 | 440 | $texto = "SEM VALOR FISCAL"; |
| 443 | - $aFont = ['font' => $this->fontePadrao,'size' => 48,'style' => 'B']; |
|
| 441 | + $aFont = ['font' => $this->fontePadrao, 'size' => 48, 'style' => 'B']; |
|
| 444 | 442 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
| 445 | - $aFont = ['font' => $this->fontePadrao,'size' => 30,'style' => 'B']; |
|
| 443 | + $aFont = ['font' => $this->fontePadrao, 'size' => 30, 'style' => 'B']; |
|
| 446 | 444 | $texto = "AMBIENTE DE HOMOLOGAÇÃO"; |
| 447 | 445 | $this->pdf->textBox($x, $y + 14, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
| 448 | 446 | $this->pdf->setTextColor(0, 0, 0); |
@@ -464,7 +462,7 @@ discard block |
||
| 464 | 462 | } else { |
| 465 | 463 | $texto = 'JUSTIFICATIVA DO CANCELAMENTO'; |
| 466 | 464 | } |
| 467 | - $aFont = ['font' => $this->fontePadrao,'size' => 10,'style' => 'B']; |
|
| 465 | + $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B']; |
|
| 468 | 466 | $this->pdf->textBox($x, $y, $maxW, 5, $texto, $aFont, 'T', 'L', 0, '', false); |
| 469 | 467 | $y += 5; |
| 470 | 468 | $this->pdf->textBox($x, $y, $maxW, 190); |
@@ -473,7 +471,7 @@ discard block |
||
| 473 | 471 | } elseif ($this->tpEvento == '110111') { |
| 474 | 472 | $texto = $this->xJust; |
| 475 | 473 | } |
| 476 | - $aFont = ['font' => $this->fontePadrao,'size' => 12,'style' => 'B']; |
|
| 474 | + $aFont = ['font' => $this->fontePadrao, 'size' => 12, 'style' => 'B']; |
|
| 477 | 475 | $this->pdf->textBox($x + 2, $y + 2, $maxW - 2, 150, $texto, $aFont, 'T', 'L', 0, '', false); |
| 478 | 476 | } |
| 479 | 477 | |
@@ -498,15 +496,15 @@ discard block |
||
| 498 | 496 | . "eletrônico XML e pode ser consultada através dos Portais " |
| 499 | 497 | . "das SEFAZ."; |
| 500 | 498 | } |
| 501 | - $aFont = ['font' => $this->fontePadrao,'size' => 10,'style' => 'I']; |
|
| 499 | + $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'I']; |
|
| 502 | 500 | $this->pdf->textBox($x, $y, $w, 20, $texto, $aFont, 'T', 'C', 0, '', false); |
| 503 | 501 | $y = $this->hPrint - 4; |
| 504 | 502 | $texto = "Impresso em " . date('d/m/Y H:i:s') . ' ' . $this->creditos; |
| 505 | 503 | $w = $this->wPrint - 4; |
| 506 | - $aFont = ['font' => $this->fontePadrao,'size' => 6,'style' => 'I']; |
|
| 504 | + $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => 'I']; |
|
| 507 | 505 | $this->pdf->textBox($x, $y, $w, 4, $texto, $aFont, 'T', 'L', 0, ''); |
| 508 | 506 | $texto = $this->powered ? "Powered by NFePHP®" : ''; |
| 509 | - $aFont = ['font' => $this->fontePadrao,'size' => 6,'style' => 'I']; |
|
| 507 | + $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => 'I']; |
|
| 510 | 508 | $this->pdf->textBox($x, $y, $w, 4, $texto, $aFont, 'T', 'R', 0, 'http://www.nfephp.org'); |
| 511 | 509 | } |
| 512 | 510 | } |
@@ -379,12 +379,12 @@ discard block |
||
| 379 | 379 | $this->pdf->setTextColor(0, 0, 0); |
| 380 | 380 | $this->pdf->textBox(0, 0, $maxW, $maxH); // POR QUE PRECISO DESA LINHA? |
| 381 | 381 | |
| 382 | - $hcabecalho = 16;//para cabeçalho (dados emitente mais logomarca) (FIXO) |
|
| 382 | + $hcabecalho = 16; //para cabeçalho (dados emitente mais logomarca) (FIXO) |
|
| 383 | 383 | if (strlen($this->getTagValue($this->emit, "xNome")) > 40) { |
| 384 | 384 | $hcabecalho += 2; |
| 385 | 385 | $tamPapelVert += 2; |
| 386 | 386 | }; |
| 387 | - $hcabecalhoSecundario = 18;//para cabeçalho secundário (cabeçalho sefaz) (FIXO) |
|
| 387 | + $hcabecalhoSecundario = 18; //para cabeçalho secundário (cabeçalho sefaz) (FIXO) |
|
| 388 | 388 | $hagencia = 0; |
| 389 | 389 | if (!empty($this->agencia)) { |
| 390 | 390 | if (strlen($this->getTagValue($this->agencia, "xNome")) > 39) { |
@@ -394,9 +394,9 @@ discard block |
||
| 394 | 394 | $hagencia += 20; |
| 395 | 395 | $tamPapelVert += 18; |
| 396 | 396 | } |
| 397 | - $hprodutos = $hLinha + ($qtdItens * $hLinha);//box poduto |
|
| 397 | + $hprodutos = $hLinha + ($qtdItens * $hLinha); //box poduto |
|
| 398 | 398 | $hTotal = 12; //box total (FIXO) |
| 399 | - $hpagamentos = (2 * $hLinha) + ($qtdPgto * $hLinha);//para pagamentos |
|
| 399 | + $hpagamentos = (2 * $hLinha) + ($qtdPgto * $hLinha); //para pagamentos |
|
| 400 | 400 | if (!empty($this->vTroco)) { |
| 401 | 401 | $hpagamentos += $hLinha; |
| 402 | 402 | } |
@@ -446,10 +446,10 @@ discard block |
||
| 446 | 446 | } |
| 447 | 447 | //creditos do integrador |
| 448 | 448 | $aFont = array('font' => $this->fontePadrao, 'size' => 6, 'style' => 'I'); |
| 449 | - $this->pdf->textBox($x, $this->hPrint-1, $this->wPrint, 3, $this->creditos, $aFont, 'T', 'L', false, '', false); |
|
| 449 | + $this->pdf->textBox($x, $this->hPrint - 1, $this->wPrint, 3, $this->creditos, $aFont, 'T', 'L', false, '', false); |
|
| 450 | 450 | $texto = ''; |
| 451 | 451 | $texto = $this->powered ? "Powered by NFePHP®" : ''; |
| 452 | - $this->pdf->textBox($x, $this->hPrint-1, $this->wPrint, 0, $texto, $aFont, 'T', 'R', false, ''); |
|
| 452 | + $this->pdf->textBox($x, $this->hPrint - 1, $this->wPrint, 0, $texto, $aFont, 'T', 'R', false, ''); |
|
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 | /** |
@@ -550,13 +550,13 @@ discard block |
||
| 550 | 550 | if (!empty($this->logomarca)) { |
| 551 | 551 | $xImg = $margemInterna; |
| 552 | 552 | $logoInfo = getimagesize($this->logomarca); |
| 553 | - $logoWmm = ($logoInfo[0]/72)*25.4; |
|
| 554 | - $logoHmm = ($logoInfo[1]/72)*25.4; |
|
| 555 | - $nImgW = $this->paperwidth/2 - ($this->paperwidth/10 + 4); |
|
| 556 | - $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0); |
|
| 553 | + $logoWmm = ($logoInfo[0] / 72) * 25.4; |
|
| 554 | + $logoHmm = ($logoInfo[1] / 72) * 25.4; |
|
| 555 | + $nImgW = $this->paperwidth / 2 - ($this->paperwidth / 10 + 4); |
|
| 556 | + $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0); |
|
| 557 | 557 | if ($nImgH > 18) { |
| 558 | 558 | $nImgH = 18; |
| 559 | - $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0); |
|
| 559 | + $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0); |
|
| 560 | 560 | } |
| 561 | 561 | $yImg = $y; |
| 562 | 562 | $this->pdf->image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, 'jpeg'); |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | $maxW = $this->wPrint; |
| 197 | 197 | //#################################################################################### |
| 198 | 198 | //coluna esquerda identificação do emitente |
| 199 | - $w = round($maxW * 0.41, 0);// 80; |
|
| 199 | + $w = round($maxW * 0.41, 0); // 80; |
|
| 200 | 200 | if ($this->orientacao == 'P') { |
| 201 | 201 | $aFont = array('font' => $this->fontePadrao, 'size' => 6, 'style' => 'I'); |
| 202 | 202 | } else { |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | $campo = $this->infCorrecao->item($i)->getElementsByTagName('campoAlterado')->item(0)->nodeValue; |
| 421 | 421 | $numero = 1; |
| 422 | 422 | if (!empty($this->infCorrecao->item($i)->getElementsByTagName('nroItemAlterado')->item(0))) { |
| 423 | - $numero =$this->infCorrecao->item($i)->getElementsByTagName('nroItemAlterado')->item(0)->nodeValue; |
|
| 423 | + $numero = $this->infCorrecao->item($i)->getElementsByTagName('nroItemAlterado')->item(0)->nodeValue; |
|
| 424 | 424 | } |
| 425 | 425 | $valor = $this->infCorrecao->item($i)->getElementsByTagName('valorAlterado')->item(0)->nodeValue; |
| 426 | 426 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | //ativar modo debug |
| 122 | 122 | error_reporting(E_ALL); |
| 123 | 123 | ini_set('display_errors', 'On'); |
| 124 | - set_error_handler(function (int $errnum, string $errmsg, string $errfile, int $errline) { |
|
| 124 | + set_error_handler(function(int $errnum, string $errmsg, string $errfile, int $errline) { |
|
| 125 | 125 | throw new \Exception("Erro identificado $errnum: '$errmsg' $errfile [linha:" . $errline . "]"); |
| 126 | 126 | }); |
| 127 | 127 | } else { |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | } |
| 276 | 276 | if (substr($logo, 0, 24) !== 'data://text/plain;base64') { |
| 277 | 277 | if (is_file($logo)) { |
| 278 | - $logo = 'data://text/plain;base64,'. base64_encode(file_get_contents($logo)); |
|
| 278 | + $logo = 'data://text/plain;base64,' . base64_encode(file_get_contents($logo)); |
|
| 279 | 279 | } else { |
| 280 | 280 | //se não é uma string e nem um file retorna nulo |
| 281 | 281 | return null; |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | imagedestroy($image); |
| 318 | 318 | $logo = ob_get_contents(); // read from buffer |
| 319 | 319 | ob_end_clean(); |
| 320 | - return 'data://text/plain;base64,'.base64_encode($logo); |
|
| 320 | + return 'data://text/plain;base64,' . base64_encode($logo); |
|
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | /** |
@@ -7,64 +7,64 @@ discard block |
||
| 7 | 7 | const FPDF_VERSION = '1.81'; |
| 8 | 8 | const FPDF_FONTPATH = 'font/'; |
| 9 | 9 | |
| 10 | - protected $page; // current page number |
|
| 11 | - protected $n; // current object number |
|
| 12 | - protected $offsets; // array of object offsets |
|
| 13 | - protected $buffer; // buffer holding in-memory PDF |
|
| 14 | - protected $pages; // array containing pages |
|
| 15 | - protected $state; // current document state |
|
| 16 | - protected $compress; // compression flag |
|
| 17 | - public $k; // scale factor (number of points in user unit) |
|
| 18 | - protected $defOrientation; // default orientation |
|
| 19 | - protected $curOrientation; // current orientation |
|
| 20 | - protected $stdPageSizes; // standard page sizes |
|
| 21 | - protected $defPageSize; // default page size |
|
| 22 | - protected $curPageSize; // current page size |
|
| 23 | - protected $curRotation; // current page rotation |
|
| 24 | - protected $pageInfo; // page-related data |
|
| 10 | + protected $page; // current page number |
|
| 11 | + protected $n; // current object number |
|
| 12 | + protected $offsets; // array of object offsets |
|
| 13 | + protected $buffer; // buffer holding in-memory PDF |
|
| 14 | + protected $pages; // array containing pages |
|
| 15 | + protected $state; // current document state |
|
| 16 | + protected $compress; // compression flag |
|
| 17 | + public $k; // scale factor (number of points in user unit) |
|
| 18 | + protected $defOrientation; // default orientation |
|
| 19 | + protected $curOrientation; // current orientation |
|
| 20 | + protected $stdPageSizes; // standard page sizes |
|
| 21 | + protected $defPageSize; // default page size |
|
| 22 | + protected $curPageSize; // current page size |
|
| 23 | + protected $curRotation; // current page rotation |
|
| 24 | + protected $pageInfo; // page-related data |
|
| 25 | 25 | protected $wPt; |
| 26 | - protected $hPt; // dimensions of current page in points |
|
| 26 | + protected $hPt; // dimensions of current page in points |
|
| 27 | 27 | protected $w; |
| 28 | - protected $h; // dimensions of current page in user unit |
|
| 29 | - protected $lMargin; // left margin |
|
| 30 | - protected $tMargin; // top margin |
|
| 31 | - protected $rMargin; // right margin |
|
| 32 | - protected $bMargin; // page break margin |
|
| 33 | - protected $cMargin; // cell margin |
|
| 28 | + protected $h; // dimensions of current page in user unit |
|
| 29 | + protected $lMargin; // left margin |
|
| 30 | + protected $tMargin; // top margin |
|
| 31 | + protected $rMargin; // right margin |
|
| 32 | + protected $bMargin; // page break margin |
|
| 33 | + protected $cMargin; // cell margin |
|
| 34 | 34 | protected $x; |
| 35 | - protected $y; // current position in user unit |
|
| 36 | - protected $lasth; // height of last printed cell |
|
| 37 | - protected $lineWidth; // line width in user unit |
|
| 38 | - protected $fontpath; // path containing fonts |
|
| 39 | - protected $coreFonts; // array of core font names |
|
| 40 | - protected $fonts; // array of used fonts |
|
| 41 | - protected $fontFiles; // array of font files |
|
| 42 | - protected $encodings; // array of encodings |
|
| 43 | - protected $cmaps; // array of ToUnicode CMaps |
|
| 44 | - protected $fontFamily; // current font family |
|
| 45 | - protected $fontStyle; // current font style |
|
| 46 | - protected $underline; // underlining flag |
|
| 47 | - protected $currentFont; // current font info |
|
| 48 | - protected $fontSizePt; // current font size in points |
|
| 49 | - public $fontSize; // current font size in user unit |
|
| 50 | - protected $drawColor; // commands for drawing color |
|
| 51 | - protected $fillColor; // commands for filling color |
|
| 52 | - protected $textColor; // commands for text color |
|
| 53 | - protected $colorFlag; // indicates whether fill and text colors are different |
|
| 54 | - protected $withAlpha; // indicates whether alpha channel is used |
|
| 55 | - protected $ws; // word spacing |
|
| 56 | - protected $images; // array of used images |
|
| 57 | - protected $pageLinks; // array of links in pages |
|
| 58 | - protected $links; // array of internal links |
|
| 59 | - protected $autoPageBreak; // automatic page breaking |
|
| 60 | - protected $pageBreakTrigger; // threshold used to trigger page breaks |
|
| 61 | - protected $inHeader; // flag set when processing header |
|
| 62 | - protected $infooter; // flag set when processing footer |
|
| 63 | - protected $aliasNbPages; // alias for total number of pages |
|
| 64 | - protected $zoomMode; // zoom display mode |
|
| 65 | - protected $layoutMode; // layout display mode |
|
| 66 | - protected $metadata; // document properties |
|
| 67 | - protected $pdfVersion; // PDF version number |
|
| 35 | + protected $y; // current position in user unit |
|
| 36 | + protected $lasth; // height of last printed cell |
|
| 37 | + protected $lineWidth; // line width in user unit |
|
| 38 | + protected $fontpath; // path containing fonts |
|
| 39 | + protected $coreFonts; // array of core font names |
|
| 40 | + protected $fonts; // array of used fonts |
|
| 41 | + protected $fontFiles; // array of font files |
|
| 42 | + protected $encodings; // array of encodings |
|
| 43 | + protected $cmaps; // array of ToUnicode CMaps |
|
| 44 | + protected $fontFamily; // current font family |
|
| 45 | + protected $fontStyle; // current font style |
|
| 46 | + protected $underline; // underlining flag |
|
| 47 | + protected $currentFont; // current font info |
|
| 48 | + protected $fontSizePt; // current font size in points |
|
| 49 | + public $fontSize; // current font size in user unit |
|
| 50 | + protected $drawColor; // commands for drawing color |
|
| 51 | + protected $fillColor; // commands for filling color |
|
| 52 | + protected $textColor; // commands for text color |
|
| 53 | + protected $colorFlag; // indicates whether fill and text colors are different |
|
| 54 | + protected $withAlpha; // indicates whether alpha channel is used |
|
| 55 | + protected $ws; // word spacing |
|
| 56 | + protected $images; // array of used images |
|
| 57 | + protected $pageLinks; // array of links in pages |
|
| 58 | + protected $links; // array of internal links |
|
| 59 | + protected $autoPageBreak; // automatic page breaking |
|
| 60 | + protected $pageBreakTrigger; // threshold used to trigger page breaks |
|
| 61 | + protected $inHeader; // flag set when processing header |
|
| 62 | + protected $infooter; // flag set when processing footer |
|
| 63 | + protected $aliasNbPages; // alias for total number of pages |
|
| 64 | + protected $zoomMode; // zoom display mode |
|
| 65 | + protected $layoutMode; // layout display mode |
|
| 66 | + protected $metadata; // document properties |
|
| 67 | + protected $pdfVersion; // PDF version number |
|
| 68 | 68 | |
| 69 | 69 | public function __construct($orientation = 'P', $unit = 'mm', $size = 'A4') |
| 70 | 70 | { |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | $this->withAlpha = false; |
| 98 | 98 | $this->ws = 0; |
| 99 | 99 | |
| 100 | - $this->fontpath = __DIR__. FPDF_FONTPATH; |
|
| 100 | + $this->fontpath = __DIR__ . FPDF_FONTPATH; |
|
| 101 | 101 | |
| 102 | 102 | // Core fonts |
| 103 | 103 | $this->coreFonts = [ |