Version Description
- Fehlerbehebung beim Datenauszug bei der PDF Generierung
Download this release
Release Info
Developer | shapepress |
Plugin | WP DSGVO Tools |
Version | 2.1.3 |
Comparing to | |
See all releases |
Code changes from version 2.1.2 to 2.1.3
- README.txt +4 -1
- includes/class-sp-dsgvo-pdf.php +1 -1
- includes/lib/tcpdf/include/tcpdf_fonts.php +177 -177
- includes/lib/tcpdf/include/tcpdf_images.php +11 -11
- includes/lib/tcpdf/include/tcpdf_static.php +4 -4
- includes/lib/tcpdf/tcpdf.php +425 -425
- includes/lib/tcpdf/tcpdf_parser.php +2 -2
- includes/lib/tcpdf/tools/tcpdf_addfont.php +1 -1
- sp-dsgvo.php +2 -2
README.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://wp-dsgvo.eu
|
|
4 |
Tags: gdpr, dsgvo, datenschutz, wordpress, compliance, data
|
5 |
Requires at least: 3.0.1
|
6 |
Tested up to: 4.9.8
|
7 |
-
Stable tag: 2.1.
|
8 |
Requires PHP: 5.6.0
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -77,6 +77,9 @@ WICHTIG: Vor der Installation bitte alle bisher aktivierten Cookie Notice Plugin
|
|
77 |
|
78 |
== Changelog ==
|
79 |
|
|
|
|
|
|
|
80 |
= 2.1.2 =
|
81 |
* Bugfix Woocommerce Checkout Checkbox: Standardtext wird nun korrekt angezeigt.
|
82 |
|
4 |
Tags: gdpr, dsgvo, datenschutz, wordpress, compliance, data
|
5 |
Requires at least: 3.0.1
|
6 |
Tested up to: 4.9.8
|
7 |
+
Stable tag: 2.1.3
|
8 |
Requires PHP: 5.6.0
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
77 |
|
78 |
== Changelog ==
|
79 |
|
80 |
+
= 2.1.3 =
|
81 |
+
* Fehlerbehebung beim Datenauszug bei der PDF Generierung
|
82 |
+
|
83 |
= 2.1.2 =
|
84 |
* Bugfix Woocommerce Checkout Checkbox: Standardtext wird nun korrekt angezeigt.
|
85 |
|
includes/class-sp-dsgvo-pdf.php
CHANGED
@@ -44,7 +44,7 @@ class SPDSGVOPDF extends DSGVOTCPDF
|
|
44 |
$fill = 0;
|
45 |
foreach ($data as $type => $d) {
|
46 |
$data = array();
|
47 |
-
|
48 |
$title = "<strong>" . $type . "</strong>";
|
49 |
|
50 |
$this->writeHTML($title, true, false, true, false, '');
|
44 |
$fill = 0;
|
45 |
foreach ($data as $type => $d) {
|
46 |
$data = array();
|
47 |
+
error_log('type: '.$type);
|
48 |
$title = "<strong>" . $type . "</strong>";
|
49 |
|
50 |
$this->writeHTML($title, true, false, true, false, '');
|
includes/lib/tcpdf/include/tcpdf_fonts.php
CHANGED
@@ -106,7 +106,7 @@ class DSGVOTCPDF_FONTS {
|
|
106 |
$fmetric['originalsize'] = strlen($font);
|
107 |
// autodetect font type
|
108 |
if (empty($fonttype)) {
|
109 |
-
if (
|
110 |
// True Type (Unicode or not)
|
111 |
$fonttype = 'TrueTypeUnicode';
|
112 |
} elseif (substr($font, 0, 4) == 'OTTO') {
|
@@ -148,10 +148,10 @@ class DSGVOTCPDF_FONTS {
|
|
148 |
$fmetric['enc'] = preg_replace('/[^A-Za-z0-9_\-]/', '', $enc);
|
149 |
$fmetric['diff'] = '';
|
150 |
if (($fmetric['type'] == 'TrueType') OR ($fmetric['type'] == 'Type1')) {
|
151 |
-
if (!empty($enc) AND ($enc != 'cp1252') AND isset(
|
152 |
// build differences from reference encoding
|
153 |
-
$enc_ref =
|
154 |
-
$enc_target =
|
155 |
$last = 0;
|
156 |
for ($i = 32; $i <= 255; ++$i) {
|
157 |
if ($enc_target[$i] != $enc_ref[$i]) {
|
@@ -186,7 +186,7 @@ class DSGVOTCPDF_FONTS {
|
|
186 |
$data .= $encrypted;
|
187 |
// store compressed font
|
188 |
$fmetric['file'] .= '.z';
|
189 |
-
$fp =
|
190 |
fwrite($fp, gzcompress($data));
|
191 |
fclose($fp);
|
192 |
// get font info
|
@@ -274,8 +274,8 @@ class DSGVOTCPDF_FONTS {
|
|
274 |
// get charstring data
|
275 |
$eplain = substr($eplain, (strpos($eplain, '/CharStrings') + 1));
|
276 |
preg_match_all('#/([A-Za-z0-9\.]*)[\s][0-9]+[\s]RD[\s](.*)[\s]ND#sU', $eplain, $matches, PREG_SET_ORDER);
|
277 |
-
if (!empty($enc) AND isset(
|
278 |
-
$enc_map =
|
279 |
} else {
|
280 |
$enc_map = false;
|
281 |
}
|
@@ -355,7 +355,7 @@ class DSGVOTCPDF_FONTS {
|
|
355 |
} else {
|
356 |
// ---------- TRUE TYPE ----------
|
357 |
$offset = 0; // offset position of the font data
|
358 |
-
if (
|
359 |
// sfnt version must be 0x00010000 for TrueType version 1.0.
|
360 |
return false;
|
361 |
}
|
@@ -366,14 +366,14 @@ class DSGVOTCPDF_FONTS {
|
|
366 |
} else {
|
367 |
// store compressed font
|
368 |
$fmetric['file'] .= '.z';
|
369 |
-
$fp =
|
370 |
fwrite($fp, gzcompress($font));
|
371 |
fclose($fp);
|
372 |
}
|
373 |
}
|
374 |
$offset += 4;
|
375 |
// get number of tables
|
376 |
-
$numTables =
|
377 |
$offset += 2;
|
378 |
// skip searchRange, entrySelector and rangeShift
|
379 |
$offset += 6;
|
@@ -385,37 +385,37 @@ class DSGVOTCPDF_FONTS {
|
|
385 |
$tag = substr($font, $offset, 4);
|
386 |
$offset += 4;
|
387 |
$table[$tag] = array();
|
388 |
-
$table[$tag]['checkSum'] =
|
389 |
$offset += 4;
|
390 |
-
$table[$tag]['offset'] =
|
391 |
$offset += 4;
|
392 |
-
$table[$tag]['length'] =
|
393 |
$offset += 4;
|
394 |
}
|
395 |
// check magicNumber
|
396 |
$offset = $table['head']['offset'] + 12;
|
397 |
-
if (
|
398 |
// magicNumber must be 0x5F0F3CF5
|
399 |
return false;
|
400 |
}
|
401 |
$offset += 4;
|
402 |
$offset += 2; // skip flags
|
403 |
// get FUnits
|
404 |
-
$fmetric['unitsPerEm'] =
|
405 |
$offset += 2;
|
406 |
// units ratio constant
|
407 |
$urk = (1000 / $fmetric['unitsPerEm']);
|
408 |
$offset += 16; // skip created, modified
|
409 |
-
$xMin = round(
|
410 |
$offset += 2;
|
411 |
-
$yMin = round(
|
412 |
$offset += 2;
|
413 |
-
$xMax = round(
|
414 |
$offset += 2;
|
415 |
-
$yMax = round(
|
416 |
$offset += 2;
|
417 |
$fmetric['bbox'] = ''.$xMin.' '.$yMin.' '.$xMax.' '.$yMax.'';
|
418 |
-
$macStyle =
|
419 |
$offset += 2;
|
420 |
// PDF font flags
|
421 |
$fmetric['Flags'] = $flags;
|
@@ -425,7 +425,7 @@ class DSGVOTCPDF_FONTS {
|
|
425 |
}
|
426 |
// get offset mode (indexToLocFormat : 0 = short, 1 = long)
|
427 |
$offset = $table['head']['offset'] + 50;
|
428 |
-
$short_offset = (
|
429 |
$offset += 2;
|
430 |
// get the offsets to the locations of the glyphs in the font, relative to the beginning of the glyphData table
|
431 |
$indexToLoc = array();
|
@@ -434,7 +434,7 @@ class DSGVOTCPDF_FONTS {
|
|
434 |
// short version
|
435 |
$tot_num_glyphs = floor($table['loca']['length'] / 2); // numGlyphs + 1
|
436 |
for ($i = 0; $i < $tot_num_glyphs; ++$i) {
|
437 |
-
$indexToLoc[$i] =
|
438 |
if (isset($indexToLoc[($i - 1)]) && ($indexToLoc[$i] == $indexToLoc[($i - 1)])) {
|
439 |
// the last glyph didn't have an outline
|
440 |
unset($indexToLoc[($i - 1)]);
|
@@ -445,7 +445,7 @@ class DSGVOTCPDF_FONTS {
|
|
445 |
// long version
|
446 |
$tot_num_glyphs = floor($table['loca']['length'] / 4); // numGlyphs + 1
|
447 |
for ($i = 0; $i < $tot_num_glyphs; ++$i) {
|
448 |
-
$indexToLoc[$i] =
|
449 |
if (isset($indexToLoc[($i - 1)]) && ($indexToLoc[$i] == $indexToLoc[($i - 1)])) {
|
450 |
// the last glyph didn't have an outline
|
451 |
unset($indexToLoc[($i - 1)]);
|
@@ -455,31 +455,31 @@ class DSGVOTCPDF_FONTS {
|
|
455 |
}
|
456 |
// get glyphs indexes of chars from cmap table
|
457 |
$offset = $table['cmap']['offset'] + 2;
|
458 |
-
$numEncodingTables =
|
459 |
$offset += 2;
|
460 |
$encodingTables = array();
|
461 |
for ($i = 0; $i < $numEncodingTables; ++$i) {
|
462 |
-
$encodingTables[$i]['platformID'] =
|
463 |
$offset += 2;
|
464 |
-
$encodingTables[$i]['encodingID'] =
|
465 |
$offset += 2;
|
466 |
-
$encodingTables[$i]['offset'] =
|
467 |
$offset += 4;
|
468 |
}
|
469 |
// ---------- get os/2 metrics ----------
|
470 |
$offset = $table['OS/2']['offset'];
|
471 |
$offset += 2; // skip version
|
472 |
// xAvgCharWidth
|
473 |
-
$fmetric['AvgWidth'] = round(
|
474 |
$offset += 2;
|
475 |
// usWeightClass
|
476 |
-
$usWeightClass = round(
|
477 |
// estimate StemV and StemH (400 = usWeightClass for Normal - Regular font)
|
478 |
$fmetric['StemV'] = round((70 * $usWeightClass) / 400);
|
479 |
$fmetric['StemH'] = round((30 * $usWeightClass) / 400);
|
480 |
$offset += 2;
|
481 |
$offset += 2; // usWidthClass
|
482 |
-
$fsType =
|
483 |
$offset += 2;
|
484 |
if ($fsType == 2) {
|
485 |
// This Font cannot be modified, embedded or exchanged in any manner without first obtaining permission of the legal owner.
|
@@ -490,22 +490,22 @@ class DSGVOTCPDF_FONTS {
|
|
490 |
$offset = $table['name']['offset'];
|
491 |
$offset += 2; // skip Format selector (=0).
|
492 |
// Number of NameRecords that follow n.
|
493 |
-
$numNameRecords =
|
494 |
$offset += 2;
|
495 |
// Offset to start of string storage (from start of table).
|
496 |
-
$stringStorageOffset =
|
497 |
$offset += 2;
|
498 |
for ($i = 0; $i < $numNameRecords; ++$i) {
|
499 |
$offset += 6; // skip Platform ID, Platform-specific encoding ID, Language ID.
|
500 |
// Name ID.
|
501 |
-
$nameID =
|
502 |
$offset += 2;
|
503 |
if ($nameID == 6) {
|
504 |
// String length (in bytes).
|
505 |
-
$stringLength =
|
506 |
$offset += 2;
|
507 |
// String offset from start of storage area (in bytes).
|
508 |
-
$stringOffset =
|
509 |
$offset += 2;
|
510 |
$offset = ($table['name']['offset'] + $stringStorageOffset + $stringOffset);
|
511 |
$fmetric['name'] = substr($font, $offset, $stringLength);
|
@@ -521,13 +521,13 @@ class DSGVOTCPDF_FONTS {
|
|
521 |
// ---------- get post data ----------
|
522 |
$offset = $table['post']['offset'];
|
523 |
$offset += 4; // skip Format Type
|
524 |
-
$fmetric['italicAngle'] =
|
525 |
$offset += 4;
|
526 |
-
$fmetric['underlinePosition'] = round(
|
527 |
$offset += 2;
|
528 |
-
$fmetric['underlineThickness'] = round(
|
529 |
$offset += 2;
|
530 |
-
$isFixedPitch = (
|
531 |
$offset += 2;
|
532 |
if ($isFixedPitch) {
|
533 |
$fmetric['Flags'] |= 1;
|
@@ -536,38 +536,38 @@ class DSGVOTCPDF_FONTS {
|
|
536 |
$offset = $table['hhea']['offset'];
|
537 |
$offset += 4; // skip Table version number
|
538 |
// Ascender
|
539 |
-
$fmetric['Ascent'] = round(
|
540 |
$offset += 2;
|
541 |
// Descender
|
542 |
-
$fmetric['Descent'] = round(
|
543 |
$offset += 2;
|
544 |
// LineGap
|
545 |
-
$fmetric['Leading'] = round(
|
546 |
$offset += 2;
|
547 |
// advanceWidthMax
|
548 |
-
$fmetric['MaxWidth'] = round(
|
549 |
$offset += 2;
|
550 |
$offset += 22; // skip some values
|
551 |
// get the number of hMetric entries in hmtx table
|
552 |
-
$numberOfHMetrics =
|
553 |
// ---------- get maxp data ----------
|
554 |
$offset = $table['maxp']['offset'];
|
555 |
$offset += 4; // skip Table version number
|
556 |
// get the the number of glyphs in the font.
|
557 |
-
$numGlyphs =
|
558 |
// ---------- get CIDToGIDMap ----------
|
559 |
$ctg = array();
|
560 |
foreach ($encodingTables as $enctable) {
|
561 |
// get only specified Platform ID and Encoding ID
|
562 |
if (($enctable['platformID'] == $platid) AND ($enctable['encodingID'] == $encid)) {
|
563 |
$offset = $table['cmap']['offset'] + $enctable['offset'];
|
564 |
-
$format =
|
565 |
$offset += 2;
|
566 |
switch ($format) {
|
567 |
case 0: { // Format 0: Byte encoding table
|
568 |
$offset += 4; // skip length and version/language
|
569 |
for ($c = 0; $c < 256; ++$c) {
|
570 |
-
$g =
|
571 |
$ctg[$c] = $g;
|
572 |
++$offset;
|
573 |
}
|
@@ -578,7 +578,7 @@ class DSGVOTCPDF_FONTS {
|
|
578 |
$numSubHeaders = 0;
|
579 |
for ($i = 0; $i < 256; ++$i) {
|
580 |
// Array that maps high bytes to subHeaders: value is subHeader index * 8.
|
581 |
-
$subHeaderKeys[$i] = (
|
582 |
$offset += 2;
|
583 |
if ($numSubHeaders < $subHeaderKeys[$i]) {
|
584 |
$numSubHeaders = $subHeaderKeys[$i];
|
@@ -590,20 +590,20 @@ class DSGVOTCPDF_FONTS {
|
|
590 |
$subHeaders = array();
|
591 |
$numGlyphIndexArray = 0;
|
592 |
for ($k = 0; $k < $numSubHeaders; ++$k) {
|
593 |
-
$subHeaders[$k]['firstCode'] =
|
594 |
$offset += 2;
|
595 |
-
$subHeaders[$k]['entryCount'] =
|
596 |
$offset += 2;
|
597 |
-
$subHeaders[$k]['idDelta'] =
|
598 |
$offset += 2;
|
599 |
-
$subHeaders[$k]['idRangeOffset'] =
|
600 |
$offset += 2;
|
601 |
$subHeaders[$k]['idRangeOffset'] -= (2 + (($numSubHeaders - $k - 1) * 8));
|
602 |
$subHeaders[$k]['idRangeOffset'] /= 2;
|
603 |
$numGlyphIndexArray += $subHeaders[$k]['entryCount'];
|
604 |
}
|
605 |
for ($k = 0; $k < $numGlyphIndexArray; ++$k) {
|
606 |
-
$glyphIndexArray[$k] =
|
607 |
$offset += 2;
|
608 |
}
|
609 |
for ($i = 0; $i < 256; ++$i) {
|
@@ -632,37 +632,37 @@ class DSGVOTCPDF_FONTS {
|
|
632 |
break;
|
633 |
}
|
634 |
case 4: { // Format 4: Segment mapping to delta values
|
635 |
-
$length =
|
636 |
$offset += 2;
|
637 |
$offset += 2; // skip version/language
|
638 |
-
$segCount = floor(
|
639 |
$offset += 2;
|
640 |
$offset += 6; // skip searchRange, entrySelector, rangeShift
|
641 |
$endCount = array(); // array of end character codes for each segment
|
642 |
for ($k = 0; $k < $segCount; ++$k) {
|
643 |
-
$endCount[$k] =
|
644 |
$offset += 2;
|
645 |
}
|
646 |
$offset += 2; // skip reservedPad
|
647 |
$startCount = array(); // array of start character codes for each segment
|
648 |
for ($k = 0; $k < $segCount; ++$k) {
|
649 |
-
$startCount[$k] =
|
650 |
$offset += 2;
|
651 |
}
|
652 |
$idDelta = array(); // delta for all character codes in segment
|
653 |
for ($k = 0; $k < $segCount; ++$k) {
|
654 |
-
$idDelta[$k] =
|
655 |
$offset += 2;
|
656 |
}
|
657 |
$idRangeOffset = array(); // Offsets into glyphIdArray or 0
|
658 |
for ($k = 0; $k < $segCount; ++$k) {
|
659 |
-
$idRangeOffset[$k] =
|
660 |
$offset += 2;
|
661 |
}
|
662 |
$gidlen = (floor($length / 2) - 8 - (4 * $segCount));
|
663 |
$glyphIdArray = array(); // glyph index array
|
664 |
for ($k = 0; $k < $gidlen; ++$k) {
|
665 |
-
$glyphIdArray[$k] =
|
666 |
$offset += 2;
|
667 |
}
|
668 |
for ($k = 0; $k < $segCount; ++$k) {
|
@@ -683,13 +683,13 @@ class DSGVOTCPDF_FONTS {
|
|
683 |
}
|
684 |
case 6: { // Format 6: Trimmed table mapping
|
685 |
$offset += 4; // skip length and version/language
|
686 |
-
$firstCode =
|
687 |
$offset += 2;
|
688 |
-
$entryCount =
|
689 |
$offset += 2;
|
690 |
for ($k = 0; $k < $entryCount; ++$k) {
|
691 |
$c = ($k + $firstCode);
|
692 |
-
$g =
|
693 |
$offset += 2;
|
694 |
$ctg[$c] = $g;
|
695 |
}
|
@@ -698,17 +698,17 @@ class DSGVOTCPDF_FONTS {
|
|
698 |
case 8: { // Format 8: Mixed 16-bit and 32-bit coverage
|
699 |
$offset += 10; // skip reserved, length and version/language
|
700 |
for ($k = 0; $k < 8192; ++$k) {
|
701 |
-
$is32[$k] =
|
702 |
++$offset;
|
703 |
}
|
704 |
-
$nGroups =
|
705 |
$offset += 4;
|
706 |
for ($i = 0; $i < $nGroups; ++$i) {
|
707 |
-
$startCharCode =
|
708 |
$offset += 4;
|
709 |
-
$endCharCode =
|
710 |
$offset += 4;
|
711 |
-
$startGlyphID =
|
712 |
$offset += 4;
|
713 |
for ($k = $startCharCode; $k <= $endCharCode; ++$k) {
|
714 |
$is32idx = floor($c / 8);
|
@@ -729,13 +729,13 @@ class DSGVOTCPDF_FONTS {
|
|
729 |
}
|
730 |
case 10: { // Format 10: Trimmed array
|
731 |
$offset += 10; // skip reserved, length and version/language
|
732 |
-
$startCharCode =
|
733 |
$offset += 4;
|
734 |
-
$numChars =
|
735 |
$offset += 4;
|
736 |
for ($k = 0; $k < $numChars; ++$k) {
|
737 |
$c = ($k + $startCharCode);
|
738 |
-
$g =
|
739 |
$ctg[$c] = $g;
|
740 |
$offset += 2;
|
741 |
}
|
@@ -743,14 +743,14 @@ class DSGVOTCPDF_FONTS {
|
|
743 |
}
|
744 |
case 12: { // Format 12: Segmented coverage
|
745 |
$offset += 10; // skip length and version/language
|
746 |
-
$nGroups =
|
747 |
$offset += 4;
|
748 |
for ($k = 0; $k < $nGroups; ++$k) {
|
749 |
-
$startCharCode =
|
750 |
$offset += 4;
|
751 |
-
$endCharCode =
|
752 |
$offset += 4;
|
753 |
-
$startGlyphCode =
|
754 |
$offset += 4;
|
755 |
for ($c = $startCharCode; $c <= $endCharCode; ++$c) {
|
756 |
$ctg[$c] = $startGlyphCode;
|
@@ -775,23 +775,23 @@ class DSGVOTCPDF_FONTS {
|
|
775 |
}
|
776 |
// get xHeight (height of x)
|
777 |
$offset = ($table['glyf']['offset'] + $indexToLoc[$ctg[120]] + 4);
|
778 |
-
$yMin =
|
779 |
$offset += 4;
|
780 |
-
$yMax =
|
781 |
$offset += 2;
|
782 |
$fmetric['XHeight'] = round(($yMax - $yMin) * $urk);
|
783 |
// get CapHeight (height of H)
|
784 |
$offset = ($table['glyf']['offset'] + $indexToLoc[$ctg[72]] + 4);
|
785 |
-
$yMin =
|
786 |
$offset += 4;
|
787 |
-
$yMax =
|
788 |
$offset += 2;
|
789 |
$fmetric['CapHeight'] = round(($yMax - $yMin) * $urk);
|
790 |
// ceate widths array
|
791 |
$cw = array();
|
792 |
$offset = $table['hmtx']['offset'];
|
793 |
for ($i = 0 ; $i < $numberOfHMetrics; ++$i) {
|
794 |
-
$cw[$i] = round(
|
795 |
$offset += 4; // skip lsb
|
796 |
}
|
797 |
if ($numberOfHMetrics < $numGlyphs) {
|
@@ -808,10 +808,10 @@ class DSGVOTCPDF_FONTS {
|
|
808 |
}
|
809 |
if ($addcbbox AND isset($indexToLoc[$ctg[$cid]])) {
|
810 |
$offset = ($table['glyf']['offset'] + $indexToLoc[$ctg[$cid]]);
|
811 |
-
$xMin = round(
|
812 |
-
$yMin = round(
|
813 |
-
$xMax = round(
|
814 |
-
$yMax = round(
|
815 |
$fmetric['cbbox'] .= ','.$cid.'=>array('.$xMin.','.$yMin.','.$xMax.','.$yMax.')';
|
816 |
}
|
817 |
}
|
@@ -885,7 +885,7 @@ class DSGVOTCPDF_FONTS {
|
|
885 |
$cidtogidmap = self::updateCIDtoGIDmap($cidtogidmap, $cid, $ctg[$cid]);
|
886 |
}
|
887 |
// store compressed CIDToGIDMap
|
888 |
-
$fp =
|
889 |
fwrite($fp, gzcompress($cidtogidmap));
|
890 |
fclose($fp);
|
891 |
}
|
@@ -911,7 +911,7 @@ class DSGVOTCPDF_FONTS {
|
|
911 |
$pfile .= '$cw=array('.substr($fmetric['cw'], 1).');'."\n";
|
912 |
$pfile .= '// --- EOF ---'."\n";
|
913 |
// store file
|
914 |
-
$fp =
|
915 |
fwrite($fp, $pfile);
|
916 |
fclose($fp);
|
917 |
// return TCPDF font name
|
@@ -952,13 +952,13 @@ class DSGVOTCPDF_FONTS {
|
|
952 |
public static function _getTrueTypeFontSubset($font, $subsetchars) {
|
953 |
ksort($subsetchars);
|
954 |
$offset = 0; // offset position of the font data
|
955 |
-
if (
|
956 |
// sfnt version must be 0x00010000 for TrueType version 1.0.
|
957 |
return $font;
|
958 |
}
|
959 |
$offset += 4;
|
960 |
// get number of tables
|
961 |
-
$numTables =
|
962 |
$offset += 2;
|
963 |
// skip searchRange, entrySelector and rangeShift
|
964 |
$offset += 6;
|
@@ -970,23 +970,23 @@ class DSGVOTCPDF_FONTS {
|
|
970 |
$tag = substr($font, $offset, 4);
|
971 |
$offset += 4;
|
972 |
$table[$tag] = array();
|
973 |
-
$table[$tag]['checkSum'] =
|
974 |
$offset += 4;
|
975 |
-
$table[$tag]['offset'] =
|
976 |
$offset += 4;
|
977 |
-
$table[$tag]['length'] =
|
978 |
$offset += 4;
|
979 |
}
|
980 |
// check magicNumber
|
981 |
$offset = $table['head']['offset'] + 12;
|
982 |
-
if (
|
983 |
// magicNumber must be 0x5F0F3CF5
|
984 |
return $font;
|
985 |
}
|
986 |
$offset += 4;
|
987 |
// get offset mode (indexToLocFormat : 0 = short, 1 = long)
|
988 |
$offset = $table['head']['offset'] + 50;
|
989 |
-
$short_offset = (
|
990 |
$offset += 2;
|
991 |
// get the offsets to the locations of the glyphs in the font, relative to the beginning of the glyphData table
|
992 |
$indexToLoc = array();
|
@@ -995,14 +995,14 @@ class DSGVOTCPDF_FONTS {
|
|
995 |
// short version
|
996 |
$tot_num_glyphs = floor($table['loca']['length'] / 2); // numGlyphs + 1
|
997 |
for ($i = 0; $i < $tot_num_glyphs; ++$i) {
|
998 |
-
$indexToLoc[$i] =
|
999 |
$offset += 2;
|
1000 |
}
|
1001 |
} else {
|
1002 |
// long version
|
1003 |
$tot_num_glyphs = ($table['loca']['length'] / 4); // numGlyphs + 1
|
1004 |
for ($i = 0; $i < $tot_num_glyphs; ++$i) {
|
1005 |
-
$indexToLoc[$i] =
|
1006 |
$offset += 4;
|
1007 |
}
|
1008 |
}
|
@@ -1010,28 +1010,28 @@ class DSGVOTCPDF_FONTS {
|
|
1010 |
$subsetglyphs = array(); // glyph IDs on key
|
1011 |
$subsetglyphs[0] = true; // character codes that do not correspond to any glyph in the font should be mapped to glyph index 0
|
1012 |
$offset = $table['cmap']['offset'] + 2;
|
1013 |
-
$numEncodingTables =
|
1014 |
$offset += 2;
|
1015 |
$encodingTables = array();
|
1016 |
for ($i = 0; $i < $numEncodingTables; ++$i) {
|
1017 |
-
$encodingTables[$i]['platformID'] =
|
1018 |
$offset += 2;
|
1019 |
-
$encodingTables[$i]['encodingID'] =
|
1020 |
$offset += 2;
|
1021 |
-
$encodingTables[$i]['offset'] =
|
1022 |
$offset += 4;
|
1023 |
}
|
1024 |
foreach ($encodingTables as $enctable) {
|
1025 |
// get all platforms and encodings
|
1026 |
$offset = $table['cmap']['offset'] + $enctable['offset'];
|
1027 |
-
$format =
|
1028 |
$offset += 2;
|
1029 |
switch ($format) {
|
1030 |
case 0: { // Format 0: Byte encoding table
|
1031 |
$offset += 4; // skip length and version/language
|
1032 |
for ($c = 0; $c < 256; ++$c) {
|
1033 |
if (isset($subsetchars[$c])) {
|
1034 |
-
$g =
|
1035 |
$subsetglyphs[$g] = true;
|
1036 |
}
|
1037 |
++$offset;
|
@@ -1043,7 +1043,7 @@ class DSGVOTCPDF_FONTS {
|
|
1043 |
$numSubHeaders = 0;
|
1044 |
for ($i = 0; $i < 256; ++$i) {
|
1045 |
// Array that maps high bytes to subHeaders: value is subHeader index * 8.
|
1046 |
-
$subHeaderKeys[$i] = (
|
1047 |
$offset += 2;
|
1048 |
if ($numSubHeaders < $subHeaderKeys[$i]) {
|
1049 |
$numSubHeaders = $subHeaderKeys[$i];
|
@@ -1055,20 +1055,20 @@ class DSGVOTCPDF_FONTS {
|
|
1055 |
$subHeaders = array();
|
1056 |
$numGlyphIndexArray = 0;
|
1057 |
for ($k = 0; $k < $numSubHeaders; ++$k) {
|
1058 |
-
$subHeaders[$k]['firstCode'] =
|
1059 |
$offset += 2;
|
1060 |
-
$subHeaders[$k]['entryCount'] =
|
1061 |
$offset += 2;
|
1062 |
-
$subHeaders[$k]['idDelta'] =
|
1063 |
$offset += 2;
|
1064 |
-
$subHeaders[$k]['idRangeOffset'] =
|
1065 |
$offset += 2;
|
1066 |
$subHeaders[$k]['idRangeOffset'] -= (2 + (($numSubHeaders - $k - 1) * 8));
|
1067 |
$subHeaders[$k]['idRangeOffset'] /= 2;
|
1068 |
$numGlyphIndexArray += $subHeaders[$k]['entryCount'];
|
1069 |
}
|
1070 |
for ($k = 0; $k < $numGlyphIndexArray; ++$k) {
|
1071 |
-
$glyphIndexArray[$k] =
|
1072 |
$offset += 2;
|
1073 |
}
|
1074 |
for ($i = 0; $i < 256; ++$i) {
|
@@ -1101,37 +1101,37 @@ class DSGVOTCPDF_FONTS {
|
|
1101 |
break;
|
1102 |
}
|
1103 |
case 4: { // Format 4: Segment mapping to delta values
|
1104 |
-
$length =
|
1105 |
$offset += 2;
|
1106 |
$offset += 2; // skip version/language
|
1107 |
-
$segCount = floor(
|
1108 |
$offset += 2;
|
1109 |
$offset += 6; // skip searchRange, entrySelector, rangeShift
|
1110 |
$endCount = array(); // array of end character codes for each segment
|
1111 |
for ($k = 0; $k < $segCount; ++$k) {
|
1112 |
-
$endCount[$k] =
|
1113 |
$offset += 2;
|
1114 |
}
|
1115 |
$offset += 2; // skip reservedPad
|
1116 |
$startCount = array(); // array of start character codes for each segment
|
1117 |
for ($k = 0; $k < $segCount; ++$k) {
|
1118 |
-
$startCount[$k] =
|
1119 |
$offset += 2;
|
1120 |
}
|
1121 |
$idDelta = array(); // delta for all character codes in segment
|
1122 |
for ($k = 0; $k < $segCount; ++$k) {
|
1123 |
-
$idDelta[$k] =
|
1124 |
$offset += 2;
|
1125 |
}
|
1126 |
$idRangeOffset = array(); // Offsets into glyphIdArray or 0
|
1127 |
for ($k = 0; $k < $segCount; ++$k) {
|
1128 |
-
$idRangeOffset[$k] =
|
1129 |
$offset += 2;
|
1130 |
}
|
1131 |
$gidlen = (floor($length / 2) - 8 - (4 * $segCount));
|
1132 |
$glyphIdArray = array(); // glyph index array
|
1133 |
for ($k = 0; $k < $gidlen; ++$k) {
|
1134 |
-
$glyphIdArray[$k] =
|
1135 |
$offset += 2;
|
1136 |
}
|
1137 |
for ($k = 0; $k < $segCount; ++$k) {
|
@@ -1154,14 +1154,14 @@ class DSGVOTCPDF_FONTS {
|
|
1154 |
}
|
1155 |
case 6: { // Format 6: Trimmed table mapping
|
1156 |
$offset += 4; // skip length and version/language
|
1157 |
-
$firstCode =
|
1158 |
$offset += 2;
|
1159 |
-
$entryCount =
|
1160 |
$offset += 2;
|
1161 |
for ($k = 0; $k < $entryCount; ++$k) {
|
1162 |
$c = ($k + $firstCode);
|
1163 |
if (isset($subsetchars[$c])) {
|
1164 |
-
$g =
|
1165 |
$subsetglyphs[$g] = true;
|
1166 |
}
|
1167 |
$offset += 2;
|
@@ -1171,17 +1171,17 @@ class DSGVOTCPDF_FONTS {
|
|
1171 |
case 8: { // Format 8: Mixed 16-bit and 32-bit coverage
|
1172 |
$offset += 10; // skip reserved, length and version/language
|
1173 |
for ($k = 0; $k < 8192; ++$k) {
|
1174 |
-
$is32[$k] =
|
1175 |
++$offset;
|
1176 |
}
|
1177 |
-
$nGroups =
|
1178 |
$offset += 4;
|
1179 |
for ($i = 0; $i < $nGroups; ++$i) {
|
1180 |
-
$startCharCode =
|
1181 |
$offset += 4;
|
1182 |
-
$endCharCode =
|
1183 |
$offset += 4;
|
1184 |
-
$startGlyphID =
|
1185 |
$offset += 4;
|
1186 |
for ($k = $startCharCode; $k <= $endCharCode; ++$k) {
|
1187 |
$is32idx = floor($c / 8);
|
@@ -1204,14 +1204,14 @@ class DSGVOTCPDF_FONTS {
|
|
1204 |
}
|
1205 |
case 10: { // Format 10: Trimmed array
|
1206 |
$offset += 10; // skip reserved, length and version/language
|
1207 |
-
$startCharCode =
|
1208 |
$offset += 4;
|
1209 |
-
$numChars =
|
1210 |
$offset += 4;
|
1211 |
for ($k = 0; $k < $numChars; ++$k) {
|
1212 |
$c = ($k + $startCharCode);
|
1213 |
if (isset($subsetchars[$c])) {
|
1214 |
-
$g =
|
1215 |
$subsetglyphs[$g] = true;
|
1216 |
}
|
1217 |
$offset += 2;
|
@@ -1220,14 +1220,14 @@ class DSGVOTCPDF_FONTS {
|
|
1220 |
}
|
1221 |
case 12: { // Format 12: Segmented coverage
|
1222 |
$offset += 10; // skip length and version/language
|
1223 |
-
$nGroups =
|
1224 |
$offset += 4;
|
1225 |
for ($k = 0; $k < $nGroups; ++$k) {
|
1226 |
-
$startCharCode =
|
1227 |
$offset += 4;
|
1228 |
-
$endCharCode =
|
1229 |
$offset += 4;
|
1230 |
-
$startGlyphCode =
|
1231 |
$offset += 4;
|
1232 |
for ($c = $startCharCode; $c <= $endCharCode; ++$c) {
|
1233 |
if (isset($subsetchars[$c])) {
|
@@ -1256,14 +1256,14 @@ class DSGVOTCPDF_FONTS {
|
|
1256 |
foreach ($sga as $key => $val) {
|
1257 |
if (isset($indexToLoc[$key])) {
|
1258 |
$offset = ($table['glyf']['offset'] + $indexToLoc[$key]);
|
1259 |
-
$numberOfContours =
|
1260 |
$offset += 2;
|
1261 |
if ($numberOfContours < 0) { // composite glyph
|
1262 |
$offset += 8; // skip xMin, yMin, xMax, yMax
|
1263 |
do {
|
1264 |
-
$flags =
|
1265 |
$offset += 2;
|
1266 |
-
$glyphIndex =
|
1267 |
$offset += 2;
|
1268 |
if (!isset($subsetglyphs[$glyphIndex])) {
|
1269 |
// add missing glyphs
|
@@ -1777,9 +1777,9 @@ class DSGVOTCPDF_FONTS {
|
|
1777 |
*/
|
1778 |
public static function UTF8ArrayToUniArray($ta, $isunicode=true) {
|
1779 |
if ($isunicode) {
|
1780 |
-
return array_map(array('
|
1781 |
}
|
1782 |
-
return array_map(array('
|
1783 |
}
|
1784 |
|
1785 |
/**
|
@@ -1841,9 +1841,9 @@ class DSGVOTCPDF_FONTS {
|
|
1841 |
foreach ($unicode as $char) {
|
1842 |
if ($char < 256) {
|
1843 |
$outarr[] = $char;
|
1844 |
-
} elseif (array_key_exists($char,
|
1845 |
// map from UTF-8
|
1846 |
-
$outarr[] =
|
1847 |
} elseif ($char == 0xFFFD) {
|
1848 |
// skip
|
1849 |
} else {
|
@@ -1866,9 +1866,9 @@ class DSGVOTCPDF_FONTS {
|
|
1866 |
foreach ($unicode as $char) {
|
1867 |
if ($char < 256) {
|
1868 |
$outstr .= chr($char);
|
1869 |
-
} elseif (array_key_exists($char,
|
1870 |
// map from UTF-8
|
1871 |
-
$outstr .= chr(
|
1872 |
} elseif ($char == 0xFFFD) {
|
1873 |
// skip
|
1874 |
} else {
|
@@ -1997,8 +1997,8 @@ class DSGVOTCPDF_FONTS {
|
|
1997 |
public static function UTF8StringToArray($str, $isunicode=true, &$currentfont) {
|
1998 |
if ($isunicode) {
|
1999 |
// requires PCRE unicode support turned on
|
2000 |
-
$chars =
|
2001 |
-
$carr = array_map(array('
|
2002 |
} else {
|
2003 |
$chars = str_split($str);
|
2004 |
$carr = array_map('ord', $chars);
|
@@ -2090,18 +2090,18 @@ class DSGVOTCPDF_FONTS {
|
|
2090 |
$pel = 0;
|
2091 |
// max level
|
2092 |
$maxlevel = 0;
|
2093 |
-
if (
|
2094 |
// create string from array
|
2095 |
$str = self::UTF8ArrSubString($ta, '', '', $isunicode);
|
2096 |
}
|
2097 |
// check if string contains arabic text
|
2098 |
-
if (preg_match(
|
2099 |
$arabic = true;
|
2100 |
} else {
|
2101 |
$arabic = false;
|
2102 |
}
|
2103 |
// check if string contains RTL text
|
2104 |
-
if (!($forcertl OR $arabic OR preg_match(
|
2105 |
return $ta;
|
2106 |
}
|
2107 |
|
@@ -2116,7 +2116,7 @@ class DSGVOTCPDF_FONTS {
|
|
2116 |
// P2. In each paragraph, find the first character of type L, AL, or R.
|
2117 |
// P3. If a character is found in P2 and it is of type AL or R, then set the paragraph embedding level to one; otherwise, set it to zero.
|
2118 |
for ($i=0; $i < $numchars; ++$i) {
|
2119 |
-
$type =
|
2120 |
if ($type == 'L') {
|
2121 |
$pel = 0;
|
2122 |
break;
|
@@ -2142,62 +2142,62 @@ class DSGVOTCPDF_FONTS {
|
|
2142 |
// X1. Begin by setting the current embedding level to the paragraph embedding level. Set the directional override status to neutral. Process each character iteratively, applying rules X2 through X9. Only embedding levels from 0 to 61 are valid in this phase.
|
2143 |
// In the resolution of levels in rules I1 and I2, the maximum embedding level of 62 can be reached.
|
2144 |
for ($i=0; $i < $numchars; ++$i) {
|
2145 |
-
if ($ta[$i] ==
|
2146 |
// X2. With each RLE, compute the least greater odd embedding level.
|
2147 |
// a. If this new level would be valid, then this embedding code is valid. Remember (push) the current embedding level and override status. Reset the current level to this new level, and reset the override status to neutral.
|
2148 |
// b. If the new level would not be valid, then this code is invalid. Do not change the current level or override status.
|
2149 |
$next_level = $cel + ($cel % 2) + 1;
|
2150 |
if ($next_level < 62) {
|
2151 |
-
$remember[] = array('num' =>
|
2152 |
$cel = $next_level;
|
2153 |
$dos = 'N';
|
2154 |
$sor = $eor;
|
2155 |
$eor = $cel % 2 ? 'R' : 'L';
|
2156 |
}
|
2157 |
-
} elseif ($ta[$i] ==
|
2158 |
// X3. With each LRE, compute the least greater even embedding level.
|
2159 |
// a. If this new level would be valid, then this embedding code is valid. Remember (push) the current embedding level and override status. Reset the current level to this new level, and reset the override status to neutral.
|
2160 |
// b. If the new level would not be valid, then this code is invalid. Do not change the current level or override status.
|
2161 |
$next_level = $cel + 2 - ($cel % 2);
|
2162 |
if ( $next_level < 62 ) {
|
2163 |
-
$remember[] = array('num' =>
|
2164 |
$cel = $next_level;
|
2165 |
$dos = 'N';
|
2166 |
$sor = $eor;
|
2167 |
$eor = $cel % 2 ? 'R' : 'L';
|
2168 |
}
|
2169 |
-
} elseif ($ta[$i] ==
|
2170 |
// X4. With each RLO, compute the least greater odd embedding level.
|
2171 |
// a. If this new level would be valid, then this embedding code is valid. Remember (push) the current embedding level and override status. Reset the current level to this new level, and reset the override status to right-to-left.
|
2172 |
// b. If the new level would not be valid, then this code is invalid. Do not change the current level or override status.
|
2173 |
$next_level = $cel + ($cel % 2) + 1;
|
2174 |
if ($next_level < 62) {
|
2175 |
-
$remember[] = array('num' =>
|
2176 |
$cel = $next_level;
|
2177 |
$dos = 'R';
|
2178 |
$sor = $eor;
|
2179 |
$eor = $cel % 2 ? 'R' : 'L';
|
2180 |
}
|
2181 |
-
} elseif ($ta[$i] ==
|
2182 |
// X5. With each LRO, compute the least greater even embedding level.
|
2183 |
// a. If this new level would be valid, then this embedding code is valid. Remember (push) the current embedding level and override status. Reset the current level to this new level, and reset the override status to left-to-right.
|
2184 |
// b. If the new level would not be valid, then this code is invalid. Do not change the current level or override status.
|
2185 |
$next_level = $cel + 2 - ($cel % 2);
|
2186 |
if ( $next_level < 62 ) {
|
2187 |
-
$remember[] = array('num' =>
|
2188 |
$cel = $next_level;
|
2189 |
$dos = 'L';
|
2190 |
$sor = $eor;
|
2191 |
$eor = $cel % 2 ? 'R' : 'L';
|
2192 |
}
|
2193 |
-
} elseif ($ta[$i] ==
|
2194 |
// X7. With each PDF, determine the matching embedding or override code. If there was a valid matching code, restore (pop) the last remembered (pushed) embedding level and directional override.
|
2195 |
if (count($remember)) {
|
2196 |
$last = count($remember ) - 1;
|
2197 |
-
if (($remember[$last]['num'] ==
|
2198 |
-
($remember[$last]['num'] ==
|
2199 |
-
($remember[$last]['num'] ==
|
2200 |
-
($remember[$last]['num'] ==
|
2201 |
$match = array_pop($remember);
|
2202 |
$cel = $match['cel'];
|
2203 |
$dos = $match['dos'];
|
@@ -2205,19 +2205,19 @@ class DSGVOTCPDF_FONTS {
|
|
2205 |
$eor = ($cel > $match['cel'] ? $cel : $match['cel']) % 2 ? 'R' : 'L';
|
2206 |
}
|
2207 |
}
|
2208 |
-
} elseif (($ta[$i] !=
|
2209 |
-
($ta[$i] !=
|
2210 |
-
($ta[$i] !=
|
2211 |
-
($ta[$i] !=
|
2212 |
-
($ta[$i] !=
|
2213 |
// X6. For all types besides RLE, LRE, RLO, LRO, and PDF:
|
2214 |
// a. Set the level of the current character to the current embedding level.
|
2215 |
// b. Whenever the directional override status is not neutral, reset the current character type to the directional override status.
|
2216 |
if ($dos != 'N') {
|
2217 |
$chardir = $dos;
|
2218 |
} else {
|
2219 |
-
if (isset(
|
2220 |
-
$chardir =
|
2221 |
} else {
|
2222 |
$chardir = 'L';
|
2223 |
}
|
@@ -2470,7 +2470,7 @@ class DSGVOTCPDF_FONTS {
|
|
2470 |
$charAL = array();
|
2471 |
$x = 0;
|
2472 |
for ($i=0; $i < $numchars; ++$i) {
|
2473 |
-
if ((
|
2474 |
$charAL[$x] = $chardata[$i];
|
2475 |
$charAL[$x]['i'] = $i;
|
2476 |
$chardata[$i]['x'] = $x;
|
@@ -2490,7 +2490,7 @@ class DSGVOTCPDF_FONTS {
|
|
2490 |
} else {
|
2491 |
$nextchar = false;
|
2492 |
}
|
2493 |
-
if (
|
2494 |
$x = $thischar['x'];
|
2495 |
if ($x > 0) {
|
2496 |
$prevchar = $charAL[($x-1)];
|
@@ -2504,7 +2504,7 @@ class DSGVOTCPDF_FONTS {
|
|
2504 |
}
|
2505 |
// if laa letter
|
2506 |
if (($prevchar !== false) AND ($prevchar['char'] == 1604) AND (in_array($thischar['char'], $alfletter))) {
|
2507 |
-
$arabicarr =
|
2508 |
$laaletter = true;
|
2509 |
if ($x > 1) {
|
2510 |
$prevchar = $charAL[($x-2)];
|
@@ -2512,12 +2512,12 @@ class DSGVOTCPDF_FONTS {
|
|
2512 |
$prevchar = false;
|
2513 |
}
|
2514 |
} else {
|
2515 |
-
$arabicarr =
|
2516 |
$laaletter = false;
|
2517 |
}
|
2518 |
if (($prevchar !== false) AND ($nextchar !== false) AND
|
2519 |
-
((
|
2520 |
-
((
|
2521 |
($prevchar['type'] == $thischar['type']) AND
|
2522 |
($nextchar['type'] == $thischar['type']) AND
|
2523 |
($nextchar['char'] != 1567)) {
|
@@ -2533,7 +2533,7 @@ class DSGVOTCPDF_FONTS {
|
|
2533 |
}
|
2534 |
}
|
2535 |
} elseif (($nextchar !== false) AND
|
2536 |
-
((
|
2537 |
($nextchar['type'] == $thischar['type']) AND
|
2538 |
($nextchar['char'] != 1567)) {
|
2539 |
if (isset($arabicarr[$chardata[$i]['char']][2])) {
|
@@ -2541,7 +2541,7 @@ class DSGVOTCPDF_FONTS {
|
|
2541 |
$chardata2[$i]['char'] = $arabicarr[$thischar['char']][2];
|
2542 |
}
|
2543 |
} elseif ((($prevchar !== false) AND
|
2544 |
-
((
|
2545 |
($prevchar['type'] == $thischar['type'])) OR
|
2546 |
(($nextchar !== false) AND ($nextchar['char'] == 1567))) {
|
2547 |
// final
|
@@ -2582,11 +2582,11 @@ class DSGVOTCPDF_FONTS {
|
|
2582 |
* Putting the combining mark and shadda in the same glyph allows us to avoid the two marks overlapping each other in an illegible manner.
|
2583 |
*/
|
2584 |
for ($i = 0; $i < ($numchars-1); ++$i) {
|
2585 |
-
if (($chardata2[$i]['char'] == 1617) AND (isset(
|
2586 |
// check if the subtitution font is defined on current font
|
2587 |
-
if (isset($currentfont['cw'][(
|
2588 |
$chardata2[$i]['char'] = false;
|
2589 |
-
$chardata2[$i+1]['char'] =
|
2590 |
}
|
2591 |
}
|
2592 |
}
|
@@ -2612,9 +2612,9 @@ class DSGVOTCPDF_FONTS {
|
|
2612 |
for ($i=0; $i < $numchars; ++$i) {
|
2613 |
if ($chardata[$i]['level'] >= $j) {
|
2614 |
$onlevel = true;
|
2615 |
-
if (isset(
|
2616 |
// L4. A character is depicted by a mirrored glyph if and only if (a) the resolved directionality of that character is R, and (b) the Bidi_Mirrored property value of that character is true.
|
2617 |
-
$chardata[$i]['char'] =
|
2618 |
}
|
2619 |
$revarr[] = $chardata[$i];
|
2620 |
} else {
|
106 |
$fmetric['originalsize'] = strlen($font);
|
107 |
// autodetect font type
|
108 |
if (empty($fonttype)) {
|
109 |
+
if (DSGVOTCPDF_STATIC::_getULONG($font, 0) == 0x10000) {
|
110 |
// True Type (Unicode or not)
|
111 |
$fonttype = 'TrueTypeUnicode';
|
112 |
} elseif (substr($font, 0, 4) == 'OTTO') {
|
148 |
$fmetric['enc'] = preg_replace('/[^A-Za-z0-9_\-]/', '', $enc);
|
149 |
$fmetric['diff'] = '';
|
150 |
if (($fmetric['type'] == 'TrueType') OR ($fmetric['type'] == 'Type1')) {
|
151 |
+
if (!empty($enc) AND ($enc != 'cp1252') AND isset(DSGVOTCPDF_FONT_DATA::$encmap[$enc])) {
|
152 |
// build differences from reference encoding
|
153 |
+
$enc_ref = DSGVOTCPDF_FONT_DATA::$encmap['cp1252'];
|
154 |
+
$enc_target = DSGVOTCPDF_FONT_DATA::$encmap[$enc];
|
155 |
$last = 0;
|
156 |
for ($i = 32; $i <= 255; ++$i) {
|
157 |
if ($enc_target[$i] != $enc_ref[$i]) {
|
186 |
$data .= $encrypted;
|
187 |
// store compressed font
|
188 |
$fmetric['file'] .= '.z';
|
189 |
+
$fp = DSGVOTCPDF_STATIC::fopenLocal($outpath.$fmetric['file'], 'wb');
|
190 |
fwrite($fp, gzcompress($data));
|
191 |
fclose($fp);
|
192 |
// get font info
|
274 |
// get charstring data
|
275 |
$eplain = substr($eplain, (strpos($eplain, '/CharStrings') + 1));
|
276 |
preg_match_all('#/([A-Za-z0-9\.]*)[\s][0-9]+[\s]RD[\s](.*)[\s]ND#sU', $eplain, $matches, PREG_SET_ORDER);
|
277 |
+
if (!empty($enc) AND isset(DSGVOTCPDF_FONT_DATA::$encmap[$enc])) {
|
278 |
+
$enc_map = DSGVOTCPDF_FONT_DATA::$encmap[$enc];
|
279 |
} else {
|
280 |
$enc_map = false;
|
281 |
}
|
355 |
} else {
|
356 |
// ---------- TRUE TYPE ----------
|
357 |
$offset = 0; // offset position of the font data
|
358 |
+
if (DSGVOTCPDF_STATIC::_getULONG($font, $offset) != 0x10000) {
|
359 |
// sfnt version must be 0x00010000 for TrueType version 1.0.
|
360 |
return false;
|
361 |
}
|
366 |
} else {
|
367 |
// store compressed font
|
368 |
$fmetric['file'] .= '.z';
|
369 |
+
$fp = DSGVOTCPDF_STATIC::fopenLocal($outpath.$fmetric['file'], 'wb');
|
370 |
fwrite($fp, gzcompress($font));
|
371 |
fclose($fp);
|
372 |
}
|
373 |
}
|
374 |
$offset += 4;
|
375 |
// get number of tables
|
376 |
+
$numTables = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
377 |
$offset += 2;
|
378 |
// skip searchRange, entrySelector and rangeShift
|
379 |
$offset += 6;
|
385 |
$tag = substr($font, $offset, 4);
|
386 |
$offset += 4;
|
387 |
$table[$tag] = array();
|
388 |
+
$table[$tag]['checkSum'] = DSGVOTCPDF_STATIC::_getULONG($font, $offset);
|
389 |
$offset += 4;
|
390 |
+
$table[$tag]['offset'] = DSGVOTCPDF_STATIC::_getULONG($font, $offset);
|
391 |
$offset += 4;
|
392 |
+
$table[$tag]['length'] = DSGVOTCPDF_STATIC::_getULONG($font, $offset);
|
393 |
$offset += 4;
|
394 |
}
|
395 |
// check magicNumber
|
396 |
$offset = $table['head']['offset'] + 12;
|
397 |
+
if (DSGVOTCPDF_STATIC::_getULONG($font, $offset) != 0x5F0F3CF5) {
|
398 |
// magicNumber must be 0x5F0F3CF5
|
399 |
return false;
|
400 |
}
|
401 |
$offset += 4;
|
402 |
$offset += 2; // skip flags
|
403 |
// get FUnits
|
404 |
+
$fmetric['unitsPerEm'] = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
405 |
$offset += 2;
|
406 |
// units ratio constant
|
407 |
$urk = (1000 / $fmetric['unitsPerEm']);
|
408 |
$offset += 16; // skip created, modified
|
409 |
+
$xMin = round(DSGVOTCPDF_STATIC::_getFWORD($font, $offset) * $urk);
|
410 |
$offset += 2;
|
411 |
+
$yMin = round(DSGVOTCPDF_STATIC::_getFWORD($font, $offset) * $urk);
|
412 |
$offset += 2;
|
413 |
+
$xMax = round(DSGVOTCPDF_STATIC::_getFWORD($font, $offset) * $urk);
|
414 |
$offset += 2;
|
415 |
+
$yMax = round(DSGVOTCPDF_STATIC::_getFWORD($font, $offset) * $urk);
|
416 |
$offset += 2;
|
417 |
$fmetric['bbox'] = ''.$xMin.' '.$yMin.' '.$xMax.' '.$yMax.'';
|
418 |
+
$macStyle = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
419 |
$offset += 2;
|
420 |
// PDF font flags
|
421 |
$fmetric['Flags'] = $flags;
|
425 |
}
|
426 |
// get offset mode (indexToLocFormat : 0 = short, 1 = long)
|
427 |
$offset = $table['head']['offset'] + 50;
|
428 |
+
$short_offset = (DSGVOTCPDF_STATIC::_getSHORT($font, $offset) == 0);
|
429 |
$offset += 2;
|
430 |
// get the offsets to the locations of the glyphs in the font, relative to the beginning of the glyphData table
|
431 |
$indexToLoc = array();
|
434 |
// short version
|
435 |
$tot_num_glyphs = floor($table['loca']['length'] / 2); // numGlyphs + 1
|
436 |
for ($i = 0; $i < $tot_num_glyphs; ++$i) {
|
437 |
+
$indexToLoc[$i] = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset) * 2;
|
438 |
if (isset($indexToLoc[($i - 1)]) && ($indexToLoc[$i] == $indexToLoc[($i - 1)])) {
|
439 |
// the last glyph didn't have an outline
|
440 |
unset($indexToLoc[($i - 1)]);
|
445 |
// long version
|
446 |
$tot_num_glyphs = floor($table['loca']['length'] / 4); // numGlyphs + 1
|
447 |
for ($i = 0; $i < $tot_num_glyphs; ++$i) {
|
448 |
+
$indexToLoc[$i] = DSGVOTCPDF_STATIC::_getULONG($font, $offset);
|
449 |
if (isset($indexToLoc[($i - 1)]) && ($indexToLoc[$i] == $indexToLoc[($i - 1)])) {
|
450 |
// the last glyph didn't have an outline
|
451 |
unset($indexToLoc[($i - 1)]);
|
455 |
}
|
456 |
// get glyphs indexes of chars from cmap table
|
457 |
$offset = $table['cmap']['offset'] + 2;
|
458 |
+
$numEncodingTables = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
459 |
$offset += 2;
|
460 |
$encodingTables = array();
|
461 |
for ($i = 0; $i < $numEncodingTables; ++$i) {
|
462 |
+
$encodingTables[$i]['platformID'] = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
463 |
$offset += 2;
|
464 |
+
$encodingTables[$i]['encodingID'] = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
465 |
$offset += 2;
|
466 |
+
$encodingTables[$i]['offset'] = DSGVOTCPDF_STATIC::_getULONG($font, $offset);
|
467 |
$offset += 4;
|
468 |
}
|
469 |
// ---------- get os/2 metrics ----------
|
470 |
$offset = $table['OS/2']['offset'];
|
471 |
$offset += 2; // skip version
|
472 |
// xAvgCharWidth
|
473 |
+
$fmetric['AvgWidth'] = round(DSGVOTCPDF_STATIC::_getFWORD($font, $offset) * $urk);
|
474 |
$offset += 2;
|
475 |
// usWeightClass
|
476 |
+
$usWeightClass = round(DSGVOTCPDF_STATIC::_getUFWORD($font, $offset) * $urk);
|
477 |
// estimate StemV and StemH (400 = usWeightClass for Normal - Regular font)
|
478 |
$fmetric['StemV'] = round((70 * $usWeightClass) / 400);
|
479 |
$fmetric['StemH'] = round((30 * $usWeightClass) / 400);
|
480 |
$offset += 2;
|
481 |
$offset += 2; // usWidthClass
|
482 |
+
$fsType = DSGVOTCPDF_STATIC::_getSHORT($font, $offset);
|
483 |
$offset += 2;
|
484 |
if ($fsType == 2) {
|
485 |
// This Font cannot be modified, embedded or exchanged in any manner without first obtaining permission of the legal owner.
|
490 |
$offset = $table['name']['offset'];
|
491 |
$offset += 2; // skip Format selector (=0).
|
492 |
// Number of NameRecords that follow n.
|
493 |
+
$numNameRecords = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
494 |
$offset += 2;
|
495 |
// Offset to start of string storage (from start of table).
|
496 |
+
$stringStorageOffset = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
497 |
$offset += 2;
|
498 |
for ($i = 0; $i < $numNameRecords; ++$i) {
|
499 |
$offset += 6; // skip Platform ID, Platform-specific encoding ID, Language ID.
|
500 |
// Name ID.
|
501 |
+
$nameID = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
502 |
$offset += 2;
|
503 |
if ($nameID == 6) {
|
504 |
// String length (in bytes).
|
505 |
+
$stringLength = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
506 |
$offset += 2;
|
507 |
// String offset from start of storage area (in bytes).
|
508 |
+
$stringOffset = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
509 |
$offset += 2;
|
510 |
$offset = ($table['name']['offset'] + $stringStorageOffset + $stringOffset);
|
511 |
$fmetric['name'] = substr($font, $offset, $stringLength);
|
521 |
// ---------- get post data ----------
|
522 |
$offset = $table['post']['offset'];
|
523 |
$offset += 4; // skip Format Type
|
524 |
+
$fmetric['italicAngle'] = DSGVOTCPDF_STATIC::_getFIXED($font, $offset);
|
525 |
$offset += 4;
|
526 |
+
$fmetric['underlinePosition'] = round(DSGVOTCPDF_STATIC::_getFWORD($font, $offset) * $urk);
|
527 |
$offset += 2;
|
528 |
+
$fmetric['underlineThickness'] = round(DSGVOTCPDF_STATIC::_getFWORD($font, $offset) * $urk);
|
529 |
$offset += 2;
|
530 |
+
$isFixedPitch = (DSGVOTCPDF_STATIC::_getULONG($font, $offset) == 0) ? false : true;
|
531 |
$offset += 2;
|
532 |
if ($isFixedPitch) {
|
533 |
$fmetric['Flags'] |= 1;
|
536 |
$offset = $table['hhea']['offset'];
|
537 |
$offset += 4; // skip Table version number
|
538 |
// Ascender
|
539 |
+
$fmetric['Ascent'] = round(DSGVOTCPDF_STATIC::_getFWORD($font, $offset) * $urk);
|
540 |
$offset += 2;
|
541 |
// Descender
|
542 |
+
$fmetric['Descent'] = round(DSGVOTCPDF_STATIC::_getFWORD($font, $offset) * $urk);
|
543 |
$offset += 2;
|
544 |
// LineGap
|
545 |
+
$fmetric['Leading'] = round(DSGVOTCPDF_STATIC::_getFWORD($font, $offset) * $urk);
|
546 |
$offset += 2;
|
547 |
// advanceWidthMax
|
548 |
+
$fmetric['MaxWidth'] = round(DSGVOTCPDF_STATIC::_getUFWORD($font, $offset) * $urk);
|
549 |
$offset += 2;
|
550 |
$offset += 22; // skip some values
|
551 |
// get the number of hMetric entries in hmtx table
|
552 |
+
$numberOfHMetrics = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
553 |
// ---------- get maxp data ----------
|
554 |
$offset = $table['maxp']['offset'];
|
555 |
$offset += 4; // skip Table version number
|
556 |
// get the the number of glyphs in the font.
|
557 |
+
$numGlyphs = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
558 |
// ---------- get CIDToGIDMap ----------
|
559 |
$ctg = array();
|
560 |
foreach ($encodingTables as $enctable) {
|
561 |
// get only specified Platform ID and Encoding ID
|
562 |
if (($enctable['platformID'] == $platid) AND ($enctable['encodingID'] == $encid)) {
|
563 |
$offset = $table['cmap']['offset'] + $enctable['offset'];
|
564 |
+
$format = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
565 |
$offset += 2;
|
566 |
switch ($format) {
|
567 |
case 0: { // Format 0: Byte encoding table
|
568 |
$offset += 4; // skip length and version/language
|
569 |
for ($c = 0; $c < 256; ++$c) {
|
570 |
+
$g = DSGVOTCPDF_STATIC::_getBYTE($font, $offset);
|
571 |
$ctg[$c] = $g;
|
572 |
++$offset;
|
573 |
}
|
578 |
$numSubHeaders = 0;
|
579 |
for ($i = 0; $i < 256; ++$i) {
|
580 |
// Array that maps high bytes to subHeaders: value is subHeader index * 8.
|
581 |
+
$subHeaderKeys[$i] = (DSGVOTCPDF_STATIC::_getUSHORT($font, $offset) / 8);
|
582 |
$offset += 2;
|
583 |
if ($numSubHeaders < $subHeaderKeys[$i]) {
|
584 |
$numSubHeaders = $subHeaderKeys[$i];
|
590 |
$subHeaders = array();
|
591 |
$numGlyphIndexArray = 0;
|
592 |
for ($k = 0; $k < $numSubHeaders; ++$k) {
|
593 |
+
$subHeaders[$k]['firstCode'] = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
594 |
$offset += 2;
|
595 |
+
$subHeaders[$k]['entryCount'] = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
596 |
$offset += 2;
|
597 |
+
$subHeaders[$k]['idDelta'] = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
598 |
$offset += 2;
|
599 |
+
$subHeaders[$k]['idRangeOffset'] = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
600 |
$offset += 2;
|
601 |
$subHeaders[$k]['idRangeOffset'] -= (2 + (($numSubHeaders - $k - 1) * 8));
|
602 |
$subHeaders[$k]['idRangeOffset'] /= 2;
|
603 |
$numGlyphIndexArray += $subHeaders[$k]['entryCount'];
|
604 |
}
|
605 |
for ($k = 0; $k < $numGlyphIndexArray; ++$k) {
|
606 |
+
$glyphIndexArray[$k] = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
607 |
$offset += 2;
|
608 |
}
|
609 |
for ($i = 0; $i < 256; ++$i) {
|
632 |
break;
|
633 |
}
|
634 |
case 4: { // Format 4: Segment mapping to delta values
|
635 |
+
$length = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
636 |
$offset += 2;
|
637 |
$offset += 2; // skip version/language
|
638 |
+
$segCount = floor(DSGVOTCPDF_STATIC::_getUSHORT($font, $offset) / 2);
|
639 |
$offset += 2;
|
640 |
$offset += 6; // skip searchRange, entrySelector, rangeShift
|
641 |
$endCount = array(); // array of end character codes for each segment
|
642 |
for ($k = 0; $k < $segCount; ++$k) {
|
643 |
+
$endCount[$k] = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
644 |
$offset += 2;
|
645 |
}
|
646 |
$offset += 2; // skip reservedPad
|
647 |
$startCount = array(); // array of start character codes for each segment
|
648 |
for ($k = 0; $k < $segCount; ++$k) {
|
649 |
+
$startCount[$k] = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
650 |
$offset += 2;
|
651 |
}
|
652 |
$idDelta = array(); // delta for all character codes in segment
|
653 |
for ($k = 0; $k < $segCount; ++$k) {
|
654 |
+
$idDelta[$k] = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
655 |
$offset += 2;
|
656 |
}
|
657 |
$idRangeOffset = array(); // Offsets into glyphIdArray or 0
|
658 |
for ($k = 0; $k < $segCount; ++$k) {
|
659 |
+
$idRangeOffset[$k] = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
660 |
$offset += 2;
|
661 |
}
|
662 |
$gidlen = (floor($length / 2) - 8 - (4 * $segCount));
|
663 |
$glyphIdArray = array(); // glyph index array
|
664 |
for ($k = 0; $k < $gidlen; ++$k) {
|
665 |
+
$glyphIdArray[$k] = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
666 |
$offset += 2;
|
667 |
}
|
668 |
for ($k = 0; $k < $segCount; ++$k) {
|
683 |
}
|
684 |
case 6: { // Format 6: Trimmed table mapping
|
685 |
$offset += 4; // skip length and version/language
|
686 |
+
$firstCode = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
687 |
$offset += 2;
|
688 |
+
$entryCount = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
689 |
$offset += 2;
|
690 |
for ($k = 0; $k < $entryCount; ++$k) {
|
691 |
$c = ($k + $firstCode);
|
692 |
+
$g = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
693 |
$offset += 2;
|
694 |
$ctg[$c] = $g;
|
695 |
}
|
698 |
case 8: { // Format 8: Mixed 16-bit and 32-bit coverage
|
699 |
$offset += 10; // skip reserved, length and version/language
|
700 |
for ($k = 0; $k < 8192; ++$k) {
|
701 |
+
$is32[$k] = DSGVOTCPDF_STATIC::_getBYTE($font, $offset);
|
702 |
++$offset;
|
703 |
}
|
704 |
+
$nGroups = DSGVOTCPDF_STATIC::_getULONG($font, $offset);
|
705 |
$offset += 4;
|
706 |
for ($i = 0; $i < $nGroups; ++$i) {
|
707 |
+
$startCharCode = DSGVOTCPDF_STATIC::_getULONG($font, $offset);
|
708 |
$offset += 4;
|
709 |
+
$endCharCode = DSGVOTCPDF_STATIC::_getULONG($font, $offset);
|
710 |
$offset += 4;
|
711 |
+
$startGlyphID = DSGVOTCPDF_STATIC::_getULONG($font, $offset);
|
712 |
$offset += 4;
|
713 |
for ($k = $startCharCode; $k <= $endCharCode; ++$k) {
|
714 |
$is32idx = floor($c / 8);
|
729 |
}
|
730 |
case 10: { // Format 10: Trimmed array
|
731 |
$offset += 10; // skip reserved, length and version/language
|
732 |
+
$startCharCode = DSGVOTCPDF_STATIC::_getULONG($font, $offset);
|
733 |
$offset += 4;
|
734 |
+
$numChars = DSGVOTCPDF_STATIC::_getULONG($font, $offset);
|
735 |
$offset += 4;
|
736 |
for ($k = 0; $k < $numChars; ++$k) {
|
737 |
$c = ($k + $startCharCode);
|
738 |
+
$g = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
739 |
$ctg[$c] = $g;
|
740 |
$offset += 2;
|
741 |
}
|
743 |
}
|
744 |
case 12: { // Format 12: Segmented coverage
|
745 |
$offset += 10; // skip length and version/language
|
746 |
+
$nGroups = DSGVOTCPDF_STATIC::_getULONG($font, $offset);
|
747 |
$offset += 4;
|
748 |
for ($k = 0; $k < $nGroups; ++$k) {
|
749 |
+
$startCharCode = DSGVOTCPDF_STATIC::_getULONG($font, $offset);
|
750 |
$offset += 4;
|
751 |
+
$endCharCode = DSGVOTCPDF_STATIC::_getULONG($font, $offset);
|
752 |
$offset += 4;
|
753 |
+
$startGlyphCode = DSGVOTCPDF_STATIC::_getULONG($font, $offset);
|
754 |
$offset += 4;
|
755 |
for ($c = $startCharCode; $c <= $endCharCode; ++$c) {
|
756 |
$ctg[$c] = $startGlyphCode;
|
775 |
}
|
776 |
// get xHeight (height of x)
|
777 |
$offset = ($table['glyf']['offset'] + $indexToLoc[$ctg[120]] + 4);
|
778 |
+
$yMin = DSGVOTCPDF_STATIC::_getFWORD($font, $offset);
|
779 |
$offset += 4;
|
780 |
+
$yMax = DSGVOTCPDF_STATIC::_getFWORD($font, $offset);
|
781 |
$offset += 2;
|
782 |
$fmetric['XHeight'] = round(($yMax - $yMin) * $urk);
|
783 |
// get CapHeight (height of H)
|
784 |
$offset = ($table['glyf']['offset'] + $indexToLoc[$ctg[72]] + 4);
|
785 |
+
$yMin = DSGVOTCPDF_STATIC::_getFWORD($font, $offset);
|
786 |
$offset += 4;
|
787 |
+
$yMax = DSGVOTCPDF_STATIC::_getFWORD($font, $offset);
|
788 |
$offset += 2;
|
789 |
$fmetric['CapHeight'] = round(($yMax - $yMin) * $urk);
|
790 |
// ceate widths array
|
791 |
$cw = array();
|
792 |
$offset = $table['hmtx']['offset'];
|
793 |
for ($i = 0 ; $i < $numberOfHMetrics; ++$i) {
|
794 |
+
$cw[$i] = round(DSGVOTCPDF_STATIC::_getUFWORD($font, $offset) * $urk);
|
795 |
$offset += 4; // skip lsb
|
796 |
}
|
797 |
if ($numberOfHMetrics < $numGlyphs) {
|
808 |
}
|
809 |
if ($addcbbox AND isset($indexToLoc[$ctg[$cid]])) {
|
810 |
$offset = ($table['glyf']['offset'] + $indexToLoc[$ctg[$cid]]);
|
811 |
+
$xMin = round(DSGVOTCPDF_STATIC::_getFWORD($font, $offset + 2) * $urk);
|
812 |
+
$yMin = round(DSGVOTCPDF_STATIC::_getFWORD($font, $offset + 4) * $urk);
|
813 |
+
$xMax = round(DSGVOTCPDF_STATIC::_getFWORD($font, $offset + 6) * $urk);
|
814 |
+
$yMax = round(DSGVOTCPDF_STATIC::_getFWORD($font, $offset + 8) * $urk);
|
815 |
$fmetric['cbbox'] .= ','.$cid.'=>array('.$xMin.','.$yMin.','.$xMax.','.$yMax.')';
|
816 |
}
|
817 |
}
|
885 |
$cidtogidmap = self::updateCIDtoGIDmap($cidtogidmap, $cid, $ctg[$cid]);
|
886 |
}
|
887 |
// store compressed CIDToGIDMap
|
888 |
+
$fp = DSGVOTCPDF_STATIC::fopenLocal($outpath.$fmetric['ctg'], 'wb');
|
889 |
fwrite($fp, gzcompress($cidtogidmap));
|
890 |
fclose($fp);
|
891 |
}
|
911 |
$pfile .= '$cw=array('.substr($fmetric['cw'], 1).');'."\n";
|
912 |
$pfile .= '// --- EOF ---'."\n";
|
913 |
// store file
|
914 |
+
$fp = DSGVOTCPDF_STATIC::fopenLocal($outpath.$font_name.'.php', 'w');
|
915 |
fwrite($fp, $pfile);
|
916 |
fclose($fp);
|
917 |
// return TCPDF font name
|
952 |
public static function _getTrueTypeFontSubset($font, $subsetchars) {
|
953 |
ksort($subsetchars);
|
954 |
$offset = 0; // offset position of the font data
|
955 |
+
if (DSGVOTCPDF_STATIC::_getULONG($font, $offset) != 0x10000) {
|
956 |
// sfnt version must be 0x00010000 for TrueType version 1.0.
|
957 |
return $font;
|
958 |
}
|
959 |
$offset += 4;
|
960 |
// get number of tables
|
961 |
+
$numTables = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
962 |
$offset += 2;
|
963 |
// skip searchRange, entrySelector and rangeShift
|
964 |
$offset += 6;
|
970 |
$tag = substr($font, $offset, 4);
|
971 |
$offset += 4;
|
972 |
$table[$tag] = array();
|
973 |
+
$table[$tag]['checkSum'] = DSGVOTCPDF_STATIC::_getULONG($font, $offset);
|
974 |
$offset += 4;
|
975 |
+
$table[$tag]['offset'] = DSGVOTCPDF_STATIC::_getULONG($font, $offset);
|
976 |
$offset += 4;
|
977 |
+
$table[$tag]['length'] = DSGVOTCPDF_STATIC::_getULONG($font, $offset);
|
978 |
$offset += 4;
|
979 |
}
|
980 |
// check magicNumber
|
981 |
$offset = $table['head']['offset'] + 12;
|
982 |
+
if (DSGVOTCPDF_STATIC::_getULONG($font, $offset) != 0x5F0F3CF5) {
|
983 |
// magicNumber must be 0x5F0F3CF5
|
984 |
return $font;
|
985 |
}
|
986 |
$offset += 4;
|
987 |
// get offset mode (indexToLocFormat : 0 = short, 1 = long)
|
988 |
$offset = $table['head']['offset'] + 50;
|
989 |
+
$short_offset = (DSGVOTCPDF_STATIC::_getSHORT($font, $offset) == 0);
|
990 |
$offset += 2;
|
991 |
// get the offsets to the locations of the glyphs in the font, relative to the beginning of the glyphData table
|
992 |
$indexToLoc = array();
|
995 |
// short version
|
996 |
$tot_num_glyphs = floor($table['loca']['length'] / 2); // numGlyphs + 1
|
997 |
for ($i = 0; $i < $tot_num_glyphs; ++$i) {
|
998 |
+
$indexToLoc[$i] = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset) * 2;
|
999 |
$offset += 2;
|
1000 |
}
|
1001 |
} else {
|
1002 |
// long version
|
1003 |
$tot_num_glyphs = ($table['loca']['length'] / 4); // numGlyphs + 1
|
1004 |
for ($i = 0; $i < $tot_num_glyphs; ++$i) {
|
1005 |
+
$indexToLoc[$i] = DSGVOTCPDF_STATIC::_getULONG($font, $offset);
|
1006 |
$offset += 4;
|
1007 |
}
|
1008 |
}
|
1010 |
$subsetglyphs = array(); // glyph IDs on key
|
1011 |
$subsetglyphs[0] = true; // character codes that do not correspond to any glyph in the font should be mapped to glyph index 0
|
1012 |
$offset = $table['cmap']['offset'] + 2;
|
1013 |
+
$numEncodingTables = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
1014 |
$offset += 2;
|
1015 |
$encodingTables = array();
|
1016 |
for ($i = 0; $i < $numEncodingTables; ++$i) {
|
1017 |
+
$encodingTables[$i]['platformID'] = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
1018 |
$offset += 2;
|
1019 |
+
$encodingTables[$i]['encodingID'] = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
1020 |
$offset += 2;
|
1021 |
+
$encodingTables[$i]['offset'] = DSGVOTCPDF_STATIC::_getULONG($font, $offset);
|
1022 |
$offset += 4;
|
1023 |
}
|
1024 |
foreach ($encodingTables as $enctable) {
|
1025 |
// get all platforms and encodings
|
1026 |
$offset = $table['cmap']['offset'] + $enctable['offset'];
|
1027 |
+
$format = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
1028 |
$offset += 2;
|
1029 |
switch ($format) {
|
1030 |
case 0: { // Format 0: Byte encoding table
|
1031 |
$offset += 4; // skip length and version/language
|
1032 |
for ($c = 0; $c < 256; ++$c) {
|
1033 |
if (isset($subsetchars[$c])) {
|
1034 |
+
$g = DSGVOTCPDF_STATIC::_getBYTE($font, $offset);
|
1035 |
$subsetglyphs[$g] = true;
|
1036 |
}
|
1037 |
++$offset;
|
1043 |
$numSubHeaders = 0;
|
1044 |
for ($i = 0; $i < 256; ++$i) {
|
1045 |
// Array that maps high bytes to subHeaders: value is subHeader index * 8.
|
1046 |
+
$subHeaderKeys[$i] = (DSGVOTCPDF_STATIC::_getUSHORT($font, $offset) / 8);
|
1047 |
$offset += 2;
|
1048 |
if ($numSubHeaders < $subHeaderKeys[$i]) {
|
1049 |
$numSubHeaders = $subHeaderKeys[$i];
|
1055 |
$subHeaders = array();
|
1056 |
$numGlyphIndexArray = 0;
|
1057 |
for ($k = 0; $k < $numSubHeaders; ++$k) {
|
1058 |
+
$subHeaders[$k]['firstCode'] = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
1059 |
$offset += 2;
|
1060 |
+
$subHeaders[$k]['entryCount'] = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
1061 |
$offset += 2;
|
1062 |
+
$subHeaders[$k]['idDelta'] = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
1063 |
$offset += 2;
|
1064 |
+
$subHeaders[$k]['idRangeOffset'] = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
1065 |
$offset += 2;
|
1066 |
$subHeaders[$k]['idRangeOffset'] -= (2 + (($numSubHeaders - $k - 1) * 8));
|
1067 |
$subHeaders[$k]['idRangeOffset'] /= 2;
|
1068 |
$numGlyphIndexArray += $subHeaders[$k]['entryCount'];
|
1069 |
}
|
1070 |
for ($k = 0; $k < $numGlyphIndexArray; ++$k) {
|
1071 |
+
$glyphIndexArray[$k] = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
1072 |
$offset += 2;
|
1073 |
}
|
1074 |
for ($i = 0; $i < 256; ++$i) {
|
1101 |
break;
|
1102 |
}
|
1103 |
case 4: { // Format 4: Segment mapping to delta values
|
1104 |
+
$length = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
1105 |
$offset += 2;
|
1106 |
$offset += 2; // skip version/language
|
1107 |
+
$segCount = floor(DSGVOTCPDF_STATIC::_getUSHORT($font, $offset) / 2);
|
1108 |
$offset += 2;
|
1109 |
$offset += 6; // skip searchRange, entrySelector, rangeShift
|
1110 |
$endCount = array(); // array of end character codes for each segment
|
1111 |
for ($k = 0; $k < $segCount; ++$k) {
|
1112 |
+
$endCount[$k] = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
1113 |
$offset += 2;
|
1114 |
}
|
1115 |
$offset += 2; // skip reservedPad
|
1116 |
$startCount = array(); // array of start character codes for each segment
|
1117 |
for ($k = 0; $k < $segCount; ++$k) {
|
1118 |
+
$startCount[$k] = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
1119 |
$offset += 2;
|
1120 |
}
|
1121 |
$idDelta = array(); // delta for all character codes in segment
|
1122 |
for ($k = 0; $k < $segCount; ++$k) {
|
1123 |
+
$idDelta[$k] = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
1124 |
$offset += 2;
|
1125 |
}
|
1126 |
$idRangeOffset = array(); // Offsets into glyphIdArray or 0
|
1127 |
for ($k = 0; $k < $segCount; ++$k) {
|
1128 |
+
$idRangeOffset[$k] = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
1129 |
$offset += 2;
|
1130 |
}
|
1131 |
$gidlen = (floor($length / 2) - 8 - (4 * $segCount));
|
1132 |
$glyphIdArray = array(); // glyph index array
|
1133 |
for ($k = 0; $k < $gidlen; ++$k) {
|
1134 |
+
$glyphIdArray[$k] = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
1135 |
$offset += 2;
|
1136 |
}
|
1137 |
for ($k = 0; $k < $segCount; ++$k) {
|
1154 |
}
|
1155 |
case 6: { // Format 6: Trimmed table mapping
|
1156 |
$offset += 4; // skip length and version/language
|
1157 |
+
$firstCode = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
1158 |
$offset += 2;
|
1159 |
+
$entryCount = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
1160 |
$offset += 2;
|
1161 |
for ($k = 0; $k < $entryCount; ++$k) {
|
1162 |
$c = ($k + $firstCode);
|
1163 |
if (isset($subsetchars[$c])) {
|
1164 |
+
$g = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
1165 |
$subsetglyphs[$g] = true;
|
1166 |
}
|
1167 |
$offset += 2;
|
1171 |
case 8: { // Format 8: Mixed 16-bit and 32-bit coverage
|
1172 |
$offset += 10; // skip reserved, length and version/language
|
1173 |
for ($k = 0; $k < 8192; ++$k) {
|
1174 |
+
$is32[$k] = DSGVOTCPDF_STATIC::_getBYTE($font, $offset);
|
1175 |
++$offset;
|
1176 |
}
|
1177 |
+
$nGroups = DSGVOTCPDF_STATIC::_getULONG($font, $offset);
|
1178 |
$offset += 4;
|
1179 |
for ($i = 0; $i < $nGroups; ++$i) {
|
1180 |
+
$startCharCode = DSGVOTCPDF_STATIC::_getULONG($font, $offset);
|
1181 |
$offset += 4;
|
1182 |
+
$endCharCode = DSGVOTCPDF_STATIC::_getULONG($font, $offset);
|
1183 |
$offset += 4;
|
1184 |
+
$startGlyphID = DSGVOTCPDF_STATIC::_getULONG($font, $offset);
|
1185 |
$offset += 4;
|
1186 |
for ($k = $startCharCode; $k <= $endCharCode; ++$k) {
|
1187 |
$is32idx = floor($c / 8);
|
1204 |
}
|
1205 |
case 10: { // Format 10: Trimmed array
|
1206 |
$offset += 10; // skip reserved, length and version/language
|
1207 |
+
$startCharCode = DSGVOTCPDF_STATIC::_getULONG($font, $offset);
|
1208 |
$offset += 4;
|
1209 |
+
$numChars = DSGVOTCPDF_STATIC::_getULONG($font, $offset);
|
1210 |
$offset += 4;
|
1211 |
for ($k = 0; $k < $numChars; ++$k) {
|
1212 |
$c = ($k + $startCharCode);
|
1213 |
if (isset($subsetchars[$c])) {
|
1214 |
+
$g = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
1215 |
$subsetglyphs[$g] = true;
|
1216 |
}
|
1217 |
$offset += 2;
|
1220 |
}
|
1221 |
case 12: { // Format 12: Segmented coverage
|
1222 |
$offset += 10; // skip length and version/language
|
1223 |
+
$nGroups = DSGVOTCPDF_STATIC::_getULONG($font, $offset);
|
1224 |
$offset += 4;
|
1225 |
for ($k = 0; $k < $nGroups; ++$k) {
|
1226 |
+
$startCharCode = DSGVOTCPDF_STATIC::_getULONG($font, $offset);
|
1227 |
$offset += 4;
|
1228 |
+
$endCharCode = DSGVOTCPDF_STATIC::_getULONG($font, $offset);
|
1229 |
$offset += 4;
|
1230 |
+
$startGlyphCode = DSGVOTCPDF_STATIC::_getULONG($font, $offset);
|
1231 |
$offset += 4;
|
1232 |
for ($c = $startCharCode; $c <= $endCharCode; ++$c) {
|
1233 |
if (isset($subsetchars[$c])) {
|
1256 |
foreach ($sga as $key => $val) {
|
1257 |
if (isset($indexToLoc[$key])) {
|
1258 |
$offset = ($table['glyf']['offset'] + $indexToLoc[$key]);
|
1259 |
+
$numberOfContours = DSGVOTCPDF_STATIC::_getSHORT($font, $offset);
|
1260 |
$offset += 2;
|
1261 |
if ($numberOfContours < 0) { // composite glyph
|
1262 |
$offset += 8; // skip xMin, yMin, xMax, yMax
|
1263 |
do {
|
1264 |
+
$flags = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
1265 |
$offset += 2;
|
1266 |
+
$glyphIndex = DSGVOTCPDF_STATIC::_getUSHORT($font, $offset);
|
1267 |
$offset += 2;
|
1268 |
if (!isset($subsetglyphs[$glyphIndex])) {
|
1269 |
// add missing glyphs
|
1777 |
*/
|
1778 |
public static function UTF8ArrayToUniArray($ta, $isunicode=true) {
|
1779 |
if ($isunicode) {
|
1780 |
+
return array_map(array('DSGVOTCPDF_FONTS', 'unichrUnicode'), $ta);
|
1781 |
}
|
1782 |
+
return array_map(array('DSGVOTCPDF_FONTS', 'unichrASCII'), $ta);
|
1783 |
}
|
1784 |
|
1785 |
/**
|
1841 |
foreach ($unicode as $char) {
|
1842 |
if ($char < 256) {
|
1843 |
$outarr[] = $char;
|
1844 |
+
} elseif (array_key_exists($char, DSGVOTCPDF_FONT_DATA::$uni_utf8tolatin)) {
|
1845 |
// map from UTF-8
|
1846 |
+
$outarr[] = DSGVOTCPDF_FONT_DATA::$uni_utf8tolatin[$char];
|
1847 |
} elseif ($char == 0xFFFD) {
|
1848 |
// skip
|
1849 |
} else {
|
1866 |
foreach ($unicode as $char) {
|
1867 |
if ($char < 256) {
|
1868 |
$outstr .= chr($char);
|
1869 |
+
} elseif (array_key_exists($char, DSGVOTCPDF_FONT_DATA::$uni_utf8tolatin)) {
|
1870 |
// map from UTF-8
|
1871 |
+
$outstr .= chr(DSGVOTCPDF_FONT_DATA::$uni_utf8tolatin[$char]);
|
1872 |
} elseif ($char == 0xFFFD) {
|
1873 |
// skip
|
1874 |
} else {
|
1997 |
public static function UTF8StringToArray($str, $isunicode=true, &$currentfont) {
|
1998 |
if ($isunicode) {
|
1999 |
// requires PCRE unicode support turned on
|
2000 |
+
$chars = DSGVOTCPDF_STATIC::pregSplit('//','u', $str, -1, PREG_SPLIT_NO_EMPTY);
|
2001 |
+
$carr = array_map(array('DSGVOTCPDF_FONTS', 'uniord'), $chars);
|
2002 |
} else {
|
2003 |
$chars = str_split($str);
|
2004 |
$carr = array_map('ord', $chars);
|
2090 |
$pel = 0;
|
2091 |
// max level
|
2092 |
$maxlevel = 0;
|
2093 |
+
if (DSGVOTCPDF_STATIC::empty_string($str)) {
|
2094 |
// create string from array
|
2095 |
$str = self::UTF8ArrSubString($ta, '', '', $isunicode);
|
2096 |
}
|
2097 |
// check if string contains arabic text
|
2098 |
+
if (preg_match(DSGVOTCPDF_FONT_DATA::$uni_RE_PATTERN_ARABIC, $str)) {
|
2099 |
$arabic = true;
|
2100 |
} else {
|
2101 |
$arabic = false;
|
2102 |
}
|
2103 |
// check if string contains RTL text
|
2104 |
+
if (!($forcertl OR $arabic OR preg_match(DSGVOTCPDF_FONT_DATA::$uni_RE_PATTERN_RTL, $str))) {
|
2105 |
return $ta;
|
2106 |
}
|
2107 |
|
2116 |
// P2. In each paragraph, find the first character of type L, AL, or R.
|
2117 |
// P3. If a character is found in P2 and it is of type AL or R, then set the paragraph embedding level to one; otherwise, set it to zero.
|
2118 |
for ($i=0; $i < $numchars; ++$i) {
|
2119 |
+
$type = DSGVOTCPDF_FONT_DATA::$uni_type[$ta[$i]];
|
2120 |
if ($type == 'L') {
|
2121 |
$pel = 0;
|
2122 |
break;
|
2142 |
// X1. Begin by setting the current embedding level to the paragraph embedding level. Set the directional override status to neutral. Process each character iteratively, applying rules X2 through X9. Only embedding levels from 0 to 61 are valid in this phase.
|
2143 |
// In the resolution of levels in rules I1 and I2, the maximum embedding level of 62 can be reached.
|
2144 |
for ($i=0; $i < $numchars; ++$i) {
|
2145 |
+
if ($ta[$i] == DSGVOTCPDF_FONT_DATA::$uni_RLE) {
|
2146 |
// X2. With each RLE, compute the least greater odd embedding level.
|
2147 |
// a. If this new level would be valid, then this embedding code is valid. Remember (push) the current embedding level and override status. Reset the current level to this new level, and reset the override status to neutral.
|
2148 |
// b. If the new level would not be valid, then this code is invalid. Do not change the current level or override status.
|
2149 |
$next_level = $cel + ($cel % 2) + 1;
|
2150 |
if ($next_level < 62) {
|
2151 |
+
$remember[] = array('num' => DSGVOTCPDF_FONT_DATA::$uni_RLE, 'cel' => $cel, 'dos' => $dos);
|
2152 |
$cel = $next_level;
|
2153 |
$dos = 'N';
|
2154 |
$sor = $eor;
|
2155 |
$eor = $cel % 2 ? 'R' : 'L';
|
2156 |
}
|
2157 |
+
} elseif ($ta[$i] == DSGVOTCPDF_FONT_DATA::$uni_LRE) {
|
2158 |
// X3. With each LRE, compute the least greater even embedding level.
|
2159 |
// a. If this new level would be valid, then this embedding code is valid. Remember (push) the current embedding level and override status. Reset the current level to this new level, and reset the override status to neutral.
|
2160 |
// b. If the new level would not be valid, then this code is invalid. Do not change the current level or override status.
|
2161 |
$next_level = $cel + 2 - ($cel % 2);
|
2162 |
if ( $next_level < 62 ) {
|
2163 |
+
$remember[] = array('num' => DSGVOTCPDF_FONT_DATA::$uni_LRE, 'cel' => $cel, 'dos' => $dos);
|
2164 |
$cel = $next_level;
|
2165 |
$dos = 'N';
|
2166 |
$sor = $eor;
|
2167 |
$eor = $cel % 2 ? 'R' : 'L';
|
2168 |
}
|
2169 |
+
} elseif ($ta[$i] == DSGVOTCPDF_FONT_DATA::$uni_RLO) {
|
2170 |
// X4. With each RLO, compute the least greater odd embedding level.
|
2171 |
// a. If this new level would be valid, then this embedding code is valid. Remember (push) the current embedding level and override status. Reset the current level to this new level, and reset the override status to right-to-left.
|
2172 |
// b. If the new level would not be valid, then this code is invalid. Do not change the current level or override status.
|
2173 |
$next_level = $cel + ($cel % 2) + 1;
|
2174 |
if ($next_level < 62) {
|
2175 |
+
$remember[] = array('num' => DSGVOTCPDF_FONT_DATA::$uni_RLO, 'cel' => $cel, 'dos' => $dos);
|
2176 |
$cel = $next_level;
|
2177 |
$dos = 'R';
|
2178 |
$sor = $eor;
|
2179 |
$eor = $cel % 2 ? 'R' : 'L';
|
2180 |
}
|
2181 |
+
} elseif ($ta[$i] == DSGVOTCPDF_FONT_DATA::$uni_LRO) {
|
2182 |
// X5. With each LRO, compute the least greater even embedding level.
|
2183 |
// a. If this new level would be valid, then this embedding code is valid. Remember (push) the current embedding level and override status. Reset the current level to this new level, and reset the override status to left-to-right.
|
2184 |
// b. If the new level would not be valid, then this code is invalid. Do not change the current level or override status.
|
2185 |
$next_level = $cel + 2 - ($cel % 2);
|
2186 |
if ( $next_level < 62 ) {
|
2187 |
+
$remember[] = array('num' => DSGVOTCPDF_FONT_DATA::$uni_LRO, 'cel' => $cel, 'dos' => $dos);
|
2188 |
$cel = $next_level;
|
2189 |
$dos = 'L';
|
2190 |
$sor = $eor;
|
2191 |
$eor = $cel % 2 ? 'R' : 'L';
|
2192 |
}
|
2193 |
+
} elseif ($ta[$i] == DSGVOTCPDF_FONT_DATA::$uni_PDF) {
|
2194 |
// X7. With each PDF, determine the matching embedding or override code. If there was a valid matching code, restore (pop) the last remembered (pushed) embedding level and directional override.
|
2195 |
if (count($remember)) {
|
2196 |
$last = count($remember ) - 1;
|
2197 |
+
if (($remember[$last]['num'] == DSGVOTCPDF_FONT_DATA::$uni_RLE) OR
|
2198 |
+
($remember[$last]['num'] == DSGVOTCPDF_FONT_DATA::$uni_LRE) OR
|
2199 |
+
($remember[$last]['num'] == DSGVOTCPDF_FONT_DATA::$uni_RLO) OR
|
2200 |
+
($remember[$last]['num'] == DSGVOTCPDF_FONT_DATA::$uni_LRO)) {
|
2201 |
$match = array_pop($remember);
|
2202 |
$cel = $match['cel'];
|
2203 |
$dos = $match['dos'];
|
2205 |
$eor = ($cel > $match['cel'] ? $cel : $match['cel']) % 2 ? 'R' : 'L';
|
2206 |
}
|
2207 |
}
|
2208 |
+
} elseif (($ta[$i] != DSGVOTCPDF_FONT_DATA::$uni_RLE) AND
|
2209 |
+
($ta[$i] != DSGVOTCPDF_FONT_DATA::$uni_LRE) AND
|
2210 |
+
($ta[$i] != DSGVOTCPDF_FONT_DATA::$uni_RLO) AND
|
2211 |
+
($ta[$i] != DSGVOTCPDF_FONT_DATA::$uni_LRO) AND
|
2212 |
+
($ta[$i] != DSGVOTCPDF_FONT_DATA::$uni_PDF)) {
|
2213 |
// X6. For all types besides RLE, LRE, RLO, LRO, and PDF:
|
2214 |
// a. Set the level of the current character to the current embedding level.
|
2215 |
// b. Whenever the directional override status is not neutral, reset the current character type to the directional override status.
|
2216 |
if ($dos != 'N') {
|
2217 |
$chardir = $dos;
|
2218 |
} else {
|
2219 |
+
if (isset(DSGVOTCPDF_FONT_DATA::$uni_type[$ta[$i]])) {
|
2220 |
+
$chardir = DSGVOTCPDF_FONT_DATA::$uni_type[$ta[$i]];
|
2221 |
} else {
|
2222 |
$chardir = 'L';
|
2223 |
}
|
2470 |
$charAL = array();
|
2471 |
$x = 0;
|
2472 |
for ($i=0; $i < $numchars; ++$i) {
|
2473 |
+
if ((DSGVOTCPDF_FONT_DATA::$uni_type[$chardata[$i]['char']] == 'AL') OR ($chardata[$i]['char'] == 32) OR ($chardata[$i]['char'] == 8204)) {
|
2474 |
$charAL[$x] = $chardata[$i];
|
2475 |
$charAL[$x]['i'] = $i;
|
2476 |
$chardata[$i]['x'] = $x;
|
2490 |
} else {
|
2491 |
$nextchar = false;
|
2492 |
}
|
2493 |
+
if (DSGVOTCPDF_FONT_DATA::$uni_type[$thischar['char']] == 'AL') {
|
2494 |
$x = $thischar['x'];
|
2495 |
if ($x > 0) {
|
2496 |
$prevchar = $charAL[($x-1)];
|
2504 |
}
|
2505 |
// if laa letter
|
2506 |
if (($prevchar !== false) AND ($prevchar['char'] == 1604) AND (in_array($thischar['char'], $alfletter))) {
|
2507 |
+
$arabicarr = DSGVOTCPDF_FONT_DATA::$uni_laa_array;
|
2508 |
$laaletter = true;
|
2509 |
if ($x > 1) {
|
2510 |
$prevchar = $charAL[($x-2)];
|
2512 |
$prevchar = false;
|
2513 |
}
|
2514 |
} else {
|
2515 |
+
$arabicarr = DSGVOTCPDF_FONT_DATA::$uni_arabicsubst;
|
2516 |
$laaletter = false;
|
2517 |
}
|
2518 |
if (($prevchar !== false) AND ($nextchar !== false) AND
|
2519 |
+
((DSGVOTCPDF_FONT_DATA::$uni_type[$prevchar['char']] == 'AL') OR (DSGVOTCPDF_FONT_DATA::$uni_type[$prevchar['char']] == 'NSM')) AND
|
2520 |
+
((DSGVOTCPDF_FONT_DATA::$uni_type[$nextchar['char']] == 'AL') OR (DSGVOTCPDF_FONT_DATA::$uni_type[$nextchar['char']] == 'NSM')) AND
|
2521 |
($prevchar['type'] == $thischar['type']) AND
|
2522 |
($nextchar['type'] == $thischar['type']) AND
|
2523 |
($nextchar['char'] != 1567)) {
|
2533 |
}
|
2534 |
}
|
2535 |
} elseif (($nextchar !== false) AND
|
2536 |
+
((DSGVOTCPDF_FONT_DATA::$uni_type[$nextchar['char']] == 'AL') OR (DSGVOTCPDF_FONT_DATA::$uni_type[$nextchar['char']] == 'NSM')) AND
|
2537 |
($nextchar['type'] == $thischar['type']) AND
|
2538 |
($nextchar['char'] != 1567)) {
|
2539 |
if (isset($arabicarr[$chardata[$i]['char']][2])) {
|
2541 |
$chardata2[$i]['char'] = $arabicarr[$thischar['char']][2];
|
2542 |
}
|
2543 |
} elseif ((($prevchar !== false) AND
|
2544 |
+
((DSGVOTCPDF_FONT_DATA::$uni_type[$prevchar['char']] == 'AL') OR (DSGVOTCPDF_FONT_DATA::$uni_type[$prevchar['char']] == 'NSM')) AND
|
2545 |
($prevchar['type'] == $thischar['type'])) OR
|
2546 |
(($nextchar !== false) AND ($nextchar['char'] == 1567))) {
|
2547 |
// final
|
2582 |
* Putting the combining mark and shadda in the same glyph allows us to avoid the two marks overlapping each other in an illegible manner.
|
2583 |
*/
|
2584 |
for ($i = 0; $i < ($numchars-1); ++$i) {
|
2585 |
+
if (($chardata2[$i]['char'] == 1617) AND (isset(DSGVOTCPDF_FONT_DATA::$uni_diacritics[($chardata2[$i+1]['char'])]))) {
|
2586 |
// check if the subtitution font is defined on current font
|
2587 |
+
if (isset($currentfont['cw'][(DSGVOTCPDF_FONT_DATA::$uni_diacritics[($chardata2[$i+1]['char'])])])) {
|
2588 |
$chardata2[$i]['char'] = false;
|
2589 |
+
$chardata2[$i+1]['char'] = DSGVOTCPDF_FONT_DATA::$uni_diacritics[($chardata2[$i+1]['char'])];
|
2590 |
}
|
2591 |
}
|
2592 |
}
|
2612 |
for ($i=0; $i < $numchars; ++$i) {
|
2613 |
if ($chardata[$i]['level'] >= $j) {
|
2614 |
$onlevel = true;
|
2615 |
+
if (isset(DSGVOTCPDF_FONT_DATA::$uni_mirror[$chardata[$i]['char']])) {
|
2616 |
// L4. A character is depicted by a mirrored glyph if and only if (a) the resolved directionality of that character is R, and (b) the Bidi_Mirrored property value of that character is true.
|
2617 |
+
$chardata[$i]['char'] = DSGVOTCPDF_FONT_DATA::$uni_mirror[$chardata[$i]['char']];
|
2618 |
}
|
2619 |
$revarr[] = $chardata[$i];
|
2620 |
} else {
|
includes/lib/tcpdf/include/tcpdf_images.php
CHANGED
@@ -78,7 +78,7 @@ class DSGVOTCPDF_IMAGES {
|
|
78 |
}
|
79 |
if (empty($type)) {
|
80 |
$fileinfo = pathinfo($imgfile);
|
81 |
-
if (isset($fileinfo['extension']) AND (!
|
82 |
$type = strtolower(trim($fileinfo['extension']));
|
83 |
}
|
84 |
}
|
@@ -212,7 +212,7 @@ class DSGVOTCPDF_IMAGES {
|
|
212 |
$offset = 0;
|
213 |
while (($pos = strpos($data, "ICC_PROFILE\0", $offset)) !== false) {
|
214 |
// get ICC sequence length
|
215 |
-
$length = (
|
216 |
// marker sequence number
|
217 |
$msn = max(1, ord($data[($pos + 12)]));
|
218 |
// number of markers (total of APP2 used)
|
@@ -259,8 +259,8 @@ class DSGVOTCPDF_IMAGES {
|
|
259 |
//Incorrect PNG file
|
260 |
return false;
|
261 |
}
|
262 |
-
$w =
|
263 |
-
$h =
|
264 |
$bpc = ord(fread($f, 1));
|
265 |
$ct = ord(fread($f, 1));
|
266 |
if ($ct == 0) {
|
@@ -297,16 +297,16 @@ class DSGVOTCPDF_IMAGES {
|
|
297 |
$trns = '';
|
298 |
$data = '';
|
299 |
$icc = false;
|
300 |
-
$n =
|
301 |
do {
|
302 |
$type = fread($f, 4);
|
303 |
if ($type == 'PLTE') {
|
304 |
// read palette
|
305 |
-
$pal =
|
306 |
fread($f, 4);
|
307 |
} elseif ($type == 'tRNS') {
|
308 |
// read transparency info
|
309 |
-
$t =
|
310 |
if ($ct == 0) { // DeviceGray
|
311 |
$trns = array(ord($t[1]));
|
312 |
} elseif ($ct == 2) { // DeviceRGB
|
@@ -322,7 +322,7 @@ class DSGVOTCPDF_IMAGES {
|
|
322 |
fread($f, 4);
|
323 |
} elseif ($type == 'IDAT') {
|
324 |
// read image data block
|
325 |
-
$data .=
|
326 |
fread($f, 4);
|
327 |
} elseif ($type == 'iCCP') {
|
328 |
// skip profile name
|
@@ -337,16 +337,16 @@ class DSGVOTCPDF_IMAGES {
|
|
337 |
return false;
|
338 |
}
|
339 |
// read ICC Color Profile
|
340 |
-
$icc =
|
341 |
// decompress profile
|
342 |
$icc = gzuncompress($icc);
|
343 |
fread($f, 4);
|
344 |
} elseif ($type == 'IEND') {
|
345 |
break;
|
346 |
} else {
|
347 |
-
|
348 |
}
|
349 |
-
$n =
|
350 |
} while ($n);
|
351 |
if (($colspace == 'Indexed') AND (empty($pal))) {
|
352 |
// Missing palette
|
78 |
}
|
79 |
if (empty($type)) {
|
80 |
$fileinfo = pathinfo($imgfile);
|
81 |
+
if (isset($fileinfo['extension']) AND (!DSGVOTCPDF_STATIC::empty_string($fileinfo['extension']))) {
|
82 |
$type = strtolower(trim($fileinfo['extension']));
|
83 |
}
|
84 |
}
|
212 |
$offset = 0;
|
213 |
while (($pos = strpos($data, "ICC_PROFILE\0", $offset)) !== false) {
|
214 |
// get ICC sequence length
|
215 |
+
$length = (DSGVOTCPDF_STATIC::_getUSHORT($data, ($pos - 2)) - 16);
|
216 |
// marker sequence number
|
217 |
$msn = max(1, ord($data[($pos + 12)]));
|
218 |
// number of markers (total of APP2 used)
|
259 |
//Incorrect PNG file
|
260 |
return false;
|
261 |
}
|
262 |
+
$w = DSGVOTCPDF_STATIC::_freadint($f);
|
263 |
+
$h = DSGVOTCPDF_STATIC::_freadint($f);
|
264 |
$bpc = ord(fread($f, 1));
|
265 |
$ct = ord(fread($f, 1));
|
266 |
if ($ct == 0) {
|
297 |
$trns = '';
|
298 |
$data = '';
|
299 |
$icc = false;
|
300 |
+
$n = DSGVOTCPDF_STATIC::_freadint($f);
|
301 |
do {
|
302 |
$type = fread($f, 4);
|
303 |
if ($type == 'PLTE') {
|
304 |
// read palette
|
305 |
+
$pal = DSGVOTCPDF_STATIC::rfread($f, $n);
|
306 |
fread($f, 4);
|
307 |
} elseif ($type == 'tRNS') {
|
308 |
// read transparency info
|
309 |
+
$t = DSGVOTCPDF_STATIC::rfread($f, $n);
|
310 |
if ($ct == 0) { // DeviceGray
|
311 |
$trns = array(ord($t[1]));
|
312 |
} elseif ($ct == 2) { // DeviceRGB
|
322 |
fread($f, 4);
|
323 |
} elseif ($type == 'IDAT') {
|
324 |
// read image data block
|
325 |
+
$data .= DSGVOTCPDF_STATIC::rfread($f, $n);
|
326 |
fread($f, 4);
|
327 |
} elseif ($type == 'iCCP') {
|
328 |
// skip profile name
|
337 |
return false;
|
338 |
}
|
339 |
// read ICC Color Profile
|
340 |
+
$icc = DSGVOTCPDF_STATIC::rfread($f, ($n - $len - 2));
|
341 |
// decompress profile
|
342 |
$icc = gzuncompress($icc);
|
343 |
fread($f, 4);
|
344 |
} elseif ($type == 'IEND') {
|
345 |
break;
|
346 |
} else {
|
347 |
+
DSGVOTCPDF_STATIC::rfread($f, $n + 4);
|
348 |
}
|
349 |
+
$n = DSGVOTCPDF_STATIC::_freadint($f);
|
350 |
} while ($n);
|
351 |
if (($colspace == 'Indexed') AND (empty($pal))) {
|
352 |
// Missing palette
|
includes/lib/tcpdf/include/tcpdf_static.php
CHANGED
@@ -293,7 +293,7 @@ class DSGVOTCPDF_STATIC {
|
|
293 |
* @public static
|
294 |
*/
|
295 |
public static function getObjFilename($type='tmp', $file_id='') {
|
296 |
-
return tempnam(K_PATH_CACHE, '__tcpdf_'.$file_id.'_'.$type.'_'.md5(
|
297 |
}
|
298 |
|
299 |
/**
|
@@ -822,7 +822,7 @@ class DSGVOTCPDF_STATIC {
|
|
822 |
if (is_array($prop['fillColor'])) {
|
823 |
$opt['mk']['bg'] = $prop['fillColor'];
|
824 |
} else {
|
825 |
-
$opt['mk']['bg'] =
|
826 |
}
|
827 |
}
|
828 |
// strokeColor: Specifies the stroke color for a field that is used to stroke the rectangle of the field with a line as large as the line width.
|
@@ -830,7 +830,7 @@ class DSGVOTCPDF_STATIC {
|
|
830 |
if (is_array($prop['strokeColor'])) {
|
831 |
$opt['mk']['bc'] = $prop['strokeColor'];
|
832 |
} else {
|
833 |
-
$opt['mk']['bc'] =
|
834 |
}
|
835 |
}
|
836 |
// rotation: The rotation of a widget in counterclockwise increments.
|
@@ -1534,7 +1534,7 @@ class DSGVOTCPDF_STATIC {
|
|
1534 |
// create new language array of patterns
|
1535 |
$patterns = array();
|
1536 |
foreach($patterns_array as $val) {
|
1537 |
-
if (!
|
1538 |
$val = trim($val);
|
1539 |
$val = str_replace('\'', '\\\'', $val);
|
1540 |
$key = preg_replace('/[0-9]+/', '', $val);
|
293 |
* @public static
|
294 |
*/
|
295 |
public static function getObjFilename($type='tmp', $file_id='') {
|
296 |
+
return tempnam(K_PATH_CACHE, '__tcpdf_'.$file_id.'_'.$type.'_'.md5(DSGVOTCPDF_STATIC::getRandomSeed()).'_');
|
297 |
}
|
298 |
|
299 |
/**
|
822 |
if (is_array($prop['fillColor'])) {
|
823 |
$opt['mk']['bg'] = $prop['fillColor'];
|
824 |
} else {
|
825 |
+
$opt['mk']['bg'] = DSGVOTCPDF_COLORS::convertHTMLColorToDec($prop['fillColor'], $spot_colors);
|
826 |
}
|
827 |
}
|
828 |
// strokeColor: Specifies the stroke color for a field that is used to stroke the rectangle of the field with a line as large as the line width.
|
830 |
if (is_array($prop['strokeColor'])) {
|
831 |
$opt['mk']['bc'] = $prop['strokeColor'];
|
832 |
} else {
|
833 |
+
$opt['mk']['bc'] = DSGVOTCPDF_COLORS::convertHTMLColorToDec($prop['strokeColor'], $spot_colors);
|
834 |
}
|
835 |
}
|
836 |
// rotation: The rotation of a widget in counterclockwise increments.
|
1534 |
// create new language array of patterns
|
1535 |
$patterns = array();
|
1536 |
foreach($patterns_array as $val) {
|
1537 |
+
if (!DSGVOTCPDF_STATIC::empty_string($val)) {
|
1538 |
$val = trim($val);
|
1539 |
$val = str_replace('\'', '\\\'', $val);
|
1540 |
$key = preg_replace('/[0-9]+/', '', $val);
|
includes/lib/tcpdf/tcpdf.php
CHANGED
@@ -1843,7 +1843,7 @@ class DSGVOTCPDF {
|
|
1843 |
}
|
1844 |
// set file ID for trailer
|
1845 |
$serformat = (is_array($format) ? json_encode($format) : $format);
|
1846 |
-
$this->file_id = md5(
|
1847 |
$this->font_obj_ids = array();
|
1848 |
$this->page_obj_id = array();
|
1849 |
$this->form_obj_id = array();
|
@@ -1957,7 +1957,7 @@ class DSGVOTCPDF {
|
|
1957 |
// set default JPEG quality
|
1958 |
$this->jpeg_quality = 75;
|
1959 |
// initialize some settings
|
1960 |
-
|
1961 |
// set default font
|
1962 |
$this->SetFont($this->FontFamily, $this->FontStyle, $this->FontSizePt);
|
1963 |
$this->setHeaderFont(array($this->FontFamily, $this->FontStyle, $this->FontSizePt));
|
@@ -2107,13 +2107,13 @@ class DSGVOTCPDF {
|
|
2107 |
}
|
2108 |
if (is_string($format)) {
|
2109 |
// get page measures from format name
|
2110 |
-
$pf =
|
2111 |
$this->fwPt = $pf[0];
|
2112 |
$this->fhPt = $pf[1];
|
2113 |
} else {
|
2114 |
// the boundaries of the physical medium on which the page shall be displayed or printed
|
2115 |
if (isset($format['MediaBox'])) {
|
2116 |
-
$this->pagedim =
|
2117 |
$this->fwPt = (($format['MediaBox']['urx'] - $format['MediaBox']['llx']) * $this->k);
|
2118 |
$this->fhPt = (($format['MediaBox']['ury'] - $format['MediaBox']['lly']) * $this->k);
|
2119 |
} else {
|
@@ -2124,27 +2124,27 @@ class DSGVOTCPDF {
|
|
2124 |
// default value
|
2125 |
$format['format'] = 'A4';
|
2126 |
}
|
2127 |
-
$pf =
|
2128 |
}
|
2129 |
$this->fwPt = $pf[0];
|
2130 |
$this->fhPt = $pf[1];
|
2131 |
-
$this->pagedim =
|
2132 |
}
|
2133 |
// the visible region of default user space
|
2134 |
if (isset($format['CropBox'])) {
|
2135 |
-
$this->pagedim =
|
2136 |
}
|
2137 |
// the region to which the contents of the page shall be clipped when output in a production environment
|
2138 |
if (isset($format['BleedBox'])) {
|
2139 |
-
$this->pagedim =
|
2140 |
}
|
2141 |
// the intended dimensions of the finished page after trimming
|
2142 |
if (isset($format['TrimBox'])) {
|
2143 |
-
$this->pagedim =
|
2144 |
}
|
2145 |
// the page's meaningful content (including potential white space)
|
2146 |
if (isset($format['ArtBox'])) {
|
2147 |
-
$this->pagedim =
|
2148 |
}
|
2149 |
// specify the colours and other visual characteristics that should be used in displaying guidelines on the screen for the various page boundaries
|
2150 |
if (isset($format['BoxColorInfo'])) {
|
@@ -2217,23 +2217,23 @@ class DSGVOTCPDF {
|
|
2217 |
public function setPageOrientation($orientation, $autopagebreak='', $bottommargin='') {
|
2218 |
if (!isset($this->pagedim[$this->page]['MediaBox'])) {
|
2219 |
// the boundaries of the physical medium on which the page shall be displayed or printed
|
2220 |
-
$this->pagedim =
|
2221 |
}
|
2222 |
if (!isset($this->pagedim[$this->page]['CropBox'])) {
|
2223 |
// the visible region of default user space
|
2224 |
-
$this->pagedim =
|
2225 |
}
|
2226 |
if (!isset($this->pagedim[$this->page]['BleedBox'])) {
|
2227 |
// the region to which the contents of the page shall be clipped when output in a production environment
|
2228 |
-
$this->pagedim =
|
2229 |
}
|
2230 |
if (!isset($this->pagedim[$this->page]['TrimBox'])) {
|
2231 |
// the intended dimensions of the finished page after trimming
|
2232 |
-
$this->pagedim =
|
2233 |
}
|
2234 |
if (!isset($this->pagedim[$this->page]['ArtBox'])) {
|
2235 |
// the page's meaningful content (including potential white space)
|
2236 |
-
$this->pagedim =
|
2237 |
}
|
2238 |
if (!isset($this->pagedim[$this->page]['Rotate'])) {
|
2239 |
// The number of degrees by which the page shall be rotated clockwise when displayed or printed. The value shall be a multiple of 90.
|
@@ -2267,18 +2267,18 @@ class DSGVOTCPDF {
|
|
2267 |
}
|
2268 |
if ((abs($this->pagedim[$this->page]['MediaBox']['urx'] - $this->hPt) < $this->feps) AND (abs($this->pagedim[$this->page]['MediaBox']['ury'] - $this->wPt) < $this->feps)){
|
2269 |
// swap X and Y coordinates (change page orientation)
|
2270 |
-
$this->pagedim =
|
2271 |
}
|
2272 |
$this->w = ($this->wPt / $this->k);
|
2273 |
$this->h = ($this->hPt / $this->k);
|
2274 |
-
if (
|
2275 |
if (isset($this->AutoPageBreak)) {
|
2276 |
$autopagebreak = $this->AutoPageBreak;
|
2277 |
} else {
|
2278 |
$autopagebreak = true;
|
2279 |
}
|
2280 |
}
|
2281 |
-
if (
|
2282 |
if (isset($this->bMargin)) {
|
2283 |
$bottommargin = $this->bMargin;
|
2284 |
} else {
|
@@ -2817,8 +2817,8 @@ class DSGVOTCPDF {
|
|
2817 |
} else {
|
2818 |
$this->Error('Incorrect zoom display mode: '.$zoom);
|
2819 |
}
|
2820 |
-
$this->LayoutMode =
|
2821 |
-
$this->PageMode =
|
2822 |
}
|
2823 |
|
2824 |
/**
|
@@ -3402,7 +3402,7 @@ class DSGVOTCPDF {
|
|
3402 |
$this->x = $this->original_lMargin;
|
3403 |
}
|
3404 |
if (($headerdata['logo']) AND ($headerdata['logo'] != K_BLANK_IMAGE)) {
|
3405 |
-
|
3406 |
if (($imgtype == 'eps') OR ($imgtype == 'ai')) {
|
3407 |
$this->ImageEps(K_PATH_IMAGES.$headerdata['logo'], '', '', $headerdata['logo_width']);
|
3408 |
} elseif ($imgtype == 'svg') {
|
@@ -3630,7 +3630,7 @@ class DSGVOTCPDF {
|
|
3630 |
$this->pagedim[$this->page]['tm'] = $this->tMargin;
|
3631 |
$this->y = $this->tMargin;
|
3632 |
}
|
3633 |
-
if (!
|
3634 |
// set margins
|
3635 |
$prev_lMargin = $this->lMargin;
|
3636 |
$prev_rMargin = $this->rMargin;
|
@@ -3730,7 +3730,7 @@ class DSGVOTCPDF {
|
|
3730 |
* @since 5.9.125 (2011-10-03)
|
3731 |
*/
|
3732 |
public function setSpotColor($type, $name, $tint=100) {
|
3733 |
-
$spotcolor =
|
3734 |
if ($spotcolor === false) {
|
3735 |
$this->Error('Undefined spot color: '.$name.', you must add it using the AddSpotColor() method.');
|
3736 |
}
|
@@ -4030,7 +4030,7 @@ class DSGVOTCPDF {
|
|
4030 |
* @since 1.2
|
4031 |
*/
|
4032 |
public function GetStringWidth($s, $fontname='', $fontstyle='', $fontsize=0, $getarray=false) {
|
4033 |
-
return $this->GetArrStringWidth(
|
4034 |
}
|
4035 |
|
4036 |
/**
|
@@ -4047,7 +4047,7 @@ class DSGVOTCPDF {
|
|
4047 |
*/
|
4048 |
public function GetArrStringWidth($sa, $fontname='', $fontstyle='', $fontsize=0, $getarray=false) {
|
4049 |
// store current values
|
4050 |
-
if (!
|
4051 |
$prev_FontFamily = $this->FontFamily;
|
4052 |
$prev_FontStyle = $this->FontStyle;
|
4053 |
$prev_FontSizePt = $this->FontSizePt;
|
@@ -4055,7 +4055,7 @@ class DSGVOTCPDF {
|
|
4055 |
}
|
4056 |
// convert UTF-8 array to Latin1 if required
|
4057 |
if ($this->isunicode AND (!$this->isUnicodeFont())) {
|
4058 |
-
$sa =
|
4059 |
}
|
4060 |
$w = 0; // total width
|
4061 |
$wa = array(); // array of characters widths
|
@@ -4066,7 +4066,7 @@ class DSGVOTCPDF {
|
|
4066 |
$w += $cw;
|
4067 |
}
|
4068 |
// restore previous values
|
4069 |
-
if (!
|
4070 |
$this->SetFont($prev_FontFamily, $prev_FontStyle, $prev_FontSizePt, '', 'default', false);
|
4071 |
}
|
4072 |
if ($getarray) {
|
@@ -4134,7 +4134,7 @@ class DSGVOTCPDF {
|
|
4134 |
*/
|
4135 |
public function GetNumChars($s) {
|
4136 |
if ($this->isUnicodeFont()) {
|
4137 |
-
return count(
|
4138 |
}
|
4139 |
return strlen($s);
|
4140 |
}
|
@@ -4145,7 +4145,7 @@ class DSGVOTCPDF {
|
|
4145 |
* @since 4.0.013 (2008-07-28)
|
4146 |
*/
|
4147 |
protected function getFontsList() {
|
4148 |
-
if (($fontsdir = opendir(
|
4149 |
while (($file = readdir($fontsdir)) !== false) {
|
4150 |
if (substr($file, -4) == '.php') {
|
4151 |
array_push($this->fontlist, strtolower(basename($file, '.php')));
|
@@ -4175,8 +4175,8 @@ class DSGVOTCPDF {
|
|
4175 |
if ($this->pdfa_mode) {
|
4176 |
$subset = false;
|
4177 |
}
|
4178 |
-
if (
|
4179 |
-
if (!
|
4180 |
$family = $this->FontFamily;
|
4181 |
} else {
|
4182 |
$this->Error('Empty font family');
|
@@ -4246,9 +4246,9 @@ class DSGVOTCPDF {
|
|
4246 |
}
|
4247 |
// get specified font directory (if any)
|
4248 |
$fontdir = false;
|
4249 |
-
if (!
|
4250 |
$fontdir = dirname($fontfile);
|
4251 |
-
if (
|
4252 |
$fontdir = '';
|
4253 |
} else {
|
4254 |
$fontdir .= '/';
|
@@ -4257,19 +4257,19 @@ class DSGVOTCPDF {
|
|
4257 |
// true when the font style variation is missing
|
4258 |
$missing_style = false;
|
4259 |
// search and include font file
|
4260 |
-
if (
|
4261 |
// build a standard filenames for specified font
|
4262 |
$tmp_fontfile = str_replace(' ', '', $family).strtolower($style).'.php';
|
4263 |
-
$fontfile =
|
4264 |
-
if (
|
4265 |
$missing_style = true;
|
4266 |
// try to remove the style part
|
4267 |
$tmp_fontfile = str_replace(' ', '', $family).'.php';
|
4268 |
-
$fontfile =
|
4269 |
}
|
4270 |
}
|
4271 |
// include font file
|
4272 |
-
if (!
|
4273 |
include($fontfile);
|
4274 |
} else {
|
4275 |
$this->Error('Could not include font definition file: '.$family.'');
|
@@ -4279,32 +4279,32 @@ class DSGVOTCPDF {
|
|
4279 |
$this->Error('The font definition file has a bad format: '.$fontfile.'');
|
4280 |
}
|
4281 |
// SET default parameters
|
4282 |
-
if (!isset($file) OR
|
4283 |
$file = '';
|
4284 |
}
|
4285 |
-
if (!isset($enc) OR
|
4286 |
$enc = '';
|
4287 |
}
|
4288 |
-
if (!isset($cidinfo) OR
|
4289 |
$cidinfo = array('Registry'=>'Adobe', 'Ordering'=>'Identity', 'Supplement'=>0);
|
4290 |
$cidinfo['uni2cid'] = array();
|
4291 |
}
|
4292 |
-
if (!isset($ctg) OR
|
4293 |
$ctg = '';
|
4294 |
}
|
4295 |
-
if (!isset($desc) OR
|
4296 |
$desc = array();
|
4297 |
}
|
4298 |
-
if (!isset($up) OR
|
4299 |
$up = -100;
|
4300 |
}
|
4301 |
-
if (!isset($ut) OR
|
4302 |
$ut = 50;
|
4303 |
}
|
4304 |
-
if (!isset($cw) OR
|
4305 |
$cw = array();
|
4306 |
}
|
4307 |
-
if (!isset($dw) OR
|
4308 |
// set default width
|
4309 |
if (isset($desc['MissingWidth']) AND ($desc['MissingWidth'] > 0)) {
|
4310 |
$dw = $desc['MissingWidth'];
|
@@ -4389,7 +4389,7 @@ class DSGVOTCPDF {
|
|
4389 |
}
|
4390 |
$this->setFontSubBuffer($fontkey, 'diff', $d);
|
4391 |
}
|
4392 |
-
if (!
|
4393 |
if (!isset($this->FontFiles[$file])) {
|
4394 |
if ((strcasecmp($type,'TrueType') == 0) OR (strcasecmp($type, 'TrueTypeUnicode') == 0)) {
|
4395 |
$this->FontFiles[$file] = array('length1' => $originalsize, 'fontdir' => $fontdir, 'subset' => $subset, 'fontkeys' => array($fontkey));
|
@@ -4608,11 +4608,11 @@ class DSGVOTCPDF {
|
|
4608 |
public function isCharDefined($char, $font='', $style='') {
|
4609 |
if (is_string($char)) {
|
4610 |
// get character code
|
4611 |
-
$char =
|
4612 |
$char = $char[0];
|
4613 |
}
|
4614 |
-
if (
|
4615 |
-
if (
|
4616 |
return (isset($this->CurrentFont['cw'][intval($char)]));
|
4617 |
}
|
4618 |
$font = $this->FontFamily;
|
@@ -4636,12 +4636,12 @@ class DSGVOTCPDF {
|
|
4636 |
if (empty($subs)) {
|
4637 |
return $text;
|
4638 |
}
|
4639 |
-
if (
|
4640 |
$font = $this->FontFamily;
|
4641 |
}
|
4642 |
$fontdata = $this->AddFont($font, $style);
|
4643 |
$fontinfo = $this->getFontBuffer($fontdata['fontkey']);
|
4644 |
-
$uniarr =
|
4645 |
foreach ($uniarr as $k => $chr) {
|
4646 |
if (!isset($fontinfo['cw'][$chr])) {
|
4647 |
// this character is missing on the selected font
|
@@ -4660,7 +4660,7 @@ class DSGVOTCPDF {
|
|
4660 |
}
|
4661 |
}
|
4662 |
}
|
4663 |
-
return
|
4664 |
}
|
4665 |
|
4666 |
/**
|
@@ -4808,8 +4808,8 @@ class DSGVOTCPDF {
|
|
4808 |
}
|
4809 |
$this->PageAnnots[$page][] = array('n' => ++$this->n, 'x' => $x, 'y' => $y, 'w' => $w, 'h' => $h, 'txt' => $text, 'opt' => $opt, 'numspaces' => $spaces);
|
4810 |
if (!$this->pdfa_mode) {
|
4811 |
-
if ((($opt['Subtype'] == 'FileAttachment') OR ($opt['Subtype'] == 'Sound')) AND (!
|
4812 |
-
AND (@file_exists($opt['FS']) OR
|
4813 |
AND (!isset($this->embeddedfiles[basename($opt['FS'])]))) {
|
4814 |
$this->embeddedfiles[basename($opt['FS'])] = array('f' => ++$this->n, 'n' => ++$this->n, 'file' => $opt['FS']);
|
4815 |
}
|
@@ -4839,7 +4839,7 @@ class DSGVOTCPDF {
|
|
4839 |
}
|
4840 |
reset($this->embeddedfiles);
|
4841 |
foreach ($this->embeddedfiles as $filename => $filedata) {
|
4842 |
-
$data =
|
4843 |
if ($data !== FALSE) {
|
4844 |
$rawsize = strlen($data);
|
4845 |
if ($rawsize > 0) {
|
@@ -4938,7 +4938,7 @@ class DSGVOTCPDF {
|
|
4938 |
* @protected
|
4939 |
*/
|
4940 |
protected function checkPageBreak($h=0, $y='', $addpage=true) {
|
4941 |
-
if (
|
4942 |
$y = $this->y;
|
4943 |
}
|
4944 |
$current_page = $this->page;
|
@@ -5062,10 +5062,10 @@ class DSGVOTCPDF {
|
|
5062 |
*/
|
5063 |
protected function getCellCode($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M') {
|
5064 |
// replace 'NO-BREAK SPACE' (U+00A0) character with a simple space
|
5065 |
-
$txt = str_replace(
|
5066 |
$prev_cell_margin = $this->cell_margin;
|
5067 |
$prev_cell_padding = $this->cell_padding;
|
5068 |
-
$txt =
|
5069 |
$rs = ''; //string to be returned
|
5070 |
$this->adjustCellPadding($border);
|
5071 |
if (!$ignore_min_height) {
|
@@ -5194,7 +5194,7 @@ class DSGVOTCPDF {
|
|
5194 |
}
|
5195 |
}
|
5196 |
$basefonty = $yt + $this->FontAscent;
|
5197 |
-
if (
|
5198 |
if ($this->rtl) {
|
5199 |
$w = $x - $this->lMargin;
|
5200 |
} else {
|
@@ -5226,10 +5226,10 @@ class DSGVOTCPDF {
|
|
5226 |
$txt2 = $txt;
|
5227 |
if ($this->isunicode) {
|
5228 |
if (($this->CurrentFont['type'] == 'core') OR ($this->CurrentFont['type'] == 'TrueType') OR ($this->CurrentFont['type'] == 'Type1')) {
|
5229 |
-
$txt2 =
|
5230 |
} else {
|
5231 |
-
$unicode =
|
5232 |
-
$unicode =
|
5233 |
// replace thai chars (if any)
|
5234 |
if (defined('K_THAI_TOPCHARS') AND (K_THAI_TOPCHARS == true)) {
|
5235 |
// number of chars
|
@@ -5321,10 +5321,10 @@ class DSGVOTCPDF {
|
|
5321 |
// update font subsetchars
|
5322 |
$this->setFontSubBuffer($this->CurrentFont['fontkey'], 'subsetchars', $this->CurrentFont['subsetchars']);
|
5323 |
} // end of K_THAI_TOPCHARS
|
5324 |
-
$txt2 =
|
5325 |
}
|
5326 |
}
|
5327 |
-
$txt2 =
|
5328 |
// get current text width (considering general font stretching and spacing)
|
5329 |
$txwidth = $this->GetStringWidth($txt);
|
5330 |
$width = $txwidth;
|
@@ -5452,8 +5452,8 @@ class DSGVOTCPDF {
|
|
5452 |
$xshift += $this->GetArrStringWidth($uniarr); // + shift justification
|
5453 |
} else {
|
5454 |
// character to print
|
5455 |
-
$topchr =
|
5456 |
-
$topchr =
|
5457 |
$s .= sprintf(' BT %F %F Td [(%s)] TJ ET', ($xdk + ($xshift * $k)), $ty, $topchr);
|
5458 |
}
|
5459 |
}
|
@@ -5764,11 +5764,11 @@ class DSGVOTCPDF {
|
|
5764 |
$this->cell_padding['T'] = 0;
|
5765 |
$this->cell_padding['B'] = 0;
|
5766 |
$this->setCellMargins(0, 0, 0, 0);
|
5767 |
-
if (
|
5768 |
// reset row height
|
5769 |
$this->resetLastH();
|
5770 |
}
|
5771 |
-
if (!
|
5772 |
$this->SetY($y);
|
5773 |
} else {
|
5774 |
$y = $this->GetY();
|
@@ -5784,7 +5784,7 @@ class DSGVOTCPDF {
|
|
5784 |
$startpage = $this->page;
|
5785 |
// get current column
|
5786 |
$startcolumn = $this->current_column;
|
5787 |
-
if (!
|
5788 |
$this->SetX($x);
|
5789 |
} else {
|
5790 |
$x = $this->GetX();
|
@@ -5801,7 +5801,7 @@ class DSGVOTCPDF {
|
|
5801 |
$this->x = $ox;
|
5802 |
$this->y = $oy;
|
5803 |
// set width
|
5804 |
-
if (
|
5805 |
if ($this->rtl) {
|
5806 |
$w = ($this->x - $this->lMargin - $mc_margin['L']);
|
5807 |
} else {
|
@@ -5921,9 +5921,9 @@ class DSGVOTCPDF {
|
|
5921 |
$check_page_regions = $this->check_page_regions;
|
5922 |
$this->check_page_regions = false;
|
5923 |
// get border modes
|
5924 |
-
$border_start =
|
5925 |
-
$border_end =
|
5926 |
-
$border_middle =
|
5927 |
// design borders around HTML cells.
|
5928 |
for ($page = $startpage; $page <= $endpage; ++$page) { // for each page
|
5929 |
$ccode = '';
|
@@ -6138,7 +6138,7 @@ class DSGVOTCPDF {
|
|
6138 |
$this->cell_padding = $cellpadding;
|
6139 |
}
|
6140 |
$this->adjustCellPadding($border);
|
6141 |
-
if (
|
6142 |
if ($this->rtl) {
|
6143 |
$w = $this->x - $this->lMargin;
|
6144 |
} else {
|
@@ -6152,7 +6152,7 @@ class DSGVOTCPDF {
|
|
6152 |
}
|
6153 |
$lines = 1;
|
6154 |
$sum = 0;
|
6155 |
-
$chars =
|
6156 |
$charsWidth = $this->GetArrStringWidth($chars, '', '', 0, true);
|
6157 |
$length = count($chars);
|
6158 |
$lastSeparator = -1;
|
@@ -6161,11 +6161,11 @@ class DSGVOTCPDF {
|
|
6161 |
$charWidth = $charsWidth[$i];
|
6162 |
if (($c != 160)
|
6163 |
AND (($c == 173)
|
6164 |
-
OR preg_match($this->re_spaces,
|
6165 |
OR (($c == 45)
|
6166 |
AND ($i > 0) AND ($i < ($length - 1))
|
6167 |
-
AND @preg_match('/[\p{L}]/'.$this->re_space['m'],
|
6168 |
-
AND @preg_match('/[\p{L}]/'.$this->re_space['m'],
|
6169 |
)
|
6170 |
)
|
6171 |
) {
|
@@ -6289,13 +6289,13 @@ class DSGVOTCPDF {
|
|
6289 |
// remove carriage returns
|
6290 |
$s = str_replace("\r", '', $txt);
|
6291 |
// check if string contains arabic text
|
6292 |
-
if (preg_match(
|
6293 |
$arabic = true;
|
6294 |
} else {
|
6295 |
$arabic = false;
|
6296 |
}
|
6297 |
// check if string contains RTL text
|
6298 |
-
if ($arabic OR ($this->tmprtl == 'R') OR preg_match(
|
6299 |
$rtlmode = true;
|
6300 |
} else {
|
6301 |
$rtlmode = false;
|
@@ -6303,18 +6303,18 @@ class DSGVOTCPDF {
|
|
6303 |
// get a char width
|
6304 |
$chrwidth = $this->GetCharWidth(46); // dot character
|
6305 |
// get array of unicode values
|
6306 |
-
$chars =
|
6307 |
// calculate maximum width for a single character on string
|
6308 |
$chrw = $this->GetArrStringWidth($chars, '', '', 0, true);
|
6309 |
array_walk($chrw, array($this, 'getRawCharWidth'));
|
6310 |
$maxchwidth = max($chrw);
|
6311 |
// get array of chars
|
6312 |
-
$uchars =
|
6313 |
// get the number of characters
|
6314 |
$nb = count($chars);
|
6315 |
// replacement for SHY character (minus symbol)
|
6316 |
$shy_replacement = 45;
|
6317 |
-
$shy_replacement_char =
|
6318 |
// widht for SHY replacement
|
6319 |
$shy_replacement_width = $this->GetCharWidth($shy_replacement);
|
6320 |
// page width
|
@@ -6367,12 +6367,12 @@ class DSGVOTCPDF {
|
|
6367 |
} else {
|
6368 |
$talign = $align;
|
6369 |
}
|
6370 |
-
$tmpstr =
|
6371 |
if ($firstline) {
|
6372 |
$startx = $this->x;
|
6373 |
$tmparr = array_slice($chars, $j, ($i - $j));
|
6374 |
if ($rtlmode) {
|
6375 |
-
$tmparr =
|
6376 |
}
|
6377 |
$linew = $this->GetArrStringWidth($tmparr);
|
6378 |
unset($tmparr);
|
@@ -6397,7 +6397,7 @@ class DSGVOTCPDF {
|
|
6397 |
unset($tmpstr);
|
6398 |
if ($firstline) {
|
6399 |
$this->cell_padding = $tmpcellpadding;
|
6400 |
-
return (
|
6401 |
}
|
6402 |
++$nl;
|
6403 |
$j = $i + 1;
|
@@ -6426,11 +6426,11 @@ class DSGVOTCPDF {
|
|
6426 |
// \p{Lo} is needed because Chinese characters are packed next to each other without spaces in between.
|
6427 |
if (($c != 160)
|
6428 |
AND (($c == 173)
|
6429 |
-
OR preg_match($this->re_spaces,
|
6430 |
OR (($c == 45)
|
6431 |
AND ($i < ($nb - 1))
|
6432 |
-
AND @preg_match('/[\p{L}]/'.$this->re_space['m'],
|
6433 |
-
AND @preg_match('/[\p{L}]/'.$this->re_space['m'],
|
6434 |
)
|
6435 |
)
|
6436 |
) {
|
@@ -6456,7 +6456,7 @@ class DSGVOTCPDF {
|
|
6456 |
if ($this->isUnicodeFont() AND ($arabic)) {
|
6457 |
// with bidirectional algorithm some chars may be changed affecting the line length
|
6458 |
// *** very slow ***
|
6459 |
-
$l = $this->GetArrStringWidth(
|
6460 |
} else {
|
6461 |
$l += $this->GetCharWidth($c);
|
6462 |
}
|
@@ -6474,16 +6474,16 @@ class DSGVOTCPDF {
|
|
6474 |
$this->Cell($w, $h, '', 0, 1);
|
6475 |
$linebreak = true;
|
6476 |
if ($firstline) {
|
6477 |
-
return (
|
6478 |
}
|
6479 |
} else {
|
6480 |
// truncate the word because do not fit on column
|
6481 |
-
$tmpstr =
|
6482 |
if ($firstline) {
|
6483 |
$startx = $this->x;
|
6484 |
$tmparr = array_slice($chars, $j, ($i - $j));
|
6485 |
if ($rtlmode) {
|
6486 |
-
$tmparr =
|
6487 |
}
|
6488 |
$linew = $this->GetArrStringWidth($tmparr);
|
6489 |
unset($tmparr);
|
@@ -6505,7 +6505,7 @@ class DSGVOTCPDF {
|
|
6505 |
unset($tmpstr);
|
6506 |
if ($firstline) {
|
6507 |
$this->cell_padding = $tmpcellpadding;
|
6508 |
-
return (
|
6509 |
}
|
6510 |
$j = $i;
|
6511 |
--$i;
|
@@ -6518,16 +6518,16 @@ class DSGVOTCPDF {
|
|
6518 |
$endspace = 0;
|
6519 |
}
|
6520 |
// check the length of the next string
|
6521 |
-
$strrest =
|
6522 |
-
$nextstr =
|
6523 |
if (isset($nextstr[0]) AND ($this->GetStringWidth($nextstr[0]) > $pw)) {
|
6524 |
// truncate the word because do not fit on a full page width
|
6525 |
-
$tmpstr =
|
6526 |
if ($firstline) {
|
6527 |
$startx = $this->x;
|
6528 |
$tmparr = array_slice($chars, $j, ($i - $j));
|
6529 |
if ($rtlmode) {
|
6530 |
-
$tmparr =
|
6531 |
}
|
6532 |
$linew = $this->GetArrStringWidth($tmparr);
|
6533 |
unset($tmparr);
|
@@ -6549,7 +6549,7 @@ class DSGVOTCPDF {
|
|
6549 |
unset($tmpstr);
|
6550 |
if ($firstline) {
|
6551 |
$this->cell_padding = $tmpcellpadding;
|
6552 |
-
return (
|
6553 |
}
|
6554 |
$j = $i;
|
6555 |
--$i;
|
@@ -6570,12 +6570,12 @@ class DSGVOTCPDF {
|
|
6570 |
$shy_char_left = '';
|
6571 |
$shy_char_right = '';
|
6572 |
}
|
6573 |
-
$tmpstr =
|
6574 |
if ($firstline) {
|
6575 |
$startx = $this->x;
|
6576 |
$tmparr = array_slice($chars, $j, (($sep + $endspace) - $j));
|
6577 |
if ($rtlmode) {
|
6578 |
-
$tmparr =
|
6579 |
}
|
6580 |
$linew = $this->GetArrStringWidth($tmparr);
|
6581 |
unset($tmparr);
|
@@ -6602,7 +6602,7 @@ class DSGVOTCPDF {
|
|
6602 |
}
|
6603 |
// return the remaining text
|
6604 |
$this->cell_padding = $tmpcellpadding;
|
6605 |
-
return (
|
6606 |
}
|
6607 |
$i = $sep;
|
6608 |
$sep = -1;
|
@@ -6664,12 +6664,12 @@ class DSGVOTCPDF {
|
|
6664 |
break;
|
6665 |
}
|
6666 |
}
|
6667 |
-
$tmpstr =
|
6668 |
if ($firstline) {
|
6669 |
$startx = $this->x;
|
6670 |
$tmparr = array_slice($chars, $j, ($nb - $j));
|
6671 |
if ($rtlmode) {
|
6672 |
-
$tmparr =
|
6673 |
}
|
6674 |
$linew = $this->GetArrStringWidth($tmparr);
|
6675 |
unset($tmparr);
|
@@ -6691,7 +6691,7 @@ class DSGVOTCPDF {
|
|
6691 |
unset($tmpstr);
|
6692 |
if ($firstline) {
|
6693 |
$this->cell_padding = $tmpcellpadding;
|
6694 |
-
return (
|
6695 |
}
|
6696 |
++$nl;
|
6697 |
}
|
@@ -6859,15 +6859,15 @@ class DSGVOTCPDF {
|
|
6859 |
$info = $this->getImageBuffer($file);
|
6860 |
$imsize = array($info['w'], $info['h']);
|
6861 |
} elseif (strpos($file, '__tcpdf_'.$this->file_id.'_img') === FALSE) {
|
6862 |
-
$imgdata =
|
6863 |
}
|
6864 |
}
|
6865 |
}
|
6866 |
if (!empty($imgdata)) {
|
6867 |
// copy image to cache
|
6868 |
$original_file = $file;
|
6869 |
-
$file =
|
6870 |
-
$fp =
|
6871 |
if (!$fp) {
|
6872 |
$this->Error('Unable to write file: '.$file);
|
6873 |
}
|
@@ -7014,12 +7014,12 @@ class DSGVOTCPDF {
|
|
7014 |
//First use of image, get info
|
7015 |
$type = strtolower($type);
|
7016 |
if ($type == '') {
|
7017 |
-
|
7018 |
} elseif ($type == 'jpg') {
|
7019 |
$type = 'jpeg';
|
7020 |
}
|
7021 |
-
$mqr =
|
7022 |
-
|
7023 |
// Specific image handlers (defined on TCPDF_IMAGES CLASS)
|
7024 |
$mtd = '_parse'.$type;
|
7025 |
// GD image handler function
|
@@ -7027,7 +7027,7 @@ class DSGVOTCPDF {
|
|
7027 |
$info = false;
|
7028 |
if ((method_exists('TCPDF_IMAGES', $mtd)) AND (!($resize AND (function_exists($gdfunction) OR extension_loaded('imagick'))))) {
|
7029 |
// TCPDF image functions
|
7030 |
-
|
7031 |
if (($ismask === false) AND ($imgmask === false) AND (strpos($file, '__tcpdf_'.$this->file_id.'_imgmask_') === FALSE)
|
7032 |
AND (($info === 'pngalpha') OR (isset($info['trns']) AND !empty($info['trns'])))) {
|
7033 |
return $this->ImagePngAlpha($file, $x, $y, $pixw, $pixh, $w, $h, 'PNG', $link, $align, $resize, $dpi, $palign, $filehash);
|
@@ -7041,15 +7041,15 @@ class DSGVOTCPDF {
|
|
7041 |
if ($resize) {
|
7042 |
$imgr = imagecreatetruecolor($neww, $newh);
|
7043 |
if (($type == 'gif') OR ($type == 'png')) {
|
7044 |
-
|
7045 |
}
|
7046 |
imagecopyresampled($imgr, $img, 0, 0, 0, 0, $neww, $newh, $pixw, $pixh);
|
7047 |
$img = $imgr;
|
7048 |
}
|
7049 |
if (($type == 'gif') OR ($type == 'png')) {
|
7050 |
-
|
7051 |
} else {
|
7052 |
-
|
7053 |
}
|
7054 |
}
|
7055 |
} catch(Exception $e) {
|
@@ -7066,7 +7066,7 @@ class DSGVOTCPDF {
|
|
7066 |
$svgimg = substr($file, 1);
|
7067 |
} else {
|
7068 |
// get SVG file content
|
7069 |
-
$svgimg =
|
7070 |
}
|
7071 |
if ($svgimg !== FALSE) {
|
7072 |
// get width and height
|
@@ -7108,9 +7108,9 @@ class DSGVOTCPDF {
|
|
7108 |
}
|
7109 |
$img->setCompressionQuality($this->jpeg_quality);
|
7110 |
$img->setImageFormat('jpeg');
|
7111 |
-
$tempname =
|
7112 |
$img->writeImage($tempname);
|
7113 |
-
$info =
|
7114 |
unlink($tempname);
|
7115 |
$img->destroy();
|
7116 |
} catch(Exception $e) {
|
@@ -7121,7 +7121,7 @@ class DSGVOTCPDF {
|
|
7121 |
// unable to process image
|
7122 |
return;
|
7123 |
}
|
7124 |
-
|
7125 |
if ($ismask) {
|
7126 |
// force grayscale
|
7127 |
$info['cs'] = 'DeviceGray';
|
@@ -7259,7 +7259,7 @@ class DSGVOTCPDF {
|
|
7259 |
$img = new Imagick();
|
7260 |
$img->readImage($file);
|
7261 |
// clone image object
|
7262 |
-
$imga =
|
7263 |
// extract alpha channel
|
7264 |
if (method_exists($img, 'setImageAlphaChannel') AND defined('Imagick::ALPHACHANNEL_EXTRACT')) {
|
7265 |
$img->setImageAlphaChannel(Imagick::ALPHACHANNEL_EXTRACT);
|
@@ -7573,21 +7573,21 @@ class DSGVOTCPDF {
|
|
7573 |
// remove last newline
|
7574 |
$pdfdoc = substr($pdfdoc, 0, -1);
|
7575 |
// remove filler space
|
7576 |
-
$byterange_string_len = strlen(
|
7577 |
// define the ByteRange
|
7578 |
$byte_range = array();
|
7579 |
$byte_range[0] = 0;
|
7580 |
-
$byte_range[1] = strpos($pdfdoc,
|
7581 |
$byte_range[2] = $byte_range[1] + $this->signature_max_length + 2;
|
7582 |
$byte_range[3] = strlen($pdfdoc) - $byte_range[2];
|
7583 |
$pdfdoc = substr($pdfdoc, 0, $byte_range[1]).substr($pdfdoc, $byte_range[2]);
|
7584 |
// replace the ByteRange
|
7585 |
$byterange = sprintf('/ByteRange[0 %u %u %u]', $byte_range[1], $byte_range[2], $byte_range[3]);
|
7586 |
$byterange .= str_repeat(' ', ($byterange_string_len - strlen($byterange)));
|
7587 |
-
$pdfdoc = str_replace(
|
7588 |
// write the document to a temporary folder
|
7589 |
-
$tempdoc =
|
7590 |
-
$f =
|
7591 |
if (!$f) {
|
7592 |
$this->Error('Unable to create temporary file: '.$tempdoc);
|
7593 |
}
|
@@ -7595,7 +7595,7 @@ class DSGVOTCPDF {
|
|
7595 |
fwrite($f, $pdfdoc, $pdfdoc_length);
|
7596 |
fclose($f);
|
7597 |
// get digital signature via openssl library
|
7598 |
-
$tempsign =
|
7599 |
if (empty($this->signature_data['extracerts'])) {
|
7600 |
openssl_pkcs7_sign($tempdoc, $tempsign, $this->signature_data['signcert'], array($this->signature_data['privkey'], $this->signature_data['password']), array(), PKCS7_BINARY | PKCS7_DETACHED);
|
7601 |
} else {
|
@@ -7637,7 +7637,7 @@ class DSGVOTCPDF {
|
|
7637 |
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
|
7638 |
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
7639 |
header('Content-Disposition: inline; filename="'.basename($name).'"');
|
7640 |
-
|
7641 |
} else {
|
7642 |
echo $this->getBuffer();
|
7643 |
}
|
@@ -7669,14 +7669,14 @@ class DSGVOTCPDF {
|
|
7669 |
// use the Content-Disposition header to supply a recommended filename
|
7670 |
header('Content-Disposition: attachment; filename="'.basename($name).'"');
|
7671 |
header('Content-Transfer-Encoding: binary');
|
7672 |
-
|
7673 |
break;
|
7674 |
}
|
7675 |
case 'F':
|
7676 |
case 'FI':
|
7677 |
case 'FD': {
|
7678 |
// save PDF to a local file
|
7679 |
-
$f =
|
7680 |
if (!$f) {
|
7681 |
$this->Error('Unable to create output file: '.$name);
|
7682 |
}
|
@@ -7691,7 +7691,7 @@ class DSGVOTCPDF {
|
|
7691 |
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
|
7692 |
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
7693 |
header('Content-Disposition: inline; filename="'.basename($name).'"');
|
7694 |
-
|
7695 |
} elseif ($dest == 'FD') {
|
7696 |
// send headers to browser
|
7697 |
if (ob_get_contents()) {
|
@@ -7717,7 +7717,7 @@ class DSGVOTCPDF {
|
|
7717 |
// use the Content-Disposition header to supply a recommended filename
|
7718 |
header('Content-Disposition: attachment; filename="'.basename($name).'"');
|
7719 |
header('Content-Transfer-Encoding: binary');
|
7720 |
-
|
7721 |
}
|
7722 |
break;
|
7723 |
}
|
@@ -7806,14 +7806,14 @@ class DSGVOTCPDF {
|
|
7806 |
// build array of Unicode + ASCII variants (the order is important)
|
7807 |
$alias = array('u' => array(), 'a' => array());
|
7808 |
$u = '{'.$a.'}';
|
7809 |
-
$alias['u'][] =
|
7810 |
if ($this->isunicode) {
|
7811 |
-
$alias['u'][] =
|
7812 |
-
$alias['u'][] =
|
7813 |
-
$alias['a'][] =
|
7814 |
-
$alias['a'][] =
|
7815 |
}
|
7816 |
-
$alias['a'][] =
|
7817 |
return $alias;
|
7818 |
}
|
7819 |
|
@@ -7823,7 +7823,7 @@ class DSGVOTCPDF {
|
|
7823 |
* @protected
|
7824 |
*/
|
7825 |
protected function getAllInternalPageNumberAliases() {
|
7826 |
-
$basic_alias = array(
|
7827 |
$pnalias = array();
|
7828 |
foreach($basic_alias as $k => $a) {
|
7829 |
$pnalias[$k] = $this->getInternalPageNumberAliases($a);
|
@@ -7858,7 +7858,7 @@ class DSGVOTCPDF {
|
|
7858 |
if ($type == 'u') {
|
7859 |
$chrdiff = floor(($diff + 12) * $ratio);
|
7860 |
$shift = str_repeat(' ', $chrdiff);
|
7861 |
-
$shift =
|
7862 |
} else {
|
7863 |
$chrdiff = floor(($diff + 11) * $ratio);
|
7864 |
$shift = str_repeat(' ', $chrdiff);
|
@@ -7878,7 +7878,7 @@ class DSGVOTCPDF {
|
|
7878 |
protected function setPageBoxTypes($boxes) {
|
7879 |
$this->page_boxes = array();
|
7880 |
foreach ($boxes as $box) {
|
7881 |
-
if (in_array($box,
|
7882 |
$this->page_boxes[] = $box;
|
7883 |
}
|
7884 |
}
|
@@ -7893,8 +7893,8 @@ class DSGVOTCPDF {
|
|
7893 |
// get internal aliases for page numbers
|
7894 |
$pnalias = $this->getAllInternalPageNumberAliases();
|
7895 |
$num_pages = $this->numpages;
|
7896 |
-
$ptpa =
|
7897 |
-
$ptpu =
|
7898 |
$ptp_num_chars = $this->GetNumChars($ptpa);
|
7899 |
$pagegroupnum = 0;
|
7900 |
$groupnum = 0;
|
@@ -7906,8 +7906,8 @@ class DSGVOTCPDF {
|
|
7906 |
$temppage = $this->getPageBuffer($n);
|
7907 |
$pagelen = strlen($temppage);
|
7908 |
// set replacements for total pages number
|
7909 |
-
$pnpa =
|
7910 |
-
$pnpu =
|
7911 |
$pnp_num_chars = $this->GetNumChars($pnpa);
|
7912 |
$pdiff = 0; // difference used for right shift alignment of page numbers
|
7913 |
$gdiff = 0; // difference used for right shift alignment of page group numbers
|
@@ -7915,13 +7915,13 @@ class DSGVOTCPDF {
|
|
7915 |
if (isset($this->newpagegroup[$n])) {
|
7916 |
$pagegroupnum = 0;
|
7917 |
++$groupnum;
|
7918 |
-
$ptga =
|
7919 |
-
$ptgu =
|
7920 |
$ptg_num_chars = $this->GetNumChars($ptga);
|
7921 |
}
|
7922 |
++$pagegroupnum;
|
7923 |
-
$pnga =
|
7924 |
-
$pngu =
|
7925 |
$png_num_chars = $this->GetNumChars($pnga);
|
7926 |
// replace page numbers
|
7927 |
$replace = array();
|
@@ -7929,7 +7929,7 @@ class DSGVOTCPDF {
|
|
7929 |
$replace[] = array($ptga, $ptg_num_chars, 7, $pnalias[2]['a']);
|
7930 |
$replace[] = array($pngu, $png_num_chars, 9, $pnalias[3]['u']);
|
7931 |
$replace[] = array($pnga, $png_num_chars, 7, $pnalias[3]['a']);
|
7932 |
-
list($temppage, $gdiff) =
|
7933 |
}
|
7934 |
// replace page numbers
|
7935 |
$replace = array();
|
@@ -7937,7 +7937,7 @@ class DSGVOTCPDF {
|
|
7937 |
$replace[] = array($ptpa, $ptp_num_chars, 7, $pnalias[0]['a']);
|
7938 |
$replace[] = array($pnpu, $pnp_num_chars, 9, $pnalias[1]['u']);
|
7939 |
$replace[] = array($pnpa, $pnp_num_chars, 7, $pnalias[1]['a']);
|
7940 |
-
list($temppage, $pdiff) =
|
7941 |
// replace right shift alias
|
7942 |
$temppage = $this->replaceRightShiftPageNumAliases($temppage, $pnalias[4], max($pdiff, $gdiff));
|
7943 |
// replace EPS marker
|
@@ -8301,7 +8301,7 @@ class DSGVOTCPDF {
|
|
8301 |
$annots .= '>>';
|
8302 |
}
|
8303 |
if (isset($pl['opt']['c']) AND (is_array($pl['opt']['c'])) AND !empty($pl['opt']['c'])) {
|
8304 |
-
$annots .= ' /C '.
|
8305 |
}
|
8306 |
//$annots .= ' /StructParent ';
|
8307 |
//$annots .= ' /OC ';
|
@@ -8367,7 +8367,7 @@ class DSGVOTCPDF {
|
|
8367 |
if (is_string($pl['txt']) && !empty($pl['txt'])) {
|
8368 |
if ($pl['txt'][0] == '#') {
|
8369 |
// internal destination
|
8370 |
-
$annots .= ' /Dest /'.
|
8371 |
} elseif ($pl['txt'][0] == '%') {
|
8372 |
// embedded PDF file
|
8373 |
$filename = basename(substr($pl['txt'], 1));
|
@@ -8539,10 +8539,10 @@ class DSGVOTCPDF {
|
|
8539 |
$annots .= ' /R '.$pl['opt']['mk']['r'];
|
8540 |
}
|
8541 |
if (isset($pl['opt']['mk']['bc']) AND (is_array($pl['opt']['mk']['bc']))) {
|
8542 |
-
$annots .= ' /BC '.
|
8543 |
}
|
8544 |
if (isset($pl['opt']['mk']['bg']) AND (is_array($pl['opt']['mk']['bg']))) {
|
8545 |
-
$annots .= ' /BG '.
|
8546 |
}
|
8547 |
if (isset($pl['opt']['mk']['ca'])) {
|
8548 |
$annots .= ' /CA '.$pl['opt']['mk']['ca'];
|
@@ -8774,12 +8774,12 @@ class DSGVOTCPDF {
|
|
8774 |
$this->_newobj();
|
8775 |
$this->_out('<< /Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$diff.'] >>'."\n".'endobj');
|
8776 |
}
|
8777 |
-
$mqr =
|
8778 |
-
|
8779 |
foreach ($this->FontFiles as $file => $info) {
|
8780 |
// search and get font file to embedd
|
8781 |
-
$fontfile =
|
8782 |
-
if (!
|
8783 |
$font = file_get_contents($fontfile);
|
8784 |
$compressed = (substr($file, -2) == '.z');
|
8785 |
if ((!$compressed) AND (isset($info['length2']))) {
|
@@ -8804,7 +8804,7 @@ class DSGVOTCPDF {
|
|
8804 |
$subsetchars += $fontinfo['subsetchars'];
|
8805 |
}
|
8806 |
// rebuild a font subset
|
8807 |
-
$font =
|
8808 |
// calculate new font length
|
8809 |
$info['length1'] = strlen($font);
|
8810 |
if ($compressed) {
|
@@ -8829,7 +8829,7 @@ class DSGVOTCPDF {
|
|
8829 |
$this->_out($out);
|
8830 |
}
|
8831 |
}
|
8832 |
-
|
8833 |
foreach ($this->fontkeys as $k) {
|
8834 |
//Font objects
|
8835 |
$font = $this->getFontBuffer($k);
|
@@ -8894,7 +8894,7 @@ class DSGVOTCPDF {
|
|
8894 |
}
|
8895 |
$s .= ' /'.$fdk.' '.$fdv.'';
|
8896 |
}
|
8897 |
-
if (!
|
8898 |
$s .= ' /FontFile'.($type == 'Type1' ? '' : '2').' '.$this->FontFiles[$font['file']]['n'].' 0 R';
|
8899 |
}
|
8900 |
$s .= '>>';
|
@@ -8942,7 +8942,7 @@ class DSGVOTCPDF {
|
|
8942 |
$out .= "\n".'endobj';
|
8943 |
$this->_out($out);
|
8944 |
// ToUnicode map for Identity-H
|
8945 |
-
$stream =
|
8946 |
// ToUnicode Object
|
8947 |
$this->_newobj();
|
8948 |
$stream = ($this->compress) ? gzcompress($stream) : $stream;
|
@@ -8962,8 +8962,8 @@ class DSGVOTCPDF {
|
|
8962 |
$out .= ' /CIDSystemInfo << '.$cidinfo.' >>';
|
8963 |
$out .= ' /FontDescriptor '.($this->n + 1).' 0 R';
|
8964 |
$out .= ' /DW '.$font['dw']; // default width
|
8965 |
-
$out .= "\n".
|
8966 |
-
if (isset($font['ctg']) AND (!
|
8967 |
$out .= "\n".'/CIDToGIDMap '.($this->n + 2).' 0 R';
|
8968 |
}
|
8969 |
$out .= ' >>';
|
@@ -8981,7 +8981,7 @@ class DSGVOTCPDF {
|
|
8981 |
$out .= ' /'.$key.' '.$value;
|
8982 |
}
|
8983 |
$fontdir = false;
|
8984 |
-
if (!
|
8985 |
// A stream containing a TrueType font
|
8986 |
$out .= ' /FontFile2 '.$this->FontFiles[$font['file']]['n'].' 0 R';
|
8987 |
$fontdir = $this->FontFiles[$font['file']]['fontdir'];
|
@@ -8989,15 +8989,15 @@ class DSGVOTCPDF {
|
|
8989 |
$out .= ' >>';
|
8990 |
$out .= "\n".'endobj';
|
8991 |
$this->_out($out);
|
8992 |
-
if (isset($font['ctg']) AND (!
|
8993 |
$this->_newobj();
|
8994 |
// Embed CIDToGIDMap
|
8995 |
// A specification of the mapping from CIDs to glyph indices
|
8996 |
// search and get CTG font file to embedd
|
8997 |
$ctgfile = strtolower($font['ctg']);
|
8998 |
// search and get ctg font file to embedd
|
8999 |
-
$fontfile =
|
9000 |
-
if (
|
9001 |
$this->Error('Font file not found: '.$ctgfile);
|
9002 |
}
|
9003 |
$stream = $this->_getrawstream(file_get_contents($fontfile));
|
@@ -9070,7 +9070,7 @@ class DSGVOTCPDF {
|
|
9070 |
$out .= ' /CIDSystemInfo <<'.$cidinfo.'>>';
|
9071 |
$out .= ' /FontDescriptor '.($this->n + 1).' 0 R';
|
9072 |
$out .= ' /DW '.$font['dw'];
|
9073 |
-
$out .= "\n".
|
9074 |
$out .= ' >>';
|
9075 |
$out .= "\n".'endobj';
|
9076 |
$this->_out($out);
|
@@ -9452,30 +9452,30 @@ class DSGVOTCPDF {
|
|
9452 |
if ($this->docinfounicode) {
|
9453 |
$this->isunicode = true;
|
9454 |
}
|
9455 |
-
if (!
|
9456 |
// The document's title.
|
9457 |
$out .= ' /Title '.$this->_textstring($this->title, $oid);
|
9458 |
}
|
9459 |
-
if (!
|
9460 |
// The name of the person who created the document.
|
9461 |
$out .= ' /Author '.$this->_textstring($this->author, $oid);
|
9462 |
}
|
9463 |
-
if (!
|
9464 |
// The subject of the document.
|
9465 |
$out .= ' /Subject '.$this->_textstring($this->subject, $oid);
|
9466 |
}
|
9467 |
-
if (!
|
9468 |
// Keywords associated with the document.
|
9469 |
$out .= ' /Keywords '.$this->_textstring($this->keywords, $oid);
|
9470 |
}
|
9471 |
-
if (!
|
9472 |
// If the document was converted to PDF from another format, the name of the conforming product that created the original document from which it was converted.
|
9473 |
$out .= ' /Creator '.$this->_textstring($this->creator, $oid);
|
9474 |
}
|
9475 |
// restore previous isunicode value
|
9476 |
$this->isunicode = $prev_isunicode;
|
9477 |
// default producer
|
9478 |
-
$out .= ' /Producer '.$this->_textstring(
|
9479 |
// The date and time the document was created, in human-readable form
|
9480 |
$out .= ' /CreationDate '.$this->_datestring(0, $this->doc_creation_timestamp);
|
9481 |
// The date and time the document was most recently modified, in human-readable form
|
@@ -9513,44 +9513,44 @@ class DSGVOTCPDF {
|
|
9513 |
$prev_encrypted = $this->encrypted;
|
9514 |
$this->encrypted = false;
|
9515 |
// set XMP data
|
9516 |
-
$xmp = '<?xpacket begin="'.
|
9517 |
$xmp .= '<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 4.2.1-c043 52.372728, 2009/01/18-15:08:04">'."\n";
|
9518 |
$xmp .= "\t".'<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">'."\n";
|
9519 |
$xmp .= "\t\t".'<rdf:Description rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/">'."\n";
|
9520 |
$xmp .= "\t\t\t".'<dc:format>application/pdf</dc:format>'."\n";
|
9521 |
$xmp .= "\t\t\t".'<dc:title>'."\n";
|
9522 |
$xmp .= "\t\t\t\t".'<rdf:Alt>'."\n";
|
9523 |
-
$xmp .= "\t\t\t\t\t".'<rdf:li xml:lang="x-default">'.
|
9524 |
$xmp .= "\t\t\t\t".'</rdf:Alt>'."\n";
|
9525 |
$xmp .= "\t\t\t".'</dc:title>'."\n";
|
9526 |
$xmp .= "\t\t\t".'<dc:creator>'."\n";
|
9527 |
$xmp .= "\t\t\t\t".'<rdf:Seq>'."\n";
|
9528 |
-
$xmp .= "\t\t\t\t\t".'<rdf:li>'.
|
9529 |
$xmp .= "\t\t\t\t".'</rdf:Seq>'."\n";
|
9530 |
$xmp .= "\t\t\t".'</dc:creator>'."\n";
|
9531 |
$xmp .= "\t\t\t".'<dc:description>'."\n";
|
9532 |
$xmp .= "\t\t\t\t".'<rdf:Alt>'."\n";
|
9533 |
-
$xmp .= "\t\t\t\t\t".'<rdf:li xml:lang="x-default">'.
|
9534 |
$xmp .= "\t\t\t\t".'</rdf:Alt>'."\n";
|
9535 |
$xmp .= "\t\t\t".'</dc:description>'."\n";
|
9536 |
$xmp .= "\t\t\t".'<dc:subject>'."\n";
|
9537 |
$xmp .= "\t\t\t\t".'<rdf:Bag>'."\n";
|
9538 |
-
$xmp .= "\t\t\t\t\t".'<rdf:li>'.
|
9539 |
$xmp .= "\t\t\t\t".'</rdf:Bag>'."\n";
|
9540 |
$xmp .= "\t\t\t".'</dc:subject>'."\n";
|
9541 |
$xmp .= "\t\t".'</rdf:Description>'."\n";
|
9542 |
// convert doc creation date format
|
9543 |
-
$dcdate =
|
9544 |
$doccreationdate = substr($dcdate, 0, 4).'-'.substr($dcdate, 4, 2).'-'.substr($dcdate, 6, 2);
|
9545 |
$doccreationdate .= 'T'.substr($dcdate, 8, 2).':'.substr($dcdate, 10, 2).':'.substr($dcdate, 12, 2);
|
9546 |
$doccreationdate .= substr($dcdate, 14, 3).':'.substr($dcdate, 18, 2);
|
9547 |
-
$doccreationdate =
|
9548 |
// convert doc modification date format
|
9549 |
-
$dmdate =
|
9550 |
$docmoddate = substr($dmdate, 0, 4).'-'.substr($dmdate, 4, 2).'-'.substr($dmdate, 6, 2);
|
9551 |
$docmoddate .= 'T'.substr($dmdate, 8, 2).':'.substr($dmdate, 10, 2).':'.substr($dmdate, 12, 2);
|
9552 |
$docmoddate .= substr($dmdate, 14, 3).':'.substr($dmdate, 18, 2);
|
9553 |
-
$docmoddate =
|
9554 |
$xmp .= "\t\t".'<rdf:Description rdf:about="" xmlns:xmp="http://ns.adobe.com/xap/1.0/">'."\n";
|
9555 |
$xmp .= "\t\t\t".'<xmp:CreateDate>'.$doccreationdate.'</xmp:CreateDate>'."\n";
|
9556 |
$xmp .= "\t\t\t".'<xmp:CreatorTool>'.$this->creator.'</xmp:CreatorTool>'."\n";
|
@@ -9558,8 +9558,8 @@ class DSGVOTCPDF {
|
|
9558 |
$xmp .= "\t\t\t".'<xmp:MetadataDate>'.$doccreationdate.'</xmp:MetadataDate>'."\n";
|
9559 |
$xmp .= "\t\t".'</rdf:Description>'."\n";
|
9560 |
$xmp .= "\t\t".'<rdf:Description rdf:about="" xmlns:pdf="http://ns.adobe.com/pdf/1.3/">'."\n";
|
9561 |
-
$xmp .= "\t\t\t".'<pdf:Keywords>'.
|
9562 |
-
$xmp .= "\t\t\t".'<pdf:Producer>'.
|
9563 |
$xmp .= "\t\t".'</rdf:Description>'."\n";
|
9564 |
$xmp .= "\t\t".'<rdf:Description rdf:about="" xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/">'."\n";
|
9565 |
$uuid = 'uuid:'.substr($this->file_id, 0, 8).'-'.substr($this->file_id, 8, 4).'-'.substr($this->file_id, 12, 4).'-'.substr($this->file_id, 16, 4).'-'.substr($this->file_id, 20, 12);
|
@@ -9681,10 +9681,10 @@ class DSGVOTCPDF {
|
|
9681 |
$out .= ' /Dests '.($this->n_dests).' 0 R';
|
9682 |
}
|
9683 |
$out .= $this->_putviewerpreferences();
|
9684 |
-
if (isset($this->LayoutMode) AND (!
|
9685 |
$out .= ' /PageLayout /'.$this->LayoutMode;
|
9686 |
}
|
9687 |
-
if (isset($this->PageMode) AND (!
|
9688 |
$out .= ' /PageMode /'.$this->PageMode;
|
9689 |
}
|
9690 |
if (count($this->outlines) > 0) {
|
@@ -9874,7 +9874,7 @@ class DSGVOTCPDF {
|
|
9874 |
if (isset($vp['PrintScaling'])) {
|
9875 |
$out .= ' /PrintScaling /'.$vp['PrintScaling'];
|
9876 |
}
|
9877 |
-
if (isset($vp['Duplex']) AND (!
|
9878 |
$out .= ' /Duplex /'.$vp['Duplex'];
|
9879 |
}
|
9880 |
if (isset($vp['PickTrayByPDFSize'])) {
|
@@ -10009,7 +10009,7 @@ class DSGVOTCPDF {
|
|
10009 |
// initialize array for graphics tranformation positions inside a page buffer
|
10010 |
$this->transfmrk[$this->page] = array();
|
10011 |
$this->state = 2;
|
10012 |
-
if (
|
10013 |
if (isset($this->CurOrientation)) {
|
10014 |
$orientation = $this->CurOrientation;
|
10015 |
} elseif ($this->fwPt > $this->fhPt) {
|
@@ -10020,7 +10020,7 @@ class DSGVOTCPDF {
|
|
10020 |
$orientation = 'P';
|
10021 |
}
|
10022 |
}
|
10023 |
-
if (
|
10024 |
$this->pagedim[$this->page] = $this->pagedim[($this->page - 1)];
|
10025 |
$this->setPageOrientation($orientation);
|
10026 |
} else {
|
@@ -10166,7 +10166,7 @@ class DSGVOTCPDF {
|
|
10166 |
$n = $this->n;
|
10167 |
}
|
10168 |
$s = $this->_encrypt_data($n, $s);
|
10169 |
-
return '('.
|
10170 |
}
|
10171 |
|
10172 |
/**
|
@@ -10177,7 +10177,7 @@ class DSGVOTCPDF {
|
|
10177 |
*/
|
10178 |
public function setDocCreationTimestamp($time) {
|
10179 |
if (is_string($time)) {
|
10180 |
-
$time =
|
10181 |
}
|
10182 |
$this->doc_creation_timestamp = intval($time);
|
10183 |
}
|
@@ -10190,7 +10190,7 @@ class DSGVOTCPDF {
|
|
10190 |
*/
|
10191 |
public function setDocModificationTimestamp($time) {
|
10192 |
if (is_string($time)) {
|
10193 |
-
$time =
|
10194 |
}
|
10195 |
$this->doc_modification_timestamp = intval($time);
|
10196 |
}
|
@@ -10227,7 +10227,7 @@ class DSGVOTCPDF {
|
|
10227 |
if ((empty($timestamp)) OR ($timestamp < 0)) {
|
10228 |
$timestamp = $this->doc_creation_timestamp;
|
10229 |
}
|
10230 |
-
return $this->_datastring('D:'.
|
10231 |
}
|
10232 |
|
10233 |
/**
|
@@ -10240,7 +10240,7 @@ class DSGVOTCPDF {
|
|
10240 |
protected function _textstring($s, $n=0) {
|
10241 |
if ($this->isunicode) {
|
10242 |
//Convert string to UTF-16BE
|
10243 |
-
$s =
|
10244 |
}
|
10245 |
return $this->_datastring($s, $n);
|
10246 |
}
|
@@ -10441,7 +10441,7 @@ class DSGVOTCPDF {
|
|
10441 |
// AES padding
|
10442 |
$objkey .= "\x73\x41\x6C\x54"; // sAlT
|
10443 |
}
|
10444 |
-
$objkey = substr(
|
10445 |
$objkey = substr($objkey, 0, 16);
|
10446 |
return $objkey;
|
10447 |
}
|
@@ -10462,15 +10462,15 @@ class DSGVOTCPDF {
|
|
10462 |
switch ($this->encryptdata['mode']) {
|
10463 |
case 0: // RC4-40
|
10464 |
case 1: { // RC4-128
|
10465 |
-
$s =
|
10466 |
break;
|
10467 |
}
|
10468 |
case 2: { // AES-128
|
10469 |
-
$s =
|
10470 |
break;
|
10471 |
}
|
10472 |
case 3: { // AES-256
|
10473 |
-
$s =
|
10474 |
break;
|
10475 |
}
|
10476 |
}
|
@@ -10572,9 +10572,9 @@ class DSGVOTCPDF {
|
|
10572 |
$out .= ' /R';
|
10573 |
if ($this->encryptdata['V'] == 5) { // AES-256
|
10574 |
$out .= ' 5';
|
10575 |
-
$out .= ' /OE ('.
|
10576 |
-
$out .= ' /UE ('.
|
10577 |
-
$out .= ' /Perms ('.
|
10578 |
} elseif ($this->encryptdata['V'] == 4) { // AES-128
|
10579 |
$out .= ' 4';
|
10580 |
} elseif ($this->encryptdata['V'] < 2) { // RC-40
|
@@ -10582,8 +10582,8 @@ class DSGVOTCPDF {
|
|
10582 |
} else { // RC-128
|
10583 |
$out .= ' 3';
|
10584 |
}
|
10585 |
-
$out .= ' /O ('.
|
10586 |
-
$out .= ' /U ('.
|
10587 |
$out .= ' /P '.$this->encryptdata['P'];
|
10588 |
if (isset($this->encryptdata['EncryptMetadata']) AND (!$this->encryptdata['EncryptMetadata'])) {
|
10589 |
$out .= ' /EncryptMetadata false';
|
@@ -10605,22 +10605,22 @@ class DSGVOTCPDF {
|
|
10605 |
*/
|
10606 |
protected function _Uvalue() {
|
10607 |
if ($this->encryptdata['mode'] == 0) { // RC4-40
|
10608 |
-
return
|
10609 |
} elseif ($this->encryptdata['mode'] < 3) { // RC4-128, AES-128
|
10610 |
-
$tmp =
|
10611 |
-
$enc =
|
10612 |
$len = strlen($tmp);
|
10613 |
for ($i = 1; $i <= 19; ++$i) {
|
10614 |
$ek = '';
|
10615 |
for ($j = 0; $j < $len; ++$j) {
|
10616 |
$ek .= chr(ord($this->encryptdata['key'][$j]) ^ $i);
|
10617 |
}
|
10618 |
-
$enc =
|
10619 |
}
|
10620 |
$enc .= str_repeat("\x00", 16);
|
10621 |
return substr($enc, 0, 32);
|
10622 |
} elseif ($this->encryptdata['mode'] == 3) { // AES-256
|
10623 |
-
$seed =
|
10624 |
// User Validation Salt
|
10625 |
$this->encryptdata['UVS'] = substr($seed, 0, 8);
|
10626 |
// User Key Salt
|
@@ -10638,7 +10638,7 @@ class DSGVOTCPDF {
|
|
10638 |
*/
|
10639 |
protected function _UEvalue() {
|
10640 |
$hashkey = hash('sha256', $this->encryptdata['user_password'].$this->encryptdata['UKS'], true);
|
10641 |
-
return
|
10642 |
}
|
10643 |
|
10644 |
/**
|
@@ -10650,14 +10650,14 @@ class DSGVOTCPDF {
|
|
10650 |
*/
|
10651 |
protected function _Ovalue() {
|
10652 |
if ($this->encryptdata['mode'] < 3) { // RC4-40, RC4-128, AES-128
|
10653 |
-
$tmp =
|
10654 |
if ($this->encryptdata['mode'] > 0) {
|
10655 |
for ($i = 0; $i < 50; ++$i) {
|
10656 |
-
$tmp =
|
10657 |
}
|
10658 |
}
|
10659 |
$owner_key = substr($tmp, 0, ($this->encryptdata['Length'] / 8));
|
10660 |
-
$enc =
|
10661 |
if ($this->encryptdata['mode'] > 0) {
|
10662 |
$len = strlen($owner_key);
|
10663 |
for ($i = 1; $i <= 19; ++$i) {
|
@@ -10665,12 +10665,12 @@ class DSGVOTCPDF {
|
|
10665 |
for ($j = 0; $j < $len; ++$j) {
|
10666 |
$ek .= chr(ord($owner_key[$j]) ^ $i);
|
10667 |
}
|
10668 |
-
$enc =
|
10669 |
}
|
10670 |
}
|
10671 |
return $enc;
|
10672 |
} elseif ($this->encryptdata['mode'] == 3) { // AES-256
|
10673 |
-
$seed =
|
10674 |
// Owner Validation Salt
|
10675 |
$this->encryptdata['OVS'] = substr($seed, 0, 8);
|
10676 |
// Owner Key Salt
|
@@ -10688,7 +10688,7 @@ class DSGVOTCPDF {
|
|
10688 |
*/
|
10689 |
protected function _OEvalue() {
|
10690 |
$hashkey = hash('sha256', $this->encryptdata['owner_password'].$this->encryptdata['OKS'].$this->encryptdata['U'], true);
|
10691 |
-
return
|
10692 |
}
|
10693 |
|
10694 |
/**
|
@@ -10701,9 +10701,9 @@ class DSGVOTCPDF {
|
|
10701 |
*/
|
10702 |
protected function _fixAES256Password($password) {
|
10703 |
$psw = ''; // password to be returned
|
10704 |
-
$psw_array =
|
10705 |
foreach ($psw_array as $c) {
|
10706 |
-
$psw .=
|
10707 |
}
|
10708 |
return substr($psw, 0, 127);
|
10709 |
}
|
@@ -10719,7 +10719,7 @@ class DSGVOTCPDF {
|
|
10719 |
if (!$this->encryptdata['pubkey']) { // standard mode
|
10720 |
if ($this->encryptdata['mode'] == 3) { // AES-256
|
10721 |
// generate 256 bit random key
|
10722 |
-
$this->encryptdata['key'] = substr(hash('sha256',
|
10723 |
// truncate passwords
|
10724 |
$this->encryptdata['user_password'] = $this->_fixAES256Password($this->encryptdata['user_password']);
|
10725 |
$this->encryptdata['owner_password'] = $this->_fixAES256Password($this->encryptdata['owner_password']);
|
@@ -10734,7 +10734,7 @@ class DSGVOTCPDF {
|
|
10734 |
// Compute P value
|
10735 |
$this->encryptdata['P'] = $this->encryptdata['protection'];
|
10736 |
// Computing the encryption dictionary's Perms (permissions) value
|
10737 |
-
$perms =
|
10738 |
$perms .= chr(255).chr(255).chr(255).chr(255); // bytes 4-7
|
10739 |
if (isset($this->encryptdata['CF']['EncryptMetadata']) AND (!$this->encryptdata['CF']['EncryptMetadata'])) { // byte 8
|
10740 |
$perms .= 'F';
|
@@ -10743,20 +10743,20 @@ class DSGVOTCPDF {
|
|
10743 |
}
|
10744 |
$perms .= 'adb'; // bytes 9-11
|
10745 |
$perms .= 'nick'; // bytes 12-15
|
10746 |
-
$this->encryptdata['perms'] =
|
10747 |
} else { // RC4-40, RC4-128, AES-128
|
10748 |
// Pad passwords
|
10749 |
-
$this->encryptdata['user_password'] = substr($this->encryptdata['user_password'].
|
10750 |
-
$this->encryptdata['owner_password'] = substr($this->encryptdata['owner_password'].
|
10751 |
// Compute O value
|
10752 |
$this->encryptdata['O'] = $this->_Ovalue();
|
10753 |
// get default permissions (reverse byte order)
|
10754 |
-
$permissions =
|
10755 |
// Compute encryption key
|
10756 |
-
$tmp =
|
10757 |
if ($this->encryptdata['mode'] > 0) {
|
10758 |
for ($i = 0; $i < 50; ++$i) {
|
10759 |
-
$tmp =
|
10760 |
}
|
10761 |
}
|
10762 |
$this->encryptdata['key'] = substr($tmp, 0, $keybytelen);
|
@@ -10767,29 +10767,29 @@ class DSGVOTCPDF {
|
|
10767 |
}
|
10768 |
} else { // Public-Key mode
|
10769 |
// random 20-byte seed
|
10770 |
-
$seed = sha1(
|
10771 |
$recipient_bytes = '';
|
10772 |
foreach ($this->encryptdata['pubkeys'] as $pubkey) {
|
10773 |
// for each public certificate
|
10774 |
if (isset($pubkey['p'])) {
|
10775 |
-
$pkprotection =
|
10776 |
} else {
|
10777 |
$pkprotection = $this->encryptdata['protection'];
|
10778 |
}
|
10779 |
// get default permissions (reverse byte order)
|
10780 |
-
$pkpermissions =
|
10781 |
// envelope data
|
10782 |
$envelope = $seed.$pkpermissions;
|
10783 |
// write the envelope data to a temporary file
|
10784 |
-
$tempkeyfile =
|
10785 |
-
$f =
|
10786 |
if (!$f) {
|
10787 |
$this->Error('Unable to create temporary key file: '.$tempkeyfile);
|
10788 |
}
|
10789 |
$envelope_length = strlen($envelope);
|
10790 |
fwrite($f, $envelope, $envelope_length);
|
10791 |
fclose($f);
|
10792 |
-
$tempencfile =
|
10793 |
if (!openssl_pkcs7_encrypt($tempkeyfile, $tempencfile, $pubkey['c'], array(), PKCS7_BINARY | PKCS7_DETACHED)) {
|
10794 |
$this->Error('Unable to encrypt the file: '.$tempkeyfile);
|
10795 |
}
|
@@ -10837,7 +10837,7 @@ class DSGVOTCPDF {
|
|
10837 |
// encryption is not allowed in PDF/A mode
|
10838 |
return;
|
10839 |
}
|
10840 |
-
$this->encryptdata['protection'] =
|
10841 |
if (($pubkeys !== null) AND (is_array($pubkeys))) {
|
10842 |
// public-key mode
|
10843 |
$this->encryptdata['pubkeys'] = $pubkeys;
|
@@ -10876,7 +10876,7 @@ class DSGVOTCPDF {
|
|
10876 |
}
|
10877 |
}
|
10878 |
if ($owner_pass === null) {
|
10879 |
-
$owner_pass = md5(
|
10880 |
}
|
10881 |
$this->encryptdata['user_password'] = $user_pass;
|
10882 |
$this->encryptdata['owner_password'] = $owner_pass;
|
@@ -10922,7 +10922,7 @@ class DSGVOTCPDF {
|
|
10922 |
}
|
10923 |
}
|
10924 |
$this->encrypted = true;
|
10925 |
-
$this->encryptdata['fileid'] =
|
10926 |
$this->_generateencryptionkey();
|
10927 |
}
|
10928 |
|
@@ -11529,7 +11529,7 @@ class DSGVOTCPDF {
|
|
11529 |
}
|
11530 |
}
|
11531 |
if (!empty($style)) {
|
11532 |
-
$op =
|
11533 |
$this->_outRect($x, $y, $w, $h, $op);
|
11534 |
}
|
11535 |
if (!empty($border_style)) {
|
@@ -11582,7 +11582,7 @@ class DSGVOTCPDF {
|
|
11582 |
if (!(false === strpos($style, 'F')) AND isset($fill_color)) {
|
11583 |
$this->SetFillColorArray($fill_color);
|
11584 |
}
|
11585 |
-
$op =
|
11586 |
if ($line_style) {
|
11587 |
$this->SetLineStyle($line_style);
|
11588 |
}
|
@@ -11612,7 +11612,7 @@ class DSGVOTCPDF {
|
|
11612 |
if (!(false === strpos($style, 'F')) AND isset($fill_color)) {
|
11613 |
$this->SetFillColorArray($fill_color);
|
11614 |
}
|
11615 |
-
$op =
|
11616 |
if ($op == 'f') {
|
11617 |
$line_style = array();
|
11618 |
}
|
@@ -11649,13 +11649,13 @@ class DSGVOTCPDF {
|
|
11649 |
if ($this->state != 2) {
|
11650 |
return;
|
11651 |
}
|
11652 |
-
if (
|
11653 |
$ry = $rx;
|
11654 |
}
|
11655 |
if (!(false === strpos($style, 'F')) AND isset($fill_color)) {
|
11656 |
$this->SetFillColorArray($fill_color);
|
11657 |
}
|
11658 |
-
$op =
|
11659 |
if ($op == 'f') {
|
11660 |
$line_style = array();
|
11661 |
}
|
@@ -11874,7 +11874,7 @@ class DSGVOTCPDF {
|
|
11874 |
if (!(false === strpos($style, 'F')) AND isset($fill_color)) {
|
11875 |
$this->SetFillColorArray($fill_color);
|
11876 |
}
|
11877 |
-
$op =
|
11878 |
if ($op == 'f') {
|
11879 |
$line_style = array();
|
11880 |
}
|
@@ -12077,7 +12077,7 @@ class DSGVOTCPDF {
|
|
12077 |
if (!(false === strpos($style, 'F')) AND isset($fill_color)) {
|
12078 |
$this->SetFillColorArray($fill_color);
|
12079 |
}
|
12080 |
-
$op =
|
12081 |
if ($op == 'f') {
|
12082 |
$border_style = array();
|
12083 |
}
|
@@ -12201,8 +12201,8 @@ class DSGVOTCPDF {
|
|
12201 |
*/
|
12202 |
public function setDestination($name, $y=-1, $page='', $x=-1) {
|
12203 |
// remove unsupported characters
|
12204 |
-
$name =
|
12205 |
-
if (
|
12206 |
return false;
|
12207 |
}
|
12208 |
if ($y == -1) {
|
@@ -12421,7 +12421,7 @@ class DSGVOTCPDF {
|
|
12421 |
if (is_string($o['u'])) {
|
12422 |
if ($o['u'][0] == '#') {
|
12423 |
// internal destination
|
12424 |
-
$out .= ' /Dest /'.
|
12425 |
} elseif ($o['u'][0] == '%') {
|
12426 |
// embedded PDF file
|
12427 |
$filename = basename(substr($o['u'], 1));
|
@@ -12584,7 +12584,7 @@ class DSGVOTCPDF {
|
|
12584 |
$this->javascript .= 'f'.$name.'.textSize='.$this->FontSizePt.";\n";
|
12585 |
while (list($key, $val) = each($prop)) {
|
12586 |
if (strcmp(substr($key, -5), 'Color') == 0) {
|
12587 |
-
$val =
|
12588 |
} else {
|
12589 |
$val = "'".$val."'";
|
12590 |
}
|
@@ -12654,7 +12654,7 @@ class DSGVOTCPDF {
|
|
12654 |
// get default style
|
12655 |
$prop = array_merge($this->getFormDefaultProp(), $prop);
|
12656 |
// get annotation data
|
12657 |
-
$popt =
|
12658 |
// set default appearance stream
|
12659 |
$this->annotation_fonts[$this->CurrentFont['fontkey']] = $this->CurrentFont['i'];
|
12660 |
$fontstyle = sprintf('/F%d %F Tf %s', $this->CurrentFont['i'], $this->FontSizePt, $this->TextColor);
|
@@ -12772,7 +12772,7 @@ class DSGVOTCPDF {
|
|
12772 |
$this->_addfield('radiobutton', $name, $x, $y, $w, $w, $prop);
|
12773 |
return;
|
12774 |
}
|
12775 |
-
if (
|
12776 |
$onvalue = 'On';
|
12777 |
}
|
12778 |
if ($checked) {
|
@@ -12807,7 +12807,7 @@ class DSGVOTCPDF {
|
|
12807 |
$prop['Radio'] = 'true';
|
12808 |
$prop['borderStyle'] = 'inset';
|
12809 |
// get annotation data
|
12810 |
-
$popt =
|
12811 |
// set additional default options
|
12812 |
$this->annotation_fonts[$tmpfont['fontkey']] = $tmpfont['i'];
|
12813 |
$fontstyle = sprintf('/F%d %F Tf %s', $tmpfont['i'], $this->FontSizePt, $this->TextColor);
|
@@ -12887,7 +12887,7 @@ class DSGVOTCPDF {
|
|
12887 |
// get default style
|
12888 |
$prop = array_merge($this->getFormDefaultProp(), $prop);
|
12889 |
// get annotation data
|
12890 |
-
$popt =
|
12891 |
// set additional default values
|
12892 |
$this->annotation_fonts[$this->CurrentFont['fontkey']] = $this->CurrentFont['i'];
|
12893 |
$fontstyle = sprintf('/F%d %F Tf %s', $this->CurrentFont['i'], $this->FontSizePt, $this->TextColor);
|
@@ -12974,7 +12974,7 @@ class DSGVOTCPDF {
|
|
12974 |
$prop = array_merge($this->getFormDefaultProp(), $prop);
|
12975 |
$prop['Combo'] = true;
|
12976 |
// get annotation data
|
12977 |
-
$popt =
|
12978 |
// set additional default options
|
12979 |
$this->annotation_fonts[$this->CurrentFont['fontkey']] = $this->CurrentFont['i'];
|
12980 |
$fontstyle = sprintf('/F%d %F Tf %s', $this->CurrentFont['i'], $this->FontSizePt, $this->TextColor);
|
@@ -13055,7 +13055,7 @@ class DSGVOTCPDF {
|
|
13055 |
$prop = array_merge($this->getFormDefaultProp(), $prop);
|
13056 |
$prop['borderStyle'] = 'inset';
|
13057 |
// get annotation data
|
13058 |
-
$popt =
|
13059 |
// set additional default options
|
13060 |
$font = 'zapfdingbats';
|
13061 |
if ($this->pdfa_mode) {
|
@@ -13080,7 +13080,7 @@ class DSGVOTCPDF {
|
|
13080 |
$opt['Subtype'] = 'Widget';
|
13081 |
$opt['ft'] = 'Btn';
|
13082 |
$opt['t'] = $name;
|
13083 |
-
if (
|
13084 |
$onvalue = 'Yes';
|
13085 |
}
|
13086 |
$opt['opt'] = array($onvalue);
|
@@ -13138,7 +13138,7 @@ class DSGVOTCPDF {
|
|
13138 |
$prop['highlight'] = 'push';
|
13139 |
$prop['display'] = 'display.noPrint';
|
13140 |
// get annotation data
|
13141 |
-
$popt =
|
13142 |
$this->annotation_fonts[$this->CurrentFont['fontkey']] = $this->CurrentFont['i'];
|
13143 |
$fontstyle = sprintf('/F%d %F Tf %s', $this->CurrentFont['i'], $this->FontSizePt, $this->TextColor);
|
13144 |
$popt['da'] = $fontstyle;
|
@@ -13291,7 +13291,7 @@ class DSGVOTCPDF {
|
|
13291 |
$out .= '<< /Type /Sig';
|
13292 |
$out .= ' /Filter /Adobe.PPKLite';
|
13293 |
$out .= ' /SubFilter /adbe.pkcs7.detached';
|
13294 |
-
$out .= ' '.
|
13295 |
$out .= ' /Contents<'.str_repeat('0', $this->signature_max_length).'>';
|
13296 |
if (empty($this->signature_data['approval']) OR ($this->signature_data['approval'] != 'A')) {
|
13297 |
$out .= ' /Reference ['; // array of signature reference dictionaries
|
@@ -13307,22 +13307,22 @@ class DSGVOTCPDF {
|
|
13307 |
$out .= ' /TransformParams <<';
|
13308 |
$out .= ' /Type /TransformParams';
|
13309 |
$out .= ' /V /2.2';
|
13310 |
-
if (!
|
13311 |
$out .= ' /Document['.$this->ur['document'].']';
|
13312 |
}
|
13313 |
-
if (!
|
13314 |
$out .= ' /Form['.$this->ur['form'].']';
|
13315 |
}
|
13316 |
-
if (!
|
13317 |
$out .= ' /Signature['.$this->ur['signature'].']';
|
13318 |
}
|
13319 |
-
if (!
|
13320 |
$out .= ' /Annots['.$this->ur['annots'].']';
|
13321 |
}
|
13322 |
-
if (!
|
13323 |
$out .= ' /EF['.$this->ur['ef'].']';
|
13324 |
}
|
13325 |
-
if (!
|
13326 |
$out .= ' /FormEX['.$this->ur['formex'].']';
|
13327 |
}
|
13328 |
}
|
@@ -13335,16 +13335,16 @@ class DSGVOTCPDF {
|
|
13335 |
$out .= ' >>';
|
13336 |
$out .= ' ]'; // end of reference
|
13337 |
}
|
13338 |
-
if (isset($this->signature_data['info']['Name']) AND !
|
13339 |
$out .= ' /Name '.$this->_textstring($this->signature_data['info']['Name'], $sigobjid);
|
13340 |
}
|
13341 |
-
if (isset($this->signature_data['info']['Location']) AND !
|
13342 |
$out .= ' /Location '.$this->_textstring($this->signature_data['info']['Location'], $sigobjid);
|
13343 |
}
|
13344 |
-
if (isset($this->signature_data['info']['Reason']) AND !
|
13345 |
$out .= ' /Reason '.$this->_textstring($this->signature_data['info']['Reason'], $sigobjid);
|
13346 |
}
|
13347 |
-
if (isset($this->signature_data['info']['ContactInfo']) AND !
|
13348 |
$out .= ' /ContactInfo '.$this->_textstring($this->signature_data['info']['ContactInfo'], $sigobjid);
|
13349 |
}
|
13350 |
$out .= ' /M '.$this->_datestring($sigobjid, $this->doc_modification_timestamp);
|
@@ -13579,7 +13579,7 @@ class DSGVOTCPDF {
|
|
13579 |
*/
|
13580 |
public function getAliasRightShift() {
|
13581 |
// calculate aproximatively the ratio between widths of aliases and replacements.
|
13582 |
-
$ref = '{'.
|
13583 |
$rep = str_repeat(' ', $this->GetNumChars($ref));
|
13584 |
$wrep = $this->GetStringWidth($rep);
|
13585 |
if ($wrep > 0) {
|
@@ -13588,7 +13588,7 @@ class DSGVOTCPDF {
|
|
13588 |
$wdiff = 1;
|
13589 |
}
|
13590 |
$sdiff = sprintf('%F', $wdiff);
|
13591 |
-
$alias =
|
13592 |
if ($this->isUnicodeFont()) {
|
13593 |
$alias = '{'.$alias;
|
13594 |
}
|
@@ -13605,9 +13605,9 @@ class DSGVOTCPDF {
|
|
13605 |
*/
|
13606 |
public function getAliasNbPages() {
|
13607 |
if ($this->isUnicodeFont()) {
|
13608 |
-
return '{'.
|
13609 |
}
|
13610 |
-
return
|
13611 |
}
|
13612 |
|
13613 |
/**
|
@@ -13620,9 +13620,9 @@ class DSGVOTCPDF {
|
|
13620 |
*/
|
13621 |
public function getAliasNumPage() {
|
13622 |
if ($this->isUnicodeFont()) {
|
13623 |
-
|
13624 |
}
|
13625 |
-
return
|
13626 |
}
|
13627 |
|
13628 |
/**
|
@@ -13635,9 +13635,9 @@ class DSGVOTCPDF {
|
|
13635 |
*/
|
13636 |
public function getPageGroupAlias() {
|
13637 |
if ($this->isUnicodeFont()) {
|
13638 |
-
|
13639 |
}
|
13640 |
-
return
|
13641 |
}
|
13642 |
|
13643 |
/**
|
@@ -13650,9 +13650,9 @@ class DSGVOTCPDF {
|
|
13650 |
*/
|
13651 |
public function getPageNumGroupAlias() {
|
13652 |
if ($this->isUnicodeFont()) {
|
13653 |
-
|
13654 |
}
|
13655 |
-
return
|
13656 |
}
|
13657 |
|
13658 |
/**
|
@@ -13672,7 +13672,7 @@ class DSGVOTCPDF {
|
|
13672 |
* @see PaneNo(), formatPageNumber()
|
13673 |
*/
|
13674 |
public function getGroupPageNoFormatted() {
|
13675 |
-
return
|
13676 |
}
|
13677 |
|
13678 |
/**
|
@@ -13682,7 +13682,7 @@ class DSGVOTCPDF {
|
|
13682 |
* @see PaneNo(), formatPageNumber()
|
13683 |
*/
|
13684 |
public function PageNoFormatted() {
|
13685 |
-
|
13686 |
}
|
13687 |
|
13688 |
/**
|
@@ -13868,7 +13868,7 @@ class DSGVOTCPDF {
|
|
13868 |
return;
|
13869 |
}
|
13870 |
$stroking = $stroking ? true : false;
|
13871 |
-
if (
|
13872 |
// default value if not set
|
13873 |
$nonstroking = $stroking;
|
13874 |
} else {
|
@@ -13908,7 +13908,7 @@ class DSGVOTCPDF {
|
|
13908 |
return;
|
13909 |
}
|
13910 |
$stroking = floatval($stroking);
|
13911 |
-
if (
|
13912 |
// default value if not set
|
13913 |
$nonstroking = $stroking;
|
13914 |
} else {
|
@@ -14126,7 +14126,7 @@ class DSGVOTCPDF {
|
|
14126 |
}
|
14127 |
default: { // SPECIFIC SPOT COLOR NAME
|
14128 |
$col_a = array(0,0,0,0,'None');
|
14129 |
-
$col_b =
|
14130 |
if ($col_b === false) {
|
14131 |
// in case of error defaults to the registration color
|
14132 |
$col_b = array(100,100,100,100,'All');
|
@@ -14790,7 +14790,7 @@ class DSGVOTCPDF {
|
|
14790 |
if ($this->rtl) {
|
14791 |
$xc = ($this->w - $xc);
|
14792 |
}
|
14793 |
-
$op =
|
14794 |
if ($op == 'f') {
|
14795 |
$line_style = array();
|
14796 |
}
|
@@ -14847,7 +14847,7 @@ class DSGVOTCPDF {
|
|
14847 |
if ($file[0] === '@') { // image from string
|
14848 |
$data = substr($file, 1);
|
14849 |
} else { // EPS/AI file
|
14850 |
-
$data =
|
14851 |
}
|
14852 |
if ($data === FALSE) {
|
14853 |
$this->Error('EPS file not found: '.$file);
|
@@ -15191,7 +15191,7 @@ class DSGVOTCPDF {
|
|
15191 |
* @public
|
15192 |
*/
|
15193 |
public function write1DBarcode($code, $type, $x='', $y='', $w='', $h='', $xres='', $style='', $align='') {
|
15194 |
-
if (
|
15195 |
return;
|
15196 |
}
|
15197 |
require_once(dirname(__FILE__).'/tcpdf_barcodes_1d.php');
|
@@ -15298,7 +15298,7 @@ class DSGVOTCPDF {
|
|
15298 |
if ($style['stretch']) {
|
15299 |
$xres = $max_xres;
|
15300 |
} else {
|
15301 |
-
if (
|
15302 |
$xres = (0.141 * $this->k); // default bar width = 0.4 mm
|
15303 |
}
|
15304 |
if ($xres > $max_xres) {
|
@@ -15435,7 +15435,7 @@ class DSGVOTCPDF {
|
|
15435 |
}
|
15436 |
// print text
|
15437 |
if ($style['text']) {
|
15438 |
-
if (isset($style['label']) AND !
|
15439 |
$label = $style['label'];
|
15440 |
} else {
|
15441 |
$label = $code;
|
@@ -15510,7 +15510,7 @@ class DSGVOTCPDF {
|
|
15510 |
* @public
|
15511 |
*/
|
15512 |
public function write2DBarcode($code, $type, $x='', $y='', $w='', $h='', $style='', $align='', $distort=false) {
|
15513 |
-
if (
|
15514 |
return;
|
15515 |
}
|
15516 |
require_once(dirname(__FILE__).'/tcpdf_barcodes_2d.php');
|
@@ -15826,7 +15826,7 @@ class DSGVOTCPDF {
|
|
15826 |
* @see setHtmlVSpace()
|
15827 |
*/
|
15828 |
public function fixHTMLCode($html, $default_css='', $tagvs='', $tidy_options='') {
|
15829 |
-
return
|
15830 |
}
|
15831 |
|
15832 |
/**
|
@@ -15931,7 +15931,7 @@ class DSGVOTCPDF {
|
|
15931 |
return array();
|
15932 |
}
|
15933 |
$border['width'] = $this->getCSSBorderWidth($width);
|
15934 |
-
$border['color'] =
|
15935 |
return $border;
|
15936 |
}
|
15937 |
|
@@ -16189,8 +16189,8 @@ class DSGVOTCPDF {
|
|
16189 |
* @public
|
16190 |
*/
|
16191 |
public function getHTMLFontUnits($val, $refsize=12, $parent_size=12, $defaultunit='pt') {
|
16192 |
-
$refsize =
|
16193 |
-
$parent_size =
|
16194 |
switch ($val) {
|
16195 |
case 'xx-small': {
|
16196 |
$size = ($refsize - 4);
|
@@ -16267,9 +16267,9 @@ class DSGVOTCPDF {
|
|
16267 |
$type = array();
|
16268 |
if (preg_match('/href[\s]*=[\s]*"([^"]*)"/', $link, $type) > 0) {
|
16269 |
// read CSS data file
|
16270 |
-
$cssdata =
|
16271 |
if (($cssdata !== FALSE) AND (strlen($cssdata) > 0)) {
|
16272 |
-
$css = array_merge($css,
|
16273 |
}
|
16274 |
}
|
16275 |
}
|
@@ -16286,7 +16286,7 @@ class DSGVOTCPDF {
|
|
16286 |
// (all, braille, embossed, handheld, print, projection, screen, speech, tty, tv)
|
16287 |
if (empty($type) OR (isset($type[1]) AND (($type[1] == 'all') OR ($type[1] == 'print')))) {
|
16288 |
$cssdata = $matches[2][$key];
|
16289 |
-
$css = array_merge($css,
|
16290 |
}
|
16291 |
}
|
16292 |
}
|
@@ -16489,7 +16489,7 @@ class DSGVOTCPDF {
|
|
16489 |
}
|
16490 |
// store header rows on a new table
|
16491 |
if (($dom[$key]['value'] == 'tr') AND ($dom[($dom[$key]['parent'])]['thead'] === true)) {
|
16492 |
-
if (
|
16493 |
$dom[($dom[($dom[$key]['parent'])]['parent'])]['thead'] = $csstagarray.$a[$dom[($dom[($dom[$key]['parent'])]['parent'])]['elkey']];
|
16494 |
}
|
16495 |
for ($i = $dom[$key]['parent']; $i <= $key; ++$i) {
|
@@ -16501,7 +16501,7 @@ class DSGVOTCPDF {
|
|
16501 |
// header elements must be always contained in a single page
|
16502 |
$dom[($dom[$key]['parent'])]['attribute']['nobr'] = 'true';
|
16503 |
}
|
16504 |
-
if (($dom[$key]['value'] == 'table') AND (!
|
16505 |
// remove the nobr attributes from the table header
|
16506 |
$dom[($dom[$key]['parent'])]['thead'] = str_replace(' nobr="true"', '', $dom[($dom[$key]['parent'])]['thead']);
|
16507 |
$dom[($dom[$key]['parent'])]['thead'] .= '</tablehead>';
|
@@ -16550,8 +16550,8 @@ class DSGVOTCPDF {
|
|
16550 |
}
|
16551 |
if (!empty($css)) {
|
16552 |
// merge CSS style to current style
|
16553 |
-
list($dom[$key]['csssel'], $dom[$key]['cssdata']) =
|
16554 |
-
$dom[$key]['attribute']['style'] =
|
16555 |
}
|
16556 |
// split style attributes
|
16557 |
if (isset($dom[$key]['attribute']['style']) AND !empty($dom[$key]['attribute']['style'])) {
|
@@ -16648,21 +16648,21 @@ class DSGVOTCPDF {
|
|
16648 |
$dom[$key]['fontstyle'] .= 'I';
|
16649 |
}
|
16650 |
// font color
|
16651 |
-
if (isset($dom[$key]['style']['color']) AND (!
|
16652 |
-
$dom[$key]['fgcolor'] =
|
16653 |
} elseif ($dom[$key]['value'] == 'a') {
|
16654 |
$dom[$key]['fgcolor'] = $this->htmlLinkColorArray;
|
16655 |
}
|
16656 |
// background color
|
16657 |
-
if (isset($dom[$key]['style']['background-color']) AND (!
|
16658 |
-
$dom[$key]['bgcolor'] =
|
16659 |
}
|
16660 |
// text-decoration
|
16661 |
if (isset($dom[$key]['style']['text-decoration'])) {
|
16662 |
$decors = explode(' ', strtolower($dom[$key]['style']['text-decoration']));
|
16663 |
foreach ($decors as $dec) {
|
16664 |
$dec = trim($dec);
|
16665 |
-
if (!
|
16666 |
if ($dec[0] == 'u') {
|
16667 |
// underline
|
16668 |
$dom[$key]['fontstyle'] .= 'U';
|
@@ -16700,16 +16700,16 @@ class DSGVOTCPDF {
|
|
16700 |
if (isset($dom[$key]['style']['border-color'])) {
|
16701 |
$brd_colors = preg_split('/[\s]+/', trim($dom[$key]['style']['border-color']));
|
16702 |
if (isset($brd_colors[3])) {
|
16703 |
-
$dom[$key]['border']['L']['color'] =
|
16704 |
}
|
16705 |
if (isset($brd_colors[1])) {
|
16706 |
-
$dom[$key]['border']['R']['color'] =
|
16707 |
}
|
16708 |
if (isset($brd_colors[0])) {
|
16709 |
-
$dom[$key]['border']['T']['color'] =
|
16710 |
}
|
16711 |
if (isset($brd_colors[2])) {
|
16712 |
-
$dom[$key]['border']['B']['color'] =
|
16713 |
}
|
16714 |
}
|
16715 |
if (isset($dom[$key]['style']['border-width'])) {
|
@@ -16771,7 +16771,7 @@ class DSGVOTCPDF {
|
|
16771 |
}
|
16772 |
}
|
16773 |
if (isset($dom[$key]['style']['border-'.$bsv.'-color'])) {
|
16774 |
-
$dom[$key]['border'][$bsk]['color'] =
|
16775 |
}
|
16776 |
if (isset($dom[$key]['style']['border-'.$bsv.'-width'])) {
|
16777 |
$dom[$key]['border'][$bsk]['width'] = $this->getCSSBorderWidth($dom[$key]['style']['border-'.$bsv.'-width']);
|
@@ -16866,7 +16866,7 @@ class DSGVOTCPDF {
|
|
16866 |
}
|
16867 |
// force natural alignment for lists
|
16868 |
if ((($dom[$key]['value'] == 'ul') OR ($dom[$key]['value'] == 'ol') OR ($dom[$key]['value'] == 'dl'))
|
16869 |
-
AND (!isset($dom[$key]['align']) OR
|
16870 |
if ($this->rtl) {
|
16871 |
$dom[$key]['align'] = 'R';
|
16872 |
} else {
|
@@ -16938,18 +16938,18 @@ class DSGVOTCPDF {
|
|
16938 |
$dom[$key]['dir'] = $dom[$key]['attribute']['dir'];
|
16939 |
}
|
16940 |
// set foreground color attribute
|
16941 |
-
if (isset($dom[$key]['attribute']['color']) AND (!
|
16942 |
-
$dom[$key]['fgcolor'] =
|
16943 |
} elseif (!isset($dom[$key]['style']['color']) AND ($dom[$key]['value'] == 'a')) {
|
16944 |
$dom[$key]['fgcolor'] = $this->htmlLinkColorArray;
|
16945 |
}
|
16946 |
// set background color attribute
|
16947 |
-
if (isset($dom[$key]['attribute']['bgcolor']) AND (!
|
16948 |
-
$dom[$key]['bgcolor'] =
|
16949 |
}
|
16950 |
// set stroke color attribute
|
16951 |
-
if (isset($dom[$key]['attribute']['strokecolor']) AND (!
|
16952 |
-
$dom[$key]['strokecolor'] =
|
16953 |
}
|
16954 |
// check for width attribute
|
16955 |
if (isset($dom[$key]['attribute']['width'])) {
|
@@ -16960,7 +16960,7 @@ class DSGVOTCPDF {
|
|
16960 |
$dom[$key]['height'] = $dom[$key]['attribute']['height'];
|
16961 |
}
|
16962 |
// check for text alignment
|
16963 |
-
if (isset($dom[$key]['attribute']['align']) AND (!
|
16964 |
$dom[$key]['align'] = strtoupper($dom[$key]['attribute']['align'][0]);
|
16965 |
}
|
16966 |
// check for text rendering mode (the following attributes do not exist in HTML)
|
@@ -17198,7 +17198,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
17198 |
$this->listordered = array();
|
17199 |
$this->listcount = array();
|
17200 |
$this->lispacer = '';
|
17201 |
-
if ((
|
17202 |
// reset row height
|
17203 |
$this->resetLastH();
|
17204 |
}
|
@@ -17287,7 +17287,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
17287 |
}
|
17288 |
// print THEAD block
|
17289 |
if (($dom[$key]['value'] == 'tr') AND isset($dom[$key]['thead']) AND $dom[$key]['thead']) {
|
17290 |
-
if (isset($dom[$key]['parent']) AND isset($dom[$dom[$key]['parent']]['thead']) AND !
|
17291 |
$this->inthead = true;
|
17292 |
// print table header (thead)
|
17293 |
$this->writeHTML($this->thead, false, false, false, false, '');
|
@@ -17541,7 +17541,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
17541 |
if (isset($dom[$key]['align'])) {
|
17542 |
$lalign = $dom[$key]['align'];
|
17543 |
}
|
17544 |
-
if (
|
17545 |
$lalign = $align;
|
17546 |
}
|
17547 |
}
|
@@ -17610,14 +17610,14 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
17610 |
$no = 0; // number of spaces on a line contained on a single block
|
17611 |
if ($this->isRTLTextDir()) { // RTL
|
17612 |
// remove left space if exist
|
17613 |
-
$pos1 =
|
17614 |
if ($pos1 > 0) {
|
17615 |
$pos1 = intval($pos1);
|
17616 |
if ($this->isUnicodeFont()) {
|
17617 |
-
$pos2 = intval(
|
17618 |
$spacelen = 2;
|
17619 |
} else {
|
17620 |
-
$pos2 = intval(
|
17621 |
$spacelen = 1;
|
17622 |
}
|
17623 |
if ($pos1 == $pos2) {
|
@@ -17631,14 +17631,14 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
17631 |
}
|
17632 |
} else { // LTR
|
17633 |
// remove right space if exist
|
17634 |
-
$pos1 =
|
17635 |
if ($pos1 > 0) {
|
17636 |
$pos1 = intval($pos1);
|
17637 |
if ($this->isUnicodeFont()) {
|
17638 |
-
$pos2 = intval(
|
17639 |
$spacelen = 2;
|
17640 |
} else {
|
17641 |
-
$pos2 = intval(
|
17642 |
$spacelen = 1;
|
17643 |
}
|
17644 |
if ($pos1 == $pos2) {
|
@@ -17779,7 +17779,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
17779 |
}
|
17780 |
case 're': {
|
17781 |
// justify block
|
17782 |
-
if (!
|
17783 |
$this->lispacer = '';
|
17784 |
continue;
|
17785 |
}
|
@@ -18296,7 +18296,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
18296 |
}
|
18297 |
} elseif (strlen($dom[$key]['value']) > 0) {
|
18298 |
// print list-item
|
18299 |
-
if (!
|
18300 |
$this->SetFont($pfontname, $pfontstyle, $pfontsize);
|
18301 |
$this->resetLastH();
|
18302 |
$minstartliney = $this->y;
|
@@ -18395,7 +18395,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
18395 |
$tmp_fontsize = isset($dom[$nkey]['fontsize']) ? $dom[$nkey]['fontsize'] : $this->FontSizePt;
|
18396 |
$same_textdir = ($dom[$nkey]['dir'] == $dom[$key]['dir']);
|
18397 |
} else {
|
18398 |
-
$nextstr =
|
18399 |
if (isset($nextstr[0]) AND $same_textdir) {
|
18400 |
$wadj += $this->GetStringWidth($nextstr[0], $tmp_fontname, $tmp_fontstyle, $tmp_fontsize);
|
18401 |
if (isset($nextstr[1])) {
|
@@ -18408,7 +18408,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
18408 |
}
|
18409 |
if (($wadj > 0) AND (($strlinelen + $wadj) >= $cwa)) {
|
18410 |
$wadj = 0;
|
18411 |
-
$nextstr =
|
18412 |
$numblks = count($nextstr);
|
18413 |
if ($numblks > 1) {
|
18414 |
// try to split on blank spaces
|
@@ -18557,14 +18557,14 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
18557 |
$no = 0; // number of spaces on a line contained on a single block
|
18558 |
if ($this->isRTLTextDir()) { // RTL
|
18559 |
// remove left space if exist
|
18560 |
-
$pos1 =
|
18561 |
if ($pos1 > 0) {
|
18562 |
$pos1 = intval($pos1);
|
18563 |
if ($this->isUnicodeFont()) {
|
18564 |
-
$pos2 = intval(
|
18565 |
$spacelen = 2;
|
18566 |
} else {
|
18567 |
-
$pos2 = intval(
|
18568 |
$spacelen = 1;
|
18569 |
}
|
18570 |
if ($pos1 == $pos2) {
|
@@ -18578,14 +18578,14 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
18578 |
}
|
18579 |
} else { // LTR
|
18580 |
// remove right space if exist
|
18581 |
-
$pos1 =
|
18582 |
if ($pos1 > 0) {
|
18583 |
$pos1 = intval($pos1);
|
18584 |
if ($this->isUnicodeFont()) {
|
18585 |
-
$pos2 = intval(
|
18586 |
$spacelen = 2;
|
18587 |
} else {
|
18588 |
-
$pos2 = intval(
|
18589 |
$spacelen = 1;
|
18590 |
}
|
18591 |
if ($pos1 == $pos2) {
|
@@ -18743,7 +18743,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
18743 |
if (!isset($dom[$key]['attribute']['nested']) OR ($dom[$key]['attribute']['nested'] != 'true')) {
|
18744 |
$this->htmlvspace = 0;
|
18745 |
// set table header
|
18746 |
-
if (!
|
18747 |
// set table header
|
18748 |
$this->thead = $dom[$key]['thead'];
|
18749 |
if (!isset($this->theadMargins) OR (empty($this->theadMargins))) {
|
@@ -18822,7 +18822,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
18822 |
$type = '';
|
18823 |
} else {
|
18824 |
// get image type
|
18825 |
-
|
18826 |
}
|
18827 |
if (!isset($tag['width'])) {
|
18828 |
$tag['width'] = 0;
|
@@ -18856,7 +18856,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
18856 |
$prevy = $this->y;
|
18857 |
$xpos = $this->x;
|
18858 |
$imglink = '';
|
18859 |
-
if (isset($this->HREF['url']) AND !
|
18860 |
$imglink = $this->HREF['url'];
|
18861 |
if ($imglink[0] == '#') {
|
18862 |
// convert url to internal link
|
@@ -18972,11 +18972,11 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
18972 |
}
|
18973 |
if ($this->listordered[$this->listnum]) {
|
18974 |
// ordered item
|
18975 |
-
if (isset($parent['attribute']['type']) AND !
|
18976 |
$this->lispacer = $parent['attribute']['type'];
|
18977 |
-
} elseif (isset($parent['listtype']) AND !
|
18978 |
$this->lispacer = $parent['listtype'];
|
18979 |
-
} elseif (isset($this->lisymbol) AND !
|
18980 |
$this->lispacer = $this->lisymbol;
|
18981 |
} else {
|
18982 |
$this->lispacer = '#';
|
@@ -18987,11 +18987,11 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
18987 |
}
|
18988 |
} else {
|
18989 |
// unordered item
|
18990 |
-
if (isset($parent['attribute']['type']) AND !
|
18991 |
$this->lispacer = $parent['attribute']['type'];
|
18992 |
-
} elseif (isset($parent['listtype']) AND !
|
18993 |
$this->lispacer = $parent['listtype'];
|
18994 |
-
} elseif (isset($this->lisymbol) AND !
|
18995 |
$this->lispacer = $this->lisymbol;
|
18996 |
} else {
|
18997 |
$this->lispacer = '!';
|
@@ -19063,24 +19063,24 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
19063 |
break;
|
19064 |
}
|
19065 |
case 'input': {
|
19066 |
-
if (isset($tag['attribute']['name']) AND !
|
19067 |
$name = $tag['attribute']['name'];
|
19068 |
} else {
|
19069 |
break;
|
19070 |
}
|
19071 |
$prop = array();
|
19072 |
$opt = array();
|
19073 |
-
if (isset($tag['attribute']['readonly']) AND !
|
19074 |
$prop['readonly'] = true;
|
19075 |
}
|
19076 |
-
if (isset($tag['attribute']['value']) AND !
|
19077 |
$value = $tag['attribute']['value'];
|
19078 |
}
|
19079 |
-
if (isset($tag['attribute']['maxlength']) AND !
|
19080 |
$opt['maxlen'] = intval($tag['attribute']['maxlength']);
|
19081 |
}
|
19082 |
$h = $this->getCellHeight($this->FontSize);
|
19083 |
-
if (isset($tag['attribute']['size']) AND !
|
19084 |
$w = intval($tag['attribute']['size']) * $this->GetStringWidth(chr(32)) * 2;
|
19085 |
} else {
|
19086 |
$w = $h;
|
@@ -19188,7 +19188,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
19188 |
}
|
19189 |
case 'image': {
|
19190 |
// THIS TYPE MUST BE FIXED
|
19191 |
-
if (isset($tag['attribute']['src']) AND !
|
19192 |
$img = $tag['attribute']['src'];
|
19193 |
} else {
|
19194 |
break;
|
@@ -19224,23 +19224,23 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
19224 |
case 'textarea': {
|
19225 |
$prop = array();
|
19226 |
$opt = array();
|
19227 |
-
if (isset($tag['attribute']['readonly']) AND !
|
19228 |
$prop['readonly'] = true;
|
19229 |
}
|
19230 |
-
if (isset($tag['attribute']['name']) AND !
|
19231 |
$name = $tag['attribute']['name'];
|
19232 |
} else {
|
19233 |
break;
|
19234 |
}
|
19235 |
-
if (isset($tag['attribute']['value']) AND !
|
19236 |
$opt['v'] = $tag['attribute']['value'];
|
19237 |
}
|
19238 |
-
if (isset($tag['attribute']['cols']) AND !
|
19239 |
$w = intval($tag['attribute']['cols']) * $this->GetStringWidth(chr(32)) * 2;
|
19240 |
} else {
|
19241 |
$w = 40;
|
19242 |
}
|
19243 |
-
if (isset($tag['attribute']['rows']) AND !
|
19244 |
$h = intval($tag['attribute']['rows']) * $this->getCellHeight($this->FontSize);
|
19245 |
} else {
|
19246 |
$h = 10;
|
@@ -19251,18 +19251,18 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
19251 |
}
|
19252 |
case 'select': {
|
19253 |
$h = $this->getCellHeight($this->FontSize);
|
19254 |
-
if (isset($tag['attribute']['size']) AND !
|
19255 |
$h *= ($tag['attribute']['size'] + 1);
|
19256 |
}
|
19257 |
$prop = array();
|
19258 |
$opt = array();
|
19259 |
-
if (isset($tag['attribute']['name']) AND !
|
19260 |
$name = $tag['attribute']['name'];
|
19261 |
} else {
|
19262 |
break;
|
19263 |
}
|
19264 |
$w = 0;
|
19265 |
-
if (isset($tag['attribute']['opt']) AND !
|
19266 |
$options = explode('#!NwL!#', $tag['attribute']['opt']);
|
19267 |
$values = array();
|
19268 |
foreach ($options as $val) {
|
@@ -19552,9 +19552,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
19552 |
$starty = $y;
|
19553 |
$w = abs($cellpos['endx'] - $cellpos['startx']);
|
19554 |
// get border modes
|
19555 |
-
$border_start =
|
19556 |
-
$border_end =
|
19557 |
-
$border_middle =
|
19558 |
// design borders around HTML cells.
|
19559 |
for ($page = $startpage; $page <= $endpage; ++$page) { // for each page
|
19560 |
$ccode = '';
|
@@ -19943,9 +19943,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
19943 |
if (isset($tag['border']) AND !empty($tag['border'])) {
|
19944 |
// get border style
|
19945 |
$border = $tag['border'];
|
19946 |
-
if (!
|
19947 |
// border for table header
|
19948 |
-
$border =
|
19949 |
}
|
19950 |
}
|
19951 |
if (isset($tag['bgcolor']) AND ($tag['bgcolor'] !== false)) {
|
@@ -19999,9 +19999,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
19999 |
$this->num_columns = 1;
|
20000 |
}
|
20001 |
// get border modes
|
20002 |
-
$border_start =
|
20003 |
-
$border_end =
|
20004 |
-
$border_middle =
|
20005 |
// temporary disable page regions
|
20006 |
$temp_page_regions = $this->page_regions;
|
20007 |
$this->page_regions = array();
|
@@ -20436,12 +20436,12 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
20436 |
}
|
20437 |
case 'i':
|
20438 |
case 'lower-roman': {
|
20439 |
-
$textitem = strtolower(
|
20440 |
break;
|
20441 |
}
|
20442 |
case 'I':
|
20443 |
case 'upper-roman': {
|
20444 |
-
$textitem =
|
20445 |
break;
|
20446 |
}
|
20447 |
case 'a':
|
@@ -20457,7 +20457,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
20457 |
break;
|
20458 |
}
|
20459 |
case 'lower-greek': {
|
20460 |
-
$textitem =
|
20461 |
break;
|
20462 |
}
|
20463 |
/*
|
@@ -20491,7 +20491,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
20491 |
$textitem = $this->listcount[$this->listnum];
|
20492 |
}
|
20493 |
}
|
20494 |
-
if (!
|
20495 |
// Check whether we need a new page or new column
|
20496 |
$prev_y = $this->y;
|
20497 |
$h = $this->getCellHeight($this->FontSize);
|
@@ -20642,7 +20642,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
20642 |
$this->num_columns = $gvars['num_columns'];
|
20643 |
}
|
20644 |
$this->_out(''.$this->linestyleWidth.' '.$this->linestyleCap.' '.$this->linestyleJoin.' '.$this->linestyleDash.' '.$this->DrawColor.' '.$this->FillColor.'');
|
20645 |
-
if (!
|
20646 |
$this->SetFont($this->FontFamily, $this->FontStyle, $this->FontSizePt);
|
20647 |
}
|
20648 |
}
|
@@ -21284,13 +21284,13 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
21284 |
$page_fill_start = false;
|
21285 |
$page_fill_end = false;
|
21286 |
$current_column = $this->current_column;
|
21287 |
-
if (
|
21288 |
$numbersfont = $this->default_monospaced_font;
|
21289 |
}
|
21290 |
-
if (
|
21291 |
$filler = ' ';
|
21292 |
}
|
21293 |
-
if (
|
21294 |
$gap = ' ';
|
21295 |
} else {
|
21296 |
$gap = '';
|
@@ -21362,7 +21362,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
21362 |
$tw = $this->w - $this->rMargin - $this->x;
|
21363 |
}
|
21364 |
$this->SetFont($numbersfont, $fontstyle, $fontsize);
|
21365 |
-
if (
|
21366 |
$pagenum = $outline['p'];
|
21367 |
} else {
|
21368 |
// placemark to be replaced with the correct number
|
@@ -21413,7 +21413,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
21413 |
}
|
21414 |
}
|
21415 |
$maxpage = max($maxpage, $page_last);
|
21416 |
-
if (!
|
21417 |
for ($p = $page_first; $p <= $page_last; ++$p) {
|
21418 |
// get page data
|
21419 |
$temppage = $this->getPageBuffer($p);
|
@@ -21428,15 +21428,15 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
21428 |
} else {
|
21429 |
$np = $n;
|
21430 |
}
|
21431 |
-
$na =
|
21432 |
-
$nu =
|
21433 |
// replace aliases with numbers
|
21434 |
foreach ($pnalias['u'] as $u) {
|
21435 |
$sfill = str_repeat($filler, max(0, (strlen($u) - strlen($nu.' '))));
|
21436 |
if ($this->rtl) {
|
21437 |
-
$nr = $nu.
|
21438 |
} else {
|
21439 |
-
$nr =
|
21440 |
}
|
21441 |
$temppage = str_replace($u, $nr, $temppage);
|
21442 |
}
|
@@ -21506,7 +21506,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
21506 |
foreach ($this->outlines as $key => $outline) {
|
21507 |
// get HTML template
|
21508 |
$row = $templates[$outline['l']];
|
21509 |
-
if (
|
21510 |
$pagenum = $outline['p'];
|
21511 |
} else {
|
21512 |
// placemark to be replaced with the correct number
|
@@ -21549,7 +21549,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
21549 |
}
|
21550 |
}
|
21551 |
$maxpage = max($maxpage, $page_last);
|
21552 |
-
if (!
|
21553 |
for ($p = $page_first; $p <= $page_last; ++$p) {
|
21554 |
// get page data
|
21555 |
$temppage = $this->getPageBuffer($p);
|
@@ -21564,16 +21564,16 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
21564 |
} else {
|
21565 |
$np = $n;
|
21566 |
}
|
21567 |
-
$na =
|
21568 |
-
$nu =
|
21569 |
// replace aliases with numbers
|
21570 |
foreach ($pnalias['u'] as $u) {
|
21571 |
if ($correct_align) {
|
21572 |
$sfill = str_repeat($filler, (strlen($u) - strlen($nu.' ')));
|
21573 |
if ($this->rtl) {
|
21574 |
-
$nr = $nu.
|
21575 |
} else {
|
21576 |
-
$nr =
|
21577 |
}
|
21578 |
} else {
|
21579 |
$nr = $nu;
|
@@ -21622,7 +21622,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
21622 |
$this->start_transaction_page = $this->page;
|
21623 |
$this->start_transaction_y = $this->y;
|
21624 |
// clone current object
|
21625 |
-
$this->objcopy =
|
21626 |
}
|
21627 |
|
21628 |
/**
|
@@ -21679,7 +21679,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
21679 |
if (($width == 0) OR ($width > $maxwidth)) {
|
21680 |
$width = $maxwidth;
|
21681 |
}
|
21682 |
-
if (
|
21683 |
$y = $this->y;
|
21684 |
}
|
21685 |
// space between columns
|
@@ -21775,7 +21775,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
21775 |
// fix for HTML mode
|
21776 |
$this->newline = true;
|
21777 |
// print HTML table header (if any)
|
21778 |
-
if ((!
|
21779 |
if ($enable_thead) {
|
21780 |
// print table header
|
21781 |
$this->writeHTML($this->thead, false, false, false, false, '');
|
@@ -21949,7 +21949,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
21949 |
if ($numchars <= $charmin) {
|
21950 |
return $word;
|
21951 |
}
|
21952 |
-
$word_string =
|
21953 |
// some words will be returned as-is
|
21954 |
$pattern = '/^([a-zA-Z0-9_\.\-]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/';
|
21955 |
if (preg_match($pattern, $word_string) > 0) {
|
@@ -21962,7 +21962,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
21962 |
return $word;
|
21963 |
}
|
21964 |
if (isset($dictionary[$word_string])) {
|
21965 |
-
return
|
21966 |
}
|
21967 |
// surround word with '_' characters
|
21968 |
$tmpword = array_merge(array(46), $word, array(46));
|
@@ -21971,9 +21971,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
21971 |
for ($pos = 0; $pos < $maxpos; ++$pos) {
|
21972 |
$imax = min(($tmpnumchars - $pos), $charmax);
|
21973 |
for ($i = 1; $i <= $imax; ++$i) {
|
21974 |
-
$subword = strtolower(
|
21975 |
if (isset($patterns[$subword])) {
|
21976 |
-
$pattern =
|
21977 |
$pattern_length = count($pattern);
|
21978 |
$digits = 1;
|
21979 |
for ($j = 0; $j < $pattern_length; ++$j) {
|
@@ -22030,18 +22030,18 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
22030 |
$intag = false; // true if we are inside an HTML tag
|
22031 |
$skip = false; // true to skip hyphenation
|
22032 |
if (!is_array($patterns)) {
|
22033 |
-
$patterns =
|
22034 |
}
|
22035 |
// get array of characters
|
22036 |
-
$unichars =
|
22037 |
// for each char
|
22038 |
foreach ($unichars as $char) {
|
22039 |
-
|
22040 |
// letter character
|
22041 |
$word[] = $char;
|
22042 |
} else {
|
22043 |
// other type of character
|
22044 |
-
if (!
|
22045 |
// hypenate the word
|
22046 |
$txtarr = array_merge($txtarr, $this->hyphenateWord($word, $patterns, $dictionary, $leftmin, $rightmin, $charmin, $charmax));
|
22047 |
$word = array();
|
@@ -22073,12 +22073,12 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
22073 |
}
|
22074 |
}
|
22075 |
}
|
22076 |
-
if (!
|
22077 |
// hypenate the word
|
22078 |
$txtarr = array_merge($txtarr, $this->hyphenateWord($word, $patterns, $dictionary, $leftmin, $rightmin, $charmin, $charmax));
|
22079 |
}
|
22080 |
// convert char array to string and return
|
22081 |
-
return
|
22082 |
}
|
22083 |
|
22084 |
/**
|
@@ -22405,10 +22405,10 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
22405 |
if (!empty($this->xobjects[$id]['annotations'])) {
|
22406 |
foreach ($this->xobjects[$id]['annotations'] as $annot) {
|
22407 |
// transform original coordinates
|
22408 |
-
$coordlt =
|
22409 |
$ax = ($coordlt[4] / $this->k);
|
22410 |
$ay = ($this->h - $h - ($coordlt[5] / $this->k));
|
22411 |
-
$coordrb =
|
22412 |
$aw = ($coordrb[4] / $this->k) - $ax;
|
22413 |
$ah = ($this->h - $h - ($coordrb[5] / $this->k)) - $ay;
|
22414 |
$this->Annotation($ax, $ay, $aw, $ah, $annot['text'], $annot['opt'], $annot['spaces']);
|
@@ -22692,7 +22692,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
22692 |
$svgdata = substr($file, 1);
|
22693 |
} else { // SVG file
|
22694 |
$this->svgdir = dirname($file);
|
22695 |
-
$svgdata =
|
22696 |
}
|
22697 |
if ($svgdata === FALSE) {
|
22698 |
$this->Error('SVG file not found: '.$file);
|
@@ -23050,10 +23050,10 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
23050 |
$this->setAlpha($svgstyle['opacity'], 'Normal', $svgstyle['opacity'], false);
|
23051 |
}
|
23052 |
// color
|
23053 |
-
$fill_color =
|
23054 |
$this->SetFillColorArray($fill_color);
|
23055 |
// text color
|
23056 |
-
$text_color =
|
23057 |
$this->SetTextColorArray($text_color);
|
23058 |
// clip
|
23059 |
if (preg_match('/rect\(([a-z0-9\-\.]*)[\s]*([a-z0-9\-\.]*)[\s]*([a-z0-9\-\.]*)[\s]*([a-z0-9\-\.]*)\)/si', $svgstyle['clip'], $regs)) {
|
@@ -23177,7 +23177,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
23177 |
$this->Gradient($gradient['type'], $gradient['coords'], $gradient['stops'], array(), false);
|
23178 |
}
|
23179 |
} elseif ($svgstyle['fill'] != 'none') {
|
23180 |
-
$fill_color =
|
23181 |
if ($svgstyle['fill-opacity'] != 1) {
|
23182 |
$this->setAlpha($this->alpha['CA'], 'Normal', $svgstyle['fill-opacity'], false);
|
23183 |
}
|
@@ -23196,7 +23196,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
23196 |
$this->setAlpha($rgba_matches[1], 'Normal', $this->alpha['ca'], false);
|
23197 |
}
|
23198 |
$stroke_style = array(
|
23199 |
-
'color' =>
|
23200 |
'width' => $this->getHTMLUnitToUnits($svgstyle['stroke-width'], 0, $this->svgunit, false),
|
23201 |
'cap' => $svgstyle['stroke-linecap'],
|
23202 |
'join' => $svgstyle['stroke-linejoin']
|
@@ -23328,7 +23328,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
23328 |
return;
|
23329 |
}
|
23330 |
// set fill/stroke style
|
23331 |
-
$op =
|
23332 |
if (empty($op)) {
|
23333 |
return;
|
23334 |
}
|
@@ -23623,8 +23623,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
23623 |
$cx = ($cax * $cos_ang) - ($cay * $sin_ang) + (($x0 + $x) / 2);
|
23624 |
$cy = ($cax * $sin_ang) + ($cay * $cos_ang) + (($y0 + $y) / 2);
|
23625 |
// get angles
|
23626 |
-
$angs =
|
23627 |
-
$dang =
|
23628 |
if (($fs == 0) AND ($dang > 0)) {
|
23629 |
$dang -= (2 * M_PI);
|
23630 |
} elseif (($fs == 1) AND ($dang < 0)) {
|
@@ -23733,23 +23733,23 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
23733 |
// default fill attribute for clipping
|
23734 |
$attribs['fill'] = 'none';
|
23735 |
}
|
23736 |
-
if (isset($attribs['style']) AND !
|
23737 |
// fix style for regular expression
|
23738 |
$attribs['style'] = ';'.$attribs['style'];
|
23739 |
}
|
23740 |
foreach ($prev_svgstyle as $key => $val) {
|
23741 |
-
|
23742 |
// inherit previous value
|
23743 |
$svgstyle[$key] = $val;
|
23744 |
}
|
23745 |
-
if (isset($attribs[$key]) AND !
|
23746 |
// specific attribute settings
|
23747 |
if ($attribs[$key] == 'inherit') {
|
23748 |
$svgstyle[$key] = $val;
|
23749 |
} else {
|
23750 |
$svgstyle[$key] = $attribs[$key];
|
23751 |
}
|
23752 |
-
} elseif (isset($attribs['style']) AND !
|
23753 |
// CSS style syntax
|
23754 |
$attrval = array();
|
23755 |
if (preg_match('/[;\"\s]{1}'.$key.'[\s]*:[\s]*([^;\"]*)/si', $attribs['style'], $attrval) AND isset($attrval[1])) {
|
@@ -23768,7 +23768,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
23768 |
$tm = array(1,0,0,1,0,0);
|
23769 |
}
|
23770 |
if (isset($attribs['transform']) AND !empty($attribs['transform'])) {
|
23771 |
-
$tm =
|
23772 |
}
|
23773 |
$svgstyle['transfmatrix'] = $tm;
|
23774 |
$invisible = false;
|
@@ -23809,7 +23809,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
23809 |
$svgW = (isset($attribs['width'])?$attribs['width']:0);
|
23810 |
$svgH = (isset($attribs['height'])?$attribs['height']:0);
|
23811 |
// set x, y position using transform matrix
|
23812 |
-
$tm =
|
23813 |
$this->SVGTransform($tm);
|
23814 |
// set clipping for width and height
|
23815 |
$x = 0;
|
@@ -23867,7 +23867,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
23867 |
$hr = $wr;
|
23868 |
}
|
23869 |
$newtm = array($wr, 0, 0, $hr, (($wr * ($ax - $vx)) - $svgX), (($hr * ($ay - $vy)) - $svgY));
|
23870 |
-
$tm =
|
23871 |
$this->SVGTransform($tm);
|
23872 |
}
|
23873 |
}
|
@@ -23882,7 +23882,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
23882 |
$y = (isset($attribs['y'])?$attribs['y']:0);
|
23883 |
$w = 1;//(isset($attribs['width'])?$attribs['width']:1);
|
23884 |
$h = 1;//(isset($attribs['height'])?$attribs['height']:1);
|
23885 |
-
$tm =
|
23886 |
$this->SVGTransform($tm);
|
23887 |
$this->setSVGStyles($svgstyle, $prev_svgstyle);
|
23888 |
break;
|
@@ -23918,7 +23918,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
23918 |
$x2 = (isset($attribs['x2'])?$attribs['x2']:'100');
|
23919 |
$y2 = (isset($attribs['y2'])?$attribs['y2']:'0');
|
23920 |
if (isset($attribs['gradientTransform'])) {
|
23921 |
-
$this->svggradients[$this->svggradientid]['gradientTransform'] =
|
23922 |
}
|
23923 |
$this->svggradients[$this->svggradientid]['coords'] = array($x1, $y1, $x2, $y2);
|
23924 |
if (isset($attribs['xlink:href']) AND !empty($attribs['xlink:href'])) {
|
@@ -23959,7 +23959,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
23959 |
$fy = (isset($attribs['fy']) ? $attribs['fy'] : $cy);
|
23960 |
$r = (isset($attribs['r']) ? $attribs['r'] : 0.5);
|
23961 |
if (isset($attribs['gradientTransform'])) {
|
23962 |
-
$this->svggradients[$this->svggradientid]['gradientTransform'] =
|
23963 |
}
|
23964 |
$this->svggradients[$this->svggradientid]['coords'] = array($cx, $cy, $fx, $fy, $r);
|
23965 |
if (isset($attribs['xlink:href']) AND !empty($attribs['xlink:href'])) {
|
@@ -23978,7 +23978,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
23978 |
$offset /= 100;
|
23979 |
}
|
23980 |
}
|
23981 |
-
$stop_color = isset($svgstyle['stop-color'])?
|
23982 |
$opacity = isset($svgstyle['stop-opacity'])?$svgstyle['stop-opacity']:1;
|
23983 |
$this->svggradients[$this->svggradientid]['stops'][] = array('offset' => $offset, 'color' => $stop_color, 'opacity' => $opacity);
|
23984 |
break;
|
@@ -23995,7 +23995,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
23995 |
$y = (isset($attribs['y'])?$attribs['y']:0);
|
23996 |
$w = (isset($attribs['width'])?$attribs['width']:1);
|
23997 |
$h = (isset($attribs['height'])?$attribs['height']:1);
|
23998 |
-
$tm =
|
23999 |
if ($clipping) {
|
24000 |
$this->SVGTransform($tm);
|
24001 |
$this->SVGPath($d, 'CNZ');
|
@@ -24188,7 +24188,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
24188 |
$img = '@'.base64_decode(substr($img, strlen($m[0])));
|
24189 |
} else {
|
24190 |
// fix image path
|
24191 |
-
if (!
|
24192 |
// replace relative path with full server path
|
24193 |
$img = $this->svgdir.'/'.$img;
|
24194 |
}
|
@@ -24210,7 +24210,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|
24210 |
}
|
24211 |
}
|
24212 |
// get image type
|
24213 |
-
$imgtype =
|
24214 |
if (($imgtype == 'eps') OR ($imgtype == 'ai')) {
|
24215 |
$this->ImageEps($img, $x, $y, $w, $h);
|
24216 |
} elseif ($imgtype == 'svg') {
|
1843 |
}
|
1844 |
// set file ID for trailer
|
1845 |
$serformat = (is_array($format) ? json_encode($format) : $format);
|
1846 |
+
$this->file_id = md5(DSGVOTCPDF_STATIC::getRandomSeed('TCPDF'.$orientation.$unit.$serformat.$encoding));
|
1847 |
$this->font_obj_ids = array();
|
1848 |
$this->page_obj_id = array();
|
1849 |
$this->form_obj_id = array();
|
1957 |
// set default JPEG quality
|
1958 |
$this->jpeg_quality = 75;
|
1959 |
// initialize some settings
|
1960 |
+
DSGVOTCPDF_FONTS::utf8Bidi(array(''), '', false, $this->isunicode, $this->CurrentFont);
|
1961 |
// set default font
|
1962 |
$this->SetFont($this->FontFamily, $this->FontStyle, $this->FontSizePt);
|
1963 |
$this->setHeaderFont(array($this->FontFamily, $this->FontStyle, $this->FontSizePt));
|
2107 |
}
|
2108 |
if (is_string($format)) {
|
2109 |
// get page measures from format name
|
2110 |
+
$pf = DSGVOTCPDF_STATIC::getPageSizeFromFormat($format);
|
2111 |
$this->fwPt = $pf[0];
|
2112 |
$this->fhPt = $pf[1];
|
2113 |
} else {
|
2114 |
// the boundaries of the physical medium on which the page shall be displayed or printed
|
2115 |
if (isset($format['MediaBox'])) {
|
2116 |
+
$this->pagedim = DSGVOTCPDF_STATIC::setPageBoxes($this->page, 'MediaBox', $format['MediaBox']['llx'], $format['MediaBox']['lly'], $format['MediaBox']['urx'], $format['MediaBox']['ury'], false, $this->k, $this->pagedim);
|
2117 |
$this->fwPt = (($format['MediaBox']['urx'] - $format['MediaBox']['llx']) * $this->k);
|
2118 |
$this->fhPt = (($format['MediaBox']['ury'] - $format['MediaBox']['lly']) * $this->k);
|
2119 |
} else {
|
2124 |
// default value
|
2125 |
$format['format'] = 'A4';
|
2126 |
}
|
2127 |
+
$pf = DSGVOTCPDF_STATIC::getPageSizeFromFormat($format['format']);
|
2128 |
}
|
2129 |
$this->fwPt = $pf[0];
|
2130 |
$this->fhPt = $pf[1];
|
2131 |
+
$this->pagedim = DSGVOTCPDF_STATIC::setPageBoxes($this->page, 'MediaBox', 0, 0, $this->fwPt, $this->fhPt, true, $this->k, $this->pagedim);
|
2132 |
}
|
2133 |
// the visible region of default user space
|
2134 |
if (isset($format['CropBox'])) {
|
2135 |
+
$this->pagedim = DSGVOTCPDF_STATIC::setPageBoxes($this->page, 'CropBox', $format['CropBox']['llx'], $format['CropBox']['lly'], $format['CropBox']['urx'], $format['CropBox']['ury'], false, $this->k, $this->pagedim);
|
2136 |
}
|
2137 |
// the region to which the contents of the page shall be clipped when output in a production environment
|
2138 |
if (isset($format['BleedBox'])) {
|
2139 |
+
$this->pagedim = DSGVOTCPDF_STATIC::setPageBoxes($this->page, 'BleedBox', $format['BleedBox']['llx'], $format['BleedBox']['lly'], $format['BleedBox']['urx'], $format['BleedBox']['ury'], false, $this->k, $this->pagedim);
|
2140 |
}
|
2141 |
// the intended dimensions of the finished page after trimming
|
2142 |
if (isset($format['TrimBox'])) {
|
2143 |
+
$this->pagedim = DSGVOTCPDF_STATIC::setPageBoxes($this->page, 'TrimBox', $format['TrimBox']['llx'], $format['TrimBox']['lly'], $format['TrimBox']['urx'], $format['TrimBox']['ury'], false, $this->k, $this->pagedim);
|
2144 |
}
|
2145 |
// the page's meaningful content (including potential white space)
|
2146 |
if (isset($format['ArtBox'])) {
|
2147 |
+
$this->pagedim = DSGVOTCPDF_STATIC::setPageBoxes($this->page, 'ArtBox', $format['ArtBox']['llx'], $format['ArtBox']['lly'], $format['ArtBox']['urx'], $format['ArtBox']['ury'], false, $this->k, $this->pagedim);
|
2148 |
}
|
2149 |
// specify the colours and other visual characteristics that should be used in displaying guidelines on the screen for the various page boundaries
|
2150 |
if (isset($format['BoxColorInfo'])) {
|
2217 |
public function setPageOrientation($orientation, $autopagebreak='', $bottommargin='') {
|
2218 |
if (!isset($this->pagedim[$this->page]['MediaBox'])) {
|
2219 |
// the boundaries of the physical medium on which the page shall be displayed or printed
|
2220 |
+
$this->pagedim = DSGVOTCPDF_STATIC::setPageBoxes($this->page, 'MediaBox', 0, 0, $this->fwPt, $this->fhPt, true, $this->k, $this->pagedim);
|
2221 |
}
|
2222 |
if (!isset($this->pagedim[$this->page]['CropBox'])) {
|
2223 |
// the visible region of default user space
|
2224 |
+
$this->pagedim = DSGVOTCPDF_STATIC::setPageBoxes($this->page, 'CropBox', $this->pagedim[$this->page]['MediaBox']['llx'], $this->pagedim[$this->page]['MediaBox']['lly'], $this->pagedim[$this->page]['MediaBox']['urx'], $this->pagedim[$this->page]['MediaBox']['ury'], true, $this->k, $this->pagedim);
|
2225 |
}
|
2226 |
if (!isset($this->pagedim[$this->page]['BleedBox'])) {
|
2227 |
// the region to which the contents of the page shall be clipped when output in a production environment
|
2228 |
+
$this->pagedim = DSGVOTCPDF_STATIC::setPageBoxes($this->page, 'BleedBox', $this->pagedim[$this->page]['CropBox']['llx'], $this->pagedim[$this->page]['CropBox']['lly'], $this->pagedim[$this->page]['CropBox']['urx'], $this->pagedim[$this->page]['CropBox']['ury'], true, $this->k, $this->pagedim);
|
2229 |
}
|
2230 |
if (!isset($this->pagedim[$this->page]['TrimBox'])) {
|
2231 |
// the intended dimensions of the finished page after trimming
|
2232 |
+
$this->pagedim = DSGVOTCPDF_STATIC::setPageBoxes($this->page, 'TrimBox', $this->pagedim[$this->page]['CropBox']['llx'], $this->pagedim[$this->page]['CropBox']['lly'], $this->pagedim[$this->page]['CropBox']['urx'], $this->pagedim[$this->page]['CropBox']['ury'], true, $this->k, $this->pagedim);
|
2233 |
}
|
2234 |
if (!isset($this->pagedim[$this->page]['ArtBox'])) {
|
2235 |
// the page's meaningful content (including potential white space)
|
2236 |
+
$this->pagedim = DSGVOTCPDF_STATIC::setPageBoxes($this->page, 'ArtBox', $this->pagedim[$this->page]['CropBox']['llx'], $this->pagedim[$this->page]['CropBox']['lly'], $this->pagedim[$this->page]['CropBox']['urx'], $this->pagedim[$this->page]['CropBox']['ury'], true, $this->k, $this->pagedim);
|
2237 |
}
|
2238 |
if (!isset($this->pagedim[$this->page]['Rotate'])) {
|
2239 |
// The number of degrees by which the page shall be rotated clockwise when displayed or printed. The value shall be a multiple of 90.
|
2267 |
}
|
2268 |
if ((abs($this->pagedim[$this->page]['MediaBox']['urx'] - $this->hPt) < $this->feps) AND (abs($this->pagedim[$this->page]['MediaBox']['ury'] - $this->wPt) < $this->feps)){
|
2269 |
// swap X and Y coordinates (change page orientation)
|
2270 |
+
$this->pagedim = DSGVOTCPDF_STATIC::swapPageBoxCoordinates($this->page, $this->pagedim);
|
2271 |
}
|
2272 |
$this->w = ($this->wPt / $this->k);
|
2273 |
$this->h = ($this->hPt / $this->k);
|
2274 |
+
if (DSGVOTCPDF_STATIC::empty_string($autopagebreak)) {
|
2275 |
if (isset($this->AutoPageBreak)) {
|
2276 |
$autopagebreak = $this->AutoPageBreak;
|
2277 |
} else {
|
2278 |
$autopagebreak = true;
|
2279 |
}
|
2280 |
}
|
2281 |
+
if (DSGVOTCPDF_STATIC::empty_string($bottommargin)) {
|
2282 |
if (isset($this->bMargin)) {
|
2283 |
$bottommargin = $this->bMargin;
|
2284 |
} else {
|
2817 |
} else {
|
2818 |
$this->Error('Incorrect zoom display mode: '.$zoom);
|
2819 |
}
|
2820 |
+
$this->LayoutMode = DSGVOTCPDF_STATIC::getPageLayoutMode($layout);
|
2821 |
+
$this->PageMode = DSGVOTCPDF_STATIC::getPageMode($mode);
|
2822 |
}
|
2823 |
|
2824 |
/**
|
3402 |
$this->x = $this->original_lMargin;
|
3403 |
}
|
3404 |
if (($headerdata['logo']) AND ($headerdata['logo'] != K_BLANK_IMAGE)) {
|
3405 |
+
$imgtype = DSGVOTCPDF_IMAGES::getImageFileType(K_PATH_IMAGES.$headerdata['logo']);
|
3406 |
if (($imgtype == 'eps') OR ($imgtype == 'ai')) {
|
3407 |
$this->ImageEps(K_PATH_IMAGES.$headerdata['logo'], '', '', $headerdata['logo_width']);
|
3408 |
} elseif ($imgtype == 'svg') {
|
3630 |
$this->pagedim[$this->page]['tm'] = $this->tMargin;
|
3631 |
$this->y = $this->tMargin;
|
3632 |
}
|
3633 |
+
if (!DSGVOTCPDF_STATIC::empty_string($this->thead) AND (!$this->inthead)) {
|
3634 |
// set margins
|
3635 |
$prev_lMargin = $this->lMargin;
|
3636 |
$prev_rMargin = $this->rMargin;
|
3730 |
* @since 5.9.125 (2011-10-03)
|
3731 |
*/
|
3732 |
public function setSpotColor($type, $name, $tint=100) {
|
3733 |
+
$spotcolor = DSGVOTCPDF_COLORS::getSpotColor($name, $this->spot_colors);
|
3734 |
if ($spotcolor === false) {
|
3735 |
$this->Error('Undefined spot color: '.$name.', you must add it using the AddSpotColor() method.');
|
3736 |
}
|
4030 |
* @since 1.2
|
4031 |
*/
|
4032 |
public function GetStringWidth($s, $fontname='', $fontstyle='', $fontsize=0, $getarray=false) {
|
4033 |
+
return $this->GetArrStringWidth(DSGVOTCPDF_FONTS::utf8Bidi(DSGVOTCPDF_FONTS::UTF8StringToArray($s, $this->isunicode, $this->CurrentFont), $s, $this->tmprtl, $this->isunicode, $this->CurrentFont), $fontname, $fontstyle, $fontsize, $getarray);
|
4034 |
}
|
4035 |
|
4036 |
/**
|
4047 |
*/
|
4048 |
public function GetArrStringWidth($sa, $fontname='', $fontstyle='', $fontsize=0, $getarray=false) {
|
4049 |
// store current values
|
4050 |
+
if (!DSGVOTCPDF_STATIC::empty_string($fontname)) {
|
4051 |
$prev_FontFamily = $this->FontFamily;
|
4052 |
$prev_FontStyle = $this->FontStyle;
|
4053 |
$prev_FontSizePt = $this->FontSizePt;
|
4055 |
}
|
4056 |
// convert UTF-8 array to Latin1 if required
|
4057 |
if ($this->isunicode AND (!$this->isUnicodeFont())) {
|
4058 |
+
$sa = DSGVOTCPDF_FONTS::UTF8ArrToLatin1Arr($sa);
|
4059 |
}
|
4060 |
$w = 0; // total width
|
4061 |
$wa = array(); // array of characters widths
|
4066 |
$w += $cw;
|
4067 |
}
|
4068 |
// restore previous values
|
4069 |
+
if (!DSGVOTCPDF_STATIC::empty_string($fontname)) {
|
4070 |
$this->SetFont($prev_FontFamily, $prev_FontStyle, $prev_FontSizePt, '', 'default', false);
|
4071 |
}
|
4072 |
if ($getarray) {
|
4134 |
*/
|
4135 |
public function GetNumChars($s) {
|
4136 |
if ($this->isUnicodeFont()) {
|
4137 |
+
return count(DSGVOTCPDF_FONTS::UTF8StringToArray($s, $this->isunicode, $this->CurrentFont));
|
4138 |
}
|
4139 |
return strlen($s);
|
4140 |
}
|
4145 |
* @since 4.0.013 (2008-07-28)
|
4146 |
*/
|
4147 |
protected function getFontsList() {
|
4148 |
+
if (($fontsdir = opendir(DSGVOTCPDF_FONTS::_getfontpath())) !== false) {
|
4149 |
while (($file = readdir($fontsdir)) !== false) {
|
4150 |
if (substr($file, -4) == '.php') {
|
4151 |
array_push($this->fontlist, strtolower(basename($file, '.php')));
|
4175 |
if ($this->pdfa_mode) {
|
4176 |
$subset = false;
|
4177 |
}
|
4178 |
+
if (DSGVOTCPDF_STATIC::empty_string($family)) {
|
4179 |
+
if (!DSGVOTCPDF_STATIC::empty_string($this->FontFamily)) {
|
4180 |
$family = $this->FontFamily;
|
4181 |
} else {
|
4182 |
$this->Error('Empty font family');
|
4246 |
}
|
4247 |
// get specified font directory (if any)
|
4248 |
$fontdir = false;
|
4249 |
+
if (!DSGVOTCPDF_STATIC::empty_string($fontfile)) {
|
4250 |
$fontdir = dirname($fontfile);
|
4251 |
+
if (DSGVOTCPDF_STATIC::empty_string($fontdir) OR ($fontdir == '.')) {
|
4252 |
$fontdir = '';
|
4253 |
} else {
|
4254 |
$fontdir .= '/';
|
4257 |
// true when the font style variation is missing
|
4258 |
$missing_style = false;
|
4259 |
// search and include font file
|
4260 |
+
if (DSGVOTCPDF_STATIC::empty_string($fontfile) OR (!@file_exists($fontfile))) {
|
4261 |
// build a standard filenames for specified font
|
4262 |
$tmp_fontfile = str_replace(' ', '', $family).strtolower($style).'.php';
|
4263 |
+
$fontfile = DSGVOTCPDF_FONTS::getFontFullPath($tmp_fontfile, $fontdir);
|
4264 |
+
if (DSGVOTCPDF_STATIC::empty_string($fontfile)) {
|
4265 |
$missing_style = true;
|
4266 |
// try to remove the style part
|
4267 |
$tmp_fontfile = str_replace(' ', '', $family).'.php';
|
4268 |
+
$fontfile = DSGVOTCPDF_FONTS::getFontFullPath($tmp_fontfile, $fontdir);
|
4269 |
}
|
4270 |
}
|
4271 |
// include font file
|
4272 |
+
if (!DSGVOTCPDF_STATIC::empty_string($fontfile) AND (@file_exists($fontfile))) {
|
4273 |
include($fontfile);
|
4274 |
} else {
|
4275 |
$this->Error('Could not include font definition file: '.$family.'');
|
4279 |
$this->Error('The font definition file has a bad format: '.$fontfile.'');
|
4280 |
}
|
4281 |
// SET default parameters
|
4282 |
+
if (!isset($file) OR DSGVOTCPDF_STATIC::empty_string($file)) {
|
4283 |
$file = '';
|
4284 |
}
|
4285 |
+
if (!isset($enc) OR DSGVOTCPDF_STATIC::empty_string($enc)) {
|
4286 |
$enc = '';
|
4287 |
}
|
4288 |
+
if (!isset($cidinfo) OR DSGVOTCPDF_STATIC::empty_string($cidinfo)) {
|
4289 |
$cidinfo = array('Registry'=>'Adobe', 'Ordering'=>'Identity', 'Supplement'=>0);
|
4290 |
$cidinfo['uni2cid'] = array();
|
4291 |
}
|
4292 |
+
if (!isset($ctg) OR DSGVOTCPDF_STATIC::empty_string($ctg)) {
|
4293 |
$ctg = '';
|
4294 |
}
|
4295 |
+
if (!isset($desc) OR DSGVOTCPDF_STATIC::empty_string($desc)) {
|
4296 |
$desc = array();
|
4297 |
}
|
4298 |
+
if (!isset($up) OR DSGVOTCPDF_STATIC::empty_string($up)) {
|
4299 |
$up = -100;
|
4300 |
}
|
4301 |
+
if (!isset($ut) OR DSGVOTCPDF_STATIC::empty_string($ut)) {
|
4302 |
$ut = 50;
|
4303 |
}
|
4304 |
+
if (!isset($cw) OR DSGVOTCPDF_STATIC::empty_string($cw)) {
|
4305 |
$cw = array();
|
4306 |
}
|
4307 |
+
if (!isset($dw) OR DSGVOTCPDF_STATIC::empty_string($dw)) {
|
4308 |
// set default width
|
4309 |
if (isset($desc['MissingWidth']) AND ($desc['MissingWidth'] > 0)) {
|
4310 |
$dw = $desc['MissingWidth'];
|
4389 |
}
|
4390 |
$this->setFontSubBuffer($fontkey, 'diff', $d);
|
4391 |
}
|
4392 |
+
if (!DSGVOTCPDF_STATIC::empty_string($file)) {
|
4393 |
if (!isset($this->FontFiles[$file])) {
|
4394 |
if ((strcasecmp($type,'TrueType') == 0) OR (strcasecmp($type, 'TrueTypeUnicode') == 0)) {
|
4395 |
$this->FontFiles[$file] = array('length1' => $originalsize, 'fontdir' => $fontdir, 'subset' => $subset, 'fontkeys' => array($fontkey));
|
4608 |
public function isCharDefined($char, $font='', $style='') {
|
4609 |
if (is_string($char)) {
|
4610 |
// get character code
|
4611 |
+
$char = DSGVOTCPDF_FONTS::UTF8StringToArray($char, $this->isunicode, $this->CurrentFont);
|
4612 |
$char = $char[0];
|
4613 |
}
|
4614 |
+
if (DSGVOTCPDF_STATIC::empty_string($font)) {
|
4615 |
+
if (DSGVOTCPDF_STATIC::empty_string($style)) {
|
4616 |
return (isset($this->CurrentFont['cw'][intval($char)]));
|
4617 |
}
|
4618 |
$font = $this->FontFamily;
|
4636 |
if (empty($subs)) {
|
4637 |
return $text;
|
4638 |
}
|
4639 |
+
if (DSGVOTCPDF_STATIC::empty_string($font)) {
|
4640 |
$font = $this->FontFamily;
|
4641 |
}
|
4642 |
$fontdata = $this->AddFont($font, $style);
|
4643 |
$fontinfo = $this->getFontBuffer($fontdata['fontkey']);
|
4644 |
+
$uniarr = DSGVOTCPDF_FONTS::UTF8StringToArray($text, $this->isunicode, $this->CurrentFont);
|
4645 |
foreach ($uniarr as $k => $chr) {
|
4646 |
if (!isset($fontinfo['cw'][$chr])) {
|
4647 |
// this character is missing on the selected font
|
4660 |
}
|
4661 |
}
|
4662 |
}
|
4663 |
+
return DSGVOTCPDF_FONTS::UniArrSubString(DSGVOTCPDF_FONTS::UTF8ArrayToUniArray($uniarr, $this->isunicode));
|
4664 |
}
|
4665 |
|
4666 |
/**
|
4808 |
}
|
4809 |
$this->PageAnnots[$page][] = array('n' => ++$this->n, 'x' => $x, 'y' => $y, 'w' => $w, 'h' => $h, 'txt' => $text, 'opt' => $opt, 'numspaces' => $spaces);
|
4810 |
if (!$this->pdfa_mode) {
|
4811 |
+
if ((($opt['Subtype'] == 'FileAttachment') OR ($opt['Subtype'] == 'Sound')) AND (!DSGVOTCPDF_STATIC::empty_string($opt['FS']))
|
4812 |
+
AND (@file_exists($opt['FS']) OR DSGVOTCPDF_STATIC::isValidURL($opt['FS']))
|
4813 |
AND (!isset($this->embeddedfiles[basename($opt['FS'])]))) {
|
4814 |
$this->embeddedfiles[basename($opt['FS'])] = array('f' => ++$this->n, 'n' => ++$this->n, 'file' => $opt['FS']);
|
4815 |
}
|
4839 |
}
|
4840 |
reset($this->embeddedfiles);
|
4841 |
foreach ($this->embeddedfiles as $filename => $filedata) {
|
4842 |
+
$data = DSGVOTCPDF_STATIC::fileGetContents($filedata['file']);
|
4843 |
if ($data !== FALSE) {
|
4844 |
$rawsize = strlen($data);
|
4845 |
if ($rawsize > 0) {
|
4938 |
* @protected
|
4939 |
*/
|
4940 |
protected function checkPageBreak($h=0, $y='', $addpage=true) {
|
4941 |
+
if (DSGVOTCPDF_STATIC::empty_string($y)) {
|
4942 |
$y = $this->y;
|
4943 |
}
|
4944 |
$current_page = $this->page;
|
5062 |
*/
|
5063 |
protected function getCellCode($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M') {
|
5064 |
// replace 'NO-BREAK SPACE' (U+00A0) character with a simple space
|
5065 |
+
$txt = str_replace(DSGVOTCPDF_FONTS::unichr(160, $this->isunicode), ' ', $txt);
|
5066 |
$prev_cell_margin = $this->cell_margin;
|
5067 |
$prev_cell_padding = $this->cell_padding;
|
5068 |
+
$txt = DSGVOTCPDF_STATIC::removeSHY($txt, $this->isunicode);
|
5069 |
$rs = ''; //string to be returned
|
5070 |
$this->adjustCellPadding($border);
|
5071 |
if (!$ignore_min_height) {
|
5194 |
}
|
5195 |
}
|
5196 |
$basefonty = $yt + $this->FontAscent;
|
5197 |
+
if (DSGVOTCPDF_STATIC::empty_string($w) OR ($w <= 0)) {
|
5198 |
if ($this->rtl) {
|
5199 |
$w = $x - $this->lMargin;
|
5200 |
} else {
|
5226 |
$txt2 = $txt;
|
5227 |
if ($this->isunicode) {
|
5228 |
if (($this->CurrentFont['type'] == 'core') OR ($this->CurrentFont['type'] == 'TrueType') OR ($this->CurrentFont['type'] == 'Type1')) {
|
5229 |
+
$txt2 = DSGVOTCPDF_FONTS::UTF8ToLatin1($txt2, $this->isunicode, $this->CurrentFont);
|
5230 |
} else {
|
5231 |
+
$unicode = DSGVOTCPDF_FONTS::UTF8StringToArray($txt, $this->isunicode, $this->CurrentFont); // array of UTF-8 unicode values
|
5232 |
+
$unicode = DSGVOTCPDF_FONTS::utf8Bidi($unicode, '', $this->tmprtl, $this->isunicode, $this->CurrentFont);
|
5233 |
// replace thai chars (if any)
|
5234 |
if (defined('K_THAI_TOPCHARS') AND (K_THAI_TOPCHARS == true)) {
|
5235 |
// number of chars
|
5321 |
// update font subsetchars
|
5322 |
$this->setFontSubBuffer($this->CurrentFont['fontkey'], 'subsetchars', $this->CurrentFont['subsetchars']);
|
5323 |
} // end of K_THAI_TOPCHARS
|
5324 |
+
$txt2 = DSGVOTCPDF_FONTS::arrUTF8ToUTF16BE($unicode, false);
|
5325 |
}
|
5326 |
}
|
5327 |
+
$txt2 = DSGVOTCPDF_STATIC::_escape($txt2);
|
5328 |
// get current text width (considering general font stretching and spacing)
|
5329 |
$txwidth = $this->GetStringWidth($txt);
|
5330 |
$width = $txwidth;
|
5452 |
$xshift += $this->GetArrStringWidth($uniarr); // + shift justification
|
5453 |
} else {
|
5454 |
// character to print
|
5455 |
+
$topchr = DSGVOTCPDF_FONTS::arrUTF8ToUTF16BE($uniarr, false);
|
5456 |
+
$topchr = DSGVOTCPDF_STATIC::_escape($topchr);
|
5457 |
$s .= sprintf(' BT %F %F Td [(%s)] TJ ET', ($xdk + ($xshift * $k)), $ty, $topchr);
|
5458 |
}
|
5459 |
}
|
5764 |
$this->cell_padding['T'] = 0;
|
5765 |
$this->cell_padding['B'] = 0;
|
5766 |
$this->setCellMargins(0, 0, 0, 0);
|
5767 |
+
if (DSGVOTCPDF_STATIC::empty_string($this->lasth) OR $reseth) {
|
5768 |
// reset row height
|
5769 |
$this->resetLastH();
|
5770 |
}
|
5771 |
+
if (!DSGVOTCPDF_STATIC::empty_string($y)) {
|
5772 |
$this->SetY($y);
|
5773 |
} else {
|
5774 |
$y = $this->GetY();
|
5784 |
$startpage = $this->page;
|
5785 |
// get current column
|
5786 |
$startcolumn = $this->current_column;
|
5787 |
+
if (!DSGVOTCPDF_STATIC::empty_string($x)) {
|
5788 |
$this->SetX($x);
|
5789 |
} else {
|
5790 |
$x = $this->GetX();
|
5801 |
$this->x = $ox;
|
5802 |
$this->y = $oy;
|
5803 |
// set width
|
5804 |
+
if (DSGVOTCPDF_STATIC::empty_string($w) OR ($w <= 0)) {
|
5805 |
if ($this->rtl) {
|
5806 |
$w = ($this->x - $this->lMargin - $mc_margin['L']);
|
5807 |
} else {
|
5921 |
$check_page_regions = $this->check_page_regions;
|
5922 |
$this->check_page_regions = false;
|
5923 |
// get border modes
|
5924 |
+
$border_start = DSGVOTCPDF_STATIC::getBorderMode($border, $position='start', $this->opencell);
|
5925 |
+
$border_end = DSGVOTCPDF_STATIC::getBorderMode($border, $position='end', $this->opencell);
|
5926 |
+
$border_middle = DSGVOTCPDF_STATIC::getBorderMode($border, $position='middle', $this->opencell);
|
5927 |
// design borders around HTML cells.
|
5928 |
for ($page = $startpage; $page <= $endpage; ++$page) { // for each page
|
5929 |
$ccode = '';
|
6138 |
$this->cell_padding = $cellpadding;
|
6139 |
}
|
6140 |
$this->adjustCellPadding($border);
|
6141 |
+
if (DSGVOTCPDF_STATIC::empty_string($w) OR ($w <= 0)) {
|
6142 |
if ($this->rtl) {
|
6143 |
$w = $this->x - $this->lMargin;
|
6144 |
} else {
|
6152 |
}
|
6153 |
$lines = 1;
|
6154 |
$sum = 0;
|
6155 |
+
$chars = DSGVOTCPDF_FONTS::utf8Bidi(DSGVOTCPDF_FONTS::UTF8StringToArray($txt, $this->isunicode, $this->CurrentFont), $txt, $this->tmprtl, $this->isunicode, $this->CurrentFont);
|
6156 |
$charsWidth = $this->GetArrStringWidth($chars, '', '', 0, true);
|
6157 |
$length = count($chars);
|
6158 |
$lastSeparator = -1;
|
6161 |
$charWidth = $charsWidth[$i];
|
6162 |
if (($c != 160)
|
6163 |
AND (($c == 173)
|
6164 |
+
OR preg_match($this->re_spaces, DSGVOTCPDF_FONTS::unichr($c, $this->isunicode))
|
6165 |
OR (($c == 45)
|
6166 |
AND ($i > 0) AND ($i < ($length - 1))
|
6167 |
+
AND @preg_match('/[\p{L}]/'.$this->re_space['m'], DSGVOTCPDF_FONTS::unichr($chars[($i - 1)], $this->isunicode))
|
6168 |
+
AND @preg_match('/[\p{L}]/'.$this->re_space['m'], DSGVOTCPDF_FONTS::unichr($chars[($i + 1)], $this->isunicode))
|
6169 |
)
|
6170 |
)
|
6171 |
) {
|
6289 |
// remove carriage returns
|
6290 |
$s = str_replace("\r", '', $txt);
|
6291 |
// check if string contains arabic text
|
6292 |
+
if (preg_match(DSGVOTCPDF_FONT_DATA::$uni_RE_PATTERN_ARABIC, $s)) {
|
6293 |
$arabic = true;
|
6294 |
} else {
|
6295 |
$arabic = false;
|
6296 |
}
|
6297 |
// check if string contains RTL text
|
6298 |
+
if ($arabic OR ($this->tmprtl == 'R') OR preg_match(DSGVOTCPDF_FONT_DATA::$uni_RE_PATTERN_RTL, $s)) {
|
6299 |
$rtlmode = true;
|
6300 |
} else {
|
6301 |
$rtlmode = false;
|
6303 |
// get a char width
|
6304 |
$chrwidth = $this->GetCharWidth(46); // dot character
|
6305 |
// get array of unicode values
|
6306 |
+
$chars = DSGVOTCPDF_FONTS::UTF8StringToArray($s, $this->isunicode, $this->CurrentFont);
|
6307 |
// calculate maximum width for a single character on string
|
6308 |
$chrw = $this->GetArrStringWidth($chars, '', '', 0, true);
|
6309 |
array_walk($chrw, array($this, 'getRawCharWidth'));
|
6310 |
$maxchwidth = max($chrw);
|
6311 |
// get array of chars
|
6312 |
+
$uchars = DSGVOTCPDF_FONTS::UTF8ArrayToUniArray($chars, $this->isunicode);
|
6313 |
// get the number of characters
|
6314 |
$nb = count($chars);
|
6315 |
// replacement for SHY character (minus symbol)
|
6316 |
$shy_replacement = 45;
|
6317 |
+
$shy_replacement_char = DSGVOTCPDF_FONTS::unichr($shy_replacement, $this->isunicode);
|
6318 |
// widht for SHY replacement
|
6319 |
$shy_replacement_width = $this->GetCharWidth($shy_replacement);
|
6320 |
// page width
|
6367 |
} else {
|
6368 |
$talign = $align;
|
6369 |
}
|
6370 |
+
$tmpstr = DSGVOTCPDF_FONTS::UniArrSubString($uchars, $j, $i);
|
6371 |
if ($firstline) {
|
6372 |
$startx = $this->x;
|
6373 |
$tmparr = array_slice($chars, $j, ($i - $j));
|
6374 |
if ($rtlmode) {
|
6375 |
+
$tmparr = DSGVOTCPDF_FONTS::utf8Bidi($tmparr, $tmpstr, $this->tmprtl, $this->isunicode, $this->CurrentFont);
|
6376 |
}
|
6377 |
$linew = $this->GetArrStringWidth($tmparr);
|
6378 |
unset($tmparr);
|
6397 |
unset($tmpstr);
|
6398 |
if ($firstline) {
|
6399 |
$this->cell_padding = $tmpcellpadding;
|
6400 |
+
return (DSGVOTCPDF_FONTS::UniArrSubString($uchars, $i));
|
6401 |
}
|
6402 |
++$nl;
|
6403 |
$j = $i + 1;
|
6426 |
// \p{Lo} is needed because Chinese characters are packed next to each other without spaces in between.
|
6427 |
if (($c != 160)
|
6428 |
AND (($c == 173)
|
6429 |
+
OR preg_match($this->re_spaces, DSGVOTCPDF_FONTS::unichr($c, $this->isunicode))
|
6430 |
OR (($c == 45)
|
6431 |
AND ($i < ($nb - 1))
|
6432 |
+
AND @preg_match('/[\p{L}]/'.$this->re_space['m'], DSGVOTCPDF_FONTS::unichr($pc, $this->isunicode))
|
6433 |
+
AND @preg_match('/[\p{L}]/'.$this->re_space['m'], DSGVOTCPDF_FONTS::unichr($chars[($i + 1)], $this->isunicode))
|
6434 |
)
|
6435 |
)
|
6436 |
) {
|
6456 |
if ($this->isUnicodeFont() AND ($arabic)) {
|
6457 |
// with bidirectional algorithm some chars may be changed affecting the line length
|
6458 |
// *** very slow ***
|
6459 |
+
$l = $this->GetArrStringWidth(DSGVOTCPDF_FONTS::utf8Bidi(array_slice($chars, $j, ($i - $j)), '', $this->tmprtl, $this->isunicode, $this->CurrentFont));
|
6460 |
} else {
|
6461 |
$l += $this->GetCharWidth($c);
|
6462 |
}
|
6474 |
$this->Cell($w, $h, '', 0, 1);
|
6475 |
$linebreak = true;
|
6476 |
if ($firstline) {
|
6477 |
+
return (DSGVOTCPDF_FONTS::UniArrSubString($uchars, $j));
|
6478 |
}
|
6479 |
} else {
|
6480 |
// truncate the word because do not fit on column
|
6481 |
+
$tmpstr = DSGVOTCPDF_FONTS::UniArrSubString($uchars, $j, $i);
|
6482 |
if ($firstline) {
|
6483 |
$startx = $this->x;
|
6484 |
$tmparr = array_slice($chars, $j, ($i - $j));
|
6485 |
if ($rtlmode) {
|
6486 |
+
$tmparr = DSGVOTCPDF_FONTS::utf8Bidi($tmparr, $tmpstr, $this->tmprtl, $this->isunicode, $this->CurrentFont);
|
6487 |
}
|
6488 |
$linew = $this->GetArrStringWidth($tmparr);
|
6489 |
unset($tmparr);
|
6505 |
unset($tmpstr);
|
6506 |
if ($firstline) {
|
6507 |
$this->cell_padding = $tmpcellpadding;
|
6508 |
+
return (DSGVOTCPDF_FONTS::UniArrSubString($uchars, $i));
|
6509 |
}
|
6510 |
$j = $i;
|
6511 |
--$i;
|
6518 |
$endspace = 0;
|
6519 |
}
|
6520 |
// check the length of the next string
|
6521 |
+
$strrest = DSGVOTCPDF_FONTS::UniArrSubString($uchars, ($sep + $endspace));
|
6522 |
+
$nextstr = DSGVOTCPDF_STATIC::pregSplit('/'.$this->re_space['p'].'/', $this->re_space['m'], $this->stringTrim($strrest));
|
6523 |
if (isset($nextstr[0]) AND ($this->GetStringWidth($nextstr[0]) > $pw)) {
|
6524 |
// truncate the word because do not fit on a full page width
|
6525 |
+
$tmpstr = DSGVOTCPDF_FONTS::UniArrSubString($uchars, $j, $i);
|
6526 |
if ($firstline) {
|
6527 |
$startx = $this->x;
|
6528 |
$tmparr = array_slice($chars, $j, ($i - $j));
|
6529 |
if ($rtlmode) {
|
6530 |
+
$tmparr = DSGVOTCPDF_FONTS::utf8Bidi($tmparr, $tmpstr, $this->tmprtl, $this->isunicode, $this->CurrentFont);
|
6531 |
}
|
6532 |
$linew = $this->GetArrStringWidth($tmparr);
|
6533 |
unset($tmparr);
|
6549 |
unset($tmpstr);
|
6550 |
if ($firstline) {
|
6551 |
$this->cell_padding = $tmpcellpadding;
|
6552 |
+
return (DSGVOTCPDF_FONTS::UniArrSubString($uchars, $i));
|
6553 |
}
|
6554 |
$j = $i;
|
6555 |
--$i;
|
6570 |
$shy_char_left = '';
|
6571 |
$shy_char_right = '';
|
6572 |
}
|
6573 |
+
$tmpstr = DSGVOTCPDF_FONTS::UniArrSubString($uchars, $j, ($sep + $endspace));
|
6574 |
if ($firstline) {
|
6575 |
$startx = $this->x;
|
6576 |
$tmparr = array_slice($chars, $j, (($sep + $endspace) - $j));
|
6577 |
if ($rtlmode) {
|
6578 |
+
$tmparr = DSGVOTCPDF_FONTS::utf8Bidi($tmparr, $tmpstr, $this->tmprtl, $this->isunicode, $this->CurrentFont);
|
6579 |
}
|
6580 |
$linew = $this->GetArrStringWidth($tmparr);
|
6581 |
unset($tmparr);
|
6602 |
}
|
6603 |
// return the remaining text
|
6604 |
$this->cell_padding = $tmpcellpadding;
|
6605 |
+
return (DSGVOTCPDF_FONTS::UniArrSubString($uchars, ($sep + $endspace)));
|
6606 |
}
|
6607 |
$i = $sep;
|
6608 |
$sep = -1;
|
6664 |
break;
|
6665 |
}
|
6666 |
}
|
6667 |
+
$tmpstr = DSGVOTCPDF_FONTS::UniArrSubString($uchars, $j, $nb);
|
6668 |
if ($firstline) {
|
6669 |
$startx = $this->x;
|
6670 |
$tmparr = array_slice($chars, $j, ($nb - $j));
|
6671 |
if ($rtlmode) {
|
6672 |
+
$tmparr = DSGVOTCPDF_FONTS::utf8Bidi($tmparr, $tmpstr, $this->tmprtl, $this->isunicode, $this->CurrentFont);
|
6673 |
}
|
6674 |
$linew = $this->GetArrStringWidth($tmparr);
|
6675 |
unset($tmparr);
|
6691 |
unset($tmpstr);
|
6692 |
if ($firstline) {
|
6693 |
$this->cell_padding = $tmpcellpadding;
|
6694 |
+
return (DSGVOTCPDF_FONTS::UniArrSubString($uchars, $nb));
|
6695 |
}
|
6696 |
++$nl;
|
6697 |
}
|
6859 |
$info = $this->getImageBuffer($file);
|
6860 |
$imsize = array($info['w'], $info['h']);
|
6861 |
} elseif (strpos($file, '__tcpdf_'.$this->file_id.'_img') === FALSE) {
|
6862 |
+
$imgdata = DSGVOTCPDF_STATIC::fileGetContents($file);
|
6863 |
}
|
6864 |
}
|
6865 |
}
|
6866 |
if (!empty($imgdata)) {
|
6867 |
// copy image to cache
|
6868 |
$original_file = $file;
|
6869 |
+
$file = DSGVOTCPDF_STATIC::getObjFilename('img', $this->file_id);
|
6870 |
+
$fp = DSGVOTCPDF_STATIC::fopenLocal($file, 'w');
|
6871 |
if (!$fp) {
|
6872 |
$this->Error('Unable to write file: '.$file);
|
6873 |
}
|
7014 |
//First use of image, get info
|
7015 |
$type = strtolower($type);
|
7016 |
if ($type == '') {
|
7017 |
+
$type = DSGVOTCPDF_IMAGES::getImageFileType($file, $imsize);
|
7018 |
} elseif ($type == 'jpg') {
|
7019 |
$type = 'jpeg';
|
7020 |
}
|
7021 |
+
$mqr = DSGVOTCPDF_STATIC::get_mqr();
|
7022 |
+
DSGVOTCPDF_STATIC::set_mqr(false);
|
7023 |
// Specific image handlers (defined on TCPDF_IMAGES CLASS)
|
7024 |
$mtd = '_parse'.$type;
|
7025 |
// GD image handler function
|
7027 |
$info = false;
|
7028 |
if ((method_exists('TCPDF_IMAGES', $mtd)) AND (!($resize AND (function_exists($gdfunction) OR extension_loaded('imagick'))))) {
|
7029 |
// TCPDF image functions
|
7030 |
+
$info = DSGVOTCPDF_IMAGES::$mtd($file);
|
7031 |
if (($ismask === false) AND ($imgmask === false) AND (strpos($file, '__tcpdf_'.$this->file_id.'_imgmask_') === FALSE)
|
7032 |
AND (($info === 'pngalpha') OR (isset($info['trns']) AND !empty($info['trns'])))) {
|
7033 |
return $this->ImagePngAlpha($file, $x, $y, $pixw, $pixh, $w, $h, 'PNG', $link, $align, $resize, $dpi, $palign, $filehash);
|
7041 |
if ($resize) {
|
7042 |
$imgr = imagecreatetruecolor($neww, $newh);
|
7043 |
if (($type == 'gif') OR ($type == 'png')) {
|
7044 |
+
$imgr = DSGVOTCPDF_IMAGES::setGDImageTransparency($imgr, $img);
|
7045 |
}
|
7046 |
imagecopyresampled($imgr, $img, 0, 0, 0, 0, $neww, $newh, $pixw, $pixh);
|
7047 |
$img = $imgr;
|
7048 |
}
|
7049 |
if (($type == 'gif') OR ($type == 'png')) {
|
7050 |
+
$info = DSGVOTCPDF_IMAGES::_toPNG($img, DSGVOTCPDF_STATIC::getObjFilename('img', $this->file_id));
|
7051 |
} else {
|
7052 |
+
$info = DSGVOTCPDF_IMAGES::_toJPEG($img, $this->jpeg_quality, DSGVOTCPDF_STATIC::getObjFilename('img', $this->file_id));
|
7053 |
}
|
7054 |
}
|
7055 |
} catch(Exception $e) {
|
7066 |
$svgimg = substr($file, 1);
|
7067 |
} else {
|
7068 |
// get SVG file content
|
7069 |
+
$svgimg = DSGVOTCPDF_STATIC::fileGetContents($file);
|
7070 |
}
|
7071 |
if ($svgimg !== FALSE) {
|
7072 |
// get width and height
|
7108 |
}
|
7109 |
$img->setCompressionQuality($this->jpeg_quality);
|
7110 |
$img->setImageFormat('jpeg');
|
7111 |
+
$tempname = DSGVOTCPDF_STATIC::getObjFilename('img', $this->file_id);
|
7112 |
$img->writeImage($tempname);
|
7113 |
+
$info = DSGVOTCPDF_IMAGES::_parsejpeg($tempname);
|
7114 |
unlink($tempname);
|
7115 |
$img->destroy();
|
7116 |
} catch(Exception $e) {
|
7121 |
// unable to process image
|
7122 |
return;
|
7123 |
}
|
7124 |
+
DSGVOTCPDF_STATIC::set_mqr($mqr);
|
7125 |
if ($ismask) {
|
7126 |
// force grayscale
|
7127 |
$info['cs'] = 'DeviceGray';
|
7259 |
$img = new Imagick();
|
7260 |
$img->readImage($file);
|
7261 |
// clone image object
|
7262 |
+
$imga = DSGVOTCPDF_STATIC::objclone($img);
|
7263 |
// extract alpha channel
|
7264 |
if (method_exists($img, 'setImageAlphaChannel') AND defined('Imagick::ALPHACHANNEL_EXTRACT')) {
|
7265 |
$img->setImageAlphaChannel(Imagick::ALPHACHANNEL_EXTRACT);
|
7573 |
// remove last newline
|
7574 |
$pdfdoc = substr($pdfdoc, 0, -1);
|
7575 |
// remove filler space
|
7576 |
+
$byterange_string_len = strlen(DSGVOTCPDF_STATIC::$byterange_string);
|
7577 |
// define the ByteRange
|
7578 |
$byte_range = array();
|
7579 |
$byte_range[0] = 0;
|
7580 |
+
$byte_range[1] = strpos($pdfdoc, DSGVOTCPDF_STATIC::$byterange_string) + $byterange_string_len + 10;
|
7581 |
$byte_range[2] = $byte_range[1] + $this->signature_max_length + 2;
|
7582 |
$byte_range[3] = strlen($pdfdoc) - $byte_range[2];
|
7583 |
$pdfdoc = substr($pdfdoc, 0, $byte_range[1]).substr($pdfdoc, $byte_range[2]);
|
7584 |
// replace the ByteRange
|
7585 |
$byterange = sprintf('/ByteRange[0 %u %u %u]', $byte_range[1], $byte_range[2], $byte_range[3]);
|
7586 |
$byterange .= str_repeat(' ', ($byterange_string_len - strlen($byterange)));
|
7587 |
+
$pdfdoc = str_replace(DSGVOTCPDF_STATIC::$byterange_string, $byterange, $pdfdoc);
|
7588 |
// write the document to a temporary folder
|
7589 |
+
$tempdoc = DSGVOTCPDF_STATIC::getObjFilename('doc', $this->file_id);
|
7590 |
+
$f = DSGVOTCPDF_STATIC::fopenLocal($tempdoc, 'wb');
|
7591 |
if (!$f) {
|
7592 |
$this->Error('Unable to create temporary file: '.$tempdoc);
|
7593 |
}
|
7595 |
fwrite($f, $pdfdoc, $pdfdoc_length);
|
7596 |
fclose($f);
|
7597 |
// get digital signature via openssl library
|
7598 |
+
$tempsign = DSGVOTCPDF_STATIC::getObjFilename('sig', $this->file_id);
|
7599 |
if (empty($this->signature_data['extracerts'])) {
|
7600 |
openssl_pkcs7_sign($tempdoc, $tempsign, $this->signature_data['signcert'], array($this->signature_data['privkey'], $this->signature_data['password']), array(), PKCS7_BINARY | PKCS7_DETACHED);
|
7601 |
} else {
|
7637 |
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
|
7638 |
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
7639 |
header('Content-Disposition: inline; filename="'.basename($name).'"');
|
7640 |
+
DSGVOTCPDF_STATIC::sendOutputData($this->getBuffer(), $this->bufferlen);
|
7641 |
} else {
|
7642 |
echo $this->getBuffer();
|
7643 |
}
|
7669 |
// use the Content-Disposition header to supply a recommended filename
|
7670 |
header('Content-Disposition: attachment; filename="'.basename($name).'"');
|
7671 |
header('Content-Transfer-Encoding: binary');
|
7672 |
+
DSGVOTCPDF_STATIC::sendOutputData($this->getBuffer(), $this->bufferlen);
|
7673 |
break;
|
7674 |
}
|
7675 |
case 'F':
|
7676 |
case 'FI':
|
7677 |
case 'FD': {
|
7678 |
// save PDF to a local file
|
7679 |
+
$f = DSGVOTCPDF_STATIC::fopenLocal($name, 'wb');
|
7680 |
if (!$f) {
|
7681 |
$this->Error('Unable to create output file: '.$name);
|
7682 |
}
|
7691 |
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
|
7692 |
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
7693 |
header('Content-Disposition: inline; filename="'.basename($name).'"');
|
7694 |
+
DSGVOTCPDF_STATIC::sendOutputData(file_get_contents($name), filesize($name));
|
7695 |
} elseif ($dest == 'FD') {
|
7696 |
// send headers to browser
|
7697 |
if (ob_get_contents()) {
|
7717 |
// use the Content-Disposition header to supply a recommended filename
|
7718 |
header('Content-Disposition: attachment; filename="'.basename($name).'"');
|
7719 |
header('Content-Transfer-Encoding: binary');
|
7720 |
+
DSGVOTCPDF_STATIC::sendOutputData(file_get_contents($name), filesize($name));
|
7721 |
}
|
7722 |
break;
|
7723 |
}
|
7806 |
// build array of Unicode + ASCII variants (the order is important)
|
7807 |
$alias = array('u' => array(), 'a' => array());
|
7808 |
$u = '{'.$a.'}';
|
7809 |
+
$alias['u'][] = DSGVOTCPDF_STATIC::_escape($u);
|
7810 |
if ($this->isunicode) {
|
7811 |
+
$alias['u'][] = DSGVOTCPDF_STATIC::_escape(DSGVOTCPDF_FONTS::UTF8ToLatin1($u, $this->isunicode, $this->CurrentFont));
|
7812 |
+
$alias['u'][] = DSGVOTCPDF_STATIC::_escape(DSGVOTCPDF_FONTS::utf8StrRev($u, false, $this->tmprtl, $this->isunicode, $this->CurrentFont));
|
7813 |
+
$alias['a'][] = DSGVOTCPDF_STATIC::_escape(DSGVOTCPDF_FONTS::UTF8ToLatin1($a, $this->isunicode, $this->CurrentFont));
|
7814 |
+
$alias['a'][] = DSGVOTCPDF_STATIC::_escape(DSGVOTCPDF_FONTS::utf8StrRev($a, false, $this->tmprtl, $this->isunicode, $this->CurrentFont));
|
7815 |
}
|
7816 |
+
$alias['a'][] = DSGVOTCPDF_STATIC::_escape($a);
|
7817 |
return $alias;
|
7818 |
}
|
7819 |
|
7823 |
* @protected
|
7824 |
*/
|
7825 |
protected function getAllInternalPageNumberAliases() {
|
7826 |
+
$basic_alias = array(DSGVOTCPDF_STATIC::$alias_tot_pages, DSGVOTCPDF_STATIC::$alias_num_page, DSGVOTCPDF_STATIC::$alias_group_tot_pages, DSGVOTCPDF_STATIC::$alias_group_num_page, DSGVOTCPDF_STATIC::$alias_right_shift);
|
7827 |
$pnalias = array();
|
7828 |
foreach($basic_alias as $k => $a) {
|
7829 |
$pnalias[$k] = $this->getInternalPageNumberAliases($a);
|
7858 |
if ($type == 'u') {
|
7859 |
$chrdiff = floor(($diff + 12) * $ratio);
|
7860 |
$shift = str_repeat(' ', $chrdiff);
|
7861 |
+
$shift = DSGVOTCPDF_FONTS::UTF8ToUTF16BE($shift, false, $this->isunicode, $this->CurrentFont);
|
7862 |
} else {
|
7863 |
$chrdiff = floor(($diff + 11) * $ratio);
|
7864 |
$shift = str_repeat(' ', $chrdiff);
|
7878 |
protected function setPageBoxTypes($boxes) {
|
7879 |
$this->page_boxes = array();
|
7880 |
foreach ($boxes as $box) {
|
7881 |
+
if (in_array($box, DSGVOTCPDF_STATIC::$pageboxes)) {
|
7882 |
$this->page_boxes[] = $box;
|
7883 |
}
|
7884 |
}
|
7893 |
// get internal aliases for page numbers
|
7894 |
$pnalias = $this->getAllInternalPageNumberAliases();
|
7895 |
$num_pages = $this->numpages;
|
7896 |
+
$ptpa = DSGVOTCPDF_STATIC::formatPageNumber(($this->starting_page_number + $num_pages - 1));
|
7897 |
+
$ptpu = DSGVOTCPDF_FONTS::UTF8ToUTF16BE($ptpa, false, $this->isunicode, $this->CurrentFont);
|
7898 |
$ptp_num_chars = $this->GetNumChars($ptpa);
|
7899 |
$pagegroupnum = 0;
|
7900 |
$groupnum = 0;
|
7906 |
$temppage = $this->getPageBuffer($n);
|
7907 |
$pagelen = strlen($temppage);
|
7908 |
// set replacements for total pages number
|
7909 |
+
$pnpa = DSGVOTCPDF_STATIC::formatPageNumber(($this->starting_page_number + $n - 1));
|
7910 |
+
$pnpu = DSGVOTCPDF_FONTS::UTF8ToUTF16BE($pnpa, false, $this->isunicode, $this->CurrentFont);
|
7911 |
$pnp_num_chars = $this->GetNumChars($pnpa);
|
7912 |
$pdiff = 0; // difference used for right shift alignment of page numbers
|
7913 |
$gdiff = 0; // difference used for right shift alignment of page group numbers
|
7915 |
if (isset($this->newpagegroup[$n])) {
|
7916 |
$pagegroupnum = 0;
|
7917 |
++$groupnum;
|
7918 |
+
$ptga = DSGVOTCPDF_STATIC::formatPageNumber($this->pagegroups[$groupnum]);
|
7919 |
+
$ptgu = DSGVOTCPDF_FONTS::UTF8ToUTF16BE($ptga, false, $this->isunicode, $this->CurrentFont);
|
7920 |
$ptg_num_chars = $this->GetNumChars($ptga);
|
7921 |
}
|
7922 |
++$pagegroupnum;
|
7923 |
+
$pnga = DSGVOTCPDF_STATIC::formatPageNumber($pagegroupnum);
|
7924 |
+
$pngu = DSGVOTCPDF_FONTS::UTF8ToUTF16BE($pnga, false, $this->isunicode, $this->CurrentFont);
|
7925 |
$png_num_chars = $this->GetNumChars($pnga);
|
7926 |
// replace page numbers
|
7927 |
$replace = array();
|
7929 |
$replace[] = array($ptga, $ptg_num_chars, 7, $pnalias[2]['a']);
|
7930 |
$replace[] = array($pngu, $png_num_chars, 9, $pnalias[3]['u']);
|
7931 |
$replace[] = array($pnga, $png_num_chars, 7, $pnalias[3]['a']);
|
7932 |
+
list($temppage, $gdiff) = DSGVOTCPDF_STATIC::replacePageNumAliases($temppage, $replace, $gdiff);
|
7933 |
}
|
7934 |
// replace page numbers
|
7935 |
$replace = array();
|
7937 |
$replace[] = array($ptpa, $ptp_num_chars, 7, $pnalias[0]['a']);
|
7938 |
$replace[] = array($pnpu, $pnp_num_chars, 9, $pnalias[1]['u']);
|
7939 |
$replace[] = array($pnpa, $pnp_num_chars, 7, $pnalias[1]['a']);
|
7940 |
+
list($temppage, $pdiff) = DSGVOTCPDF_STATIC::replacePageNumAliases($temppage, $replace, $pdiff);
|
7941 |
// replace right shift alias
|
7942 |
$temppage = $this->replaceRightShiftPageNumAliases($temppage, $pnalias[4], max($pdiff, $gdiff));
|
7943 |
// replace EPS marker
|
8301 |
$annots .= '>>';
|
8302 |
}
|
8303 |
if (isset($pl['opt']['c']) AND (is_array($pl['opt']['c'])) AND !empty($pl['opt']['c'])) {
|
8304 |
+
$annots .= ' /C '.DSGVOTCPDF_COLORS::getColorStringFromArray($pl['opt']['c']);
|
8305 |
}
|
8306 |
//$annots .= ' /StructParent ';
|
8307 |
//$annots .= ' /OC ';
|
8367 |
if (is_string($pl['txt']) && !empty($pl['txt'])) {
|
8368 |
if ($pl['txt'][0] == '#') {
|
8369 |
// internal destination
|
8370 |
+
$annots .= ' /Dest /'.DSGVOTCPDF_STATIC::encodeNameObject(substr($pl['txt'], 1));
|
8371 |
} elseif ($pl['txt'][0] == '%') {
|
8372 |
// embedded PDF file
|
8373 |
$filename = basename(substr($pl['txt'], 1));
|
8539 |
$annots .= ' /R '.$pl['opt']['mk']['r'];
|
8540 |
}
|
8541 |
if (isset($pl['opt']['mk']['bc']) AND (is_array($pl['opt']['mk']['bc']))) {
|
8542 |
+
$annots .= ' /BC '.DSGVOTCPDF_COLORS::getColorStringFromArray($pl['opt']['mk']['bc']);
|
8543 |
}
|
8544 |
if (isset($pl['opt']['mk']['bg']) AND (is_array($pl['opt']['mk']['bg']))) {
|
8545 |
+
$annots .= ' /BG '.DSGVOTCPDF_COLORS::getColorStringFromArray($pl['opt']['mk']['bg']);
|
8546 |
}
|
8547 |
if (isset($pl['opt']['mk']['ca'])) {
|
8548 |
$annots .= ' /CA '.$pl['opt']['mk']['ca'];
|
8774 |
$this->_newobj();
|
8775 |
$this->_out('<< /Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$diff.'] >>'."\n".'endobj');
|
8776 |
}
|
8777 |
+
$mqr = DSGVOTCPDF_STATIC::get_mqr();
|
8778 |
+
DSGVOTCPDF_STATIC::set_mqr(false);
|
8779 |
foreach ($this->FontFiles as $file => $info) {
|
8780 |
// search and get font file to embedd
|
8781 |
+
$fontfile = DSGVOTCPDF_FONTS::getFontFullPath($file, $info['fontdir']);
|
8782 |
+
if (!DSGVOTCPDF_STATIC::empty_string($fontfile)) {
|
8783 |
$font = file_get_contents($fontfile);
|
8784 |
$compressed = (substr($file, -2) == '.z');
|
8785 |
if ((!$compressed) AND (isset($info['length2']))) {
|
8804 |
$subsetchars += $fontinfo['subsetchars'];
|
8805 |
}
|
8806 |
// rebuild a font subset
|
8807 |
+
$font = DSGVOTCPDF_FONTS::_getTrueTypeFontSubset($font, $subsetchars);
|
8808 |
// calculate new font length
|
8809 |
$info['length1'] = strlen($font);
|
8810 |
if ($compressed) {
|
8829 |
$this->_out($out);
|
8830 |
}
|
8831 |
}
|
8832 |
+
DSGVOTCPDF_STATIC::set_mqr($mqr);
|
8833 |
foreach ($this->fontkeys as $k) {
|
8834 |
//Font objects
|
8835 |
$font = $this->getFontBuffer($k);
|
8894 |
}
|
8895 |
$s .= ' /'.$fdk.' '.$fdv.'';
|
8896 |
}
|
8897 |
+
if (!DSGVOTCPDF_STATIC::empty_string($font['file'])) {
|
8898 |
$s .= ' /FontFile'.($type == 'Type1' ? '' : '2').' '.$this->FontFiles[$font['file']]['n'].' 0 R';
|
8899 |
}
|
8900 |
$s .= '>>';
|
8942 |
$out .= "\n".'endobj';
|
8943 |
$this->_out($out);
|
8944 |
// ToUnicode map for Identity-H
|
8945 |
+
$stream = DSGVOTCPDF_FONT_DATA::$uni_identity_h;
|
8946 |
// ToUnicode Object
|
8947 |
$this->_newobj();
|
8948 |
$stream = ($this->compress) ? gzcompress($stream) : $stream;
|
8962 |
$out .= ' /CIDSystemInfo << '.$cidinfo.' >>';
|
8963 |
$out .= ' /FontDescriptor '.($this->n + 1).' 0 R';
|
8964 |
$out .= ' /DW '.$font['dw']; // default width
|
8965 |
+
$out .= "\n".DSGVOTCPDF_FONTS::_putfontwidths($font, 0);
|
8966 |
+
if (isset($font['ctg']) AND (!DSGVOTCPDF_STATIC::empty_string($font['ctg']))) {
|
8967 |
$out .= "\n".'/CIDToGIDMap '.($this->n + 2).' 0 R';
|
8968 |
}
|
8969 |
$out .= ' >>';
|
8981 |
$out .= ' /'.$key.' '.$value;
|
8982 |
}
|
8983 |
$fontdir = false;
|
8984 |
+
if (!DSGVOTCPDF_STATIC::empty_string($font['file'])) {
|
8985 |
// A stream containing a TrueType font
|
8986 |
$out .= ' /FontFile2 '.$this->FontFiles[$font['file']]['n'].' 0 R';
|
8987 |
$fontdir = $this->FontFiles[$font['file']]['fontdir'];
|
8989 |
$out .= ' >>';
|
8990 |
$out .= "\n".'endobj';
|
8991 |
$this->_out($out);
|
8992 |
+
if (isset($font['ctg']) AND (!DSGVOTCPDF_STATIC::empty_string($font['ctg']))) {
|
8993 |
$this->_newobj();
|
8994 |
// Embed CIDToGIDMap
|
8995 |
// A specification of the mapping from CIDs to glyph indices
|
8996 |
// search and get CTG font file to embedd
|
8997 |
$ctgfile = strtolower($font['ctg']);
|
8998 |
// search and get ctg font file to embedd
|
8999 |
+
$fontfile = DSGVOTCPDF_FONTS::getFontFullPath($ctgfile, $fontdir);
|
9000 |
+
if (DSGVOTCPDF_STATIC::empty_string($fontfile)) {
|
9001 |
$this->Error('Font file not found: '.$ctgfile);
|
9002 |
}
|
9003 |
$stream = $this->_getrawstream(file_get_contents($fontfile));
|
9070 |
$out .= ' /CIDSystemInfo <<'.$cidinfo.'>>';
|
9071 |
$out .= ' /FontDescriptor '.($this->n + 1).' 0 R';
|
9072 |
$out .= ' /DW '.$font['dw'];
|
9073 |
+
$out .= "\n".DSGVOTCPDF_FONTS::_putfontwidths($font, $cidoffset);
|
9074 |
$out .= ' >>';
|
9075 |
$out .= "\n".'endobj';
|
9076 |
$this->_out($out);
|
9452 |
if ($this->docinfounicode) {
|
9453 |
$this->isunicode = true;
|
9454 |
}
|
9455 |
+
if (!DSGVOTCPDF_STATIC::empty_string($this->title)) {
|
9456 |
// The document's title.
|
9457 |
$out .= ' /Title '.$this->_textstring($this->title, $oid);
|
9458 |
}
|
9459 |
+
if (!DSGVOTCPDF_STATIC::empty_string($this->author)) {
|
9460 |
// The name of the person who created the document.
|
9461 |
$out .= ' /Author '.$this->_textstring($this->author, $oid);
|
9462 |
}
|
9463 |
+
if (!DSGVOTCPDF_STATIC::empty_string($this->subject)) {
|
9464 |
// The subject of the document.
|
9465 |
$out .= ' /Subject '.$this->_textstring($this->subject, $oid);
|
9466 |
}
|
9467 |
+
if (!DSGVOTCPDF_STATIC::empty_string($this->keywords)) {
|
9468 |
// Keywords associated with the document.
|
9469 |
$out .= ' /Keywords '.$this->_textstring($this->keywords, $oid);
|
9470 |
}
|
9471 |
+
if (!DSGVOTCPDF_STATIC::empty_string($this->creator)) {
|
9472 |
// If the document was converted to PDF from another format, the name of the conforming product that created the original document from which it was converted.
|
9473 |
$out .= ' /Creator '.$this->_textstring($this->creator, $oid);
|
9474 |
}
|
9475 |
// restore previous isunicode value
|
9476 |
$this->isunicode = $prev_isunicode;
|
9477 |
// default producer
|
9478 |
+
$out .= ' /Producer '.$this->_textstring(DSGVOTCPDF_STATIC::getTCPDFProducer(), $oid);
|
9479 |
// The date and time the document was created, in human-readable form
|
9480 |
$out .= ' /CreationDate '.$this->_datestring(0, $this->doc_creation_timestamp);
|
9481 |
// The date and time the document was most recently modified, in human-readable form
|
9513 |
$prev_encrypted = $this->encrypted;
|
9514 |
$this->encrypted = false;
|
9515 |
// set XMP data
|
9516 |
+
$xmp = '<?xpacket begin="'.DSGVOTCPDF_FONTS::unichr(0xfeff, $this->isunicode).'" id="W5M0MpCehiHzreSzNTczkc9d"?>'."\n";
|
9517 |
$xmp .= '<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 4.2.1-c043 52.372728, 2009/01/18-15:08:04">'."\n";
|
9518 |
$xmp .= "\t".'<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">'."\n";
|
9519 |
$xmp .= "\t\t".'<rdf:Description rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/">'."\n";
|
9520 |
$xmp .= "\t\t\t".'<dc:format>application/pdf</dc:format>'."\n";
|
9521 |
$xmp .= "\t\t\t".'<dc:title>'."\n";
|
9522 |
$xmp .= "\t\t\t\t".'<rdf:Alt>'."\n";
|
9523 |
+
$xmp .= "\t\t\t\t\t".'<rdf:li xml:lang="x-default">'.DSGVOTCPDF_STATIC::_escapeXML($this->title).'</rdf:li>'."\n";
|
9524 |
$xmp .= "\t\t\t\t".'</rdf:Alt>'."\n";
|
9525 |
$xmp .= "\t\t\t".'</dc:title>'."\n";
|
9526 |
$xmp .= "\t\t\t".'<dc:creator>'."\n";
|
9527 |
$xmp .= "\t\t\t\t".'<rdf:Seq>'."\n";
|
9528 |
+
$xmp .= "\t\t\t\t\t".'<rdf:li>'.DSGVOTCPDF_STATIC::_escapeXML($this->author).'</rdf:li>'."\n";
|
9529 |
$xmp .= "\t\t\t\t".'</rdf:Seq>'."\n";
|
9530 |
$xmp .= "\t\t\t".'</dc:creator>'."\n";
|
9531 |
$xmp .= "\t\t\t".'<dc:description>'."\n";
|
9532 |
$xmp .= "\t\t\t\t".'<rdf:Alt>'."\n";
|
9533 |
+
$xmp .= "\t\t\t\t\t".'<rdf:li xml:lang="x-default">'.DSGVOTCPDF_STATIC::_escapeXML($this->subject).'</rdf:li>'."\n";
|
9534 |
$xmp .= "\t\t\t\t".'</rdf:Alt>'."\n";
|
9535 |
$xmp .= "\t\t\t".'</dc:description>'."\n";
|
9536 |
$xmp .= "\t\t\t".'<dc:subject>'."\n";
|
9537 |
$xmp .= "\t\t\t\t".'<rdf:Bag>'."\n";
|
9538 |
+
$xmp .= "\t\t\t\t\t".'<rdf:li>'.DSGVOTCPDF_STATIC::_escapeXML($this->keywords).'</rdf:li>'."\n";
|
9539 |
$xmp .= "\t\t\t\t".'</rdf:Bag>'."\n";
|
9540 |
$xmp .= "\t\t\t".'</dc:subject>'."\n";
|
9541 |
$xmp .= "\t\t".'</rdf:Description>'."\n";
|
9542 |
// convert doc creation date format
|
9543 |
+
$dcdate = DSGVOTCPDF_STATIC::getFormattedDate($this->doc_creation_timestamp);
|
9544 |
$doccreationdate = substr($dcdate, 0, 4).'-'.substr($dcdate, 4, 2).'-'.substr($dcdate, 6, 2);
|
9545 |
$doccreationdate .= 'T'.substr($dcdate, 8, 2).':'.substr($dcdate, 10, 2).':'.substr($dcdate, 12, 2);
|
9546 |
$doccreationdate .= substr($dcdate, 14, 3).':'.substr($dcdate, 18, 2);
|
9547 |
+
$doccreationdate = DSGVOTCPDF_STATIC::_escapeXML($doccreationdate);
|
9548 |
// convert doc modification date format
|
9549 |
+
$dmdate = DSGVOTCPDF_STATIC::getFormattedDate($this->doc_modification_timestamp);
|
9550 |
$docmoddate = substr($dmdate, 0, 4).'-'.substr($dmdate, 4, 2).'-'.substr($dmdate, 6, 2);
|
9551 |
$docmoddate .= 'T'.substr($dmdate, 8, 2).':'.substr($dmdate, 10, 2).':'.substr($dmdate, 12, 2);
|
9552 |
$docmoddate .= substr($dmdate, 14, 3).':'.substr($dmdate, 18, 2);
|
9553 |
+
$docmoddate = DSGVOTCPDF_STATIC::_escapeXML($docmoddate);
|
9554 |
$xmp .= "\t\t".'<rdf:Description rdf:about="" xmlns:xmp="http://ns.adobe.com/xap/1.0/">'."\n";
|
9555 |
$xmp .= "\t\t\t".'<xmp:CreateDate>'.$doccreationdate.'</xmp:CreateDate>'."\n";
|
9556 |
$xmp .= "\t\t\t".'<xmp:CreatorTool>'.$this->creator.'</xmp:CreatorTool>'."\n";
|
9558 |
$xmp .= "\t\t\t".'<xmp:MetadataDate>'.$doccreationdate.'</xmp:MetadataDate>'."\n";
|
9559 |
$xmp .= "\t\t".'</rdf:Description>'."\n";
|
9560 |
$xmp .= "\t\t".'<rdf:Description rdf:about="" xmlns:pdf="http://ns.adobe.com/pdf/1.3/">'."\n";
|
9561 |
+
$xmp .= "\t\t\t".'<pdf:Keywords>'.DSGVOTCPDF_STATIC::_escapeXML($this->keywords).'</pdf:Keywords>'."\n";
|
9562 |
+
$xmp .= "\t\t\t".'<pdf:Producer>'.DSGVOTCPDF_STATIC::_escapeXML(DSGVOTCPDF_STATIC::getTCPDFProducer()).'</pdf:Producer>'."\n";
|
9563 |
$xmp .= "\t\t".'</rdf:Description>'."\n";
|
9564 |
$xmp .= "\t\t".'<rdf:Description rdf:about="" xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/">'."\n";
|
9565 |
$uuid = 'uuid:'.substr($this->file_id, 0, 8).'-'.substr($this->file_id, 8, 4).'-'.substr($this->file_id, 12, 4).'-'.substr($this->file_id, 16, 4).'-'.substr($this->file_id, 20, 12);
|
9681 |
$out .= ' /Dests '.($this->n_dests).' 0 R';
|
9682 |
}
|
9683 |
$out .= $this->_putviewerpreferences();
|
9684 |
+
if (isset($this->LayoutMode) AND (!DSGVOTCPDF_STATIC::empty_string($this->LayoutMode))) {
|
9685 |
$out .= ' /PageLayout /'.$this->LayoutMode;
|
9686 |
}
|
9687 |
+
if (isset($this->PageMode) AND (!DSGVOTCPDF_STATIC::empty_string($this->PageMode))) {
|
9688 |
$out .= ' /PageMode /'.$this->PageMode;
|
9689 |
}
|
9690 |
if (count($this->outlines) > 0) {
|
9874 |
if (isset($vp['PrintScaling'])) {
|
9875 |
$out .= ' /PrintScaling /'.$vp['PrintScaling'];
|
9876 |
}
|
9877 |
+
if (isset($vp['Duplex']) AND (!DSGVOTCPDF_STATIC::empty_string($vp['Duplex']))) {
|
9878 |
$out .= ' /Duplex /'.$vp['Duplex'];
|
9879 |
}
|
9880 |
if (isset($vp['PickTrayByPDFSize'])) {
|
10009 |
// initialize array for graphics tranformation positions inside a page buffer
|
10010 |
$this->transfmrk[$this->page] = array();
|
10011 |
$this->state = 2;
|
10012 |
+
if (DSGVOTCPDF_STATIC::empty_string($orientation)) {
|
10013 |
if (isset($this->CurOrientation)) {
|
10014 |
$orientation = $this->CurOrientation;
|
10015 |
} elseif ($this->fwPt > $this->fhPt) {
|
10020 |
$orientation = 'P';
|
10021 |
}
|
10022 |
}
|
10023 |
+
if (DSGVOTCPDF_STATIC::empty_string($format)) {
|
10024 |
$this->pagedim[$this->page] = $this->pagedim[($this->page - 1)];
|
10025 |
$this->setPageOrientation($orientation);
|
10026 |
} else {
|
10166 |
$n = $this->n;
|
10167 |
}
|
10168 |
$s = $this->_encrypt_data($n, $s);
|
10169 |
+
return '('. DSGVOTCPDF_STATIC::_escape($s).')';
|
10170 |
}
|
10171 |
|
10172 |
/**
|
10177 |
*/
|
10178 |
public function setDocCreationTimestamp($time) {
|
10179 |
if (is_string($time)) {
|
10180 |
+
$time = DSGVOTCPDF_STATIC::getTimestamp($time);
|
10181 |
}
|
10182 |
$this->doc_creation_timestamp = intval($time);
|
10183 |
}
|
10190 |
*/
|
10191 |
public function setDocModificationTimestamp($time) {
|
10192 |
if (is_string($time)) {
|
10193 |
+
$time = DSGVOTCPDF_STATIC::getTimestamp($time);
|
10194 |
}
|
10195 |
$this->doc_modification_timestamp = intval($time);
|
10196 |
}
|
10227 |
if ((empty($timestamp)) OR ($timestamp < 0)) {
|
10228 |
$timestamp = $this->doc_creation_timestamp;
|
10229 |
}
|
10230 |
+
return $this->_datastring('D:'.DSGVOTCPDF_STATIC::getFormattedDate($timestamp), $n);
|
10231 |
}
|
10232 |
|
10233 |
/**
|
10240 |
protected function _textstring($s, $n=0) {
|
10241 |
if ($this->isunicode) {
|
10242 |
//Convert string to UTF-16BE
|
10243 |
+
$s = DSGVOTCPDF_FONTS::UTF8ToUTF16BE($s, true, $this->isunicode, $this->CurrentFont);
|
10244 |
}
|
10245 |
return $this->_datastring($s, $n);
|
10246 |
}
|
10441 |
// AES padding
|
10442 |
$objkey .= "\x73\x41\x6C\x54"; // sAlT
|
10443 |
}
|
10444 |
+
$objkey = substr(DSGVOTCPDF_STATIC::_md5_16($objkey), 0, (($this->encryptdata['Length'] / 8) + 5));
|
10445 |
$objkey = substr($objkey, 0, 16);
|
10446 |
return $objkey;
|
10447 |
}
|
10462 |
switch ($this->encryptdata['mode']) {
|
10463 |
case 0: // RC4-40
|
10464 |
case 1: { // RC4-128
|
10465 |
+
$s = DSGVOTCPDF_STATIC::_RC4($this->_objectkey($n), $s, $this->last_enc_key, $this->last_enc_key_c);
|
10466 |
break;
|
10467 |
}
|
10468 |
case 2: { // AES-128
|
10469 |
+
$s = DSGVOTCPDF_STATIC::_AES($this->_objectkey($n), $s);
|
10470 |
break;
|
10471 |
}
|
10472 |
case 3: { // AES-256
|
10473 |
+
$s = DSGVOTCPDF_STATIC::_AES($this->encryptdata['key'], $s);
|
10474 |
break;
|
10475 |
}
|
10476 |
}
|
10572 |
$out .= ' /R';
|
10573 |
if ($this->encryptdata['V'] == 5) { // AES-256
|
10574 |
$out .= ' 5';
|
10575 |
+
$out .= ' /OE ('.DSGVOTCPDF_STATIC::_escape($this->encryptdata['OE']).')';
|
10576 |
+
$out .= ' /UE ('.DSGVOTCPDF_STATIC::_escape($this->encryptdata['UE']).')';
|
10577 |
+
$out .= ' /Perms ('.DSGVOTCPDF_STATIC::_escape($this->encryptdata['perms']).')';
|
10578 |
} elseif ($this->encryptdata['V'] == 4) { // AES-128
|
10579 |
$out .= ' 4';
|
10580 |
} elseif ($this->encryptdata['V'] < 2) { // RC-40
|
10582 |
} else { // RC-128
|
10583 |
$out .= ' 3';
|
10584 |
}
|
10585 |
+
$out .= ' /O ('.DSGVOTCPDF_STATIC::_escape($this->encryptdata['O']).')';
|
10586 |
+
$out .= ' /U ('.DSGVOTCPDF_STATIC::_escape($this->encryptdata['U']).')';
|
10587 |
$out .= ' /P '.$this->encryptdata['P'];
|
10588 |
if (isset($this->encryptdata['EncryptMetadata']) AND (!$this->encryptdata['EncryptMetadata'])) {
|
10589 |
$out .= ' /EncryptMetadata false';
|
10605 |
*/
|
10606 |
protected function _Uvalue() {
|
10607 |
if ($this->encryptdata['mode'] == 0) { // RC4-40
|
10608 |
+
return DSGVOTCPDF_STATIC::_RC4($this->encryptdata['key'], DSGVOTCPDF_STATIC::$enc_padding, $this->last_enc_key, $this->last_enc_key_c);
|
10609 |
} elseif ($this->encryptdata['mode'] < 3) { // RC4-128, AES-128
|
10610 |
+
$tmp = DSGVOTCPDF_STATIC::_md5_16(DSGVOTCPDF_STATIC::$enc_padding.$this->encryptdata['fileid']);
|
10611 |
+
$enc = DSGVOTCPDF_STATIC::_RC4($this->encryptdata['key'], $tmp, $this->last_enc_key, $this->last_enc_key_c);
|
10612 |
$len = strlen($tmp);
|
10613 |
for ($i = 1; $i <= 19; ++$i) {
|
10614 |
$ek = '';
|
10615 |
for ($j = 0; $j < $len; ++$j) {
|
10616 |
$ek .= chr(ord($this->encryptdata['key'][$j]) ^ $i);
|
10617 |
}
|
10618 |
+
$enc = DSGVOTCPDF_STATIC::_RC4($ek, $enc, $this->last_enc_key, $this->last_enc_key_c);
|
10619 |
}
|
10620 |
$enc .= str_repeat("\x00", 16);
|
10621 |
return substr($enc, 0, 32);
|
10622 |
} elseif ($this->encryptdata['mode'] == 3) { // AES-256
|
10623 |
+
$seed = DSGVOTCPDF_STATIC::_md5_16(DSGVOTCPDF_STATIC::getRandomSeed());
|
10624 |
// User Validation Salt
|
10625 |
$this->encryptdata['UVS'] = substr($seed, 0, 8);
|
10626 |
// User Key Salt
|
10638 |
*/
|
10639 |
protected function _UEvalue() {
|
10640 |
$hashkey = hash('sha256', $this->encryptdata['user_password'].$this->encryptdata['UKS'], true);
|
10641 |
+
return DSGVOTCPDF_STATIC::_AESnopad($hashkey, $this->encryptdata['key']);
|
10642 |
}
|
10643 |
|
10644 |
/**
|
10650 |
*/
|
10651 |
protected function _Ovalue() {
|
10652 |
if ($this->encryptdata['mode'] < 3) { // RC4-40, RC4-128, AES-128
|
10653 |
+
$tmp = DSGVOTCPDF_STATIC::_md5_16($this->encryptdata['owner_password']);
|
10654 |
if ($this->encryptdata['mode'] > 0) {
|
10655 |
for ($i = 0; $i < 50; ++$i) {
|
10656 |
+
$tmp = DSGVOTCPDF_STATIC::_md5_16($tmp);
|
10657 |
}
|
10658 |
}
|
10659 |
$owner_key = substr($tmp, 0, ($this->encryptdata['Length'] / 8));
|
10660 |
+
$enc = DSGVOTCPDF_STATIC::_RC4($owner_key, $this->encryptdata['user_password'], $this->last_enc_key, $this->last_enc_key_c);
|
10661 |
if ($this->encryptdata['mode'] > 0) {
|
10662 |
$len = strlen($owner_key);
|
10663 |
for ($i = 1; $i <= 19; ++$i) {
|
10665 |
for ($j = 0; $j < $len; ++$j) {
|
10666 |
$ek .= chr(ord($owner_key[$j]) ^ $i);
|
10667 |
}
|
10668 |
+
$enc = DSGVOTCPDF_STATIC::_RC4($ek, $enc, $this->last_enc_key, $this->last_enc_key_c);
|
10669 |
}
|
10670 |
}
|
10671 |
return $enc;
|
10672 |
} elseif ($this->encryptdata['mode'] == 3) { // AES-256
|
10673 |
+
$seed = DSGVOTCPDF_STATIC::_md5_16(DSGVOTCPDF_STATIC::getRandomSeed());
|
10674 |
// Owner Validation Salt
|
10675 |
$this->encryptdata['OVS'] = substr($seed, 0, 8);
|
10676 |
// Owner Key Salt
|
10688 |
*/
|
10689 |
protected function _OEvalue() {
|
10690 |
$hashkey = hash('sha256', $this->encryptdata['owner_password'].$this->encryptdata['OKS'].$this->encryptdata['U'], true);
|
10691 |
+
return DSGVOTCPDF_STATIC::_AESnopad($hashkey, $this->encryptdata['key']);
|
10692 |
}
|
10693 |
|
10694 |
/**
|
10701 |
*/
|
10702 |
protected function _fixAES256Password($password) {
|
10703 |
$psw = ''; // password to be returned
|
10704 |
+
$psw_array = DSGVOTCPDF_FONTS::utf8Bidi(DSGVOTCPDF_FONTS::UTF8StringToArray($password, $this->isunicode, $this->CurrentFont), $password, $this->rtl, $this->isunicode, $this->CurrentFont);
|
10705 |
foreach ($psw_array as $c) {
|
10706 |
+
$psw .= DSGVOTCPDF_FONTS::unichr($c, $this->isunicode);
|
10707 |
}
|
10708 |
return substr($psw, 0, 127);
|
10709 |
}
|
10719 |
if (!$this->encryptdata['pubkey']) { // standard mode
|
10720 |
if ($this->encryptdata['mode'] == 3) { // AES-256
|
10721 |
// generate 256 bit random key
|
10722 |
+
$this->encryptdata['key'] = substr(hash('sha256', DSGVOTCPDF_STATIC::getRandomSeed(), true), 0, $keybytelen);
|
10723 |
// truncate passwords
|
10724 |
$this->encryptdata['user_password'] = $this->_fixAES256Password($this->encryptdata['user_password']);
|
10725 |
$this->encryptdata['owner_password'] = $this->_fixAES256Password($this->encryptdata['owner_password']);
|
10734 |
// Compute P value
|
10735 |
$this->encryptdata['P'] = $this->encryptdata['protection'];
|
10736 |
// Computing the encryption dictionary's Perms (permissions) value
|
10737 |
+
$perms = DSGVOTCPDF_STATIC::getEncPermissionsString($this->encryptdata['protection']); // bytes 0-3
|
10738 |
$perms .= chr(255).chr(255).chr(255).chr(255); // bytes 4-7
|
10739 |
if (isset($this->encryptdata['CF']['EncryptMetadata']) AND (!$this->encryptdata['CF']['EncryptMetadata'])) { // byte 8
|
10740 |
$perms .= 'F';
|
10743 |
}
|
10744 |
$perms .= 'adb'; // bytes 9-11
|
10745 |
$perms .= 'nick'; // bytes 12-15
|
10746 |
+
$this->encryptdata['perms'] = DSGVOTCPDF_STATIC::_AESnopad($this->encryptdata['key'], $perms);
|
10747 |
} else { // RC4-40, RC4-128, AES-128
|
10748 |
// Pad passwords
|
10749 |
+
$this->encryptdata['user_password'] = substr($this->encryptdata['user_password'].DSGVOTCPDF_STATIC::$enc_padding, 0, 32);
|
10750 |
+
$this->encryptdata['owner_password'] = substr($this->encryptdata['owner_password'].DSGVOTCPDF_STATIC::$enc_padding, 0, 32);
|
10751 |
// Compute O value
|
10752 |
$this->encryptdata['O'] = $this->_Ovalue();
|
10753 |
// get default permissions (reverse byte order)
|
10754 |
+
$permissions = DSGVOTCPDF_STATIC::getEncPermissionsString($this->encryptdata['protection']);
|
10755 |
// Compute encryption key
|
10756 |
+
$tmp = DSGVOTCPDF_STATIC::_md5_16($this->encryptdata['user_password'].$this->encryptdata['O'].$permissions.$this->encryptdata['fileid']);
|
10757 |
if ($this->encryptdata['mode'] > 0) {
|
10758 |
for ($i = 0; $i < 50; ++$i) {
|
10759 |
+
$tmp = DSGVOTCPDF_STATIC::_md5_16(substr($tmp, 0, $keybytelen));
|
10760 |
}
|
10761 |
}
|
10762 |
$this->encryptdata['key'] = substr($tmp, 0, $keybytelen);
|
10767 |
}
|
10768 |
} else { // Public-Key mode
|
10769 |
// random 20-byte seed
|
10770 |
+
$seed = sha1(DSGVOTCPDF_STATIC::getRandomSeed(), true);
|
10771 |
$recipient_bytes = '';
|
10772 |
foreach ($this->encryptdata['pubkeys'] as $pubkey) {
|
10773 |
// for each public certificate
|
10774 |
if (isset($pubkey['p'])) {
|
10775 |
+
$pkprotection = DSGVOTCPDF_STATIC::getUserPermissionCode($pubkey['p'], $this->encryptdata['mode']);
|
10776 |
} else {
|
10777 |
$pkprotection = $this->encryptdata['protection'];
|
10778 |
}
|
10779 |
// get default permissions (reverse byte order)
|
10780 |
+
$pkpermissions = DSGVOTCPDF_STATIC::getEncPermissionsString($pkprotection);
|
10781 |
// envelope data
|
10782 |
$envelope = $seed.$pkpermissions;
|
10783 |
// write the envelope data to a temporary file
|
10784 |
+
$tempkeyfile = DSGVOTCPDF_STATIC::getObjFilename('key', $this->file_id);
|
10785 |
+
$f = DSGVOTCPDF_STATIC::fopenLocal($tempkeyfile, 'wb');
|
10786 |
if (!$f) {
|
10787 |
$this->Error('Unable to create temporary key file: '.$tempkeyfile);
|
10788 |
}
|
10789 |
$envelope_length = strlen($envelope);
|
10790 |
fwrite($f, $envelope, $envelope_length);
|
10791 |
fclose($f);
|
10792 |
+
$tempencfile = DSGVOTCPDF_STATIC::getObjFilename('enc', $this->file_id);
|
10793 |
if (!openssl_pkcs7_encrypt($tempkeyfile, $tempencfile, $pubkey['c'], array(), PKCS7_BINARY | PKCS7_DETACHED)) {
|
10794 |
$this->Error('Unable to encrypt the file: '.$tempkeyfile);
|
10795 |
}
|
10837 |
// encryption is not allowed in PDF/A mode
|
10838 |
return;
|
10839 |
}
|
10840 |
+
$this->encryptdata['protection'] = DSGVOTCPDF_STATIC::getUserPermissionCode($permissions, $mode);
|
10841 |
if (($pubkeys !== null) AND (is_array($pubkeys))) {
|
10842 |
// public-key mode
|
10843 |
$this->encryptdata['pubkeys'] = $pubkeys;
|
10876 |
}
|
10877 |
}
|
10878 |
if ($owner_pass === null) {
|
10879 |
+
$owner_pass = md5(DSGVOTCPDF_STATIC::getRandomSeed());
|
10880 |
}
|
10881 |
$this->encryptdata['user_password'] = $user_pass;
|
10882 |
$this->encryptdata['owner_password'] = $owner_pass;
|
10922 |
}
|
10923 |
}
|
10924 |
$this->encrypted = true;
|
10925 |
+
$this->encryptdata['fileid'] = DSGVOTCPDF_STATIC::convertHexStringToString($this->file_id);
|
10926 |
$this->_generateencryptionkey();
|
10927 |
}
|
10928 |
|
11529 |
}
|
11530 |
}
|
11531 |
if (!empty($style)) {
|
11532 |
+
$op = DSGVOTCPDF_STATIC::getPathPaintOperator($style);
|
11533 |
$this->_outRect($x, $y, $w, $h, $op);
|
11534 |
}
|
11535 |
if (!empty($border_style)) {
|
11582 |
if (!(false === strpos($style, 'F')) AND isset($fill_color)) {
|
11583 |
$this->SetFillColorArray($fill_color);
|
11584 |
}
|
11585 |
+
$op = DSGVOTCPDF_STATIC::getPathPaintOperator($style);
|
11586 |
if ($line_style) {
|
11587 |
$this->SetLineStyle($line_style);
|
11588 |
}
|
11612 |
if (!(false === strpos($style, 'F')) AND isset($fill_color)) {
|
11613 |
$this->SetFillColorArray($fill_color);
|
11614 |
}
|
11615 |
+
$op = DSGVOTCPDF_STATIC::getPathPaintOperator($style);
|
11616 |
if ($op == 'f') {
|
11617 |
$line_style = array();
|
11618 |
}
|
11649 |
if ($this->state != 2) {
|
11650 |
return;
|
11651 |
}
|
11652 |
+
if (DSGVOTCPDF_STATIC::empty_string($ry) OR ($ry == 0)) {
|
11653 |
$ry = $rx;
|
11654 |
}
|
11655 |
if (!(false === strpos($style, 'F')) AND isset($fill_color)) {
|
11656 |
$this->SetFillColorArray($fill_color);
|
11657 |
}
|
11658 |
+
$op = DSGVOTCPDF_STATIC::getPathPaintOperator($style);
|
11659 |
if ($op == 'f') {
|
11660 |
$line_style = array();
|
11661 |
}
|
11874 |
if (!(false === strpos($style, 'F')) AND isset($fill_color)) {
|
11875 |
$this->SetFillColorArray($fill_color);
|
11876 |
}
|
11877 |
+
$op = DSGVOTCPDF_STATIC::getPathPaintOperator($style);
|
11878 |
if ($op == 'f') {
|
11879 |
$line_style = array();
|
11880 |
}
|
12077 |
if (!(false === strpos($style, 'F')) AND isset($fill_color)) {
|
12078 |
$this->SetFillColorArray($fill_color);
|
12079 |
}
|
12080 |
+
$op = DSGVOTCPDF_STATIC::getPathPaintOperator($style);
|
12081 |
if ($op == 'f') {
|
12082 |
$border_style = array();
|
12083 |
}
|
12201 |
*/
|
12202 |
public function setDestination($name, $y=-1, $page='', $x=-1) {
|
12203 |
// remove unsupported characters
|
12204 |
+
$name = DSGVOTCPDF_STATIC::encodeNameObject($name);
|
12205 |
+
if (DSGVOTCPDF_STATIC::empty_string($name)) {
|
12206 |
return false;
|
12207 |
}
|
12208 |
if ($y == -1) {
|
12421 |
if (is_string($o['u'])) {
|
12422 |
if ($o['u'][0] == '#') {
|
12423 |
// internal destination
|
12424 |
+
$out .= ' /Dest /'.DSGVOTCPDF_STATIC::encodeNameObject(substr($o['u'], 1));
|
12425 |
} elseif ($o['u'][0] == '%') {
|
12426 |
// embedded PDF file
|
12427 |
$filename = basename(substr($o['u'], 1));
|
12584 |
$this->javascript .= 'f'.$name.'.textSize='.$this->FontSizePt.";\n";
|
12585 |
while (list($key, $val) = each($prop)) {
|
12586 |
if (strcmp(substr($key, -5), 'Color') == 0) {
|
12587 |
+
$val = DSGVOTCPDF_COLORS::_JScolor($val);
|
12588 |
} else {
|
12589 |
$val = "'".$val."'";
|
12590 |
}
|
12654 |
// get default style
|
12655 |
$prop = array_merge($this->getFormDefaultProp(), $prop);
|
12656 |
// get annotation data
|
12657 |
+
$popt = DSGVOTCPDF_STATIC::getAnnotOptFromJSProp($prop, $this->spot_colors, $this->rtl);
|
12658 |
// set default appearance stream
|
12659 |
$this->annotation_fonts[$this->CurrentFont['fontkey']] = $this->CurrentFont['i'];
|
12660 |
$fontstyle = sprintf('/F%d %F Tf %s', $this->CurrentFont['i'], $this->FontSizePt, $this->TextColor);
|
12772 |
$this->_addfield('radiobutton', $name, $x, $y, $w, $w, $prop);
|
12773 |
return;
|
12774 |
}
|
12775 |
+
if (DSGVOTCPDF_STATIC::empty_string($onvalue)) {
|
12776 |
$onvalue = 'On';
|
12777 |
}
|
12778 |
if ($checked) {
|
12807 |
$prop['Radio'] = 'true';
|
12808 |
$prop['borderStyle'] = 'inset';
|
12809 |
// get annotation data
|
12810 |
+
$popt = DSGVOTCPDF_STATIC::getAnnotOptFromJSProp($prop, $this->spot_colors, $this->rtl);
|
12811 |
// set additional default options
|
12812 |
$this->annotation_fonts[$tmpfont['fontkey']] = $tmpfont['i'];
|
12813 |
$fontstyle = sprintf('/F%d %F Tf %s', $tmpfont['i'], $this->FontSizePt, $this->TextColor);
|
12887 |
// get default style
|
12888 |
$prop = array_merge($this->getFormDefaultProp(), $prop);
|
12889 |
// get annotation data
|
12890 |
+
$popt = DSGVOTCPDF_STATIC::getAnnotOptFromJSProp($prop, $this->spot_colors, $this->rtl);
|
12891 |
// set additional default values
|
12892 |
$this->annotation_fonts[$this->CurrentFont['fontkey']] = $this->CurrentFont['i'];
|
12893 |
$fontstyle = sprintf('/F%d %F Tf %s', $this->CurrentFont['i'], $this->FontSizePt, $this->TextColor);
|
12974 |
$prop = array_merge($this->getFormDefaultProp(), $prop);
|
12975 |
$prop['Combo'] = true;
|
12976 |
// get annotation data
|
12977 |
+
$popt = DSGVOTCPDF_STATIC::getAnnotOptFromJSProp($prop, $this->spot_colors, $this->rtl);
|
12978 |
// set additional default options
|
12979 |
$this->annotation_fonts[$this->CurrentFont['fontkey']] = $this->CurrentFont['i'];
|
12980 |
$fontstyle = sprintf('/F%d %F Tf %s', $this->CurrentFont['i'], $this->FontSizePt, $this->TextColor);
|
13055 |
$prop = array_merge($this->getFormDefaultProp(), $prop);
|
13056 |
$prop['borderStyle'] = 'inset';
|
13057 |
// get annotation data
|
13058 |
+
$popt = DSGVOTCPDF_STATIC::getAnnotOptFromJSProp($prop, $this->spot_colors, $this->rtl);
|
13059 |
// set additional default options
|
13060 |
$font = 'zapfdingbats';
|
13061 |
if ($this->pdfa_mode) {
|
13080 |
$opt['Subtype'] = 'Widget';
|
13081 |
$opt['ft'] = 'Btn';
|
13082 |
$opt['t'] = $name;
|
13083 |
+
if (DSGVOTCPDF_STATIC::empty_string($onvalue)) {
|
13084 |
$onvalue = 'Yes';
|
13085 |
}
|
13086 |
$opt['opt'] = array($onvalue);
|
13138 |
$prop['highlight'] = 'push';
|
13139 |
$prop['display'] = 'display.noPrint';
|
13140 |
// get annotation data
|
13141 |
+
$popt = DSGVOTCPDF_STATIC::getAnnotOptFromJSProp($prop, $this->spot_colors, $this->rtl);
|
13142 |
$this->annotation_fonts[$this->CurrentFont['fontkey']] = $this->CurrentFont['i'];
|
13143 |
$fontstyle = sprintf('/F%d %F Tf %s', $this->CurrentFont['i'], $this->FontSizePt, $this->TextColor);
|
13144 |
$popt['da'] = $fontstyle;
|
13291 |
$out .= '<< /Type /Sig';
|
13292 |
$out .= ' /Filter /Adobe.PPKLite';
|
13293 |
$out .= ' /SubFilter /adbe.pkcs7.detached';
|
13294 |
+
$out .= ' '.DSGVOTCPDF_STATIC::$byterange_string;
|
13295 |
$out .= ' /Contents<'.str_repeat('0', $this->signature_max_length).'>';
|
13296 |
if (empty($this->signature_data['approval']) OR ($this->signature_data['approval'] != 'A')) {
|
13297 |
$out .= ' /Reference ['; // array of signature reference dictionaries
|
13307 |
$out .= ' /TransformParams <<';
|
13308 |
$out .= ' /Type /TransformParams';
|
13309 |
$out .= ' /V /2.2';
|
13310 |
+
if (!DSGVOTCPDF_STATIC::empty_string($this->ur['document'])) {
|
13311 |
$out .= ' /Document['.$this->ur['document'].']';
|
13312 |
}
|
13313 |
+
if (!DSGVOTCPDF_STATIC::empty_string($this->ur['form'])) {
|
13314 |
$out .= ' /Form['.$this->ur['form'].']';
|
13315 |
}
|
13316 |
+
if (!DSGVOTCPDF_STATIC::empty_string($this->ur['signature'])) {
|
13317 |
$out .= ' /Signature['.$this->ur['signature'].']';
|
13318 |
}
|
13319 |
+
if (!DSGVOTCPDF_STATIC::empty_string($this->ur['annots'])) {
|
13320 |
$out .= ' /Annots['.$this->ur['annots'].']';
|
13321 |
}
|
13322 |
+
if (!DSGVOTCPDF_STATIC::empty_string($this->ur['ef'])) {
|
13323 |
$out .= ' /EF['.$this->ur['ef'].']';
|
13324 |
}
|
13325 |
+
if (!DSGVOTCPDF_STATIC::empty_string($this->ur['formex'])) {
|
13326 |
$out .= ' /FormEX['.$this->ur['formex'].']';
|
13327 |
}
|
13328 |
}
|
13335 |
$out .= ' >>';
|
13336 |
$out .= ' ]'; // end of reference
|
13337 |
}
|
13338 |
+
if (isset($this->signature_data['info']['Name']) AND !DSGVOTCPDF_STATIC::empty_string($this->signature_data['info']['Name'])) {
|
13339 |
$out .= ' /Name '.$this->_textstring($this->signature_data['info']['Name'], $sigobjid);
|
13340 |
}
|
13341 |
+
if (isset($this->signature_data['info']['Location']) AND !DSGVOTCPDF_STATIC::empty_string($this->signature_data['info']['Location'])) {
|
13342 |
$out .= ' /Location '.$this->_textstring($this->signature_data['info']['Location'], $sigobjid);
|
13343 |
}
|
13344 |
+
if (isset($this->signature_data['info']['Reason']) AND !DSGVOTCPDF_STATIC::empty_string($this->signature_data['info']['Reason'])) {
|
13345 |
$out .= ' /Reason '.$this->_textstring($this->signature_data['info']['Reason'], $sigobjid);
|
13346 |
}
|
13347 |
+
if (isset($this->signature_data['info']['ContactInfo']) AND !DSGVOTCPDF_STATIC::empty_string($this->signature_data['info']['ContactInfo'])) {
|
13348 |
$out .= ' /ContactInfo '.$this->_textstring($this->signature_data['info']['ContactInfo'], $sigobjid);
|
13349 |
}
|
13350 |
$out .= ' /M '.$this->_datestring($sigobjid, $this->doc_modification_timestamp);
|
13579 |
*/
|
13580 |
public function getAliasRightShift() {
|
13581 |
// calculate aproximatively the ratio between widths of aliases and replacements.
|
13582 |
+
$ref = '{'.DSGVOTCPDF_STATIC::$alias_right_shift.'}{'.DSGVOTCPDF_STATIC::$alias_tot_pages.'}{'.DSGVOTCPDF_STATIC::$alias_num_page.'}';
|
13583 |
$rep = str_repeat(' ', $this->GetNumChars($ref));
|
13584 |
$wrep = $this->GetStringWidth($rep);
|
13585 |
if ($wrep > 0) {
|
13588 |
$wdiff = 1;
|
13589 |
}
|
13590 |
$sdiff = sprintf('%F', $wdiff);
|
13591 |
+
$alias = DSGVOTCPDF_STATIC::$alias_right_shift.$sdiff.'}';
|
13592 |
if ($this->isUnicodeFont()) {
|
13593 |
$alias = '{'.$alias;
|
13594 |
}
|
13605 |
*/
|
13606 |
public function getAliasNbPages() {
|
13607 |
if ($this->isUnicodeFont()) {
|
13608 |
+
return '{'.DSGVOTCPDF_STATIC::$alias_tot_pages.'}';
|
13609 |
}
|
13610 |
+
return DSGVOTCPDF_STATIC::$alias_tot_pages;
|
13611 |
}
|
13612 |
|
13613 |
/**
|
13620 |
*/
|
13621 |
public function getAliasNumPage() {
|
13622 |
if ($this->isUnicodeFont()) {
|
13623 |
+
return '{'.DSGVOTCPDF_STATIC::$alias_num_page.'}';
|
13624 |
}
|
13625 |
+
return DSGVOTCPDF_STATIC::$alias_num_page;
|
13626 |
}
|
13627 |
|
13628 |
/**
|
13635 |
*/
|
13636 |
public function getPageGroupAlias() {
|
13637 |
if ($this->isUnicodeFont()) {
|
13638 |
+
return '{'.DSGVOTCPDF_STATIC::$alias_group_tot_pages.'}';
|
13639 |
}
|
13640 |
+
return DSGVOTCPDF_STATIC::$alias_group_tot_pages;
|
13641 |
}
|
13642 |
|
13643 |
/**
|
13650 |
*/
|
13651 |
public function getPageNumGroupAlias() {
|
13652 |
if ($this->isUnicodeFont()) {
|
13653 |
+
return '{'.DSGVOTCPDF_STATIC::$alias_group_num_page.'}';
|
13654 |
}
|
13655 |
+
return DSGVOTCPDF_STATIC::$alias_group_num_page;
|
13656 |
}
|
13657 |
|
13658 |
/**
|
13672 |
* @see PaneNo(), formatPageNumber()
|
13673 |
*/
|
13674 |
public function getGroupPageNoFormatted() {
|
13675 |
+
return DSGVOTCPDF_STATIC::formatPageNumber($this->getGroupPageNo());
|
13676 |
}
|
13677 |
|
13678 |
/**
|
13682 |
* @see PaneNo(), formatPageNumber()
|
13683 |
*/
|
13684 |
public function PageNoFormatted() {
|
13685 |
+
return DSGVOTCPDF_STATIC::formatPageNumber($this->PageNo());
|
13686 |
}
|
13687 |
|
13688 |
/**
|
13868 |
return;
|
13869 |
}
|
13870 |
$stroking = $stroking ? true : false;
|
13871 |
+
if (DSGVOTCPDF_STATIC::empty_string($nonstroking)) {
|
13872 |
// default value if not set
|
13873 |
$nonstroking = $stroking;
|
13874 |
} else {
|
13908 |
return;
|
13909 |
}
|
13910 |
$stroking = floatval($stroking);
|
13911 |
+
if (DSGVOTCPDF_STATIC::empty_string($nonstroking)) {
|
13912 |
// default value if not set
|
13913 |
$nonstroking = $stroking;
|
13914 |
} else {
|
14126 |
}
|
14127 |
default: { // SPECIFIC SPOT COLOR NAME
|
14128 |
$col_a = array(0,0,0,0,'None');
|
14129 |
+
$col_b = DSGVOTCPDF_COLORS::getSpotColor($col, $this->spot_colors);
|
14130 |
if ($col_b === false) {
|
14131 |
// in case of error defaults to the registration color
|
14132 |
$col_b = array(100,100,100,100,'All');
|
14790 |
if ($this->rtl) {
|
14791 |
$xc = ($this->w - $xc);
|
14792 |
}
|
14793 |
+
$op = DSGVOTCPDF_STATIC::getPathPaintOperator($style);
|
14794 |
if ($op == 'f') {
|
14795 |
$line_style = array();
|
14796 |
}
|
14847 |
if ($file[0] === '@') { // image from string
|
14848 |
$data = substr($file, 1);
|
14849 |
} else { // EPS/AI file
|
14850 |
+
$data = DSGVOTCPDF_STATIC::fileGetContents($file);
|
14851 |
}
|
14852 |
if ($data === FALSE) {
|
14853 |
$this->Error('EPS file not found: '.$file);
|
15191 |
* @public
|
15192 |
*/
|
15193 |
public function write1DBarcode($code, $type, $x='', $y='', $w='', $h='', $xres='', $style='', $align='') {
|
15194 |
+
if (DSGVOTCPDF_STATIC::empty_string(trim($code))) {
|
15195 |
return;
|
15196 |
}
|
15197 |
require_once(dirname(__FILE__).'/tcpdf_barcodes_1d.php');
|
15298 |
if ($style['stretch']) {
|
15299 |
$xres = $max_xres;
|
15300 |
} else {
|
15301 |
+
if (DSGVOTCPDF_STATIC::empty_string($xres)) {
|
15302 |
$xres = (0.141 * $this->k); // default bar width = 0.4 mm
|
15303 |
}
|
15304 |
if ($xres > $max_xres) {
|
15435 |
}
|
15436 |
// print text
|
15437 |
if ($style['text']) {
|
15438 |
+
if (isset($style['label']) AND !DSGVOTCPDF_STATIC::empty_string($style['label'])) {
|
15439 |
$label = $style['label'];
|
15440 |
} else {
|
15441 |
$label = $code;
|
15510 |
* @public
|
15511 |
*/
|
15512 |
public function write2DBarcode($code, $type, $x='', $y='', $w='', $h='', $style='', $align='', $distort=false) {
|
15513 |
+
if (DSGVOTCPDF_STATIC::empty_string(trim($code))) {
|
15514 |
return;
|
15515 |
}
|
15516 |
require_once(dirname(__FILE__).'/tcpdf_barcodes_2d.php');
|
15826 |
* @see setHtmlVSpace()
|
15827 |
*/
|
15828 |
public function fixHTMLCode($html, $default_css='', $tagvs='', $tidy_options='') {
|
15829 |
+
return DSGVOTCPDF_STATIC::fixHTMLCode($html, $default_css, $tagvs, $tidy_options, $this->tagvspaces);
|
15830 |
}
|
15831 |
|
15832 |
/**
|
15931 |
return array();
|
15932 |
}
|
15933 |
$border['width'] = $this->getCSSBorderWidth($width);
|
15934 |
+
$border['color'] = DSGVOTCPDF_COLORS::convertHTMLColorToDec($color, $this->spot_colors);
|
15935 |
return $border;
|
15936 |
}
|
15937 |
|
16189 |
* @public
|
16190 |
*/
|
16191 |
public function getHTMLFontUnits($val, $refsize=12, $parent_size=12, $defaultunit='pt') {
|
16192 |
+
$refsize = DSGVOTCPDF_FONTS::getFontRefSize($refsize);
|
16193 |
+
$parent_size = DSGVOTCPDF_FONTS::getFontRefSize($parent_size, $refsize);
|
16194 |
switch ($val) {
|
16195 |
case 'xx-small': {
|
16196 |
$size = ($refsize - 4);
|
16267 |
$type = array();
|
16268 |
if (preg_match('/href[\s]*=[\s]*"([^"]*)"/', $link, $type) > 0) {
|
16269 |
// read CSS data file
|
16270 |
+
$cssdata = DSGVOTCPDF_STATIC::fileGetContents(trim($type[1]));
|
16271 |
if (($cssdata !== FALSE) AND (strlen($cssdata) > 0)) {
|
16272 |
+
$css = array_merge($css, DSGVOTCPDF_STATIC::extractCSSproperties($cssdata));
|
16273 |
}
|
16274 |
}
|
16275 |
}
|
16286 |
// (all, braille, embossed, handheld, print, projection, screen, speech, tty, tv)
|
16287 |
if (empty($type) OR (isset($type[1]) AND (($type[1] == 'all') OR ($type[1] == 'print')))) {
|
16288 |
$cssdata = $matches[2][$key];
|
16289 |
+
$css = array_merge($css, DSGVOTCPDF_STATIC::extractCSSproperties($cssdata));
|
16290 |
}
|
16291 |
}
|
16292 |
}
|
16489 |
}
|
16490 |
// store header rows on a new table
|
16491 |
if (($dom[$key]['value'] == 'tr') AND ($dom[($dom[$key]['parent'])]['thead'] === true)) {
|
16492 |
+
if (DSGVOTCPDF_STATIC::empty_string($dom[($dom[($dom[$key]['parent'])]['parent'])]['thead'])) {
|
16493 |
$dom[($dom[($dom[$key]['parent'])]['parent'])]['thead'] = $csstagarray.$a[$dom[($dom[($dom[$key]['parent'])]['parent'])]['elkey']];
|
16494 |
}
|
16495 |
for ($i = $dom[$key]['parent']; $i <= $key; ++$i) {
|
16501 |
// header elements must be always contained in a single page
|
16502 |
$dom[($dom[$key]['parent'])]['attribute']['nobr'] = 'true';
|
16503 |
}
|
16504 |
+
if (($dom[$key]['value'] == 'table') AND (!DSGVOTCPDF_STATIC::empty_string($dom[($dom[$key]['parent'])]['thead']))) {
|
16505 |
// remove the nobr attributes from the table header
|
16506 |
$dom[($dom[$key]['parent'])]['thead'] = str_replace(' nobr="true"', '', $dom[($dom[$key]['parent'])]['thead']);
|
16507 |
$dom[($dom[$key]['parent'])]['thead'] .= '</tablehead>';
|
16550 |
}
|
16551 |
if (!empty($css)) {
|
16552 |
// merge CSS style to current style
|
16553 |
+
list($dom[$key]['csssel'], $dom[$key]['cssdata']) = DSGVOTCPDF_STATIC::getCSSdataArray($dom, $key, $css);
|
16554 |
+
$dom[$key]['attribute']['style'] = DSGVOTCPDF_STATIC::getTagStyleFromCSSarray($dom[$key]['cssdata']);
|
16555 |
}
|
16556 |
// split style attributes
|
16557 |
if (isset($dom[$key]['attribute']['style']) AND !empty($dom[$key]['attribute']['style'])) {
|
16648 |
$dom[$key]['fontstyle'] .= 'I';
|
16649 |
}
|
16650 |
// font color
|
16651 |
+
if (isset($dom[$key]['style']['color']) AND (!DSGVOTCPDF_STATIC::empty_string($dom[$key]['style']['color']))) {
|
16652 |
+
$dom[$key]['fgcolor'] = DSGVOTCPDF_COLORS::convertHTMLColorToDec($dom[$key]['style']['color'], $this->spot_colors);
|
16653 |
} elseif ($dom[$key]['value'] == 'a') {
|
16654 |
$dom[$key]['fgcolor'] = $this->htmlLinkColorArray;
|
16655 |
}
|
16656 |
// background color
|
16657 |
+
if (isset($dom[$key]['style']['background-color']) AND (!DSGVOTCPDF_STATIC::empty_string($dom[$key]['style']['background-color']))) {
|
16658 |
+
$dom[$key]['bgcolor'] = DSGVOTCPDF_COLORS::convertHTMLColorToDec($dom[$key]['style']['background-color'], $this->spot_colors);
|
16659 |
}
|
16660 |
// text-decoration
|
16661 |
if (isset($dom[$key]['style']['text-decoration'])) {
|
16662 |
$decors = explode(' ', strtolower($dom[$key]['style']['text-decoration']));
|
16663 |
foreach ($decors as $dec) {
|
16664 |
$dec = trim($dec);
|
16665 |
+
if (!DSGVOTCPDF_STATIC::empty_string($dec)) {
|
16666 |
if ($dec[0] == 'u') {
|
16667 |
// underline
|
16668 |
$dom[$key]['fontstyle'] .= 'U';
|
16700 |
if (isset($dom[$key]['style']['border-color'])) {
|
16701 |
$brd_colors = preg_split('/[\s]+/', trim($dom[$key]['style']['border-color']));
|
16702 |
if (isset($brd_colors[3])) {
|
16703 |
+
$dom[$key]['border']['L']['color'] = DSGVOTCPDF_COLORS::convertHTMLColorToDec($brd_colors[3], $this->spot_colors);
|
16704 |
}
|
16705 |
if (isset($brd_colors[1])) {
|
16706 |
+
$dom[$key]['border']['R']['color'] = DSGVOTCPDF_COLORS::convertHTMLColorToDec($brd_colors[1], $this->spot_colors);
|
16707 |
}
|
16708 |
if (isset($brd_colors[0])) {
|
16709 |
+
$dom[$key]['border']['T']['color'] = DSGVOTCPDF_COLORS::convertHTMLColorToDec($brd_colors[0], $this->spot_colors);
|
16710 |
}
|
16711 |
if (isset($brd_colors[2])) {
|
16712 |
+
$dom[$key]['border']['B']['color'] = DSGVOTCPDF_COLORS::convertHTMLColorToDec($brd_colors[2], $this->spot_colors);
|
16713 |
}
|
16714 |
}
|
16715 |
if (isset($dom[$key]['style']['border-width'])) {
|
16771 |
}
|
16772 |
}
|
16773 |
if (isset($dom[$key]['style']['border-'.$bsv.'-color'])) {
|
16774 |
+
$dom[$key]['border'][$bsk]['color'] = DSGVOTCPDF_COLORS::convertHTMLColorToDec($dom[$key]['style']['border-'.$bsv.'-color'], $this->spot_colors);
|
16775 |
}
|
16776 |
if (isset($dom[$key]['style']['border-'.$bsv.'-width'])) {
|
16777 |
$dom[$key]['border'][$bsk]['width'] = $this->getCSSBorderWidth($dom[$key]['style']['border-'.$bsv.'-width']);
|
16866 |
}
|
16867 |
// force natural alignment for lists
|
16868 |
if ((($dom[$key]['value'] == 'ul') OR ($dom[$key]['value'] == 'ol') OR ($dom[$key]['value'] == 'dl'))
|
16869 |
+
AND (!isset($dom[$key]['align']) OR DSGVOTCPDF_STATIC::empty_string($dom[$key]['align']) OR ($dom[$key]['align'] != 'J'))) {
|
16870 |
if ($this->rtl) {
|
16871 |
$dom[$key]['align'] = 'R';
|
16872 |
} else {
|
16938 |
$dom[$key]['dir'] = $dom[$key]['attribute']['dir'];
|
16939 |
}
|
16940 |
// set foreground color attribute
|
16941 |
+
if (isset($dom[$key]['attribute']['color']) AND (!DSGVOTCPDF_STATIC::empty_string($dom[$key]['attribute']['color']))) {
|
16942 |
+
$dom[$key]['fgcolor'] = DSGVOTCPDF_COLORS::convertHTMLColorToDec($dom[$key]['attribute']['color'], $this->spot_colors);
|
16943 |
} elseif (!isset($dom[$key]['style']['color']) AND ($dom[$key]['value'] == 'a')) {
|
16944 |
$dom[$key]['fgcolor'] = $this->htmlLinkColorArray;
|
16945 |
}
|
16946 |
// set background color attribute
|
16947 |
+
if (isset($dom[$key]['attribute']['bgcolor']) AND (!DSGVOTCPDF_STATIC::empty_string($dom[$key]['attribute']['bgcolor']))) {
|
16948 |
+
$dom[$key]['bgcolor'] = DSGVOTCPDF_COLORS::convertHTMLColorToDec($dom[$key]['attribute']['bgcolor'], $this->spot_colors);
|
16949 |
}
|
16950 |
// set stroke color attribute
|
16951 |
+
if (isset($dom[$key]['attribute']['strokecolor']) AND (!DSGVOTCPDF_STATIC::empty_string($dom[$key]['attribute']['strokecolor']))) {
|
16952 |
+
$dom[$key]['strokecolor'] = DSGVOTCPDF_COLORS::convertHTMLColorToDec($dom[$key]['attribute']['strokecolor'], $this->spot_colors);
|
16953 |
}
|
16954 |
// check for width attribute
|
16955 |
if (isset($dom[$key]['attribute']['width'])) {
|
16960 |
$dom[$key]['height'] = $dom[$key]['attribute']['height'];
|
16961 |
}
|
16962 |
// check for text alignment
|
16963 |
+
if (isset($dom[$key]['attribute']['align']) AND (!DSGVOTCPDF_STATIC::empty_string($dom[$key]['attribute']['align'])) AND ($dom[$key]['value'] !== 'img')) {
|
16964 |
$dom[$key]['align'] = strtoupper($dom[$key]['attribute']['align'][0]);
|
16965 |
}
|
16966 |
// check for text rendering mode (the following attributes do not exist in HTML)
|
17198 |
$this->listordered = array();
|
17199 |
$this->listcount = array();
|
17200 |
$this->lispacer = '';
|
17201 |
+
if ((DSGVOTCPDF_STATIC::empty_string($this->lasth)) OR ($reseth)) {
|
17202 |
// reset row height
|
17203 |
$this->resetLastH();
|
17204 |
}
|
17287 |
}
|
17288 |
// print THEAD block
|
17289 |
if (($dom[$key]['value'] == 'tr') AND isset($dom[$key]['thead']) AND $dom[$key]['thead']) {
|
17290 |
+
if (isset($dom[$key]['parent']) AND isset($dom[$dom[$key]['parent']]['thead']) AND !DSGVOTCPDF_STATIC::empty_string($dom[$dom[$key]['parent']]['thead'])) {
|
17291 |
$this->inthead = true;
|
17292 |
// print table header (thead)
|
17293 |
$this->writeHTML($this->thead, false, false, false, false, '');
|
17541 |
if (isset($dom[$key]['align'])) {
|
17542 |
$lalign = $dom[$key]['align'];
|
17543 |
}
|
17544 |
+
if (DSGVOTCPDF_STATIC::empty_string($lalign)) {
|
17545 |
$lalign = $align;
|
17546 |
}
|
17547 |
}
|
17610 |
$no = 0; // number of spaces on a line contained on a single block
|
17611 |
if ($this->isRTLTextDir()) { // RTL
|
17612 |
// remove left space if exist
|
17613 |
+
$pos1 = DSGVOTCPDF_STATIC::revstrpos($pmid, '[(');
|
17614 |
if ($pos1 > 0) {
|
17615 |
$pos1 = intval($pos1);
|
17616 |
if ($this->isUnicodeFont()) {
|
17617 |
+
$pos2 = intval(DSGVOTCPDF_STATIC::revstrpos($pmid, '[('.chr(0).chr(32)));
|
17618 |
$spacelen = 2;
|
17619 |
} else {
|
17620 |
+
$pos2 = intval(DSGVOTCPDF_STATIC::revstrpos($pmid, '[('.chr(32)));
|
17621 |
$spacelen = 1;
|
17622 |
}
|
17623 |
if ($pos1 == $pos2) {
|
17631 |
}
|
17632 |
} else { // LTR
|
17633 |
// remove right space if exist
|
17634 |
+
$pos1 = DSGVOTCPDF_STATIC::revstrpos($pmid, ')]');
|
17635 |
if ($pos1 > 0) {
|
17636 |
$pos1 = intval($pos1);
|
17637 |
if ($this->isUnicodeFont()) {
|
17638 |
+
$pos2 = intval(DSGVOTCPDF_STATIC::revstrpos($pmid, chr(0).chr(32).')]')) + 2;
|
17639 |
$spacelen = 2;
|
17640 |
} else {
|
17641 |
+
$pos2 = intval(DSGVOTCPDF_STATIC::revstrpos($pmid, chr(32).')]')) + 1;
|
17642 |
$spacelen = 1;
|
17643 |
}
|
17644 |
if ($pos1 == $pos2) {
|
17779 |
}
|
17780 |
case 're': {
|
17781 |
// justify block
|
17782 |
+
if (!DSGVOTCPDF_STATIC::empty_string($this->lispacer)) {
|
17783 |
$this->lispacer = '';
|
17784 |
continue;
|
17785 |
}
|
18296 |
}
|
18297 |
} elseif (strlen($dom[$key]['value']) > 0) {
|
18298 |
// print list-item
|
18299 |
+
if (!DSGVOTCPDF_STATIC::empty_string($this->lispacer) AND ($this->lispacer != '^')) {
|
18300 |
$this->SetFont($pfontname, $pfontstyle, $pfontsize);
|
18301 |
$this->resetLastH();
|
18302 |
$minstartliney = $this->y;
|
18395 |
$tmp_fontsize = isset($dom[$nkey]['fontsize']) ? $dom[$nkey]['fontsize'] : $this->FontSizePt;
|
18396 |
$same_textdir = ($dom[$nkey]['dir'] == $dom[$key]['dir']);
|
18397 |
} else {
|
18398 |
+
$nextstr = DSGVOTCPDF_STATIC::pregSplit('/'.$this->re_space['p'].'+/', $this->re_space['m'], $dom[$nkey]['value']);
|
18399 |
if (isset($nextstr[0]) AND $same_textdir) {
|
18400 |
$wadj += $this->GetStringWidth($nextstr[0], $tmp_fontname, $tmp_fontstyle, $tmp_fontsize);
|
18401 |
if (isset($nextstr[1])) {
|
18408 |
}
|
18409 |
if (($wadj > 0) AND (($strlinelen + $wadj) >= $cwa)) {
|
18410 |
$wadj = 0;
|
18411 |
+
$nextstr = DSGVOTCPDF_STATIC::pregSplit('/'.$this->re_space['p'].'/', $this->re_space['m'], $dom[$key]['value']);
|
18412 |
$numblks = count($nextstr);
|
18413 |
if ($numblks > 1) {
|
18414 |
// try to split on blank spaces
|
18557 |
$no = 0; // number of spaces on a line contained on a single block
|
18558 |
if ($this->isRTLTextDir()) { // RTL
|
18559 |
// remove left space if exist
|
18560 |
+
$pos1 = DSGVOTCPDF_STATIC::revstrpos($pmid, '[(');
|
18561 |
if ($pos1 > 0) {
|
18562 |
$pos1 = intval($pos1);
|
18563 |
if ($this->isUnicodeFont()) {
|
18564 |
+
$pos2 = intval(DSGVOTCPDF_STATIC::revstrpos($pmid, '[('.chr(0).chr(32)));
|
18565 |
$spacelen = 2;
|
18566 |
} else {
|
18567 |
+
$pos2 = intval(DSGVOTCPDF_STATIC::revstrpos($pmid, '[('.chr(32)));
|
18568 |
$spacelen = 1;
|
18569 |
}
|
18570 |
if ($pos1 == $pos2) {
|
18578 |
}
|
18579 |
} else { // LTR
|
18580 |
// remove right space if exist
|
18581 |
+
$pos1 = DSGVOTCPDF_STATIC::revstrpos($pmid, ')]');
|
18582 |
if ($pos1 > 0) {
|
18583 |
$pos1 = intval($pos1);
|
18584 |
if ($this->isUnicodeFont()) {
|
18585 |
+
$pos2 = intval(DSGVOTCPDF_STATIC::revstrpos($pmid, chr(0).chr(32).')]')) + 2;
|
18586 |
$spacelen = 2;
|
18587 |
} else {
|
18588 |
+
$pos2 = intval(DSGVOTCPDF_STATIC::revstrpos($pmid, chr(32).')]')) + 1;
|
18589 |
$spacelen = 1;
|
18590 |
}
|
18591 |
if ($pos1 == $pos2) {
|
18743 |
if (!isset($dom[$key]['attribute']['nested']) OR ($dom[$key]['attribute']['nested'] != 'true')) {
|
18744 |
$this->htmlvspace = 0;
|
18745 |
// set table header
|
18746 |
+
if (!DSGVOTCPDF_STATIC::empty_string($dom[$key]['thead'])) {
|
18747 |
// set table header
|
18748 |
$this->thead = $dom[$key]['thead'];
|
18749 |
if (!isset($this->theadMargins) OR (empty($this->theadMargins))) {
|
18822 |
$type = '';
|
18823 |
} else {
|
18824 |
// get image type
|
18825 |
+
$type = DSGVOTCPDF_IMAGES::getImageFileType($tag['attribute']['src']);
|
18826 |
}
|
18827 |
if (!isset($tag['width'])) {
|
18828 |
$tag['width'] = 0;
|
18856 |
$prevy = $this->y;
|
18857 |
$xpos = $this->x;
|
18858 |
$imglink = '';
|
18859 |
+
if (isset($this->HREF['url']) AND !DSGVOTCPDF_STATIC::empty_string($this->HREF['url'])) {
|
18860 |
$imglink = $this->HREF['url'];
|
18861 |
if ($imglink[0] == '#') {
|
18862 |
// convert url to internal link
|
18972 |
}
|
18973 |
if ($this->listordered[$this->listnum]) {
|
18974 |
// ordered item
|
18975 |
+
if (isset($parent['attribute']['type']) AND !DSGVOTCPDF_STATIC::empty_string($parent['attribute']['type'])) {
|
18976 |
$this->lispacer = $parent['attribute']['type'];
|
18977 |
+
} elseif (isset($parent['listtype']) AND !DSGVOTCPDF_STATIC::empty_string($parent['listtype'])) {
|
18978 |
$this->lispacer = $parent['listtype'];
|
18979 |
+
} elseif (isset($this->lisymbol) AND !DSGVOTCPDF_STATIC::empty_string($this->lisymbol)) {
|
18980 |
$this->lispacer = $this->lisymbol;
|
18981 |
} else {
|
18982 |
$this->lispacer = '#';
|
18987 |
}
|
18988 |
} else {
|
18989 |
// unordered item
|
18990 |
+
if (isset($parent['attribute']['type']) AND !DSGVOTCPDF_STATIC::empty_string($parent['attribute']['type'])) {
|
18991 |
$this->lispacer = $parent['attribute']['type'];
|
18992 |
+
} elseif (isset($parent['listtype']) AND !DSGVOTCPDF_STATIC::empty_string($parent['listtype'])) {
|
18993 |
$this->lispacer = $parent['listtype'];
|
18994 |
+
} elseif (isset($this->lisymbol) AND !DSGVOTCPDF_STATIC::empty_string($this->lisymbol)) {
|
18995 |
$this->lispacer = $this->lisymbol;
|
18996 |
} else {
|
18997 |
$this->lispacer = '!';
|
19063 |
break;
|
19064 |
}
|
19065 |
case 'input': {
|
19066 |
+
if (isset($tag['attribute']['name']) AND !DSGVOTCPDF_STATIC::empty_string($tag['attribute']['name'])) {
|
19067 |
$name = $tag['attribute']['name'];
|
19068 |
} else {
|
19069 |
break;
|
19070 |
}
|
19071 |
$prop = array();
|
19072 |
$opt = array();
|
19073 |
+
if (isset($tag['attribute']['readonly']) AND !DSGVOTCPDF_STATIC::empty_string($tag['attribute']['readonly'])) {
|
19074 |
$prop['readonly'] = true;
|
19075 |
}
|
19076 |
+
if (isset($tag['attribute']['value']) AND !DSGVOTCPDF_STATIC::empty_string($tag['attribute']['value'])) {
|
19077 |
$value = $tag['attribute']['value'];
|
19078 |
}
|
19079 |
+
if (isset($tag['attribute']['maxlength']) AND !DSGVOTCPDF_STATIC::empty_string($tag['attribute']['maxlength'])) {
|
19080 |
$opt['maxlen'] = intval($tag['attribute']['maxlength']);
|
19081 |
}
|
19082 |
$h = $this->getCellHeight($this->FontSize);
|
19083 |
+
if (isset($tag['attribute']['size']) AND !DSGVOTCPDF_STATIC::empty_string($tag['attribute']['size'])) {
|
19084 |
$w = intval($tag['attribute']['size']) * $this->GetStringWidth(chr(32)) * 2;
|
19085 |
} else {
|
19086 |
$w = $h;
|
19188 |
}
|
19189 |
case 'image': {
|
19190 |
// THIS TYPE MUST BE FIXED
|
19191 |
+
if (isset($tag['attribute']['src']) AND !DSGVOTCPDF_STATIC::empty_string($tag['attribute']['src'])) {
|
19192 |
$img = $tag['attribute']['src'];
|
19193 |
} else {
|
19194 |
break;
|
19224 |
case 'textarea': {
|
19225 |
$prop = array();
|
19226 |
$opt = array();
|
19227 |
+
if (isset($tag['attribute']['readonly']) AND !DSGVOTCPDF_STATIC::empty_string($tag['attribute']['readonly'])) {
|
19228 |
$prop['readonly'] = true;
|
19229 |
}
|
19230 |
+
if (isset($tag['attribute']['name']) AND !DSGVOTCPDF_STATIC::empty_string($tag['attribute']['name'])) {
|
19231 |
$name = $tag['attribute']['name'];
|
19232 |
} else {
|
19233 |
break;
|
19234 |
}
|
19235 |
+
if (isset($tag['attribute']['value']) AND !DSGVOTCPDF_STATIC::empty_string($tag['attribute']['value'])) {
|
19236 |
$opt['v'] = $tag['attribute']['value'];
|
19237 |
}
|
19238 |
+
if (isset($tag['attribute']['cols']) AND !DSGVOTCPDF_STATIC::empty_string($tag['attribute']['cols'])) {
|
19239 |
$w = intval($tag['attribute']['cols']) * $this->GetStringWidth(chr(32)) * 2;
|
19240 |
} else {
|
19241 |
$w = 40;
|
19242 |
}
|
19243 |
+
if (isset($tag['attribute']['rows']) AND !DSGVOTCPDF_STATIC::empty_string($tag['attribute']['rows'])) {
|
19244 |
$h = intval($tag['attribute']['rows']) * $this->getCellHeight($this->FontSize);
|
19245 |
} else {
|
19246 |
$h = 10;
|
19251 |
}
|
19252 |
case 'select': {
|
19253 |
$h = $this->getCellHeight($this->FontSize);
|
19254 |
+
if (isset($tag['attribute']['size']) AND !DSGVOTCPDF_STATIC::empty_string($tag['attribute']['size'])) {
|
19255 |
$h *= ($tag['attribute']['size'] + 1);
|
19256 |
}
|
19257 |
$prop = array();
|
19258 |
$opt = array();
|
19259 |
+
if (isset($tag['attribute']['name']) AND !DSGVOTCPDF_STATIC::empty_string($tag['attribute']['name'])) {
|
19260 |
$name = $tag['attribute']['name'];
|
19261 |
} else {
|
19262 |
break;
|
19263 |
}
|
19264 |
$w = 0;
|
19265 |
+
if (isset($tag['attribute']['opt']) AND !DSGVOTCPDF_STATIC::empty_string($tag['attribute']['opt'])) {
|
19266 |
$options = explode('#!NwL!#', $tag['attribute']['opt']);
|
19267 |
$values = array();
|
19268 |
foreach ($options as $val) {
|
19552 |
$starty = $y;
|
19553 |
$w = abs($cellpos['endx'] - $cellpos['startx']);
|
19554 |
// get border modes
|
19555 |
+
$border_start = DSGVOTCPDF_STATIC::getBorderMode($border, $position='start', $this->opencell);
|
19556 |
+
$border_end = DSGVOTCPDF_STATIC::getBorderMode($border, $position='end', $this->opencell);
|
19557 |
+
$border_middle = DSGVOTCPDF_STATIC::getBorderMode($border, $position='middle', $this->opencell);
|
19558 |
// design borders around HTML cells.
|
19559 |
for ($page = $startpage; $page <= $endpage; ++$page) { // for each page
|
19560 |
$ccode = '';
|
19943 |
if (isset($tag['border']) AND !empty($tag['border'])) {
|
19944 |
// get border style
|
19945 |
$border = $tag['border'];
|
19946 |
+
if (!DSGVOTCPDF_STATIC::empty_string($this->thead) AND (!$this->inthead)) {
|
19947 |
// border for table header
|
19948 |
+
$border = DSGVOTCPDF_STATIC::getBorderMode($border, $position='middle', $this->opencell);
|
19949 |
}
|
19950 |
}
|
19951 |
if (isset($tag['bgcolor']) AND ($tag['bgcolor'] !== false)) {
|
19999 |
$this->num_columns = 1;
|
20000 |
}
|
20001 |
// get border modes
|
20002 |
+
$border_start = DSGVOTCPDF_STATIC::getBorderMode($border, $position='start', $this->opencell);
|
20003 |
+
$border_end = DSGVOTCPDF_STATIC::getBorderMode($border, $position='end', $this->opencell);
|
20004 |
+
$border_middle = DSGVOTCPDF_STATIC::getBorderMode($border, $position='middle', $this->opencell);
|
20005 |
// temporary disable page regions
|
20006 |
$temp_page_regions = $this->page_regions;
|
20007 |
$this->page_regions = array();
|
20436 |
}
|
20437 |
case 'i':
|
20438 |
case 'lower-roman': {
|
20439 |
+
$textitem = strtolower(DSGVOTCPDF_STATIC::intToRoman($this->listcount[$this->listnum]));
|
20440 |
break;
|
20441 |
}
|
20442 |
case 'I':
|
20443 |
case 'upper-roman': {
|
20444 |
+
$textitem = DSGVOTCPDF_STATIC::intToRoman($this->listcount[$this->listnum]);
|
20445 |
break;
|
20446 |
}
|
20447 |
case 'a':
|
20457 |
break;
|
20458 |
}
|
20459 |
case 'lower-greek': {
|
20460 |
+
$textitem = DSGVOTCPDF_FONTS::unichr((945 + $this->listcount[$this->listnum] - 1), $this->isunicode);
|
20461 |
break;
|
20462 |
}
|
20463 |
/*
|
20491 |
$textitem = $this->listcount[$this->listnum];
|
20492 |
}
|
20493 |
}
|
20494 |
+
if (!DSGVOTCPDF_STATIC::empty_string($textitem)) {
|
20495 |
// Check whether we need a new page or new column
|
20496 |
$prev_y = $this->y;
|
20497 |
$h = $this->getCellHeight($this->FontSize);
|
20642 |
$this->num_columns = $gvars['num_columns'];
|
20643 |
}
|
20644 |
$this->_out(''.$this->linestyleWidth.' '.$this->linestyleCap.' '.$this->linestyleJoin.' '.$this->linestyleDash.' '.$this->DrawColor.' '.$this->FillColor.'');
|
20645 |
+
if (!DSGVOTCPDF_STATIC::empty_string($this->FontFamily)) {
|
20646 |
$this->SetFont($this->FontFamily, $this->FontStyle, $this->FontSizePt);
|
20647 |
}
|
20648 |
}
|
21284 |
$page_fill_start = false;
|
21285 |
$page_fill_end = false;
|
21286 |
$current_column = $this->current_column;
|
21287 |
+
if (DSGVOTCPDF_STATIC::empty_string($numbersfont)) {
|
21288 |
$numbersfont = $this->default_monospaced_font;
|
21289 |
}
|
21290 |
+
if (DSGVOTCPDF_STATIC::empty_string($filler)) {
|
21291 |
$filler = ' ';
|
21292 |
}
|
21293 |
+
if (DSGVOTCPDF_STATIC::empty_string($page)) {
|
21294 |
$gap = ' ';
|
21295 |
} else {
|
21296 |
$gap = '';
|
21362 |
$tw = $this->w - $this->rMargin - $this->x;
|
21363 |
}
|
21364 |
$this->SetFont($numbersfont, $fontstyle, $fontsize);
|
21365 |
+
if (DSGVOTCPDF_STATIC::empty_string($page)) {
|
21366 |
$pagenum = $outline['p'];
|
21367 |
} else {
|
21368 |
// placemark to be replaced with the correct number
|
21413 |
}
|
21414 |
}
|
21415 |
$maxpage = max($maxpage, $page_last);
|
21416 |
+
if (!DSGVOTCPDF_STATIC::empty_string($page)) {
|
21417 |
for ($p = $page_first; $p <= $page_last; ++$p) {
|
21418 |
// get page data
|
21419 |
$temppage = $this->getPageBuffer($p);
|
21428 |
} else {
|
21429 |
$np = $n;
|
21430 |
}
|
21431 |
+
$na = DSGVOTCPDF_STATIC::formatTOCPageNumber(($this->starting_page_number + $np - 1));
|
21432 |
+
$nu = DSGVOTCPDF_FONTS::UTF8ToUTF16BE($na, false, $this->isunicode, $this->CurrentFont);
|
21433 |
// replace aliases with numbers
|
21434 |
foreach ($pnalias['u'] as $u) {
|
21435 |
$sfill = str_repeat($filler, max(0, (strlen($u) - strlen($nu.' '))));
|
21436 |
if ($this->rtl) {
|
21437 |
+
$nr = $nu.DSGVOTCPDF_FONTS::UTF8ToUTF16BE(' '.$sfill, false, $this->isunicode, $this->CurrentFont);
|
21438 |
} else {
|
21439 |
+
$nr = DSGVOTCPDF_FONTS::UTF8ToUTF16BE($sfill.' ', false, $this->isunicode, $this->CurrentFont).$nu;
|
21440 |
}
|
21441 |
$temppage = str_replace($u, $nr, $temppage);
|
21442 |
}
|
21506 |
foreach ($this->outlines as $key => $outline) {
|
21507 |
// get HTML template
|
21508 |
$row = $templates[$outline['l']];
|
21509 |
+
if (DSGVOTCPDF_STATIC::empty_string($page)) {
|
21510 |
$pagenum = $outline['p'];
|
21511 |
} else {
|
21512 |
// placemark to be replaced with the correct number
|
21549 |
}
|
21550 |
}
|
21551 |
$maxpage = max($maxpage, $page_last);
|
21552 |
+
if (!DSGVOTCPDF_STATIC::empty_string($page)) {
|
21553 |
for ($p = $page_first; $p <= $page_last; ++$p) {
|
21554 |
// get page data
|
21555 |
$temppage = $this->getPageBuffer($p);
|
21564 |
} else {
|
21565 |
$np = $n;
|
21566 |
}
|
21567 |
+
$na = DSGVOTCPDF_STATIC::formatTOCPageNumber(($this->starting_page_number + $np - 1));
|
21568 |
+
$nu = DSGVOTCPDF_FONTS::UTF8ToUTF16BE($na, false, $this->isunicode, $this->CurrentFont);
|
21569 |
// replace aliases with numbers
|
21570 |
foreach ($pnalias['u'] as $u) {
|
21571 |
if ($correct_align) {
|
21572 |
$sfill = str_repeat($filler, (strlen($u) - strlen($nu.' ')));
|
21573 |
if ($this->rtl) {
|
21574 |
+
$nr = $nu.DSGVOTCPDF_FONTS::UTF8ToUTF16BE(' '.$sfill, false, $this->isunicode, $this->CurrentFont);
|
21575 |
} else {
|
21576 |
+
$nr = DSGVOTCPDF_FONTS::UTF8ToUTF16BE($sfill.' ', false, $this->isunicode, $this->CurrentFont).$nu;
|
21577 |
}
|
21578 |
} else {
|
21579 |
$nr = $nu;
|
21622 |
$this->start_transaction_page = $this->page;
|
21623 |
$this->start_transaction_y = $this->y;
|
21624 |
// clone current object
|
21625 |
+
$this->objcopy = DSGVOTCPDF_STATIC::objclone($this);
|
21626 |
}
|
21627 |
|
21628 |
/**
|
21679 |
if (($width == 0) OR ($width > $maxwidth)) {
|
21680 |
$width = $maxwidth;
|
21681 |
}
|
21682 |
+
if (DSGVOTCPDF_STATIC::empty_string($y)) {
|
21683 |
$y = $this->y;
|
21684 |
}
|
21685 |
// space between columns
|
21775 |
// fix for HTML mode
|
21776 |
$this->newline = true;
|
21777 |
// print HTML table header (if any)
|
21778 |
+
if ((!DSGVOTCPDF_STATIC::empty_string($this->thead)) AND (!$this->inthead)) {
|
21779 |
if ($enable_thead) {
|
21780 |
// print table header
|
21781 |
$this->writeHTML($this->thead, false, false, false, false, '');
|
21949 |
if ($numchars <= $charmin) {
|
21950 |
return $word;
|
21951 |
}
|
21952 |
+
$word_string = DSGVOTCPDF_FONTS::UTF8ArrSubString($word, '', '', $this->isunicode);
|
21953 |
// some words will be returned as-is
|
21954 |
$pattern = '/^([a-zA-Z0-9_\.\-]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/';
|
21955 |
if (preg_match($pattern, $word_string) > 0) {
|
21962 |
return $word;
|
21963 |
}
|
21964 |
if (isset($dictionary[$word_string])) {
|
21965 |
+
return DSGVOTCPDF_FONTS::UTF8StringToArray($dictionary[$word_string], $this->isunicode, $this->CurrentFont);
|
21966 |
}
|
21967 |
// surround word with '_' characters
|
21968 |
$tmpword = array_merge(array(46), $word, array(46));
|
21971 |
for ($pos = 0; $pos < $maxpos; ++$pos) {
|
21972 |
$imax = min(($tmpnumchars - $pos), $charmax);
|
21973 |
for ($i = 1; $i <= $imax; ++$i) {
|
21974 |
+
$subword = strtolower(DSGVOTCPDF_FONTS::UTF8ArrSubString($tmpword, $pos, ($pos + $i), $this->isunicode));
|
21975 |
if (isset($patterns[$subword])) {
|
21976 |
+
$pattern = DSGVOTCPDF_FONTS::UTF8StringToArray($patterns[$subword], $this->isunicode, $this->CurrentFont);
|
21977 |
$pattern_length = count($pattern);
|
21978 |
$digits = 1;
|
21979 |
for ($j = 0; $j < $pattern_length; ++$j) {
|
22030 |
$intag = false; // true if we are inside an HTML tag
|
22031 |
$skip = false; // true to skip hyphenation
|
22032 |
if (!is_array($patterns)) {
|
22033 |
+
$patterns = DSGVOTCPDF_STATIC::getHyphenPatternsFromTEX($patterns);
|
22034 |
}
|
22035 |
// get array of characters
|
22036 |
+
$unichars = DSGVOTCPDF_FONTS::UTF8StringToArray($text, $this->isunicode, $this->CurrentFont);
|
22037 |
// for each char
|
22038 |
foreach ($unichars as $char) {
|
22039 |
+
if ((!$intag) AND (!$skip) AND DSGVOTCPDF_FONT_DATA::$uni_type[$char] == 'L') {
|
22040 |
// letter character
|
22041 |
$word[] = $char;
|
22042 |
} else {
|
22043 |
// other type of character
|
22044 |
+
if (!DSGVOTCPDF_STATIC::empty_string($word)) {
|
22045 |
// hypenate the word
|
22046 |
$txtarr = array_merge($txtarr, $this->hyphenateWord($word, $patterns, $dictionary, $leftmin, $rightmin, $charmin, $charmax));
|
22047 |
$word = array();
|
22073 |
}
|
22074 |
}
|
22075 |
}
|
22076 |
+
if (!DSGVOTCPDF_STATIC::empty_string($word)) {
|
22077 |
// hypenate the word
|
22078 |
$txtarr = array_merge($txtarr, $this->hyphenateWord($word, $patterns, $dictionary, $leftmin, $rightmin, $charmin, $charmax));
|
22079 |
}
|
22080 |
// convert char array to string and return
|
22081 |
+
return DSGVOTCPDF_FONTS::UTF8ArrSubString($txtarr, '', '', $this->isunicode);
|
22082 |
}
|
22083 |
|
22084 |
/**
|
22405 |
if (!empty($this->xobjects[$id]['annotations'])) {
|
22406 |
foreach ($this->xobjects[$id]['annotations'] as $annot) {
|
22407 |
// transform original coordinates
|
22408 |
+
$coordlt = DSGVOTCPDF_STATIC::getTransformationMatrixProduct($tm, array(1, 0, 0, 1, ($annot['x'] * $this->k), (-$annot['y'] * $this->k)));
|
22409 |
$ax = ($coordlt[4] / $this->k);
|
22410 |
$ay = ($this->h - $h - ($coordlt[5] / $this->k));
|
22411 |
+
$coordrb = DSGVOTCPDF_STATIC::getTransformationMatrixProduct($tm, array(1, 0, 0, 1, (($annot['x'] + $annot['w']) * $this->k), ((-$annot['y'] - $annot['h']) * $this->k)));
|
22412 |
$aw = ($coordrb[4] / $this->k) - $ax;
|
22413 |
$ah = ($this->h - $h - ($coordrb[5] / $this->k)) - $ay;
|
22414 |
$this->Annotation($ax, $ay, $aw, $ah, $annot['text'], $annot['opt'], $annot['spaces']);
|
22692 |
$svgdata = substr($file, 1);
|
22693 |
} else { // SVG file
|
22694 |
$this->svgdir = dirname($file);
|
22695 |
+
$svgdata = DSGVOTCPDF_STATIC::fileGetContents($file);
|
22696 |
}
|
22697 |
if ($svgdata === FALSE) {
|
22698 |
$this->Error('SVG file not found: '.$file);
|
23050 |
$this->setAlpha($svgstyle['opacity'], 'Normal', $svgstyle['opacity'], false);
|
23051 |
}
|
23052 |
// color
|
23053 |
+
$fill_color = DSGVOTCPDF_COLORS::convertHTMLColorToDec($svgstyle['color'], $this->spot_colors);
|
23054 |
$this->SetFillColorArray($fill_color);
|
23055 |
// text color
|
23056 |
+
$text_color = DSGVOTCPDF_COLORS::convertHTMLColorToDec($svgstyle['text-color'], $this->spot_colors);
|
23057 |
$this->SetTextColorArray($text_color);
|
23058 |
// clip
|
23059 |
if (preg_match('/rect\(([a-z0-9\-\.]*)[\s]*([a-z0-9\-\.]*)[\s]*([a-z0-9\-\.]*)[\s]*([a-z0-9\-\.]*)\)/si', $svgstyle['clip'], $regs)) {
|
23177 |
$this->Gradient($gradient['type'], $gradient['coords'], $gradient['stops'], array(), false);
|
23178 |
}
|
23179 |
} elseif ($svgstyle['fill'] != 'none') {
|
23180 |
+
$fill_color = DSGVOTCPDF_COLORS::convertHTMLColorToDec($svgstyle['fill'], $this->spot_colors);
|
23181 |
if ($svgstyle['fill-opacity'] != 1) {
|
23182 |
$this->setAlpha($this->alpha['CA'], 'Normal', $svgstyle['fill-opacity'], false);
|
23183 |
}
|
23196 |
$this->setAlpha($rgba_matches[1], 'Normal', $this->alpha['ca'], false);
|
23197 |
}
|
23198 |
$stroke_style = array(
|
23199 |
+
'color' => DSGVOTCPDF_COLORS::convertHTMLColorToDec($svgstyle['stroke'], $this->spot_colors),
|
23200 |
'width' => $this->getHTMLUnitToUnits($svgstyle['stroke-width'], 0, $this->svgunit, false),
|
23201 |
'cap' => $svgstyle['stroke-linecap'],
|
23202 |
'join' => $svgstyle['stroke-linejoin']
|
23328 |
return;
|
23329 |
}
|
23330 |
// set fill/stroke style
|
23331 |
+
$op = DSGVOTCPDF_STATIC::getPathPaintOperator($style, '');
|
23332 |
if (empty($op)) {
|
23333 |
return;
|
23334 |
}
|
23623 |
$cx = ($cax * $cos_ang) - ($cay * $sin_ang) + (($x0 + $x) / 2);
|
23624 |
$cy = ($cax * $sin_ang) + ($cay * $cos_ang) + (($y0 + $y) / 2);
|
23625 |
// get angles
|
23626 |
+
$angs = DSGVOTCPDF_STATIC::getVectorsAngle(1, 0, (($xa - $cax) / $rx), (($cay - $ya) / $ry));
|
23627 |
+
$dang = DSGVOTCPDF_STATIC::getVectorsAngle((($xa - $cax) / $rx), (($ya - $cay) / $ry), ((-$xa - $cax) / $rx), ((-$ya - $cay) / $ry));
|
23628 |
if (($fs == 0) AND ($dang > 0)) {
|
23629 |
$dang -= (2 * M_PI);
|
23630 |
} elseif (($fs == 1) AND ($dang < 0)) {
|
23733 |
// default fill attribute for clipping
|
23734 |
$attribs['fill'] = 'none';
|
23735 |
}
|
23736 |
+
if (isset($attribs['style']) AND !DSGVOTCPDF_STATIC::empty_string($attribs['style']) AND ($attribs['style'][0] != ';')) {
|
23737 |
// fix style for regular expression
|
23738 |
$attribs['style'] = ';'.$attribs['style'];
|
23739 |
}
|
23740 |
foreach ($prev_svgstyle as $key => $val) {
|
23741 |
+
if (in_array($key, DSGVOTCPDF_IMAGES::$svginheritprop)) {
|
23742 |
// inherit previous value
|
23743 |
$svgstyle[$key] = $val;
|
23744 |
}
|
23745 |
+
if (isset($attribs[$key]) AND !DSGVOTCPDF_STATIC::empty_string($attribs[$key])) {
|
23746 |
// specific attribute settings
|
23747 |
if ($attribs[$key] == 'inherit') {
|
23748 |
$svgstyle[$key] = $val;
|
23749 |
} else {
|
23750 |
$svgstyle[$key] = $attribs[$key];
|
23751 |
}
|
23752 |
+
} elseif (isset($attribs['style']) AND !DSGVOTCPDF_STATIC::empty_string($attribs['style'])) {
|
23753 |
// CSS style syntax
|
23754 |
$attrval = array();
|
23755 |
if (preg_match('/[;\"\s]{1}'.$key.'[\s]*:[\s]*([^;\"]*)/si', $attribs['style'], $attrval) AND isset($attrval[1])) {
|
23768 |
$tm = array(1,0,0,1,0,0);
|
23769 |
}
|
23770 |
if (isset($attribs['transform']) AND !empty($attribs['transform'])) {
|
23771 |
+
$tm = DSGVOTCPDF_STATIC::getTransformationMatrixProduct($tm, DSGVOTCPDF_STATIC::getSVGTransformMatrix($attribs['transform']));
|
23772 |
}
|
23773 |
$svgstyle['transfmatrix'] = $tm;
|
23774 |
$invisible = false;
|
23809 |
$svgW = (isset($attribs['width'])?$attribs['width']:0);
|
23810 |
$svgH = (isset($attribs['height'])?$attribs['height']:0);
|
23811 |
// set x, y position using transform matrix
|
23812 |
+
$tm = DSGVOTCPDF_STATIC::getTransformationMatrixProduct($tm, array( 1, 0, 0, 1, $svgX, $svgY));
|
23813 |
$this->SVGTransform($tm);
|
23814 |
// set clipping for width and height
|
23815 |
$x = 0;
|
23867 |
$hr = $wr;
|
23868 |
}
|
23869 |
$newtm = array($wr, 0, 0, $hr, (($wr * ($ax - $vx)) - $svgX), (($hr * ($ay - $vy)) - $svgY));
|
23870 |
+
$tm = DSGVOTCPDF_STATIC::getTransformationMatrixProduct($tm, $newtm);
|
23871 |
$this->SVGTransform($tm);
|
23872 |
}
|
23873 |
}
|
23882 |
$y = (isset($attribs['y'])?$attribs['y']:0);
|
23883 |
$w = 1;//(isset($attribs['width'])?$attribs['width']:1);
|
23884 |
$h = 1;//(isset($attribs['height'])?$attribs['height']:1);
|
23885 |
+
$tm = DSGVOTCPDF_STATIC::getTransformationMatrixProduct($tm, array($w, 0, 0, $h, $x, $y));
|
23886 |
$this->SVGTransform($tm);
|
23887 |
$this->setSVGStyles($svgstyle, $prev_svgstyle);
|
23888 |
break;
|
23918 |
$x2 = (isset($attribs['x2'])?$attribs['x2']:'100');
|
23919 |
$y2 = (isset($attribs['y2'])?$attribs['y2']:'0');
|
23920 |
if (isset($attribs['gradientTransform'])) {
|
23921 |
+
$this->svggradients[$this->svggradientid]['gradientTransform'] = DSGVOTCPDF_STATIC::getSVGTransformMatrix($attribs['gradientTransform']);
|
23922 |
}
|
23923 |
$this->svggradients[$this->svggradientid]['coords'] = array($x1, $y1, $x2, $y2);
|
23924 |
if (isset($attribs['xlink:href']) AND !empty($attribs['xlink:href'])) {
|
23959 |
$fy = (isset($attribs['fy']) ? $attribs['fy'] : $cy);
|
23960 |
$r = (isset($attribs['r']) ? $attribs['r'] : 0.5);
|
23961 |
if (isset($attribs['gradientTransform'])) {
|
23962 |
+
$this->svggradients[$this->svggradientid]['gradientTransform'] = DSGVOTCPDF_STATIC::getSVGTransformMatrix($attribs['gradientTransform']);
|
23963 |
}
|
23964 |
$this->svggradients[$this->svggradientid]['coords'] = array($cx, $cy, $fx, $fy, $r);
|
23965 |
if (isset($attribs['xlink:href']) AND !empty($attribs['xlink:href'])) {
|
23978 |
$offset /= 100;
|
23979 |
}
|
23980 |
}
|
23981 |
+
$stop_color = isset($svgstyle['stop-color'])?DSGVOTCPDF_COLORS::convertHTMLColorToDec($svgstyle['stop-color'], $this->spot_colors):'black';
|
23982 |
$opacity = isset($svgstyle['stop-opacity'])?$svgstyle['stop-opacity']:1;
|
23983 |
$this->svggradients[$this->svggradientid]['stops'][] = array('offset' => $offset, 'color' => $stop_color, 'opacity' => $opacity);
|
23984 |
break;
|
23995 |
$y = (isset($attribs['y'])?$attribs['y']:0);
|
23996 |
$w = (isset($attribs['width'])?$attribs['width']:1);
|
23997 |
$h = (isset($attribs['height'])?$attribs['height']:1);
|
23998 |
+
$tm = DSGVOTCPDF_STATIC::getTransformationMatrixProduct($tm, array($w, 0, 0, $h, $x, $y));
|
23999 |
if ($clipping) {
|
24000 |
$this->SVGTransform($tm);
|
24001 |
$this->SVGPath($d, 'CNZ');
|
24188 |
$img = '@'.base64_decode(substr($img, strlen($m[0])));
|
24189 |
} else {
|
24190 |
// fix image path
|
24191 |
+
if (!DSGVOTCPDF_STATIC::empty_string($this->svgdir) AND (($img[0] == '.') OR (basename($img) == $img))) {
|
24192 |
// replace relative path with full server path
|
24193 |
$img = $this->svgdir.'/'.$img;
|
24194 |
}
|
24210 |
}
|
24211 |
}
|
24212 |
// get image type
|
24213 |
+
$imgtype = DSGVOTCPDF_IMAGES::getImageFileType($img);
|
24214 |
if (($imgtype == 'eps') OR ($imgtype == 'ai')) {
|
24215 |
$this->ImageEps($img, $x, $y, $w, $h);
|
24216 |
} elseif ($imgtype == 'svg') {
|
includes/lib/tcpdf/tcpdf_parser.php
CHANGED
@@ -776,9 +776,9 @@ class DSGVOTCPDF_PARSER {
|
|
776 |
// decode the stream
|
777 |
$remaining_filters = array();
|
778 |
foreach ($filters as $filter) {
|
779 |
-
if (in_array($filter,
|
780 |
try {
|
781 |
-
|
782 |
} catch (Exception $e) {
|
783 |
$emsg = $e->getMessage();
|
784 |
if ((($emsg[0] == '~') AND !$this->cfg['ignore_missing_filter_decoders'])
|
776 |
// decode the stream
|
777 |
$remaining_filters = array();
|
778 |
foreach ($filters as $filter) {
|
779 |
+
if (in_array($filter, DSGVOTCPDF_FILTERS::getAvailableFilters())) {
|
780 |
try {
|
781 |
+
$stream = DSGVOTCPDF_FILTERS::decodeFilter($filter, $stream);
|
782 |
} catch (Exception $e) {
|
783 |
$emsg = $e->getMessage();
|
784 |
if ((($emsg[0] == '~') AND !$this->cfg['ignore_missing_filter_decoders'])
|
includes/lib/tcpdf/tools/tcpdf_addfont.php
CHANGED
@@ -247,7 +247,7 @@ $errors = false;
|
|
247 |
|
248 |
foreach ($options['fonts'] as $font) {
|
249 |
$fontfile = realpath($font);
|
250 |
-
$fontname =
|
251 |
if ($fontname === false) {
|
252 |
$errors = true;
|
253 |
echo "--- ERROR: can't add ".$font."\n";
|
247 |
|
248 |
foreach ($options['fonts'] as $font) {
|
249 |
$fontfile = realpath($font);
|
250 |
+
$fontname = DSGVOTCPDF_FONTS::addTTFfont($fontfile, $options['type'], $options['enc'], $options['flags'], $options['outpath'], $options['platid'], $options['encid'], $options['addcbbox'], $options['link']);
|
251 |
if ($fontname === false) {
|
252 |
$errors = true;
|
253 |
echo "--- ERROR: can't add ".$font."\n";
|
sp-dsgvo.php
CHANGED
@@ -16,7 +16,7 @@
|
|
16 |
* Plugin Name: WP DSGVO Tools
|
17 |
* Plugin URI: https://wp-dsgvo.eu
|
18 |
* Description: WP DSGVO Tools helfen beim Erfüllen der Richtlinien der Datenschutzgrundverordnung (<a target="_blank" href="https://ico.org.uk/for-organisations/data-protection-reform/overview-of-the-gdpr/">DSGVO</a>), spezialisiert auf Österreich und Deutschland.
|
19 |
-
* Version: 2.1.
|
20 |
* Author: Shapepress eU
|
21 |
* Author URI: https://www.shapepress.com
|
22 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
@@ -28,7 +28,7 @@ if (! defined('WPINC')) {
|
|
28 |
die();
|
29 |
}
|
30 |
|
31 |
-
define('sp_dsgvo_VERSION', '2.1.
|
32 |
define('sp_dsgvo_NAME', 'sp-dsgvo');
|
33 |
/* i592995 */
|
34 |
define('sp_dsgvo_URL', plugin_dir_url( __FILE__ ));
|
16 |
* Plugin Name: WP DSGVO Tools
|
17 |
* Plugin URI: https://wp-dsgvo.eu
|
18 |
* Description: WP DSGVO Tools helfen beim Erfüllen der Richtlinien der Datenschutzgrundverordnung (<a target="_blank" href="https://ico.org.uk/for-organisations/data-protection-reform/overview-of-the-gdpr/">DSGVO</a>), spezialisiert auf Österreich und Deutschland.
|
19 |
+
* Version: 2.1.3
|
20 |
* Author: Shapepress eU
|
21 |
* Author URI: https://www.shapepress.com
|
22 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
28 |
die();
|
29 |
}
|
30 |
|
31 |
+
define('sp_dsgvo_VERSION', '2.1.3');
|
32 |
define('sp_dsgvo_NAME', 'sp-dsgvo');
|
33 |
/* i592995 */
|
34 |
define('sp_dsgvo_URL', plugin_dir_url( __FILE__ ));
|