Version Description
- Bug: Ensure the mPDF temporary directory is set to the PDF Working Directory
tmp
folder [GH#817] - Bug: Refine the Background Processing description and tooltip text [GH#818]
Download this release
Release Info
Developer | Blue Liquid Designs |
Plugin | Gravity PDF |
Version | 5.0.1 |
Comparing to | |
See all releases |
Code changes from version 5.0.0 to 5.0.1
- README.txt +5 -1
- pdf.php +2 -2
- src/assets/languages/gravity-forms-pdf-extended.pot +2 -2
- src/deprecated.php +1 -1
- src/helper/Helper_Options_Fields.php +2 -2
- src/helper/Helper_PDF.php +1 -1
- vendor/composer/installed.json +6 -6
- vendor/mpdf/mpdf/.travis.yml +2 -2
- vendor/mpdf/mpdf/data/entity_substitutions.php +39 -0
- vendor/mpdf/mpdf/src/DirectWrite.php +32 -10
- vendor/mpdf/mpdf/src/Image/Svg.php +1 -1
- vendor/mpdf/mpdf/src/Log/Context.php +2 -0
- vendor/mpdf/mpdf/src/Mpdf.php +507 -259
README.txt
CHANGED
@@ -5,7 +5,7 @@ Donate link: https://gravitypdf.com/donate-to-plugin/
|
|
5 |
Tags: gravity, forms, pdf, automation, attachment, email
|
6 |
Requires at least: 4.8
|
7 |
Tested up to: 4.9
|
8 |
-
Stable tag: 5.0.
|
9 |
Requires PHP: 5.6
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl.txt
|
@@ -90,6 +90,10 @@ Also, if you enjoy using the software [we'd love it if you could give us a revie
|
|
90 |
|
91 |
== Changelog ==
|
92 |
|
|
|
|
|
|
|
|
|
93 |
= 5.0.0 =
|
94 |
* Breaking Change: Bump minimum version of Gravity Forms from 1.9 to 2.3.1+
|
95 |
* Breaking Change: Bump WordPress minimum version from 4.4 to 4.8+
|
5 |
Tags: gravity, forms, pdf, automation, attachment, email
|
6 |
Requires at least: 4.8
|
7 |
Tested up to: 4.9
|
8 |
+
Stable tag: 5.0.1
|
9 |
Requires PHP: 5.6
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl.txt
|
90 |
|
91 |
== Changelog ==
|
92 |
|
93 |
+
= 5.0.1 =
|
94 |
+
* Bug: Ensure the mPDF temporary directory is set to the PDF Working Directory `tmp` folder [GH#817]
|
95 |
+
* Bug: Refine the Background Processing description and tooltip text [GH#818]
|
96 |
+
|
97 |
= 5.0.0 =
|
98 |
* Breaking Change: Bump minimum version of Gravity Forms from 1.9 to 2.3.1+
|
99 |
* Breaking Change: Bump WordPress minimum version from 4.4 to 4.8+
|
pdf.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Gravity PDF
|
4 |
-
Version: 5.0.
|
5 |
Description: Automatically generate highly-customisable PDF documents using Gravity Forms.
|
6 |
Author: Gravity PDF
|
7 |
Author URI: https://gravitypdf.com
|
@@ -37,7 +37,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
37 |
/*
|
38 |
* Set base constants we'll use throughout the plugin
|
39 |
*/
|
40 |
-
define( 'PDF_EXTENDED_VERSION', '5.0.
|
41 |
define( 'PDF_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); /* plugin directory path */
|
42 |
define( 'PDF_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); /* plugin directory url */
|
43 |
define( 'PDF_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); /* the plugin basename */
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Gravity PDF
|
4 |
+
Version: 5.0.1
|
5 |
Description: Automatically generate highly-customisable PDF documents using Gravity Forms.
|
6 |
Author: Gravity PDF
|
7 |
Author URI: https://gravitypdf.com
|
37 |
/*
|
38 |
* Set base constants we'll use throughout the plugin
|
39 |
*/
|
40 |
+
define( 'PDF_EXTENDED_VERSION', '5.0.1' ); /* the current plugin version */
|
41 |
define( 'PDF_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); /* plugin directory path */
|
42 |
define( 'PDF_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); /* plugin directory url */
|
43 |
define( 'PDF_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); /* the plugin basename */
|
src/assets/languages/gravity-forms-pdf-extended.pot
CHANGED
@@ -510,11 +510,11 @@ msgid "Background Processing"
|
|
510 |
msgstr ""
|
511 |
|
512 |
#: src/helper/Helper_Options_Fields.php:178
|
513 |
-
msgid "When enable,
|
514 |
msgstr ""
|
515 |
|
516 |
#: src/helper/Helper_Options_Fields.php:185
|
517 |
-
msgid "When enabled,
|
518 |
msgstr ""
|
519 |
|
520 |
#: src/helper/Helper_Options_Fields.php:190, src/helper/Helper_Options_Fields.php:198
|
510 |
msgstr ""
|
511 |
|
512 |
#: src/helper/Helper_Options_Fields.php:178
|
513 |
+
msgid "When enable, form submission and resending notifications with PDFs are handled in a background task. %sRequires Background tasks to be enabled%s."
|
514 |
msgstr ""
|
515 |
|
516 |
#: src/helper/Helper_Options_Fields.php:185
|
517 |
+
msgid "When enabled, reduce wait time during form submission as PDF generation is off-loaded to a background process. It is important to ensure Background Tasks are enabled in the Gravity Forms System Status before enabling this feature."
|
518 |
msgstr ""
|
519 |
|
520 |
#: src/helper/Helper_Options_Fields.php:190, src/helper/Helper_Options_Fields.php:198
|
src/deprecated.php
CHANGED
@@ -753,7 +753,7 @@ if ( ! class_exists( 'mPDF' ) ) {
|
|
753 |
|
754 |
'fontdata' => apply_filters( 'mpdf_font_data', $defaultFontConfig['fontdata'] ),
|
755 |
|
756 |
-
'
|
757 |
|
758 |
'allow_output_buffering' => true,
|
759 |
'autoLangToFont' => true,
|
753 |
|
754 |
'fontdata' => apply_filters( 'mpdf_font_data', $defaultFontConfig['fontdata'] ),
|
755 |
|
756 |
+
'tempDir' => $data->template_tmp_location . 'mpdf',
|
757 |
|
758 |
'allow_output_buffering' => true,
|
759 |
'autoLangToFont' => true,
|
src/helper/Helper_Options_Fields.php
CHANGED
@@ -175,14 +175,14 @@ class Helper_Options_Fields extends Helper_Abstract_Options implements Helper_In
|
|
175 |
'background_processing' => [
|
176 |
'id' => 'background_processing',
|
177 |
'name' => esc_html__( 'Background Processing', 'gravity-forms-pdf-extended' ),
|
178 |
-
'desc' => sprintf( esc_html__( 'When enable,
|
179 |
'type' => 'radio',
|
180 |
'options' => [
|
181 |
'Enable' => esc_html__( 'Enable', 'gravity-forms-pdf-extended' ),
|
182 |
'Disable' => esc_html__( 'Disable', 'gravity-forms-pdf-extended' ),
|
183 |
],
|
184 |
'std' => 'Disable',
|
185 |
-
'tooltip' => '<h6>' . esc_html__( 'Background Processing', 'gravity-forms-pdf-extended' ) . '</h6>' . esc_html__( 'When enabled,
|
186 |
],
|
187 |
|
188 |
'shortcode_debug_messages' => [
|
175 |
'background_processing' => [
|
176 |
'id' => 'background_processing',
|
177 |
'name' => esc_html__( 'Background Processing', 'gravity-forms-pdf-extended' ),
|
178 |
+
'desc' => sprintf( esc_html__( 'When enable, form submission and resending notifications with PDFs are handled in a background task. %sRequires Background tasks to be enabled%s.', 'gravity-forms-pdf-extended' ), '<a href="https://gravitypdf.com/documentation/v5/background-processing/">', '</a>' ),
|
179 |
'type' => 'radio',
|
180 |
'options' => [
|
181 |
'Enable' => esc_html__( 'Enable', 'gravity-forms-pdf-extended' ),
|
182 |
'Disable' => esc_html__( 'Disable', 'gravity-forms-pdf-extended' ),
|
183 |
],
|
184 |
'std' => 'Disable',
|
185 |
+
'tooltip' => '<h6>' . esc_html__( 'Background Processing', 'gravity-forms-pdf-extended' ) . '</h6>' . esc_html__( 'When enabled, reduce wait time during form submission as PDF generation is off-loaded to a background process. It is important to ensure Background Tasks are enabled in the Gravity Forms System Status before enabling this feature.', 'gravity-forms-pdf-extended' ),
|
186 |
],
|
187 |
|
188 |
'shortcode_debug_messages' => [
|
src/helper/Helper_PDF.php
CHANGED
@@ -642,7 +642,7 @@ class Helper_PDF {
|
|
642 |
|
643 |
'fontdata' => apply_filters( 'mpdf_font_data', $defaultFontConfig['fontdata'] ),
|
644 |
|
645 |
-
'
|
646 |
|
647 |
'allow_output_buffering' => true,
|
648 |
'autoLangToFont' => true,
|
642 |
|
643 |
'fontdata' => apply_filters( 'mpdf_font_data', $defaultFontConfig['fontdata'] ),
|
644 |
|
645 |
+
'tempDir' => $this->data->template_tmp_location . 'mpdf',
|
646 |
|
647 |
'allow_output_buffering' => true,
|
648 |
'autoLangToFont' => true,
|
vendor/composer/installed.json
CHANGED
@@ -197,17 +197,17 @@
|
|
197 |
},
|
198 |
{
|
199 |
"name": "mpdf/mpdf",
|
200 |
-
"version": "v7.1.
|
201 |
-
"version_normalized": "7.1.
|
202 |
"source": {
|
203 |
"type": "git",
|
204 |
"url": "https://github.com/mpdf/mpdf.git",
|
205 |
-
"reference": "
|
206 |
},
|
207 |
"dist": {
|
208 |
"type": "zip",
|
209 |
-
"url": "https://api.github.com/repos/mpdf/mpdf/zipball/
|
210 |
-
"reference": "
|
211 |
"shasum": ""
|
212 |
},
|
213 |
"require": {
|
@@ -230,7 +230,7 @@
|
|
230 |
"ext-xml": "Needed mainly for SVG manipulation",
|
231 |
"ext-zlib": "Needed for compression of embedded resources, such as fonts"
|
232 |
},
|
233 |
-
"time": "2018-
|
234 |
"type": "library",
|
235 |
"extra": {
|
236 |
"branch-alias": {
|
197 |
},
|
198 |
{
|
199 |
"name": "mpdf/mpdf",
|
200 |
+
"version": "v7.1.5",
|
201 |
+
"version_normalized": "7.1.5.0",
|
202 |
"source": {
|
203 |
"type": "git",
|
204 |
"url": "https://github.com/mpdf/mpdf.git",
|
205 |
+
"reference": "2ed29c3a59fa23e77052e9d7fa7e31c707fb7502"
|
206 |
},
|
207 |
"dist": {
|
208 |
"type": "zip",
|
209 |
+
"url": "https://api.github.com/repos/mpdf/mpdf/zipball/2ed29c3a59fa23e77052e9d7fa7e31c707fb7502",
|
210 |
+
"reference": "2ed29c3a59fa23e77052e9d7fa7e31c707fb7502",
|
211 |
"shasum": ""
|
212 |
},
|
213 |
"require": {
|
230 |
"ext-xml": "Needed mainly for SVG manipulation",
|
231 |
"ext-zlib": "Needed for compression of embedded resources, such as fonts"
|
232 |
},
|
233 |
+
"time": "2018-09-19T09:58:39+00:00",
|
234 |
"type": "library",
|
235 |
"extra": {
|
236 |
"branch-alias": {
|
vendor/mpdf/mpdf/.travis.yml
CHANGED
@@ -17,8 +17,8 @@ matrix:
|
|
17 |
|
18 |
- env: LINT=1
|
19 |
php: 7.1
|
20 |
-
|
21 |
-
|
22 |
|
23 |
allow_failures:
|
24 |
- php: nightly
|
17 |
|
18 |
- env: LINT=1
|
19 |
php: 7.1
|
20 |
+
#- env: COVERAGE=1
|
21 |
+
# php: 7.1
|
22 |
|
23 |
allow_failures:
|
24 |
- php: nightly
|
vendor/mpdf/mpdf/data/entity_substitutions.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
return [
|
4 |
+
'nbsp' => '160', 'iexcl' => '161', 'cent' => '162', 'pound' => '163', 'curren' => '164', 'yen' => '165', 'brvbar' => '166', 'sect' => '167',
|
5 |
+
'uml' => '168', 'copy' => '169', 'ordf' => '170', 'laquo' => '171', 'not' => '172', 'shy' => '173', 'reg' => '174', 'macr' => '175',
|
6 |
+
'deg' => '176', 'plusmn' => '177', 'sup2' => '178', 'sup3' => '179', 'acute' => '180', 'micro' => '181', 'para' => '182', 'middot' => '183',
|
7 |
+
'cedil' => '184', 'sup1' => '185', 'ordm' => '186', 'raquo' => '187', 'frac14' => '188', 'frac12' => '189', 'frac34' => '190',
|
8 |
+
'iquest' => '191', 'Agrave' => '192', 'Aacute' => '193', 'Acirc' => '194', 'Atilde' => '195', 'Auml' => '196', 'Aring' => '197',
|
9 |
+
'AElig' => '198', 'Ccedil' => '199', 'Egrave' => '200', 'Eacute' => '201', 'Ecirc' => '202', 'Euml' => '203', 'Igrave' => '204',
|
10 |
+
'Iacute' => '205', 'Icirc' => '206', 'Iuml' => '207', 'ETH' => '208', 'Ntilde' => '209', 'Ograve' => '210', 'Oacute' => '211',
|
11 |
+
'Ocirc' => '212', 'Otilde' => '213', 'Ouml' => '214', 'times' => '215', 'Oslash' => '216', 'Ugrave' => '217', 'Uacute' => '218',
|
12 |
+
'Ucirc' => '219', 'Uuml' => '220', 'Yacute' => '221', 'THORN' => '222', 'szlig' => '223', 'agrave' => '224', 'aacute' => '225',
|
13 |
+
'acirc' => '226', 'atilde' => '227', 'auml' => '228', 'aring' => '229', 'aelig' => '230', 'ccedil' => '231', 'egrave' => '232',
|
14 |
+
'eacute' => '233', 'ecirc' => '234', 'euml' => '235', 'igrave' => '236', 'iacute' => '237', 'icirc' => '238', 'iuml' => '239',
|
15 |
+
'eth' => '240', 'ntilde' => '241', 'ograve' => '242', 'oacute' => '243', 'ocirc' => '244', 'otilde' => '245', 'ouml' => '246',
|
16 |
+
'divide' => '247', 'oslash' => '248', 'ugrave' => '249', 'uacute' => '250', 'ucirc' => '251', 'uuml' => '252', 'yacute' => '253',
|
17 |
+
'thorn' => '254', 'yuml' => '255', 'OElig' => '338', 'oelig' => '339', 'Scaron' => '352', 'scaron' => '353', 'Yuml' => '376',
|
18 |
+
'fnof' => '402', 'circ' => '710', 'tilde' => '732', 'Alpha' => '913', 'Beta' => '914', 'Gamma' => '915', 'Delta' => '916',
|
19 |
+
'Epsilon' => '917', 'Zeta' => '918', 'Eta' => '919', 'Theta' => '920', 'Iota' => '921', 'Kappa' => '922', 'Lambda' => '923',
|
20 |
+
'Mu' => '924', 'Nu' => '925', 'Xi' => '926', 'Omicron' => '927', 'Pi' => '928', 'Rho' => '929', 'Sigma' => '931', 'Tau' => '932',
|
21 |
+
'Upsilon' => '933', 'Phi' => '934', 'Chi' => '935', 'Psi' => '936', 'Omega' => '937', 'alpha' => '945', 'beta' => '946', 'gamma' => '947',
|
22 |
+
'delta' => '948', 'epsilon' => '949', 'zeta' => '950', 'eta' => '951', 'theta' => '952', 'iota' => '953', 'kappa' => '954',
|
23 |
+
'lambda' => '955', 'mu' => '956', 'nu' => '957', 'xi' => '958', 'omicron' => '959', 'pi' => '960', 'rho' => '961', 'sigmaf' => '962',
|
24 |
+
'sigma' => '963', 'tau' => '964', 'upsilon' => '965', 'phi' => '966', 'chi' => '967', 'psi' => '968', 'omega' => '969',
|
25 |
+
'thetasym' => '977', 'upsih' => '978', 'piv' => '982', 'ensp' => '8194', 'emsp' => '8195', 'thinsp' => '8201', 'zwnj' => '8204',
|
26 |
+
'zwj' => '8205', 'lrm' => '8206', 'rlm' => '8207', 'ndash' => '8211', 'mdash' => '8212', 'lsquo' => '8216', 'rsquo' => '8217',
|
27 |
+
'sbquo' => '8218', 'ldquo' => '8220', 'rdquo' => '8221', 'bdquo' => '8222', 'dagger' => '8224', 'Dagger' => '8225', 'bull' => '8226',
|
28 |
+
'hellip' => '8230', 'permil' => '8240', 'prime' => '8242', 'Prime' => '8243', 'lsaquo' => '8249', 'rsaquo' => '8250', 'oline' => '8254',
|
29 |
+
'frasl' => '8260', 'euro' => '8364', 'image' => '8465', 'weierp' => '8472', 'real' => '8476', 'trade' => '8482', 'alefsym' => '8501',
|
30 |
+
'larr' => '8592', 'uarr' => '8593', 'rarr' => '8594', 'darr' => '8595', 'harr' => '8596', 'crarr' => '8629', 'lArr' => '8656',
|
31 |
+
'uArr' => '8657', 'rArr' => '8658', 'dArr' => '8659', 'hArr' => '8660', 'forall' => '8704', 'part' => '8706', 'exist' => '8707',
|
32 |
+
'empty' => '8709', 'nabla' => '8711', 'isin' => '8712', 'notin' => '8713', 'ni' => '8715', 'prod' => '8719', 'sum' => '8721',
|
33 |
+
'minus' => '8722', 'lowast' => '8727', 'radic' => '8730', 'prop' => '8733', 'infin' => '8734', 'ang' => '8736', 'and' => '8743',
|
34 |
+
'or' => '8744', 'cap' => '8745', 'cup' => '8746', 'int' => '8747', 'there4' => '8756', 'sim' => '8764', 'cong' => '8773',
|
35 |
+
'asymp' => '8776', 'ne' => '8800', 'equiv' => '8801', 'le' => '8804', 'ge' => '8805', 'sub' => '8834', 'sup' => '8835', 'nsub' => '8836',
|
36 |
+
'sube' => '8838', 'supe' => '8839', 'oplus' => '8853', 'otimes' => '8855', 'perp' => '8869', 'sdot' => '8901', 'lceil' => '8968',
|
37 |
+
'rceil' => '8969', 'lfloor' => '8970', 'rfloor' => '8971', 'lang' => '9001', 'rang' => '9002', 'loz' => '9674', 'spades' => '9824',
|
38 |
+
'clubs' => '9827', 'hearts' => '9829', 'diams' => '9830',
|
39 |
+
];
|
vendor/mpdf/mpdf/src/DirectWrite.php
CHANGED
@@ -280,19 +280,25 @@ class DirectWrite
|
|
280 |
if ($fontfamily || $fontstyle || $fontsizePt) {
|
281 |
$this->mpdf->SetFont($fontfamily, $fontstyle, $fontsizePt);
|
282 |
}
|
283 |
-
|
284 |
-
$
|
|
|
|
|
285 |
if ($kerning == 0) {
|
286 |
-
|
287 |
}
|
|
|
288 |
if ($fontwidth == 0) {
|
289 |
-
|
290 |
}
|
|
|
291 |
$text = str_replace("\r", '', $text);
|
292 |
-
|
|
|
293 |
$u = ($r * 2) * M_PI;
|
294 |
$checking = true;
|
295 |
$autoset = false;
|
|
|
296 |
while ($checking) {
|
297 |
$t = 0;
|
298 |
$w = [];
|
@@ -339,10 +345,11 @@ class DirectWrite
|
|
339 |
}
|
340 |
}
|
341 |
|
342 |
-
//total width of string in degrees
|
343 |
$d = ($t / $u) * 360;
|
344 |
|
345 |
$this->mpdf->StartTransform();
|
|
|
346 |
// rotate matrix for the first letter to center the text
|
347 |
// (half of total degrees)
|
348 |
if ($align === 'top') {
|
@@ -350,49 +357,61 @@ class DirectWrite
|
|
350 |
} else {
|
351 |
$this->mpdf->transformRotate($d / 2, $x, $y);
|
352 |
}
|
353 |
-
|
|
|
354 |
for ($i = 0; $i < $nb; $i++) {
|
|
|
355 |
if ($align === 'top') {
|
356 |
-
|
|
|
357 |
if ($i === 0) {
|
358 |
$this->mpdf->transformRotate((($w[$i] / 2) / $u) * 360, $x, $y);
|
359 |
} else {
|
360 |
$this->mpdf->transformRotate((($w[$i] / 2 + $w[$i - 1] / 2) / $u) * 360, $x, $y);
|
361 |
}
|
|
|
362 |
if ($fontwidth !== 1) {
|
363 |
$this->mpdf->StartTransform();
|
364 |
$this->mpdf->transformScale($fontwidth * 100, 100, $x, $y);
|
365 |
}
|
|
|
366 |
$this->mpdf->SetXY($x - $w[$i] / 2, $y - $r);
|
|
|
367 |
} else {
|
368 |
-
|
|
|
369 |
if ($i === 0) {
|
370 |
$this->mpdf->transformRotate(-(($w[$i] / 2) / $u) * 360, $x, $y);
|
371 |
} else {
|
372 |
$this->mpdf->transformRotate(-(($w[$i] / 2 + $w[$i - 1] / 2) / $u) * 360, $x, $y);
|
373 |
}
|
|
|
374 |
if ($fontwidth !== 1) {
|
375 |
$this->mpdf->StartTransform();
|
376 |
$this->mpdf->transformScale($fontwidth * 100, 100, $x, $y);
|
377 |
}
|
378 |
$this->mpdf->SetXY($x - $w[$i] / 2, $y + $r - $this->mpdf->FontSize);
|
379 |
}
|
|
|
380 |
if ($this->mpdf->usingCoreFont) {
|
381 |
$c = $text[$i];
|
382 |
} else {
|
383 |
$c = mb_substr($text, $i, 1, $this->mpdf->mb_enc);
|
384 |
}
|
|
|
385 |
$this->mpdf->Cell($w[$i], $this->mpdf->FontSize, $c, 0, 0, 'C'); // mPDF 5.3.53
|
|
|
386 |
if ($fontwidth !== 1) {
|
387 |
$this->mpdf->StopTransform();
|
388 |
}
|
389 |
}
|
|
|
390 |
$this->mpdf->StopTransform();
|
391 |
|
392 |
// mPDF 5.5.23
|
393 |
if ($align === 'top' && $divider != '') {
|
394 |
$wc = $this->mpdf->GetStringWidth($divider);
|
395 |
-
$wc
|
396 |
|
397 |
$this->mpdf->StartTransform();
|
398 |
$this->mpdf->transformRotate(90, $x, $y);
|
@@ -422,9 +441,11 @@ class DirectWrite
|
|
422 |
$this->mpdf->SetFont($font, $fontstyle, $szfont, false);
|
423 |
|
424 |
$text = $this->mpdf->purify_utf8_text($text);
|
|
|
425 |
if ($this->mpdf->text_input_as_HTML) {
|
426 |
$text = $this->mpdf->all_entities_to_utf8($text);
|
427 |
}
|
|
|
428 |
if ($this->mpdf->usingCoreFont) {
|
429 |
$text = mb_convert_encoding($text, $this->mpdf->mb_enc, 'UTF-8');
|
430 |
}
|
@@ -438,6 +459,7 @@ class DirectWrite
|
|
438 |
$textvar = 0;
|
439 |
$save_OTLtags = $this->mpdf->OTLtags;
|
440 |
$this->mpdf->OTLtags = [];
|
|
|
441 |
if ($this->mpdf->useKerning) {
|
442 |
if ($this->mpdf->CurrentFont['haskernGPOS']) {
|
443 |
$this->mpdf->OTLtags['Plus'] .= ' kern';
|
280 |
if ($fontfamily || $fontstyle || $fontsizePt) {
|
281 |
$this->mpdf->SetFont($fontfamily, $fontstyle, $fontsizePt);
|
282 |
}
|
283 |
+
|
284 |
+
$kerning /= 100;
|
285 |
+
$fontwidth /= 100;
|
286 |
+
|
287 |
if ($kerning == 0) {
|
288 |
+
throw new \Mpdf\MpdfException('Please use values unequal to zero for kerning (CircularText)');
|
289 |
}
|
290 |
+
|
291 |
if ($fontwidth == 0) {
|
292 |
+
throw new \Mpdf\MpdfException('Please use values unequal to zero for font width (CircularText)');
|
293 |
}
|
294 |
+
|
295 |
$text = str_replace("\r", '', $text);
|
296 |
+
|
297 |
+
// circumference
|
298 |
$u = ($r * 2) * M_PI;
|
299 |
$checking = true;
|
300 |
$autoset = false;
|
301 |
+
|
302 |
while ($checking) {
|
303 |
$t = 0;
|
304 |
$w = [];
|
345 |
}
|
346 |
}
|
347 |
|
348 |
+
// total width of string in degrees
|
349 |
$d = ($t / $u) * 360;
|
350 |
|
351 |
$this->mpdf->StartTransform();
|
352 |
+
|
353 |
// rotate matrix for the first letter to center the text
|
354 |
// (half of total degrees)
|
355 |
if ($align === 'top') {
|
357 |
} else {
|
358 |
$this->mpdf->transformRotate($d / 2, $x, $y);
|
359 |
}
|
360 |
+
|
361 |
+
// run through the string
|
362 |
for ($i = 0; $i < $nb; $i++) {
|
363 |
+
|
364 |
if ($align === 'top') {
|
365 |
+
|
366 |
+
// rotate matrix half of the width of current letter + half of the width of preceding letter
|
367 |
if ($i === 0) {
|
368 |
$this->mpdf->transformRotate((($w[$i] / 2) / $u) * 360, $x, $y);
|
369 |
} else {
|
370 |
$this->mpdf->transformRotate((($w[$i] / 2 + $w[$i - 1] / 2) / $u) * 360, $x, $y);
|
371 |
}
|
372 |
+
|
373 |
if ($fontwidth !== 1) {
|
374 |
$this->mpdf->StartTransform();
|
375 |
$this->mpdf->transformScale($fontwidth * 100, 100, $x, $y);
|
376 |
}
|
377 |
+
|
378 |
$this->mpdf->SetXY($x - $w[$i] / 2, $y - $r);
|
379 |
+
|
380 |
} else {
|
381 |
+
|
382 |
+
// rotate matrix half of the width of current letter + half of the width of preceding letter
|
383 |
if ($i === 0) {
|
384 |
$this->mpdf->transformRotate(-(($w[$i] / 2) / $u) * 360, $x, $y);
|
385 |
} else {
|
386 |
$this->mpdf->transformRotate(-(($w[$i] / 2 + $w[$i - 1] / 2) / $u) * 360, $x, $y);
|
387 |
}
|
388 |
+
|
389 |
if ($fontwidth !== 1) {
|
390 |
$this->mpdf->StartTransform();
|
391 |
$this->mpdf->transformScale($fontwidth * 100, 100, $x, $y);
|
392 |
}
|
393 |
$this->mpdf->SetXY($x - $w[$i] / 2, $y + $r - $this->mpdf->FontSize);
|
394 |
}
|
395 |
+
|
396 |
if ($this->mpdf->usingCoreFont) {
|
397 |
$c = $text[$i];
|
398 |
} else {
|
399 |
$c = mb_substr($text, $i, 1, $this->mpdf->mb_enc);
|
400 |
}
|
401 |
+
|
402 |
$this->mpdf->Cell($w[$i], $this->mpdf->FontSize, $c, 0, 0, 'C'); // mPDF 5.3.53
|
403 |
+
|
404 |
if ($fontwidth !== 1) {
|
405 |
$this->mpdf->StopTransform();
|
406 |
}
|
407 |
}
|
408 |
+
|
409 |
$this->mpdf->StopTransform();
|
410 |
|
411 |
// mPDF 5.5.23
|
412 |
if ($align === 'top' && $divider != '') {
|
413 |
$wc = $this->mpdf->GetStringWidth($divider);
|
414 |
+
$wc *= $kerning * $fontwidth;
|
415 |
|
416 |
$this->mpdf->StartTransform();
|
417 |
$this->mpdf->transformRotate(90, $x, $y);
|
441 |
$this->mpdf->SetFont($font, $fontstyle, $szfont, false);
|
442 |
|
443 |
$text = $this->mpdf->purify_utf8_text($text);
|
444 |
+
|
445 |
if ($this->mpdf->text_input_as_HTML) {
|
446 |
$text = $this->mpdf->all_entities_to_utf8($text);
|
447 |
}
|
448 |
+
|
449 |
if ($this->mpdf->usingCoreFont) {
|
450 |
$text = mb_convert_encoding($text, $this->mpdf->mb_enc, 'UTF-8');
|
451 |
}
|
459 |
$textvar = 0;
|
460 |
$save_OTLtags = $this->mpdf->OTLtags;
|
461 |
$this->mpdf->OTLtags = [];
|
462 |
+
|
463 |
if ($this->mpdf->useKerning) {
|
464 |
if ($this->mpdf->CurrentFont['haskernGPOS']) {
|
465 |
$this->mpdf->OTLtags['Plus'] .= ' kern';
|
vendor/mpdf/mpdf/src/Image/Svg.php
CHANGED
@@ -1465,7 +1465,7 @@ class Svg
|
|
1465 |
}
|
1466 |
if (isset($critere_style['stroke-dasharray'])) {
|
1467 |
$off = 0;
|
1468 |
-
$d = preg_split('/
|
1469 |
if (count($d) == 1 && $d[0] == 0) {
|
1470 |
$path_style .= '[] 0 d ';
|
1471 |
} else {
|
1465 |
}
|
1466 |
if (isset($critere_style['stroke-dasharray'])) {
|
1467 |
$off = 0;
|
1468 |
+
$d = preg_split('/(,\s?|\s)/', $critere_style['stroke-dasharray']);
|
1469 |
if (count($d) == 1 && $d[0] == 0) {
|
1470 |
$path_style .= '[] 0 d ';
|
1471 |
} else {
|
vendor/mpdf/mpdf/src/Log/Context.php
CHANGED
@@ -17,4 +17,6 @@ class Context
|
|
17 |
|
18 |
const CSS_SIZE_CONVERSION = 'css_size_conversion';
|
19 |
|
|
|
|
|
20 |
}
|
17 |
|
18 |
const CSS_SIZE_CONVERSION = 'css_size_conversion';
|
19 |
|
20 |
+
const HTML_MARKUP = 'html_markup';
|
21 |
+
|
22 |
}
|
vendor/mpdf/mpdf/src/Mpdf.php
CHANGED
@@ -55,7 +55,7 @@ use Psr\Log\NullLogger;
|
|
55 |
class Mpdf implements \Psr\Log\LoggerAwareInterface
|
56 |
{
|
57 |
|
58 |
-
const VERSION = '7.1.
|
59 |
|
60 |
const SCALE = 72 / 25.4;
|
61 |
|
@@ -3692,12 +3692,12 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
3692 |
$y5 = $y3 - ($y3 - $y4) / 2;
|
3693 |
|
3694 |
$s = '';
|
3695 |
-
$s.=sprintf('%.3F %.3F m %.3F %.3F l S', $x1 * Mpdf::SCALE, ($this->h - $y1) * Mpdf::SCALE, $x5 * Mpdf::SCALE, $y5 * Mpdf::SCALE);
|
3696 |
$this->_out($s);
|
3697 |
|
3698 |
$s = '';
|
3699 |
-
$s.=sprintf('%.3F %.3F m %.3F %.3F l %.3F %.3F l %.3F %.3F l %.3F %.3F l ', $x5 * Mpdf::SCALE, $y5 * Mpdf::SCALE, $x3 * Mpdf::SCALE, $y3 * Mpdf::SCALE, $x2 * Mpdf::SCALE, ($this->h - $y2) * Mpdf::SCALE, $x4 * Mpdf::SCALE, $y4 * Mpdf::SCALE, $x5 * Mpdf::SCALE, $y5 * Mpdf::SCALE);
|
3700 |
-
$s
|
3701 |
$this->_out($s);
|
3702 |
}
|
3703 |
|
@@ -4311,7 +4311,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
4311 |
$aix = $aixextra . $aix;
|
4312 |
|
4313 |
if ($this->ColorFlag) {
|
4314 |
-
$s
|
4315 |
}
|
4316 |
|
4317 |
$this->CurrentFont['used'] = true;
|
@@ -4377,9 +4377,9 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
4377 |
$ut = 60 / 1000 * $this->FontSize;
|
4378 |
}
|
4379 |
$olw = $this->LineWidth;
|
4380 |
-
$s.=' ' . (sprintf(' %.3F w', $ut * Mpdf::SCALE));
|
4381 |
-
$s.=' ' . $this->_dounderline($x, $y + $adjusty, $txt, $OTLdata, $textvar);
|
4382 |
-
$s.=' ' . (sprintf(' %.3F w', $olw * Mpdf::SCALE));
|
4383 |
if ($this->FillColor != $c) {
|
4384 |
$s.= ' ' . $this->FillColor . ' ';
|
4385 |
}
|
@@ -4403,9 +4403,9 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
4403 |
$ut = 60 / 1000 * $this->FontSize;
|
4404 |
}
|
4405 |
$olw = $this->LineWidth;
|
4406 |
-
$s.=' ' . (sprintf(' %.3F w', $ut * Mpdf::SCALE));
|
4407 |
-
$s.=' ' . $this->_dounderline($x, $y + $adjusty, $txt, $OTLdata, $textvar);
|
4408 |
-
$s.=' ' . (sprintf(' %.3F w', $olw * Mpdf::SCALE));
|
4409 |
if ($this->FillColor != $c) {
|
4410 |
$s.= ' ' . $this->FillColor . ' ';
|
4411 |
}
|
@@ -4664,11 +4664,15 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
4664 |
return [$charspacing, $ws, $kashida_space];
|
4665 |
}
|
4666 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4667 |
function Cell($w, $h = 0, $txt = '', $border = 0, $ln = 0, $align = '', $fill = 0, $link = '', $currentx = 0, $lcpaddingL = 0, $lcpaddingR = 0, $valign = 'M', $spanfill = 0, $exactWidth = false, $OTLdata = false, $textvar = 0, $lineBox = false)
|
4668 |
{
|
4669 |
-
// mPDF 5.7.1
|
4670 |
-
// Output a cell
|
4671 |
-
// Expects input to be mb_encoded if necessary and RTL reversed
|
4672 |
// NON_BREAKING SPACE
|
4673 |
if ($this->usingCoreFont) {
|
4674 |
$txt = str_replace(chr(160), chr(32), $txt);
|
@@ -4677,6 +4681,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
4677 |
}
|
4678 |
|
4679 |
$oldcolumn = $this->CurrCol;
|
|
|
4680 |
// Automatic page break
|
4681 |
// Allows PAGE-BREAK-AFTER = avoid to work
|
4682 |
if (isset($this->blk[$this->blklvl])) {
|
@@ -4684,15 +4689,29 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
4684 |
} else {
|
4685 |
$bottom = 0;
|
4686 |
}
|
4687 |
-
|
4688 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4689 |
$x = $this->x; // Current X position
|
|
|
4690 |
// WORD SPACING
|
4691 |
$ws = $this->ws; // Word Spacing
|
4692 |
$charspacing = $this->charspacing; // Character Spacing
|
4693 |
$this->ResetSpacing();
|
4694 |
|
4695 |
$this->AddPage($this->CurOrientation);
|
|
|
4696 |
// Added to correct for OddEven Margins
|
4697 |
$x += $this->MarginCorrection;
|
4698 |
if ($currentx) {
|
@@ -4706,7 +4725,6 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
4706 |
// Test: to put line through centre of cell: $this->Line($this->x,$this->y+($h/2),$this->x+50,$this->y+($h/2));
|
4707 |
// Test: to put border around cell as it is specified: $border='LRTB';
|
4708 |
|
4709 |
-
|
4710 |
/* -- COLUMNS -- */
|
4711 |
// COLS
|
4712 |
// COLUMN CHANGE
|
@@ -4731,6 +4749,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
4731 |
if ($w == 0) {
|
4732 |
$w = $this->w - $this->rMargin - $this->x;
|
4733 |
}
|
|
|
4734 |
$s = '';
|
4735 |
if ($fill == 1 && $this->FillColor) {
|
4736 |
if ((isset($this->pageoutput[$this->page]['FillColor']) && $this->pageoutput[$this->page]['FillColor'] != $this->FillColor) || !isset($this->pageoutput[$this->page]['FillColor'])) {
|
@@ -4739,7 +4758,6 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
4739 |
$this->pageoutput[$this->page]['FillColor'] = $this->FillColor;
|
4740 |
}
|
4741 |
|
4742 |
-
|
4743 |
if ($lineBox && isset($lineBox['boxtop']) && $txt) { // i.e. always from WriteFlowingBlock/finishFlowingBlock (but not objects -
|
4744 |
// which only have $lineBox['top'] set)
|
4745 |
$boxtop = $this->y + $lineBox['boxtop'];
|
@@ -4762,12 +4780,16 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
4762 |
$bord_boxbottom = $this->y + $lineBox['border-boxbottom'] - $lineBox['border-baseline-shift'];
|
4763 |
$bord_boxheight = $bord_boxbottom - $bord_boxtop;
|
4764 |
}
|
|
|
4765 |
} else {
|
|
|
4766 |
$boxtop = $this->y;
|
4767 |
$boxheight = $h;
|
4768 |
$boxbottom = $this->y + $h;
|
4769 |
$baseline_shift = 0;
|
|
|
4770 |
if ($txt != '') {
|
|
|
4771 |
// FONT SIZE - this determines the baseline caculation
|
4772 |
$bfs = $this->FontSize;
|
4773 |
// Calculate baseline Superscript and Subscript Y coordinate adjustment
|
@@ -4776,11 +4798,9 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
4776 |
|
4777 |
if ($textvar & TextVars::FA_SUPERSCRIPT) {
|
4778 |
$baseline_shift = $this->textparam['text-baseline'];
|
4779 |
-
}
|
4780 |
-
elseif ($textvar & TextVars::FA_SUBSCRIPT) {
|
4781 |
$baseline_shift = $this->textparam['text-baseline'];
|
4782 |
-
}
|
4783 |
-
elseif ($this->bullet) {
|
4784 |
$baseline += ($bfx - 0.7) * $this->FontSize;
|
4785 |
}
|
4786 |
|
@@ -4792,6 +4812,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
4792 |
} else {
|
4793 |
$va = 0.5 * $h;
|
4794 |
} // Middle
|
|
|
4795 |
// ONLY SET THESE IF WANT TO CONFINE BORDER +/- FILL TO FIT FONTSIZE - NOT FULL CELL AS IS ORIGINAL FUNCTION
|
4796 |
// spanfill or spanborder are set in FlowingBlock functions
|
4797 |
if ($spanfill || !empty($this->spanborddet) || $link != '') {
|
@@ -4800,8 +4821,10 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
4800 |
$boxheight = $this->FontSize * (1 + $exth);
|
4801 |
$boxbottom = $boxtop + $boxheight;
|
4802 |
}
|
|
|
4803 |
$glyphYorigin = $baseline + $va;
|
4804 |
}
|
|
|
4805 |
$boxtop -= $baseline_shift;
|
4806 |
$boxbottom -= $baseline_shift;
|
4807 |
$bord_boxtop = $bg_boxtop = $boxtop;
|
@@ -4809,45 +4832,56 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
4809 |
$bord_boxheight = $bg_boxheight = $boxheight = $boxbottom - $boxtop;
|
4810 |
}
|
4811 |
|
4812 |
-
|
4813 |
$bbw = $tbw = $lbw = $rbw = 0; // Border widths
|
4814 |
if (!empty($this->spanborddet)) {
|
|
|
4815 |
if (!isset($this->spanborddet['B'])) {
|
4816 |
$this->spanborddet['B'] = ['s' => 0, 'style' => '', 'w' => 0];
|
4817 |
}
|
|
|
4818 |
if (!isset($this->spanborddet['T'])) {
|
4819 |
$this->spanborddet['T'] = ['s' => 0, 'style' => '', 'w' => 0];
|
4820 |
}
|
|
|
4821 |
if (!isset($this->spanborddet['L'])) {
|
4822 |
$this->spanborddet['L'] = ['s' => 0, 'style' => '', 'w' => 0];
|
4823 |
}
|
|
|
4824 |
if (!isset($this->spanborddet['R'])) {
|
4825 |
$this->spanborddet['R'] = ['s' => 0, 'style' => '', 'w' => 0];
|
4826 |
}
|
|
|
4827 |
$bbw = $this->spanborddet['B']['w'];
|
4828 |
$tbw = $this->spanborddet['T']['w'];
|
4829 |
$lbw = $this->spanborddet['L']['w'];
|
4830 |
$rbw = $this->spanborddet['R']['w'];
|
4831 |
}
|
|
|
4832 |
if ($fill == 1 || $border == 1 || !empty($this->spanborddet)) {
|
|
|
4833 |
if (!empty($this->spanborddet)) {
|
|
|
4834 |
if ($fill == 1) {
|
4835 |
-
$s.=sprintf('%.3F %.3F %.3F %.3F re f ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bg_boxtop + $tbw) * Mpdf::SCALE, ($w + $lbw + $rbw) * Mpdf::SCALE, (-$bg_boxheight - $tbw - $bbw) * Mpdf::SCALE);
|
4836 |
}
|
|
|
4837 |
$s.= ' q ';
|
4838 |
$dashon = 3;
|
4839 |
$dashoff = 3.5;
|
4840 |
$dot = 2.5;
|
|
|
4841 |
if ($tbw) {
|
4842 |
$short = 0;
|
|
|
4843 |
if ($this->spanborddet['T']['style'] == 'dashed') {
|
4844 |
-
$s.=sprintf(' 0 j 0 J [%.3F %.3F] 0 d ', $tbw * $dashon * Mpdf::SCALE, $tbw * $dashoff * Mpdf::SCALE);
|
4845 |
} elseif ($this->spanborddet['T']['style'] == 'dotted') {
|
4846 |
-
$s.=sprintf(' 1 j 1 J [%.3F %.3F] %.3F d ', 0.001, $tbw * $dot * Mpdf::SCALE, -$tbw / 2 * Mpdf::SCALE);
|
4847 |
$short = $tbw / 2;
|
4848 |
} else {
|
4849 |
-
$s.=' 0 j 0 J [] 0 d ';
|
4850 |
}
|
|
|
4851 |
if ($this->spanborddet['T']['style'] != 'dotted') {
|
4852 |
$s .= 'q ';
|
4853 |
$s .= sprintf('%.3F %.3F m ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE);
|
@@ -4856,32 +4890,37 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
4856 |
$s .= sprintf('%.3F %.3F l ', ($this->x) * Mpdf::SCALE, ($this->h - $bord_boxtop) * Mpdf::SCALE);
|
4857 |
$s .= ' h W n '; // Ends path no-op & Sets the clipping path
|
4858 |
}
|
|
|
4859 |
$c = $this->SetDColor($this->spanborddet['T']['c'], true);
|
|
|
4860 |
if ($this->spanborddet['T']['style'] == 'double') {
|
4861 |
-
$s.=sprintf(' %s %.3F w ', $c, $tbw / 3 * Mpdf::SCALE);
|
4862 |
-
$s.=sprintf('%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw * 5 / 6) * Mpdf::SCALE, ($this->x + $w + $rbw) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw * 5 / 6) * Mpdf::SCALE);
|
4863 |
-
$s.=sprintf('%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw / 6) * Mpdf::SCALE, ($this->x + $w + $rbw) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw / 6) * Mpdf::SCALE);
|
4864 |
} elseif ($this->spanborddet['T']['style'] == 'dotted') {
|
4865 |
-
$s.=sprintf(' %s %.3F w ', $c, $tbw * Mpdf::SCALE);
|
4866 |
-
$s.=sprintf('%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw / 2) * Mpdf::SCALE, ($this->x + $w + $rbw - $short) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw / 2) * Mpdf::SCALE);
|
4867 |
} else {
|
4868 |
-
$s.=sprintf(' %s %.3F w ', $c, $tbw * Mpdf::SCALE);
|
4869 |
-
$s.=sprintf('%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw / 2) * Mpdf::SCALE, ($this->x + $w + $rbw - $short) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw / 2) * Mpdf::SCALE);
|
4870 |
}
|
|
|
4871 |
if ($this->spanborddet['T']['style'] != 'dotted') {
|
4872 |
$s .= ' Q ';
|
4873 |
}
|
4874 |
}
|
4875 |
if ($bbw) {
|
|
|
4876 |
$short = 0;
|
4877 |
if ($this->spanborddet['B']['style'] == 'dashed') {
|
4878 |
-
$s.=sprintf(' 0 j 0 J [%.3F %.3F] 0 d ', $bbw * $dashon * Mpdf::SCALE, $bbw * $dashoff * Mpdf::SCALE);
|
4879 |
} elseif ($this->spanborddet['B']['style'] == 'dotted') {
|
4880 |
-
$s.=sprintf(' 1 j 1 J [%.3F %.3F] %.3F d ', 0.001, $bbw * $dot * Mpdf::SCALE, -$bbw / 2 * Mpdf::SCALE);
|
4881 |
$short = $bbw / 2;
|
4882 |
} else {
|
4883 |
-
$s.=' 0 j 0 J [] 0 d ';
|
4884 |
}
|
|
|
4885 |
if ($this->spanborddet['B']['style'] != 'dotted') {
|
4886 |
$s .= 'q ';
|
4887 |
$s .= sprintf('%.3F %.3F m ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw) * Mpdf::SCALE);
|
@@ -4890,32 +4929,37 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
4890 |
$s .= sprintf('%.3F %.3F l ', ($this->x) * Mpdf::SCALE, ($this->h - $bord_boxbottom) * Mpdf::SCALE);
|
4891 |
$s .= ' h W n '; // Ends path no-op & Sets the clipping path
|
4892 |
}
|
|
|
4893 |
$c = $this->SetDColor($this->spanborddet['B']['c'], true);
|
|
|
4894 |
if ($this->spanborddet['B']['style'] == 'double') {
|
4895 |
-
$s.=sprintf(' %s %.3F w ', $c, $bbw / 3 * Mpdf::SCALE);
|
4896 |
-
$s.=sprintf('%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw / 6) * Mpdf::SCALE, ($this->x + $w + $rbw - $short) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw / 6) * Mpdf::SCALE);
|
4897 |
-
$s.=sprintf('%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw * 5 / 6) * Mpdf::SCALE, ($this->x + $w + $rbw - $short) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw * 5 / 6) * Mpdf::SCALE);
|
4898 |
} elseif ($this->spanborddet['B']['style'] == 'dotted') {
|
4899 |
-
$s.=sprintf(' %s %.3F w ', $c, $bbw * Mpdf::SCALE);
|
4900 |
-
$s.=sprintf('%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw / 2) * Mpdf::SCALE, ($this->x + $w + $rbw - $short) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw / 2) * Mpdf::SCALE);
|
4901 |
} else {
|
4902 |
-
$s.=sprintf(' %s %.3F w ', $c, $bbw * Mpdf::SCALE);
|
4903 |
-
$s.=sprintf('%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw / 2) * Mpdf::SCALE, ($this->x + $w + $rbw - $short) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw / 2) * Mpdf::SCALE);
|
4904 |
}
|
|
|
4905 |
if ($this->spanborddet['B']['style'] != 'dotted') {
|
4906 |
$s .= ' Q ';
|
4907 |
}
|
4908 |
}
|
|
|
4909 |
if ($lbw) {
|
4910 |
$short = 0;
|
4911 |
if ($this->spanborddet['L']['style'] == 'dashed') {
|
4912 |
-
$s.=sprintf(' 0 j 0 J [%.3F %.3F] 0 d ', $lbw * $dashon * Mpdf::SCALE, $lbw * $dashoff * Mpdf::SCALE);
|
4913 |
} elseif ($this->spanborddet['L']['style'] == 'dotted') {
|
4914 |
-
$s.=sprintf(' 1 j 1 J [%.3F %.3F] %.3F d ', 0.001, $lbw * $dot * Mpdf::SCALE, -$lbw / 2 * Mpdf::SCALE);
|
4915 |
$short = $lbw / 2;
|
4916 |
} else {
|
4917 |
-
$s.=' 0 j 0 J [] 0 d ';
|
4918 |
}
|
|
|
4919 |
if ($this->spanborddet['L']['style'] != 'dotted') {
|
4920 |
$s .= 'q ';
|
4921 |
$s .= sprintf('%.3F %.3F m ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw) * Mpdf::SCALE);
|
@@ -4924,32 +4968,37 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
4924 |
$s .= sprintf('%.3F %.3F l ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE);
|
4925 |
$s .= ' h W n '; // Ends path no-op & Sets the clipping path
|
4926 |
}
|
|
|
4927 |
$c = $this->SetDColor($this->spanborddet['L']['c'], true);
|
4928 |
if ($this->spanborddet['L']['style'] == 'double') {
|
4929 |
-
$s.=sprintf(' %s %.3F w ', $c, $lbw / 3 * Mpdf::SCALE);
|
4930 |
-
$s.=sprintf('%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw / 6) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE, ($this->x - $lbw / 6) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw + $short) * Mpdf::SCALE);
|
4931 |
-
$s.=sprintf('%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw * 5 / 6) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE, ($this->x - $lbw * 5 / 6) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw + $short) * Mpdf::SCALE);
|
4932 |
} elseif ($this->spanborddet['L']['style'] == 'dotted') {
|
4933 |
-
$s.=sprintf(' %s %.3F w ', $c, $lbw * Mpdf::SCALE);
|
4934 |
-
$s.=sprintf('%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw / 2) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE, ($this->x - $lbw / 2) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw + $short) * Mpdf::SCALE);
|
4935 |
} else {
|
4936 |
-
$s.=sprintf(' %s %.3F w ', $c, $lbw * Mpdf::SCALE);
|
4937 |
-
$s.=sprintf('%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw / 2) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE, ($this->x - $lbw / 2) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw + $short) * Mpdf::SCALE);
|
4938 |
}
|
|
|
4939 |
if ($this->spanborddet['L']['style'] != 'dotted') {
|
4940 |
$s .= ' Q ';
|
4941 |
}
|
4942 |
}
|
|
|
4943 |
if ($rbw) {
|
|
|
4944 |
$short = 0;
|
4945 |
if ($this->spanborddet['R']['style'] == 'dashed') {
|
4946 |
-
$s.=sprintf(' 0 j 0 J [%.3F %.3F] 0 d ', $rbw * $dashon * Mpdf::SCALE, $rbw * $dashoff * Mpdf::SCALE);
|
4947 |
} elseif ($this->spanborddet['R']['style'] == 'dotted') {
|
4948 |
-
$s.=sprintf(' 1 j 1 J [%.3F %.3F] %.3F d ', 0.001, $rbw * $dot * Mpdf::SCALE, -$rbw / 2 * Mpdf::SCALE);
|
4949 |
$short = $rbw / 2;
|
4950 |
} else {
|
4951 |
-
$s.=' 0 j 0 J [] 0 d ';
|
4952 |
}
|
|
|
4953 |
if ($this->spanborddet['R']['style'] != 'dotted') {
|
4954 |
$s .= 'q ';
|
4955 |
$s .= sprintf('%.3F %.3F m ', ($this->x + $w + $rbw) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw) * Mpdf::SCALE);
|
@@ -4958,51 +5007,63 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
4958 |
$s .= sprintf('%.3F %.3F l ', ($this->x + $w + $rbw) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE);
|
4959 |
$s .= ' h W n '; // Ends path no-op & Sets the clipping path
|
4960 |
}
|
|
|
4961 |
$c = $this->SetDColor($this->spanborddet['R']['c'], true);
|
4962 |
if ($this->spanborddet['R']['style'] == 'double') {
|
4963 |
-
$s.=sprintf(' %s %.3F w ', $c, $rbw / 3 * Mpdf::SCALE);
|
4964 |
-
$s.=sprintf('%.3F %.3F m %.3F %.3F l S ', ($this->x + $w + $rbw / 6) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE, ($this->x + $w + $rbw / 6) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw + $short) * Mpdf::SCALE);
|
4965 |
-
$s.=sprintf('%.3F %.3F m %.3F %.3F l S ', ($this->x + $w + $rbw * 5 / 6) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE, ($this->x + $w + $rbw * 5 / 6) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw + $short) * Mpdf::SCALE);
|
4966 |
} elseif ($this->spanborddet['R']['style'] == 'dotted') {
|
4967 |
-
$s.=sprintf(' %s %.3F w ', $c, $rbw * Mpdf::SCALE);
|
4968 |
-
$s.=sprintf('%.3F %.3F m %.3F %.3F l S ', ($this->x + $w + $rbw / 2) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE, ($this->x + $w + $rbw / 2) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw + $short) * Mpdf::SCALE);
|
4969 |
} else {
|
4970 |
-
$s.=sprintf(' %s %.3F w ', $c, $rbw * Mpdf::SCALE);
|
4971 |
-
$s.=sprintf('%.3F %.3F m %.3F %.3F l S ', ($this->x + $w + $rbw / 2) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE, ($this->x + $w + $rbw / 2) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw + $short) * Mpdf::SCALE);
|
4972 |
}
|
|
|
4973 |
if ($this->spanborddet['R']['style'] != 'dotted') {
|
4974 |
$s .= ' Q ';
|
4975 |
}
|
4976 |
}
|
|
|
4977 |
$s.= ' Q ';
|
|
|
4978 |
} else { // If "border", does not come from WriteFlowingBlock or FinishFlowingBlock
|
|
|
4979 |
if ($fill == 1) {
|
4980 |
$op = ($border == 1) ? 'B' : 'f';
|
4981 |
} else {
|
4982 |
$op = 'S';
|
4983 |
}
|
4984 |
-
|
|
|
4985 |
}
|
4986 |
}
|
4987 |
|
4988 |
if (is_string($border)) { // If "border", does not come from WriteFlowingBlock or FinishFlowingBlock
|
|
|
4989 |
$x = $this->x;
|
4990 |
$y = $this->y;
|
|
|
4991 |
if (is_int(strpos($border, 'L'))) {
|
4992 |
-
$s.=sprintf('%.3F %.3F m %.3F %.3F l S ', $x * Mpdf::SCALE, ($this->h - $bord_boxtop) * Mpdf::SCALE, $x * Mpdf::SCALE, ($this->h - ($bord_boxbottom)) * Mpdf::SCALE);
|
4993 |
}
|
|
|
4994 |
if (is_int(strpos($border, 'T'))) {
|
4995 |
-
$s.=sprintf('%.3F %.3F m %.3F %.3F l S ', $x * Mpdf::SCALE, ($this->h - $bord_boxtop) * Mpdf::SCALE, ($x + $w) * Mpdf::SCALE, ($this->h - $bord_boxtop) * Mpdf::SCALE);
|
4996 |
}
|
|
|
4997 |
if (is_int(strpos($border, 'R'))) {
|
4998 |
-
$s.=sprintf('%.3F %.3F m %.3F %.3F l S ', ($x + $w) * Mpdf::SCALE, ($this->h - $bord_boxtop) * Mpdf::SCALE, ($x + $w) * Mpdf::SCALE, ($this->h - ($bord_boxbottom)) * Mpdf::SCALE);
|
4999 |
}
|
|
|
5000 |
if (is_int(strpos($border, 'B'))) {
|
5001 |
-
$s.=sprintf('%.3F %.3F m %.3F %.3F l S ', $x * Mpdf::SCALE, ($this->h - ($bord_boxbottom)) * Mpdf::SCALE, ($x + $w) * Mpdf::SCALE, ($this->h - ($bord_boxbottom)) * Mpdf::SCALE);
|
5002 |
}
|
5003 |
}
|
5004 |
|
5005 |
if ($txt != '') {
|
|
|
5006 |
if ($exactWidth) {
|
5007 |
$stringWidth = $w;
|
5008 |
} else {
|
@@ -5668,14 +5729,14 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
5668 |
$tj .= $this->_escape($tc);
|
5669 |
}
|
5670 |
$tj .= ')';
|
5671 |
-
$s.=sprintf(' %.3F Tc [%s] TJ', $this->charspacing, $tj);
|
5672 |
|
5673 |
|
5674 |
if (($i + 1) < count($t)) {
|
5675 |
-
$s.=sprintf(' %.3F Tc (%s) Tj', $this->ws + $this->charspacing, $space);
|
5676 |
}
|
5677 |
}
|
5678 |
-
$s.=' ET ';
|
5679 |
} elseif (!$this->usingCoreFont) {
|
5680 |
$s = '';
|
5681 |
$tj = '(';
|
@@ -5690,7 +5751,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
5690 |
$tj .= $this->_escape($tx);
|
5691 |
}
|
5692 |
$tj .= ')';
|
5693 |
-
$s.=sprintf(' BT ' . $aix . ' [%s] TJ ET ', $x * Mpdf::SCALE, ($this->h - $y) * Mpdf::SCALE, $tj);
|
5694 |
} else { // CORE Font
|
5695 |
$s = '';
|
5696 |
$tj = '(';
|
@@ -5703,7 +5764,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
5703 |
$tj .= $this->_escape($txt[$i]);
|
5704 |
}
|
5705 |
$tj .= ')';
|
5706 |
-
$s.=sprintf(' BT ' . $aix . ' [%s] TJ ET ', $x * Mpdf::SCALE, ($this->h - $y) * Mpdf::SCALE, $tj);
|
5707 |
}
|
5708 |
|
5709 |
return $s;
|
@@ -5773,10 +5834,10 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
5773 |
} else {
|
5774 |
$b2 = '';
|
5775 |
if (is_int(strpos($border, 'L'))) {
|
5776 |
-
$b2.='L';
|
5777 |
}
|
5778 |
if (is_int(strpos($border, 'R'))) {
|
5779 |
-
$b2.='R';
|
5780 |
}
|
5781 |
$b = is_int(strpos($border, 'T')) ? $b2 . 'T' : $b2;
|
5782 |
}
|
@@ -5988,7 +6049,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
5988 |
}
|
5989 |
// Last chunk
|
5990 |
if ($border and is_int(strpos($border, 'B'))) {
|
5991 |
-
$b.='B';
|
5992 |
}
|
5993 |
if (!$this->usingCoreFont) {
|
5994 |
$tmp = rtrim(mb_substr($s, $j, $i - $j, $this->mb_enc));
|
@@ -9843,7 +9904,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
9843 |
$this->_out('<</Type /Pages');
|
9844 |
$kids = '/Kids [';
|
9845 |
for ($i = 0; $i < $nb; $i++) {
|
9846 |
-
$kids.=(3 + 2 * $i) . ' 0 R ';
|
9847 |
}
|
9848 |
$this->_out($kids . ']');
|
9849 |
$this->_out('/Count ' . $nb);
|
@@ -10187,15 +10248,18 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
10187 |
$this->kwt_Annots[$this->page][] = $an;
|
10188 |
return;
|
10189 |
}
|
|
|
10190 |
if ($this->writingHTMLheader || $this->writingHTMLfooter) {
|
10191 |
$this->HTMLheaderPageAnnots[] = $an;
|
10192 |
return;
|
10193 |
}
|
|
|
10194 |
// Put an Annotation on the page
|
10195 |
$this->PageAnnots[$page][] = $an;
|
|
|
10196 |
/* -- COLUMNS -- */
|
10197 |
// Save cross-reference to Column buffer
|
10198 |
-
$ref = count($this->PageAnnots[$this->page]) - 1;
|
10199 |
$this->columnAnnots[$this->CurrCol][intval($this->x)][intval($this->y)] = $ref;
|
10200 |
/* -- END COLUMNS -- */
|
10201 |
}
|
@@ -10388,9 +10452,9 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
10388 |
$v = $v | 4;
|
10389 |
$v = $v & ~32;
|
10390 |
} // SYMBOLIC font flag
|
10391 |
-
$s.=' /' . $kd . ' ' . $v . "\n";
|
10392 |
}
|
10393 |
-
$s.='/FontFile2 ' . ($this->n + 2) . ' 0 R';
|
10394 |
$this->_out($s . '>>');
|
10395 |
$this->_out('endobj');
|
10396 |
|
@@ -10898,7 +10962,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
10898 |
if (isset($info['trns']) and is_array($info['trns'])) {
|
10899 |
$trns = '';
|
10900 |
for ($i = 0; $i < count($info['trns']); $i++) {
|
10901 |
-
$trns
|
10902 |
}
|
10903 |
$this->_out('/Mask [' . $trns . ']');
|
10904 |
}
|
@@ -20482,7 +20546,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
20482 |
$style = '';
|
20483 |
foreach (['B', 'I'] as $s) {
|
20484 |
if ($this->$s) {
|
20485 |
-
$style
|
20486 |
}
|
20487 |
}
|
20488 |
$this->currentfontstyle = $style;
|
@@ -20497,12 +20561,12 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
20497 |
if (isset($arr[$s])) {
|
20498 |
if ($arr[$s]) {
|
20499 |
$this->$s = true;
|
20500 |
-
$style
|
20501 |
} else {
|
20502 |
$this->$s = false;
|
20503 |
}
|
20504 |
} elseif ($this->$s) {
|
20505 |
-
$style
|
20506 |
}
|
20507 |
}
|
20508 |
$this->currentfontstyle = $style;
|
@@ -20516,7 +20580,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
20516 |
foreach (['B', 'I'] as $s) {
|
20517 |
if (strpos($str, $s) !== false) {
|
20518 |
$this->$s = true;
|
20519 |
-
$style
|
20520 |
} else {
|
20521 |
$this->$s = false;
|
20522 |
}
|
@@ -22207,7 +22271,11 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
22207 |
$h = $heightrow[$i];
|
22208 |
if (isset($cell['rowspan'])) {
|
22209 |
for ($k = $i + $cell['rowspan'] - 1; $k > $i; $k--) {
|
22210 |
-
$
|
|
|
|
|
|
|
|
|
22211 |
}
|
22212 |
}
|
22213 |
$cell['y0'] = $y;
|
@@ -27022,15 +27090,19 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27022 |
$this->links[$v['link']][1] = $this->y0;
|
27023 |
}
|
27024 |
/* -- END TOC -- */
|
|
|
27025 |
$trans_on = false;
|
27026 |
foreach ($this->columnbuffer as $key => $s) {
|
|
|
27027 |
if (isset($s['rel_y'])) { // only process position sensitive data
|
|
|
27028 |
// Set ratio to expand y values or heights
|
27029 |
-
if ($this->ColDetails[$s['col']]['max_bottom']) {
|
27030 |
$ratio = ($lowest_bottom_y - ($this->y0)) / ($this->ColDetails[$s['col']]['max_bottom'] - ($this->y0));
|
27031 |
} else {
|
27032 |
$ratio = 1;
|
27033 |
}
|
|
|
27034 |
if (($ratio > 1) && ($ratio <= $this->max_colH_correction)) {
|
27035 |
// Start Transformation
|
27036 |
$this->pages[$this->page] .= $this->StartTransform(true) . "\n";
|
@@ -27038,6 +27110,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27038 |
$trans_on = true;
|
27039 |
}
|
27040 |
}
|
|
|
27041 |
// Now output the adjusted values
|
27042 |
$this->pages[$this->page] .= $s['s'] . "\n";
|
27043 |
if (isset($s['rel_y']) && ($ratio > 1) && ($ratio <= $this->max_colH_correction)) {
|
@@ -27046,6 +27119,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27046 |
$trans_on = false;
|
27047 |
}
|
27048 |
}
|
|
|
27049 |
if ($trans_on) {
|
27050 |
$this->pages[$this->page] .= $this->StopTransform(true) . "\n";
|
27051 |
}
|
@@ -27053,44 +27127,57 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27053 |
if ($lowest_bottom_y > 0) {
|
27054 |
$this->y = $lowest_bottom_y;
|
27055 |
}
|
27056 |
-
|
27057 |
-
else {
|
|
|
27058 |
// If page has not ended but height adjustment was disabled by custom column-break - adjust y
|
27059 |
$lowest_bottom_y = 0;
|
|
|
27060 |
if (!$this->ColActive && (!$this->ColumnAdjust || $this->keepColumns)) {
|
|
|
27061 |
// calculate the lowest bottom margin
|
27062 |
foreach ($this->columnbuffer as $key => $s) {
|
|
|
27063 |
// Only process output data
|
27064 |
$t = $s['s'];
|
27065 |
-
if ($t
|
27066 |
-
|
27067 |
-
|
27068 |
-
|
27069 |
-
|
|
|
|
|
|
|
27070 |
$clb = $s['y'] + $s['h'];
|
27071 |
-
|
|
|
27072 |
$this->ColDetails[$s['col']]['max_bottom'] = $clb;
|
27073 |
}
|
|
|
27074 |
if ($clb > $lowest_bottom_y) {
|
27075 |
$lowest_bottom_y = $clb;
|
27076 |
}
|
27077 |
}
|
27078 |
}
|
27079 |
}
|
|
|
27080 |
foreach ($this->columnbuffer as $key => $s) {
|
27081 |
if ($s['s'] != 'ACROFORM') {
|
27082 |
$this->pages[$this->page] .= $s['s'] . "\n";
|
27083 |
}
|
27084 |
}
|
|
|
27085 |
if ($lowest_bottom_y > 0) {
|
27086 |
$this->y = $lowest_bottom_y;
|
27087 |
}
|
|
|
27088 |
/* -- BOOKMARKS -- */
|
27089 |
// Output Bookmarks
|
27090 |
foreach ($this->col_BMoutlines as $v) {
|
27091 |
$this->BMoutlines[] = ['t' => $v['t'], 'l' => $v['l'], 'y' => $v['y'], 'p' => $v['p']];
|
27092 |
}
|
27093 |
/* -- END BOOKMARKS -- */
|
|
|
27094 |
/* -- TOC -- */
|
27095 |
// Output ToC
|
27096 |
foreach ($this->col_toc as $v) {
|
@@ -27098,10 +27185,13 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27098 |
}
|
27099 |
/* -- END TOC -- */
|
27100 |
}
|
|
|
27101 |
foreach ($this->internallink as $key => $f) {
|
|
|
27102 |
if (isset($this->internallink[$key]['col'])) {
|
27103 |
unset($this->internallink[$key]['col']);
|
27104 |
}
|
|
|
27105 |
if (isset($this->internallink[$key]['rel_y'])) {
|
27106 |
unset($this->internallink[$key]['rel_y']);
|
27107 |
}
|
@@ -27122,24 +27212,29 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27122 |
function columnAdjustPregReplace($type, $xadj, $yadj, $pattern, $subject)
|
27123 |
{
|
27124 |
preg_match($pattern, $subject, $matches);
|
|
|
27125 |
if (!count($matches)) {
|
27126 |
return $subject;
|
27127 |
}
|
|
|
27128 |
if (!isset($matches[3])) {
|
27129 |
$matches[3] = 0;
|
27130 |
}
|
|
|
27131 |
if (!isset($matches[4])) {
|
27132 |
$matches[4] = 0;
|
27133 |
}
|
|
|
27134 |
if (!isset($matches[5])) {
|
27135 |
$matches[5] = 0;
|
27136 |
}
|
|
|
27137 |
if (!isset($matches[6])) {
|
27138 |
$matches[6] = 0;
|
27139 |
}
|
|
|
27140 |
return str_replace($matches[0], $this->columnAdjustAdd($type, Mpdf::SCALE, $xadj, $yadj, $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]), $subject);
|
27141 |
}
|
27142 |
-
|
27143 |
/* -- END COLUMNS -- */
|
27144 |
|
27145 |
// ==================================================================
|
@@ -27147,17 +27242,23 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27147 |
function printcellbuffer()
|
27148 |
{
|
27149 |
if (count($this->cellBorderBuffer)) {
|
|
|
27150 |
sort($this->cellBorderBuffer);
|
|
|
27151 |
foreach ($this->cellBorderBuffer as $cbb) {
|
|
|
27152 |
$cba = unpack("A16dom/nbord/A1side/ns/dbw/a6ca/A10style/dx/dy/dw/dh/dmbl/dmbr/dmrt/dmrb/dmtl/dmtr/dmlt/dmlb/dcpd/dover/", $cbb);
|
27153 |
$side = $cba['side'];
|
27154 |
$color = str_pad($cba['ca'], 6, "\x00");
|
|
|
27155 |
$details = [];
|
|
|
27156 |
$details[$side]['dom'] = (float) $cba['dom'];
|
27157 |
$details[$side]['s'] = $cba['s'];
|
27158 |
$details[$side]['w'] = $cba['bw'];
|
27159 |
$details[$side]['c'] = $color;
|
27160 |
$details[$side]['style'] = trim($cba['style']);
|
|
|
27161 |
$details['mbw']['BL'] = $cba['mbl'];
|
27162 |
$details['mbw']['BR'] = $cba['mbr'];
|
27163 |
$details['mbw']['RT'] = $cba['mrt'];
|
@@ -27166,15 +27267,20 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27166 |
$details['mbw']['TR'] = $cba['mtr'];
|
27167 |
$details['mbw']['LT'] = $cba['mlt'];
|
27168 |
$details['mbw']['LB'] = $cba['mlb'];
|
|
|
27169 |
$details['cellposdom'] = $cba['cpd'];
|
|
|
27170 |
$details['p'] = $side;
|
|
|
27171 |
if ($cba['over'] == 1) {
|
27172 |
$details[$side]['overlay'] = true;
|
27173 |
} else {
|
27174 |
$details[$side]['overlay'] = false;
|
27175 |
}
|
|
|
27176 |
$this->_tableRect($cba['x'], $cba['y'], $cba['w'], $cba['h'], $cba['bord'], $details, false, false);
|
27177 |
}
|
|
|
27178 |
$this->cellBorderBuffer = [];
|
27179 |
}
|
27180 |
}
|
@@ -27184,13 +27290,16 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27184 |
{
|
27185 |
|
27186 |
if (!$this->table_rotate) {
|
|
|
27187 |
$this->pages[$this->page] .= $this->tablebuffer;
|
|
|
27188 |
foreach ($this->tbrot_Links as $p => $l) {
|
27189 |
foreach ($l as $v) {
|
27190 |
$this->PageLinks[$p][] = $v;
|
27191 |
}
|
27192 |
}
|
27193 |
$this->tbrot_Links = [];
|
|
|
27194 |
/* -- ANNOTATIONS -- */
|
27195 |
foreach ($this->tbrot_Annots as $p => $l) {
|
27196 |
foreach ($l as $v) {
|
@@ -27218,13 +27327,16 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27218 |
|
27219 |
return;
|
27220 |
}
|
|
|
27221 |
// elseif rotated
|
27222 |
$lm = $this->lMargin + $this->blk[$this->blklvl]['outer_left_margin'] + $this->blk[$this->blklvl]['border_left']['w'] + $this->blk[$this->blklvl]['padding_left'];
|
27223 |
$pw = $this->blk[$this->blklvl]['inner_width'];
|
|
|
27224 |
// Start Transformation
|
27225 |
$this->pages[$this->page] .= $this->StartTransform(true) . "\n";
|
27226 |
|
27227 |
if ($this->table_rotate > 1) { // clockwise
|
|
|
27228 |
if ($this->tbrot_align == 'L') {
|
27229 |
$xadj = $this->tbrot_h; // align L (as is)
|
27230 |
} elseif ($this->tbrot_align == 'R') {
|
@@ -27232,8 +27344,11 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27232 |
} else {
|
27233 |
$xadj = $lm - $this->tbrot_x0 + (($pw + $this->tbrot_h) / 2); // align C
|
27234 |
}
|
|
|
27235 |
$yadj = 0;
|
|
|
27236 |
} else { // anti-clockwise
|
|
|
27237 |
if ($this->tbrot_align == 'L') {
|
27238 |
$xadj = 0; // align L (as is)
|
27239 |
} elseif ($this->tbrot_align == 'R') {
|
@@ -27241,6 +27356,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27241 |
} else {
|
27242 |
$xadj = $lm - $this->tbrot_x0 + (($pw - $this->tbrot_h) / 2); // align C
|
27243 |
}
|
|
|
27244 |
$yadj = $this->tbrot_w;
|
27245 |
}
|
27246 |
|
@@ -27251,13 +27367,15 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27251 |
// Now output the adjusted values
|
27252 |
$this->pages[$this->page] .= $this->tablebuffer;
|
27253 |
|
27254 |
-
|
27255 |
foreach ($this->tbrot_Links as $p => $l) {
|
|
|
27256 |
foreach ($l as $v) {
|
|
|
27257 |
$w = $v[2] / Mpdf::SCALE;
|
27258 |
$h = $v[3] / Mpdf::SCALE;
|
27259 |
$ax = ($v[0] / Mpdf::SCALE) - $this->tbrot_x0;
|
27260 |
$ay = (($this->hPt - $v[1]) / Mpdf::SCALE) - $this->tbrot_y0;
|
|
|
27261 |
if ($this->table_rotate > 1) { // clockwise
|
27262 |
$bx = $this->tbrot_x0 + $xadj - $ay - $h;
|
27263 |
$by = $this->tbrot_y0 + $yadj + $ax;
|
@@ -27265,13 +27383,16 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27265 |
$bx = $this->tbrot_x0 + $xadj + $ay;
|
27266 |
$by = $this->tbrot_y0 + $yadj - $ax - $w;
|
27267 |
}
|
|
|
27268 |
$v[0] = $bx * Mpdf::SCALE;
|
27269 |
$v[1] = ($this->h - $by) * Mpdf::SCALE;
|
27270 |
$v[2] = $h * Mpdf::SCALE; // swap width and height
|
27271 |
$v[3] = $w * Mpdf::SCALE;
|
|
|
27272 |
$this->PageLinks[$p][] = $v;
|
27273 |
}
|
27274 |
}
|
|
|
27275 |
$this->tbrot_Links = [];
|
27276 |
foreach ($this->internallink as $key => $f) {
|
27277 |
if (is_array($f) && isset($f['tbrot'])) {
|
@@ -27281,11 +27402,13 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27281 |
$this->internallink[$key] = $f;
|
27282 |
}
|
27283 |
}
|
|
|
27284 |
/* -- ANNOTATIONS -- */
|
27285 |
foreach ($this->tbrot_Annots as $p => $l) {
|
27286 |
foreach ($l as $v) {
|
27287 |
$ax = abs($v['x']) - $this->tbrot_x0; // abs because -ve values are internally set and held for reference if annotMargin set
|
27288 |
$ay = $v['y'] - $this->tbrot_y0;
|
|
|
27289 |
if ($this->table_rotate > 1) { // clockwise
|
27290 |
$bx = $this->tbrot_x0 + $xadj - $ay;
|
27291 |
$by = $this->tbrot_y0 + $yadj + $ax;
|
@@ -27293,21 +27416,22 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27293 |
$bx = $this->tbrot_x0 + $xadj + $ay;
|
27294 |
$by = $this->tbrot_y0 + $yadj - $ax;
|
27295 |
}
|
|
|
27296 |
if ($v['x'] < 0) {
|
27297 |
$v['x'] = -$bx;
|
27298 |
} else {
|
27299 |
$v['x'] = $bx;
|
27300 |
}
|
|
|
27301 |
$v['y'] = ($by);
|
27302 |
$this->PageAnnots[$p][] = $v;
|
27303 |
}
|
27304 |
}
|
|
|
27305 |
$this->tbrot_Annots = [];
|
27306 |
/* -- END ANNOTATIONS -- */
|
27307 |
|
27308 |
-
|
27309 |
/* -- BOOKMARKS -- */
|
27310 |
-
|
27311 |
// Adjust Bookmarks
|
27312 |
foreach ($this->tbrot_BMoutlines as $v) {
|
27313 |
$v['y'] = $this->tbrot_y0;
|
@@ -27316,7 +27440,6 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27316 |
/* -- END BOOKMARKS -- */
|
27317 |
|
27318 |
/* -- TOC -- */
|
27319 |
-
|
27320 |
// Adjust ToC - uses document page number
|
27321 |
foreach ($this->tbrot_toc as $v) {
|
27322 |
$this->tableOfContents->_toc[] = ['t' => $v['t'], 'l' => $v['l'], 'p' => $this->page, 'link' => $v['link'], 'toc_id' => $v['toc_id']];
|
@@ -27324,35 +27447,37 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27324 |
}
|
27325 |
/* -- END TOC -- */
|
27326 |
|
27327 |
-
|
27328 |
-
|
27329 |
$this->tbrot_BMoutlines = [];
|
27330 |
$this->tbrot_toc = [];
|
27331 |
|
27332 |
// Stop Transformation
|
27333 |
$this->pages[$this->page] .= $this->StopTransform(true) . "\n";
|
27334 |
|
27335 |
-
|
27336 |
$this->y = $this->tbrot_y0 + $this->tbrot_w;
|
27337 |
$this->x = $this->lMargin;
|
27338 |
|
27339 |
$this->tablebuffer = '';
|
27340 |
}
|
27341 |
|
27342 |
-
|
27343 |
-
|
|
|
27344 |
function printkwtbuffer()
|
27345 |
{
|
27346 |
if (!$this->kwt_moved) {
|
|
|
27347 |
foreach ($this->kwt_buffer as $s) {
|
27348 |
$this->pages[$this->page] .= $s['s'] . "\n";
|
27349 |
}
|
|
|
27350 |
foreach ($this->kwt_Links as $p => $l) {
|
27351 |
foreach ($l as $v) {
|
27352 |
$this->PageLinks[$p][] = $v;
|
27353 |
}
|
27354 |
}
|
|
|
27355 |
$this->kwt_Links = [];
|
|
|
27356 |
/* -- ANNOTATIONS -- */
|
27357 |
foreach ($this->kwt_Annots as $p => $l) {
|
27358 |
foreach ($l as $v) {
|
@@ -27365,7 +27490,9 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27365 |
/* -- INDEX -- */
|
27366 |
// Output Reference (index)
|
27367 |
foreach ($this->kwt_Reference as $v) {
|
|
|
27368 |
$Present = 0;
|
|
|
27369 |
for ($i = 0; $i < count($this->Reference); $i++) {
|
27370 |
if ($this->Reference[$i]['t'] == $v['t']) {
|
27371 |
$Present = 1;
|
@@ -27374,6 +27501,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27374 |
}
|
27375 |
}
|
27376 |
}
|
|
|
27377 |
if ($Present == 0) {
|
27378 |
$this->Reference[] = ['t' => $v['t'], 'p' => [$v['op']]];
|
27379 |
}
|
@@ -27398,6 +27526,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27398 |
/* -- END TOC -- */
|
27399 |
|
27400 |
$this->pageoutput[$this->page] = []; // mPDF 6
|
|
|
27401 |
return;
|
27402 |
}
|
27403 |
|
@@ -27424,6 +27553,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27424 |
$this->PageLinks[$p][] = $v;
|
27425 |
}
|
27426 |
}
|
|
|
27427 |
foreach ($this->internallink as $key => $f) {
|
27428 |
if (is_array($f) && isset($f['kwt'])) {
|
27429 |
$f['Y'] += $yadj;
|
@@ -27432,6 +27562,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27432 |
$this->internallink[$key] = $f;
|
27433 |
}
|
27434 |
}
|
|
|
27435 |
/* -- ANNOTATIONS -- */
|
27436 |
foreach ($this->kwt_Annots as $p => $l) {
|
27437 |
foreach ($l as $v) {
|
@@ -27460,10 +27591,11 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27460 |
/* -- END BOOKMARKS -- */
|
27461 |
|
27462 |
/* -- INDEX -- */
|
27463 |
-
|
27464 |
// Adjust Reference (index)
|
27465 |
foreach ($this->kwt_Reference as $v) {
|
|
|
27466 |
$Present = 0;
|
|
|
27467 |
// Search the reference (AND Ref/PageNo) in the array
|
27468 |
for ($i = 0; $i < count($this->Reference); $i++) {
|
27469 |
if ($this->Reference[$i]['t'] == $v['t']) {
|
@@ -27473,6 +27605,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27473 |
}
|
27474 |
}
|
27475 |
}
|
|
|
27476 |
if ($Present == 0) {
|
27477 |
$this->Reference[] = ['t' => $v['t'], 'p' => [$this->page]];
|
27478 |
}
|
@@ -27496,6 +27629,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27496 |
$this->kwt_Reference = [];
|
27497 |
$this->kwt_BMoutlines = [];
|
27498 |
$this->kwt_toc = [];
|
|
|
27499 |
// Stop Transformation
|
27500 |
$this->pages[$this->page] .= $this->StopTransform(true) . "\n";
|
27501 |
|
@@ -27504,11 +27638,8 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27504 |
$this->y += $this->kwt_height;
|
27505 |
$this->pageoutput[$this->page] = []; // mPDF 6
|
27506 |
}
|
27507 |
-
|
27508 |
/* -- END TABLES -- */
|
27509 |
|
27510 |
-
// ==================================================================
|
27511 |
-
|
27512 |
function printfloatbuffer()
|
27513 |
{
|
27514 |
if (count($this->floatbuffer)) {
|
@@ -27520,9 +27651,6 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27520 |
}
|
27521 |
}
|
27522 |
|
27523 |
-
// ==================================================================
|
27524 |
-
// ==================================================================
|
27525 |
-
// Added ELLIPSES and CIRCLES
|
27526 |
function Circle($x, $y, $r, $style = 'S')
|
27527 |
{
|
27528 |
$this->Ellipse($x, $y, $r, $r, $style);
|
@@ -27530,16 +27658,19 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27530 |
|
27531 |
function Ellipse($x, $y, $rx, $ry, $style = 'S')
|
27532 |
{
|
27533 |
-
if ($style
|
27534 |
$op = 'f';
|
27535 |
-
} elseif ($style
|
27536 |
$op = 'B';
|
27537 |
} else {
|
27538 |
$op = 'S';
|
27539 |
}
|
|
|
27540 |
$lx = 4 / 3 * (M_SQRT2 - 1) * $rx;
|
27541 |
$ly = 4 / 3 * (M_SQRT2 - 1) * $ry;
|
|
|
27542 |
$h = $this->h;
|
|
|
27543 |
$this->_out(sprintf('%.3F %.3F m %.3F %.3F %.3F %.3F %.3F %.3F c', ($x + $rx) * Mpdf::SCALE, ($h - $y) * Mpdf::SCALE, ($x + $rx) * Mpdf::SCALE, ($h - ($y - $ly)) * Mpdf::SCALE, ($x + $lx) * Mpdf::SCALE, ($h - ($y - $ry)) * Mpdf::SCALE, $x * Mpdf::SCALE, ($h - ($y - $ry)) * Mpdf::SCALE));
|
27544 |
$this->_out(sprintf('%.3F %.3F %.3F %.3F %.3F %.3F c', ($x - $lx) * Mpdf::SCALE, ($h - ($y - $ry)) * Mpdf::SCALE, ($x - $rx) * Mpdf::SCALE, ($h - ($y - $ly)) * Mpdf::SCALE, ($x - $rx) * Mpdf::SCALE, ($h - $y) * Mpdf::SCALE));
|
27545 |
$this->_out(sprintf('%.3F %.3F %.3F %.3F %.3F %.3F c', ($x - $rx) * Mpdf::SCALE, ($h - ($y + $ly)) * Mpdf::SCALE, ($x - $lx) * Mpdf::SCALE, ($h - ($y + $ry)) * Mpdf::SCALE, $x * Mpdf::SCALE, ($h - ($y + $ry)) * Mpdf::SCALE));
|
@@ -27547,8 +27678,6 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27547 |
}
|
27548 |
|
27549 |
/* -- DIRECTW -- */
|
27550 |
-
|
27551 |
-
// Added adaptation of shaded_box = AUTOSIZE-TEXT
|
27552 |
function AutosizeText($text, $w, $font, $style, $szfont = 72)
|
27553 |
{
|
27554 |
|
@@ -27567,11 +27696,12 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27567 |
// DIRECTIONALITY
|
27568 |
if (preg_match("/([" . $this->pregRTLchars . "])/u", $text)) {
|
27569 |
$this->biDirectional = true;
|
27570 |
-
}
|
27571 |
|
27572 |
$textvar = 0;
|
27573 |
$save_OTLtags = $this->OTLtags;
|
27574 |
$this->OTLtags = [];
|
|
|
27575 |
if ($this->useKerning) {
|
27576 |
if ($this->CurrentFont['haskernGPOS']) {
|
27577 |
$this->OTLtags['Plus'] .= ' kern';
|
@@ -27587,26 +27717,29 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27587 |
$OTLdata = $this->otl->OTLdata;
|
27588 |
}
|
27589 |
/* -- END OTL -- */
|
|
|
27590 |
$this->OTLtags = $save_OTLtags;
|
27591 |
|
27592 |
$this->magic_reverse_dir($text, $this->directionality, $OTLdata);
|
27593 |
|
27594 |
-
|
27595 |
$width = $this->sizeConverter->convert($w);
|
27596 |
$loop = 0;
|
|
|
27597 |
while ($loop == 0) {
|
|
|
27598 |
$this->SetFont($font, $style, $szfont, false);
|
27599 |
$sz = $this->GetStringWidth($text, true, $OTLdata, $textvar);
|
|
|
27600 |
if ($sz > $w) {
|
27601 |
$szfont --;
|
27602 |
} else {
|
27603 |
$loop ++;
|
27604 |
}
|
27605 |
}
|
|
|
27606 |
$this->SetFont($font, $style, $szfont, true, true);
|
27607 |
$this->Cell($w, 0, $text, 0, 0, "C", 0, '', 0, 0, 0, 'M', 0, false, $OTLdata, $textvar);
|
27608 |
}
|
27609 |
-
|
27610 |
/* -- END DIRECTW -- */
|
27611 |
|
27612 |
// ====================================================
|
@@ -27618,39 +27751,40 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27618 |
if ($this->usingCoreFont) {
|
27619 |
return 0;
|
27620 |
}
|
|
|
27621 |
if ($chunk == '') {
|
27622 |
return 0;
|
27623 |
}
|
27624 |
|
27625 |
if ($this->biDirectional || $dir == 'rtl') {
|
|
|
27626 |
// check if string contains RTL text
|
27627 |
// including any added from OTL tables (in PUA)
|
27628 |
$pregRTLchars = $this->pregRTLchars;
|
|
|
27629 |
if (isset($this->CurrentFont['rtlPUAstr']) && $this->CurrentFont['rtlPUAstr']) {
|
27630 |
$pregRTLchars .= $this->CurrentFont['rtlPUAstr'];
|
27631 |
}
|
|
|
27632 |
if (!preg_match("/[" . $pregRTLchars . "]/u", $chunk) && $dir != 'rtl') {
|
27633 |
return 0;
|
27634 |
} // Chunk doesn't contain RTL characters
|
27635 |
|
27636 |
$unicode = $this->UTF8StringToArray($chunk, false);
|
27637 |
|
27638 |
-
$
|
27639 |
if (empty($chunkOTLdata)) {
|
27640 |
-
$this->getBasicOTLdata($chunkOTLdata, $unicode, $
|
27641 |
}
|
27642 |
|
27643 |
-
|
27644 |
-
$useGPOS = true;
|
27645 |
-
} else {
|
27646 |
-
$useGPOS = false;
|
27647 |
-
}
|
27648 |
|
27649 |
// NB Returned $chunk may be a shorter string (with adjusted $cOTLdata) by removal of LRE, RLE etc embedding codes.
|
27650 |
list($chunk, $rtl_content) = $this->otl->bidiSort($unicode, $chunk, $dir, $chunkOTLdata, $useGPOS);
|
27651 |
|
27652 |
return $rtl_content;
|
27653 |
}
|
|
|
27654 |
/* -- END OTL -- */
|
27655 |
return 0;
|
27656 |
}
|
@@ -27662,15 +27796,20 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27662 |
if (empty($this->otl)) {
|
27663 |
$this->otl = new Otl($this, $this->fontCache);
|
27664 |
}
|
|
|
27665 |
$chunkOTLdata['group'] = '';
|
27666 |
$chunkOTLdata['GPOSinfo'] = [];
|
27667 |
$chunkOTLdata['char_data'] = [];
|
|
|
27668 |
foreach ($unicode as $char) {
|
|
|
27669 |
$ucd_record = Ucdn::get_ucd_record($char);
|
27670 |
$chunkOTLdata['char_data'][] = ['bidi_class' => $ucd_record[2], 'uni' => $char];
|
|
|
27671 |
if ($ucd_record[2] == 0 || $ucd_record[2] == 3 || $ucd_record[2] == 4) {
|
27672 |
$is_strong = true;
|
27673 |
} // contains strong character
|
|
|
27674 |
if ($ucd_record[0] == Ucdn::UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK) {
|
27675 |
$chunkOTLdata['group'] .= 'M';
|
27676 |
} elseif ($char == 32 || $char == 12288) {
|
@@ -27684,48 +27823,44 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27684 |
function _setBidiCodes($mode = 'start', $bdf = '')
|
27685 |
{
|
27686 |
$s = '';
|
|
|
27687 |
if ($mode == 'end') {
|
|
|
27688 |
// PDF comes before PDI to close isolate-override (e.g. "LRILROPDFPDI")
|
27689 |
if (strpos($bdf, 'PDF') !== false) {
|
27690 |
$s .= UtfString::code2utf(0x202C);
|
27691 |
} // POP DIRECTIONAL FORMATTING
|
|
|
27692 |
if (strpos($bdf, 'PDI') !== false) {
|
27693 |
$s .= UtfString::code2utf(0x2069);
|
27694 |
} // POP DIRECTIONAL ISOLATE
|
|
|
27695 |
} elseif ($mode == 'start') {
|
|
|
27696 |
// LRI comes before LRO to open isolate-override (e.g. "LRILROPDFPDI")
|
27697 |
-
if (strpos($bdf, 'LRI') !== false) {
|
27698 |
$s .= UtfString::code2utf(0x2066);
|
27699 |
-
} // U+
|
27700 |
-
elseif (strpos($bdf, 'RLI') !== false) {
|
27701 |
$s .= UtfString::code2utf(0x2067);
|
27702 |
-
} // U+
|
27703 |
-
elseif (strpos($bdf, 'FSI') !== false) {
|
27704 |
$s .= UtfString::code2utf(0x2068);
|
27705 |
-
}
|
27706 |
-
|
|
|
27707 |
$s .= UtfString::code2utf(0x202D);
|
27708 |
-
} // U+
|
27709 |
-
elseif (strpos($bdf, 'RLO') !== false) {
|
27710 |
$s .= UtfString::code2utf(0x202E);
|
27711 |
-
} // U+
|
27712 |
-
elseif (strpos($bdf, 'LRE') !== false) {
|
27713 |
$s .= UtfString::code2utf(0x202A);
|
27714 |
-
} // U+
|
27715 |
-
elseif (strpos($bdf, 'RLE') !== false) {
|
27716 |
$s .= UtfString::code2utf(0x202B);
|
27717 |
-
}
|
27718 |
}
|
|
|
27719 |
return $s;
|
27720 |
}
|
27721 |
-
|
27722 |
/* -- END OTL -- */
|
27723 |
|
27724 |
-
//
|
27725 |
-
// ****************************
|
27726 |
-
// ****************************
|
27727 |
-
|
27728 |
-
|
27729 |
function SetSubstitutions()
|
27730 |
{
|
27731 |
$subsarray = [];
|
@@ -27749,6 +27884,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27749 |
$html .= $e;
|
27750 |
}
|
27751 |
}
|
|
|
27752 |
return $html;
|
27753 |
}
|
27754 |
|
@@ -27766,19 +27902,24 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27766 |
return 4;
|
27767 |
}
|
27768 |
}
|
|
|
27769 |
return 0;
|
27770 |
}
|
27771 |
|
27772 |
-
|
|
|
|
|
27773 |
function SubstituteCharsNonCore(&$writehtml_a, &$writehtml_i, &$writehtml_e)
|
27774 |
{
|
27775 |
// Ignore if in Textarea
|
27776 |
if ($writehtml_i > 0 && strtolower(substr($writehtml_a[$writehtml_i - 1], 0, 8)) == 'textarea') {
|
27777 |
return 0;
|
27778 |
}
|
|
|
27779 |
if (mb_convert_encoding(mb_convert_encoding($writehtml_e, $this->mb_enc, "UTF-8"), "UTF-8", $this->mb_enc) == $writehtml_e) {
|
27780 |
return 0;
|
27781 |
}
|
|
|
27782 |
$cw = &$this->CurrentFont['cw'];
|
27783 |
$unicode = $this->UTF8StringToArray($writehtml_e, false);
|
27784 |
$start = -1;
|
@@ -27786,13 +27927,18 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27786 |
$flag = 0;
|
27787 |
$ftype = '';
|
27788 |
$u = [];
|
|
|
27789 |
if (!$this->subArrMB) {
|
|
|
27790 |
require __DIR__ . '/../data/subs_core.php';
|
|
|
27791 |
$this->subArrMB['a'] = $aarr;
|
27792 |
$this->subArrMB['s'] = $sarr;
|
27793 |
$this->subArrMB['z'] = $zarr;
|
27794 |
}
|
|
|
27795 |
foreach ($unicode as $c => $char) {
|
|
|
27796 |
if (($char > 127 || ($flag == 1 && $char == 32)) && $char != 173 && (!isset($this->subArrMB['a'][$char]) || ($flag == 1 && $char == 32)) && ($char < 1536 || ($char > 1791 && $char < 2304) || $char > 3455)) {
|
27797 |
if ($flag == 0) {
|
27798 |
$start = $c;
|
@@ -27804,19 +27950,22 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27804 |
break;
|
27805 |
}
|
27806 |
}
|
|
|
27807 |
if ($flag > 0 && !$end) {
|
27808 |
$end = count($unicode) - 1;
|
27809 |
}
|
|
|
27810 |
if ($start == -1) {
|
27811 |
return 0;
|
27812 |
}
|
27813 |
|
27814 |
-
//
|
27815 |
if (!is_array($this->backupSubsFont)) {
|
27816 |
$this->backupSubsFont = ["$this->backupSubsFont"];
|
27817 |
}
|
27818 |
|
27819 |
foreach ($this->backupSubsFont as $bsfctr => $bsf) {
|
|
|
27820 |
if ($this->fonttrans[$bsf] == 'chelvetica' || $this->fonttrans[$bsf] == 'ctimes' || $this->fonttrans[$bsf] == 'ccourier') {
|
27821 |
continue;
|
27822 |
}
|
@@ -27851,6 +28000,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27851 |
$writehtml_e = mb_substr($writehtml_e, 0, $start + 1, 'UTF-8');
|
27852 |
array_splice($writehtml_a, $writehtml_i + 1, 0, ['', $cont]);
|
27853 |
$this->subPos = $writehtml_i + 1;
|
|
|
27854 |
return 2;
|
27855 |
} else {
|
27856 |
break;
|
@@ -27864,12 +28014,14 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27864 |
$writehtml_e = $m[1];
|
27865 |
array_splice($writehtml_a, $writehtml_i + 1, 0, ['span style="font-family: ' . $font . '"', $m[2], '/span', $m[3]]);
|
27866 |
$this->subPos = $writehtml_i + 3;
|
|
|
27867 |
return 4;
|
27868 |
}
|
27869 |
}
|
27870 |
}
|
27871 |
|
27872 |
unset($cw);
|
|
|
27873 |
return 0;
|
27874 |
}
|
27875 |
|
@@ -27879,6 +28031,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27879 |
if ($writehtml_i > 0 && strtolower(substr($writehtml_a[$writehtml_i - 1], 0, 8)) == 'textarea') {
|
27880 |
return 0;
|
27881 |
}
|
|
|
27882 |
$cw = &$this->CurrentFont['cw'];
|
27883 |
$unicode = $this->UTF8StringToArray($writehtml_e, false);
|
27884 |
$start = -1;
|
@@ -27886,41 +28039,57 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27886 |
$flag = 0;
|
27887 |
$ftype = '';
|
27888 |
$u = [];
|
|
|
27889 |
foreach ($unicode as $c => $char) {
|
|
|
27890 |
if (($flag == 0 || $flag == 2) && (!$this->_charDefined($cw, $char) || ($flag == 2 && $char == 32)) && $this->checkSIP && $char > 131071) { // Unicode Plane 2 (SIP)
|
|
|
27891 |
if (in_array($this->FontFamily, $this->available_CJK_fonts)) {
|
27892 |
return 0;
|
27893 |
}
|
|
|
27894 |
if ($flag == 0) {
|
27895 |
$start = $c;
|
27896 |
}
|
|
|
27897 |
$flag = 2;
|
27898 |
$u[] = $char;
|
27899 |
-
|
27900 |
-
|
|
|
|
|
|
|
27901 |
if ($flag == 0) {
|
27902 |
$start = $c;
|
27903 |
}
|
|
|
27904 |
$flag = 1;
|
27905 |
$u[] = $char;
|
|
|
27906 |
} elseif ($flag > 0) {
|
|
|
27907 |
$end = $c - 1;
|
27908 |
break;
|
|
|
27909 |
}
|
27910 |
}
|
|
|
27911 |
if ($flag > 0 && !$end) {
|
27912 |
$end = count($unicode) - 1;
|
27913 |
}
|
|
|
27914 |
if ($start == -1) {
|
27915 |
return 0;
|
27916 |
}
|
27917 |
|
27918 |
-
if ($flag == 2) {
|
|
|
27919 |
// Check if current CJK font has a ext-B related font
|
27920 |
if (isset($this->CurrentFont['sipext']) && $this->CurrentFont['sipext']) {
|
27921 |
$font = $this->CurrentFont['sipext'];
|
27922 |
unset($cw);
|
27923 |
$cw = '';
|
|
|
27924 |
if (isset($this->fonts[$font])) {
|
27925 |
$cw = &$this->fonts[$font]['cw'];
|
27926 |
} elseif ($this->fontCache->has($font . '.cw.dat')) {
|
@@ -27956,8 +28125,10 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27956 |
}
|
27957 |
}
|
27958 |
}
|
|
|
27959 |
// Check Backup SIP font (defined in Config\FontVariables)
|
27960 |
if (isset($this->backupSIPFont) && $this->backupSIPFont) {
|
|
|
27961 |
if ($this->currentfontfamily != $this->backupSIPFont) {
|
27962 |
$font = $this->backupSIPFont;
|
27963 |
} else {
|
@@ -27992,6 +28163,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
27992 |
break;
|
27993 |
}
|
27994 |
}
|
|
|
27995 |
if ($l > 0) {
|
27996 |
$patt = mb_substr($writehtml_e, $start, $l);
|
27997 |
if (preg_match("/(.*?)(" . preg_quote($patt, '/') . ")(.*)/u", $writehtml_e, $m)) {
|
@@ -28002,10 +28174,10 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28002 |
}
|
28003 |
}
|
28004 |
}
|
|
|
28005 |
return 0;
|
28006 |
}
|
28007 |
|
28008 |
-
|
28009 |
// FIRST TRY CORE FONTS (when appropriate)
|
28010 |
if (!$this->PDFA && !$this->PDFX && !$this->biDirectional) { // mPDF 6
|
28011 |
$repl = [];
|
@@ -28062,6 +28234,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28062 |
if (!is_array($this->backupSubsFont)) {
|
28063 |
$this->backupSubsFont = ["$this->backupSubsFont"];
|
28064 |
}
|
|
|
28065 |
foreach ($this->backupSubsFont as $bsfctr => $bsf) {
|
28066 |
if ($this->currentfontfamily != $bsf) {
|
28067 |
$font = $bsf;
|
@@ -28104,6 +28277,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28104 |
}
|
28105 |
}
|
28106 |
}
|
|
|
28107 |
if ($l > 0) {
|
28108 |
$patt = mb_substr($writehtml_e, $start, $l);
|
28109 |
if (preg_match("/(.*?)(" . preg_quote($patt, '/') . ")(.*)/u", $writehtml_e, $m)) {
|
@@ -28116,48 +28290,14 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28116 |
}
|
28117 |
|
28118 |
unset($cw);
|
|
|
28119 |
return 0;
|
28120 |
}
|
28121 |
|
28122 |
function setHiEntitySubstitutions()
|
28123 |
{
|
28124 |
-
$entarr =
|
28125 |
-
|
28126 |
-
'uml' => '168', 'copy' => '169', 'ordf' => '170', 'laquo' => '171', 'not' => '172', 'shy' => '173', 'reg' => '174', 'macr' => '175',
|
28127 |
-
'deg' => '176', 'plusmn' => '177', 'sup2' => '178', 'sup3' => '179', 'acute' => '180', 'micro' => '181', 'para' => '182', 'middot' => '183',
|
28128 |
-
'cedil' => '184', 'sup1' => '185', 'ordm' => '186', 'raquo' => '187', 'frac14' => '188', 'frac12' => '189', 'frac34' => '190',
|
28129 |
-
'iquest' => '191', 'Agrave' => '192', 'Aacute' => '193', 'Acirc' => '194', 'Atilde' => '195', 'Auml' => '196', 'Aring' => '197',
|
28130 |
-
'AElig' => '198', 'Ccedil' => '199', 'Egrave' => '200', 'Eacute' => '201', 'Ecirc' => '202', 'Euml' => '203', 'Igrave' => '204',
|
28131 |
-
'Iacute' => '205', 'Icirc' => '206', 'Iuml' => '207', 'ETH' => '208', 'Ntilde' => '209', 'Ograve' => '210', 'Oacute' => '211',
|
28132 |
-
'Ocirc' => '212', 'Otilde' => '213', 'Ouml' => '214', 'times' => '215', 'Oslash' => '216', 'Ugrave' => '217', 'Uacute' => '218',
|
28133 |
-
'Ucirc' => '219', 'Uuml' => '220', 'Yacute' => '221', 'THORN' => '222', 'szlig' => '223', 'agrave' => '224', 'aacute' => '225',
|
28134 |
-
'acirc' => '226', 'atilde' => '227', 'auml' => '228', 'aring' => '229', 'aelig' => '230', 'ccedil' => '231', 'egrave' => '232',
|
28135 |
-
'eacute' => '233', 'ecirc' => '234', 'euml' => '235', 'igrave' => '236', 'iacute' => '237', 'icirc' => '238', 'iuml' => '239',
|
28136 |
-
'eth' => '240', 'ntilde' => '241', 'ograve' => '242', 'oacute' => '243', 'ocirc' => '244', 'otilde' => '245', 'ouml' => '246',
|
28137 |
-
'divide' => '247', 'oslash' => '248', 'ugrave' => '249', 'uacute' => '250', 'ucirc' => '251', 'uuml' => '252', 'yacute' => '253',
|
28138 |
-
'thorn' => '254', 'yuml' => '255', 'OElig' => '338', 'oelig' => '339', 'Scaron' => '352', 'scaron' => '353', 'Yuml' => '376',
|
28139 |
-
'fnof' => '402', 'circ' => '710', 'tilde' => '732', 'Alpha' => '913', 'Beta' => '914', 'Gamma' => '915', 'Delta' => '916',
|
28140 |
-
'Epsilon' => '917', 'Zeta' => '918', 'Eta' => '919', 'Theta' => '920', 'Iota' => '921', 'Kappa' => '922', 'Lambda' => '923',
|
28141 |
-
'Mu' => '924', 'Nu' => '925', 'Xi' => '926', 'Omicron' => '927', 'Pi' => '928', 'Rho' => '929', 'Sigma' => '931', 'Tau' => '932',
|
28142 |
-
'Upsilon' => '933', 'Phi' => '934', 'Chi' => '935', 'Psi' => '936', 'Omega' => '937', 'alpha' => '945', 'beta' => '946', 'gamma' => '947',
|
28143 |
-
'delta' => '948', 'epsilon' => '949', 'zeta' => '950', 'eta' => '951', 'theta' => '952', 'iota' => '953', 'kappa' => '954',
|
28144 |
-
'lambda' => '955', 'mu' => '956', 'nu' => '957', 'xi' => '958', 'omicron' => '959', 'pi' => '960', 'rho' => '961', 'sigmaf' => '962',
|
28145 |
-
'sigma' => '963', 'tau' => '964', 'upsilon' => '965', 'phi' => '966', 'chi' => '967', 'psi' => '968', 'omega' => '969',
|
28146 |
-
'thetasym' => '977', 'upsih' => '978', 'piv' => '982', 'ensp' => '8194', 'emsp' => '8195', 'thinsp' => '8201', 'zwnj' => '8204',
|
28147 |
-
'zwj' => '8205', 'lrm' => '8206', 'rlm' => '8207', 'ndash' => '8211', 'mdash' => '8212', 'lsquo' => '8216', 'rsquo' => '8217',
|
28148 |
-
'sbquo' => '8218', 'ldquo' => '8220', 'rdquo' => '8221', 'bdquo' => '8222', 'dagger' => '8224', 'Dagger' => '8225', 'bull' => '8226',
|
28149 |
-
'hellip' => '8230', 'permil' => '8240', 'prime' => '8242', 'Prime' => '8243', 'lsaquo' => '8249', 'rsaquo' => '8250', 'oline' => '8254',
|
28150 |
-
'frasl' => '8260', 'euro' => '8364', 'image' => '8465', 'weierp' => '8472', 'real' => '8476', 'trade' => '8482', 'alefsym' => '8501',
|
28151 |
-
'larr' => '8592', 'uarr' => '8593', 'rarr' => '8594', 'darr' => '8595', 'harr' => '8596', 'crarr' => '8629', 'lArr' => '8656',
|
28152 |
-
'uArr' => '8657', 'rArr' => '8658', 'dArr' => '8659', 'hArr' => '8660', 'forall' => '8704', 'part' => '8706', 'exist' => '8707',
|
28153 |
-
'empty' => '8709', 'nabla' => '8711', 'isin' => '8712', 'notin' => '8713', 'ni' => '8715', 'prod' => '8719', 'sum' => '8721',
|
28154 |
-
'minus' => '8722', 'lowast' => '8727', 'radic' => '8730', 'prop' => '8733', 'infin' => '8734', 'ang' => '8736', 'and' => '8743',
|
28155 |
-
'or' => '8744', 'cap' => '8745', 'cup' => '8746', 'int' => '8747', 'there4' => '8756', 'sim' => '8764', 'cong' => '8773',
|
28156 |
-
'asymp' => '8776', 'ne' => '8800', 'equiv' => '8801', 'le' => '8804', 'ge' => '8805', 'sub' => '8834', 'sup' => '8835', 'nsub' => '8836',
|
28157 |
-
'sube' => '8838', 'supe' => '8839', 'oplus' => '8853', 'otimes' => '8855', 'perp' => '8869', 'sdot' => '8901', 'lceil' => '8968',
|
28158 |
-
'rceil' => '8969', 'lfloor' => '8970', 'rfloor' => '8971', 'lang' => '9001', 'rang' => '9002', 'loz' => '9674', 'spades' => '9824',
|
28159 |
-
'clubs' => '9827', 'hearts' => '9829', 'diams' => '9830',
|
28160 |
-
];
|
28161 |
foreach ($entarr as $key => $val) {
|
28162 |
$this->entsearch[] = '&' . $key . ';';
|
28163 |
$this->entsubstitute[] = UtfString::code2utf($val);
|
@@ -28171,10 +28311,13 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28171 |
if (count($this->entsearch)) {
|
28172 |
$html = str_replace($this->entsearch, $this->entsubstitute, $html);
|
28173 |
}
|
|
|
28174 |
return $html;
|
28175 |
}
|
28176 |
|
28177 |
-
|
|
|
|
|
28178 |
function is_utf8(&$string)
|
28179 |
{
|
28180 |
if ($string === mb_convert_encoding(mb_convert_encoding($string, "UTF-32", "UTF-8"), "UTF-8", "UTF-32")) {
|
@@ -28189,28 +28332,40 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28189 |
}
|
28190 |
}
|
28191 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28192 |
function purify_utf8($html, $lo = true)
|
28193 |
{
|
28194 |
-
// For HTML
|
28195 |
-
// Checks string is valid UTF-8 encoded
|
28196 |
-
// converts html_entities > ASCII 127 to UTF-8
|
28197 |
-
// Only exception - leaves low ASCII entities e.g. < & etc.
|
28198 |
-
// Leaves in particular < to distinguish from tag marker
|
28199 |
if (!$this->is_utf8($html)) {
|
|
|
28200 |
while (mb_convert_encoding(mb_convert_encoding($html, "UTF-32", "UTF-8"), "UTF-8", "UTF-32") != $html) {
|
28201 |
-
|
28202 |
-
|
|
|
|
|
|
|
|
|
|
|
28203 |
$pos = $start = strlen($a);
|
28204 |
$err = '';
|
28205 |
while (ord(substr($html, $pos, 1)) > 128) {
|
28206 |
$err .= '[[#' . ord(substr($html, $pos, 1)) . ']]';
|
28207 |
$pos++;
|
28208 |
}
|
|
|
28209 |
$this->logger->error($err, ['context' => LogContext::UTF8]);
|
28210 |
$html = substr($html, $pos);
|
28211 |
}
|
|
|
28212 |
throw new \Mpdf\MpdfException("HTML contains invalid UTF-8 character(s). See log for further details");
|
28213 |
}
|
|
|
28214 |
$html = preg_replace("/\r/", "", $html);
|
28215 |
|
28216 |
// converts html_entities > ASCII 127 to UTF-8
|
@@ -28220,12 +28375,15 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28220 |
// converts all &#nnn; or &#xHHH; to UTF-8 multibyte
|
28221 |
// If $lo==true then includes ASCII < 128
|
28222 |
$html = UtfString::strcode2utf($html, $lo);
|
28223 |
-
|
|
|
28224 |
}
|
28225 |
|
|
|
|
|
|
|
28226 |
function purify_utf8_text($txt)
|
28227 |
{
|
28228 |
-
// For TEXT
|
28229 |
// Make sure UTF-8 string of characters
|
28230 |
if (!$this->is_utf8($txt)) {
|
28231 |
throw new \Mpdf\MpdfException("Text contains invalid UTF-8 character(s)");
|
@@ -28249,16 +28407,19 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28249 |
return ($txt);
|
28250 |
}
|
28251 |
|
28252 |
-
|
28253 |
-
|
28254 |
-
|
28255 |
-
|
28256 |
-
|
|
|
|
|
28257 |
function WriteBarcode($code, $showtext = 1, $x = '', $y = '', $size = 1, $border = 0, $paddingL = 1, $paddingR = 1, $paddingT = 2, $paddingB = 2, $height = 1, $bgcol = false, $col = false, $btype = 'ISBN', $supplement = '0', $supplement_code = '', $k = 1)
|
28258 |
{
|
28259 |
if (empty($code)) {
|
28260 |
return;
|
28261 |
}
|
|
|
28262 |
$codestr = $code;
|
28263 |
$code = preg_replace('/\-/', '', $code);
|
28264 |
|
@@ -28272,31 +28433,42 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28272 |
if ($arrcode === false) {
|
28273 |
throw new \Mpdf\MpdfException('Error in barcode string: ' . $codestr);
|
28274 |
}
|
28275 |
-
|
|
|
|
|
|
|
|
|
|
|
28276 |
$code .= $arrcode['checkdigit'];
|
|
|
28277 |
if (stristr($codestr, '-')) {
|
28278 |
$codestr .= '-' . $arrcode['checkdigit'];
|
28279 |
} else {
|
28280 |
$codestr .= $arrcode['checkdigit'];
|
28281 |
}
|
28282 |
}
|
28283 |
-
|
|
|
28284 |
$codestr = 'ISBN ' . $codestr;
|
28285 |
}
|
28286 |
-
|
|
|
28287 |
$codestr = 'ISSN ' . $codestr;
|
28288 |
}
|
28289 |
|
28290 |
if (empty($x)) {
|
28291 |
$x = $this->x;
|
28292 |
}
|
|
|
28293 |
if (empty($y)) {
|
28294 |
$y = $this->y;
|
28295 |
}
|
|
|
28296 |
// set foreground color
|
28297 |
$prevDrawColor = $this->DrawColor;
|
28298 |
$prevTextColor = $this->TextColor;
|
28299 |
$prevFillColor = $this->FillColor;
|
|
|
28300 |
$lw = $this->LineWidth;
|
28301 |
$this->SetLineWidth(0.01);
|
28302 |
|
@@ -28322,10 +28494,13 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28322 |
$codestr_fontsize = 2.1 * $size;
|
28323 |
$paddingT += $codestr_fontsize + $tisbnm;
|
28324 |
}
|
|
|
28325 |
$oh = $fbh + $paddingT + $paddingB; // Full overall height incl. user-defined padding
|
|
|
28326 |
// PRINT border background color
|
28327 |
$xpos = $x;
|
28328 |
$ypos = $y;
|
|
|
28329 |
if ($col) {
|
28330 |
$this->SetDColor($col);
|
28331 |
$this->SetTColor($col);
|
@@ -28333,17 +28508,21 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28333 |
$this->SetDColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
|
28334 |
$this->SetTColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
|
28335 |
}
|
|
|
28336 |
if ($bgcol) {
|
28337 |
$this->SetFColor($bgcol);
|
28338 |
} else {
|
28339 |
$this->SetFColor($this->colorConverter->convert(255, $this->PDFAXwarnings));
|
28340 |
}
|
|
|
28341 |
if (!$bgcol && !$col) { // fn. called directly - not via HTML
|
|
|
28342 |
if ($border) {
|
28343 |
$fillb = 'DF';
|
28344 |
} else {
|
28345 |
$fillb = 'F';
|
28346 |
}
|
|
|
28347 |
$this->Rect($xpos, $ypos, $ow, $oh, $fillb);
|
28348 |
}
|
28349 |
|
@@ -28351,11 +28530,13 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28351 |
// PRINT BARS
|
28352 |
$xpos = $x + $paddingL + $llm;
|
28353 |
$ypos = $y + $paddingT;
|
|
|
28354 |
if ($col) {
|
28355 |
$this->SetFColor($col);
|
28356 |
} else {
|
28357 |
$this->SetFColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
|
28358 |
}
|
|
|
28359 |
if ($arrcode !== false) {
|
28360 |
foreach ($arrcode["bcode"] as $v) {
|
28361 |
$bw = ($v["w"] * $xres);
|
@@ -28367,14 +28548,14 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28367 |
}
|
28368 |
}
|
28369 |
|
28370 |
-
|
28371 |
// print text
|
28372 |
$prevFontFamily = $this->FontFamily;
|
28373 |
$prevFontStyle = $this->FontStyle;
|
28374 |
$prevFontSizePt = $this->FontSizePt;
|
28375 |
|
28376 |
// ISBN string
|
28377 |
-
if (($btype
|
|
|
28378 |
if ($this->onlyCoreFonts) {
|
28379 |
$this->SetFont('chelvetica');
|
28380 |
} else {
|
@@ -28386,18 +28567,22 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28386 |
} else {
|
28387 |
$this->SetFColor($this->colorConverter->convert(255, $this->PDFAXwarnings));
|
28388 |
}
|
|
|
28389 |
$this->x = $x + $paddingL + 1; // 1mm left margin (cf. $fbwi above)
|
|
|
28390 |
// max width is $fbwi
|
28391 |
$loop = 0;
|
28392 |
while ($loop == 0) {
|
28393 |
$this->SetFontSize($codestr_fontsize * 1.4 * Mpdf::SCALE, false); // don't write
|
28394 |
$sz = $this->GetStringWidth($codestr);
|
|
|
28395 |
if ($sz > $fbwi) {
|
28396 |
$codestr_fontsize -= 0.1;
|
28397 |
} else {
|
28398 |
$loop ++;
|
28399 |
}
|
28400 |
}
|
|
|
28401 |
$this->SetFont('', '', $codestr_fontsize * 1.4 * Mpdf::SCALE, true, true); // * 1.4 because font height is only 7/10 of given mm
|
28402 |
// WORD SPACING
|
28403 |
if ($fbwi > $sz) {
|
@@ -28407,8 +28592,10 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28407 |
$this->_out(sprintf('BT %.3F Tc ET', $charspacing * Mpdf::SCALE));
|
28408 |
}
|
28409 |
}
|
|
|
28410 |
$this->y = $y + $paddingT - ($codestr_fontsize ) - $tisbnm;
|
28411 |
$this->Cell($fbw, $codestr_fontsize, $codestr);
|
|
|
28412 |
if ($charspacing) {
|
28413 |
$this->_out('BT 0 Tc ET');
|
28414 |
}
|
@@ -28424,8 +28611,11 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28424 |
$this->SetFont('ocrb');
|
28425 |
$fh = 1.06;
|
28426 |
}
|
|
|
28427 |
$charRO = '';
|
28428 |
-
|
|
|
|
|
28429 |
$outerfontsize = 3; // Inner fontsize = 3
|
28430 |
$outerp = $xres * 4;
|
28431 |
$innerp = $xres * 2.5;
|
@@ -28434,10 +28624,13 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28434 |
$charLO = substr($code, 0, 1); // Left Outer
|
28435 |
$charLI = substr($code, 1, 6); // Left Inner
|
28436 |
$charRI = substr($code, 7, 6); // Right Inner
|
|
|
28437 |
if (!$supplement) {
|
28438 |
$charRO = '>'; // Right Outer
|
28439 |
}
|
28440 |
-
|
|
|
|
|
28441 |
$outerfontsize = 2.3; // Inner fontsize = 3
|
28442 |
$outerp = $xres * 10;
|
28443 |
$innerp = $xres * 2.5;
|
@@ -28447,7 +28640,9 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28447 |
$charLI = substr($code, 1, 5); // Left Inner
|
28448 |
$charRI = substr($code, 6, 5); // Right Inner
|
28449 |
$charRO = substr($code, 11, 1); // Right Outer
|
28450 |
-
|
|
|
|
|
28451 |
$outerfontsize = 2.3; // Inner fontsize = 3
|
28452 |
$outerp = $xres * 4;
|
28453 |
$innerp = 0;
|
@@ -28458,7 +28653,9 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28458 |
$charLI = substr($upce_code, 0, 3); // Left Inner
|
28459 |
$charRI = substr($upce_code, 3, 3); // Right Inner
|
28460 |
$charRO = substr($code, 11, 1); // Right Outer
|
28461 |
-
|
|
|
|
|
28462 |
$outerfontsize = 3; // Inner fontsize = 3
|
28463 |
$outerp = $xres * 4;
|
28464 |
$innerp = $xres * 2.5;
|
@@ -28467,6 +28664,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28467 |
$charLO = '<'; // Left Outer
|
28468 |
$charLI = substr($code, 0, 4); // Left Inner
|
28469 |
$charRI = substr($code, 4, 4); // Right Inner
|
|
|
28470 |
if (!$supplement) {
|
28471 |
$charRO = '>'; // Right Outer
|
28472 |
}
|
@@ -28474,12 +28672,12 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28474 |
|
28475 |
$this->SetFontSize(($outerfontsize / 3) * 3 * $fh * $size * Mpdf::SCALE); // 3mm numerals (FontSize is larger to account for space above/below characters)
|
28476 |
|
28477 |
-
if (!$this->usingCoreFont) {
|
28478 |
$cw = $this->_getCharWidth($this->CurrentFont['cw'], 32) * 3 * $fh * $size / 1000;
|
28479 |
-
}
|
28480 |
-
else {
|
28481 |
$cw = 600 * 3 * $fh * $size / 1000;
|
28482 |
-
}
|
|
|
28483 |
// Outer left character
|
28484 |
$y_text = $y + $paddingT + $bch - ($num_height / 2);
|
28485 |
$y_text_outer = $y + $paddingT + $bch - ($num_height * ($outerfontsize / 3) / 2);
|
@@ -28502,6 +28700,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28502 |
}
|
28503 |
|
28504 |
$this->SetFontSize(3 * $fh * $size * Mpdf::SCALE); // 3mm numerals (FontSize is larger to account for space above/below characters)
|
|
|
28505 |
// Inner left half characters
|
28506 |
$this->x = $x + $paddingL + $llm + $outerp;
|
28507 |
$this->y = $y_text;
|
@@ -28526,12 +28725,15 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28526 |
if ($supplement) { // EAN-2 or -5 Supplement
|
28527 |
// PRINT BARS
|
28528 |
$supparrcode = $this->barcode->getBarcodeArray($supplement_code, 'EAN' . $supplement);
|
|
|
28529 |
if ($supparrcode === false) {
|
28530 |
throw new \Mpdf\MpdfException('Error in barcode string (supplement): ' . $codestr . ' ' . $supplement_code);
|
28531 |
}
|
|
|
28532 |
if (strlen($supplement_code) != $supplement) {
|
28533 |
throw new \Mpdf\MpdfException('Barcode supplement incorrect: ' . $supplement_code);
|
28534 |
}
|
|
|
28535 |
$llm = $fbw - (($arrcode['lightmR'] - $supparrcode['sepM']) * $arrcode['nom-X'] * $size); // Left Light margin
|
28536 |
$rlm = $arrcode['lightmR'] * $arrcode['nom-X'] * $size; // Right Light margin
|
28537 |
|
@@ -28543,11 +28745,13 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28543 |
|
28544 |
$xpos = $x + $paddingL + $llm;
|
28545 |
$ypos = $y + $paddingT + $num_height + 0.5;
|
|
|
28546 |
if ($col) {
|
28547 |
$this->SetFColor($col);
|
28548 |
} else {
|
28549 |
$this->SetFColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
|
28550 |
}
|
|
|
28551 |
if ($supparrcode !== false) {
|
28552 |
foreach ($supparrcode["bcode"] as $v) {
|
28553 |
$bw = ($v["w"] * $xres);
|
@@ -28565,6 +28769,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28565 |
} else {
|
28566 |
$this->SetFColor($this->colorConverter->convert(255, $this->PDFAXwarnings));
|
28567 |
}
|
|
|
28568 |
$this->SetFontSize(3 * $fh * $size * Mpdf::SCALE); // 3mm numerals (FontSize is larger to account for space above/below characters)
|
28569 |
$this->x = $x + $paddingL + $llm;
|
28570 |
$this->y = $y + $paddingT;
|
@@ -28586,8 +28791,9 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28586 |
$this->SetY($y);
|
28587 |
}
|
28588 |
|
28589 |
-
|
28590 |
-
|
|
|
28591 |
function WriteBarcode2($code, $x = '', $y = '', $size = 1, $height = 1, $bgcol = false, $col = false, $btype = 'IMB', $print_ratio = '', $k = 1)
|
28592 |
{
|
28593 |
if (empty($code)) {
|
@@ -28600,9 +28806,11 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28600 |
if (empty($x)) {
|
28601 |
$x = $this->x;
|
28602 |
}
|
|
|
28603 |
if (empty($y)) {
|
28604 |
$y = $this->y;
|
28605 |
}
|
|
|
28606 |
$prevDrawColor = $this->DrawColor;
|
28607 |
$prevTextColor = $this->TextColor;
|
28608 |
$prevFillColor = $this->FillColor;
|
@@ -28611,7 +28819,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28611 |
$size /= $k; // in case resized in a table
|
28612 |
$xres = $arrcode['nom-X'] * $size;
|
28613 |
|
28614 |
-
if ($btype
|
28615 |
$llm = $arrcode['quietL'] / $k; // Left Quiet margin
|
28616 |
$rlm = $arrcode['quietR'] / $k; // Right Quiet margin
|
28617 |
$tlm = $blm = $arrcode['quietTB'] / $k;
|
@@ -28622,15 +28830,16 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28622 |
$tlm = $blm = $arrcode['lightTB'] * $xres * $height;
|
28623 |
}
|
28624 |
|
28625 |
-
|
28626 |
$bcw = ($arrcode["maxw"] * $xres);
|
28627 |
$fbw = $bcw + $llm + $rlm; // Full barcode width incl. light margins
|
28628 |
|
28629 |
$bch = ($arrcode["nom-H"] * $size * $height);
|
28630 |
$fbh = $bch + $tlm + $blm; // Full barcode height
|
|
|
28631 |
// PRINT border background color
|
28632 |
$xpos = $x;
|
28633 |
$ypos = $y;
|
|
|
28634 |
if ($col) {
|
28635 |
$this->SetDColor($col);
|
28636 |
$this->SetTColor($col);
|
@@ -28638,6 +28847,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28638 |
$this->SetDColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
|
28639 |
$this->SetTColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
|
28640 |
}
|
|
|
28641 |
if ($bgcol) {
|
28642 |
$this->SetFColor($bgcol);
|
28643 |
} else {
|
@@ -28676,12 +28886,8 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28676 |
$this->SetLineWidth($lw);
|
28677 |
$this->SetY($y);
|
28678 |
}
|
28679 |
-
|
28680 |
/* -- END BARCODES -- */
|
28681 |
|
28682 |
-
// ====================================================
|
28683 |
-
// ====================================================
|
28684 |
-
|
28685 |
function StartTransform($returnstring = false)
|
28686 |
{
|
28687 |
if ($returnstring) {
|
@@ -28705,14 +28911,18 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28705 |
if ($x === '') {
|
28706 |
$x = $this->x;
|
28707 |
}
|
|
|
28708 |
if ($y === '') {
|
28709 |
$y = $this->y;
|
28710 |
}
|
|
|
28711 |
if (($s_x == 0) or ( $s_y == 0)) {
|
28712 |
throw new \Mpdf\MpdfException('Please do not use values equal to zero for scaling');
|
28713 |
}
|
|
|
28714 |
$y = ($this->h - $y) * Mpdf::SCALE;
|
28715 |
$x *= Mpdf::SCALE;
|
|
|
28716 |
// calculate elements of transformation matrix
|
28717 |
$s_x /= 100;
|
28718 |
$s_y /= 100;
|
@@ -28723,6 +28933,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28723 |
$tm[3] = $s_y;
|
28724 |
$tm[4] = $x * (1 - $s_x);
|
28725 |
$tm[5] = $y * (1 - $s_y);
|
|
|
28726 |
// scale the coordinate system
|
28727 |
if ($returnstring) {
|
28728 |
return($this->_transform($tm, true));
|
@@ -28741,6 +28952,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28741 |
$tm[3] = 1;
|
28742 |
$tm[4] = $t_x * Mpdf::SCALE;
|
28743 |
$tm[5] = -$t_y * Mpdf::SCALE;
|
|
|
28744 |
// translate the coordinate system
|
28745 |
if ($returnstring) {
|
28746 |
return($this->_transform($tm, true));
|
@@ -28754,12 +28966,15 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28754 |
if ($x === '') {
|
28755 |
$x = $this->x;
|
28756 |
}
|
|
|
28757 |
if ($y === '') {
|
28758 |
$y = $this->y;
|
28759 |
}
|
|
|
28760 |
$angle = -$angle;
|
28761 |
$y = ($this->h - $y) * Mpdf::SCALE;
|
28762 |
$x *= Mpdf::SCALE;
|
|
|
28763 |
// calculate elements of transformation matrix
|
28764 |
$tm = [];
|
28765 |
$tm[0] = cos(deg2rad($angle));
|
@@ -28768,27 +28983,34 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28768 |
$tm[3] = $tm[0];
|
28769 |
$tm[4] = $x + $tm[1] * $y - $tm[0] * $x;
|
28770 |
$tm[5] = $y - $tm[0] * $y - $tm[1] * $x;
|
|
|
28771 |
// rotate the coordinate system around ($x,$y)
|
28772 |
if ($returnstring) {
|
28773 |
-
return
|
28774 |
} else {
|
28775 |
$this->_transform($tm);
|
28776 |
}
|
28777 |
}
|
28778 |
|
28779 |
-
|
|
|
|
|
28780 |
function transformSkew($angle_x, $angle_y, $x = '', $y = '', $returnstring = false)
|
28781 |
{
|
28782 |
if ($x === '') {
|
28783 |
$x = $this->x;
|
28784 |
}
|
|
|
28785 |
if ($y === '') {
|
28786 |
$y = $this->y;
|
28787 |
}
|
|
|
28788 |
$angle_x = -$angle_x;
|
28789 |
$angle_y = -$angle_y;
|
|
|
28790 |
$x *= Mpdf::SCALE;
|
28791 |
$y = ($this->h - $y) * Mpdf::SCALE;
|
|
|
28792 |
// calculate elements of transformation matrix
|
28793 |
$tm = [];
|
28794 |
$tm[0] = 1;
|
@@ -28797,9 +29019,10 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28797 |
$tm[3] = 1;
|
28798 |
$tm[4] = -$tm[2] * $y;
|
28799 |
$tm[5] = -$tm[1] * $x;
|
|
|
28800 |
// skew the coordinate system
|
28801 |
if ($returnstring) {
|
28802 |
-
return
|
28803 |
} else {
|
28804 |
$this->_transform($tm);
|
28805 |
}
|
@@ -28825,11 +29048,13 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28825 |
$a = preg_split('/<(.*?)>/ms', $html, -1, PREG_SPLIT_DELIM_CAPTURE);
|
28826 |
foreach ($a as $i => $e) {
|
28827 |
if ($i % 2 == 0) {
|
|
|
28828 |
// ignore if in Textarea
|
28829 |
if ($i > 0 && strtolower(substr($a[$i - 1], 1, 8)) == 'textarea') {
|
28830 |
$a[$i] = $e;
|
28831 |
continue;
|
28832 |
}
|
|
|
28833 |
$e = UtfString::strcode2utf($e);
|
28834 |
$e = $this->lesser_entity_decode($e);
|
28835 |
|
@@ -28841,7 +29066,9 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28841 |
$chardata = [];
|
28842 |
$subchunk = 0;
|
28843 |
$charctr = 0;
|
|
|
28844 |
foreach ($earr as $char) {
|
|
|
28845 |
$ucd_record = Ucdn::get_ucd_record($char);
|
28846 |
$sbl = $ucd_record[6];
|
28847 |
|
@@ -28880,11 +29107,13 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28880 |
|
28881 |
$o = '';
|
28882 |
for ($sch = 0; $sch <= $subchunk; $sch++) {
|
|
|
28883 |
if (isset($chardata[$sch])) {
|
28884 |
$s = '';
|
28885 |
for ($j = 0; $j < count($chardata[$sch]); $j++) {
|
28886 |
$s .= UtfString::code2utf($chardata[$sch][$j]['uni']);
|
28887 |
}
|
|
|
28888 |
// ZZZ99 Undo lesser_entity_decode as above - but only for <>&
|
28889 |
$s = str_replace("&", "&", $s);
|
28890 |
$s = str_replace("<", "<", $s);
|
@@ -28893,8 +29122,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28893 |
// Check Vietnamese if Latin script - even if Basescript
|
28894 |
if ($scriptblocks[$sch] == Ucdn::SCRIPT_LATIN && $this->autoVietnamese && preg_match("/([" . $this->scriptToLanguage->getLanguageDelimiters('viet') . "])/u", $s)) {
|
28895 |
$o .= '<span lang="vi" class="lang_vi">' . $s . '</span>';
|
28896 |
-
} // Check Arabic for different languages if Arabic script - even if Basescript
|
28897 |
-
elseif ($scriptblocks[$sch] == Ucdn::SCRIPT_ARABIC && $this->autoArabic) {
|
28898 |
if (preg_match("/[" . $this->scriptToLanguage->getLanguageDelimiters('sindhi') . "]/u", $s)) {
|
28899 |
$o .= '<span lang="sd" class="lang_sd">' . $s . '</span>';
|
28900 |
} elseif (preg_match("/[" . $this->scriptToLanguage->getLanguageDelimiters('urdu') . "]/u", $s)) {
|
@@ -28909,8 +29137,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28909 |
// Just output chars
|
28910 |
$o .= $s;
|
28911 |
}
|
28912 |
-
} // Identify Script block if not Basescript, and mark up as language
|
28913 |
-
elseif ($scriptblocks[$sch] > 0 && $scriptblocks[$sch] != $this->baseScript && $this->scriptToLanguage->getLanguageByScript($scriptblocks[$sch])) {
|
28914 |
// Encase in <span>
|
28915 |
$o .= '<span lang="' . $this->scriptToLanguage->getLanguageByScript($scriptblocks[$sch]) . '" class="lang_' . $this->scriptToLanguage->getLanguageByScript($scriptblocks[$sch]) . '">';
|
28916 |
$o .= $s;
|
@@ -28927,60 +29154,62 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28927 |
$a[$i] = '<' . $e . '>';
|
28928 |
}
|
28929 |
}
|
|
|
28930 |
$n = implode('', $a);
|
28931 |
|
28932 |
return $n;
|
28933 |
}
|
28934 |
|
28935 |
-
// ===========================
|
28936 |
-
// Functions
|
28937 |
-
// Call-back function Used for usort in fn _tableWrite
|
28938 |
-
|
28939 |
-
function _cmpdom($a, $b)
|
28940 |
-
{
|
28941 |
-
return ($a["dom"] < $b["dom"]) ? -1 : 1;
|
28942 |
-
}
|
28943 |
-
|
28944 |
-
function mb_strrev($str, $enc = 'utf-8')
|
28945 |
-
{
|
28946 |
-
$ch = [];
|
28947 |
-
$ch = preg_split('//u', $str);
|
28948 |
-
$revch = array_reverse($ch);
|
28949 |
-
return implode('', $revch);
|
28950 |
-
}
|
28951 |
-
|
28952 |
/* -- COLUMNS -- */
|
28953 |
-
|
28954 |
-
|
|
|
28955 |
function columnAdjustAdd($type, $k, $xadj, $yadj, $a, $b, $c = 0, $d = 0, $e = 0, $f = 0)
|
28956 |
{
|
28957 |
-
if ($type
|
|
|
28958 |
$a += ($xadj * $k);
|
28959 |
$b -= ($yadj * $k);
|
|
|
28960 |
return 'BT ' . sprintf('%.3F %.3F', $a, $b) . ' Td';
|
28961 |
-
|
|
|
|
|
28962 |
$a += ($xadj * $k);
|
28963 |
$b -= ($yadj * $k);
|
|
|
28964 |
return sprintf('%.3F %.3F %.3F %.3F', $a, $b, $c, $d) . ' re';
|
28965 |
-
|
|
|
|
|
28966 |
$a += ($xadj * $k);
|
28967 |
$b -= ($yadj * $k);
|
|
|
28968 |
return sprintf('%.3F %.3F l', $a, $b);
|
28969 |
-
|
|
|
|
|
28970 |
$c += ($xadj * $k);
|
28971 |
$d -= ($yadj * $k);
|
|
|
28972 |
return sprintf('q %.3F 0 0 %.3F %.3F %.3F', $a, $b, $c, $d) . ' cm /' . $e;
|
28973 |
-
|
|
|
|
|
28974 |
$a += ($xadj * $k);
|
28975 |
$b -= ($yadj * $k);
|
|
|
28976 |
return sprintf('%.3F %.3F m', $a, $b);
|
28977 |
-
|
|
|
|
|
28978 |
$a += ($xadj * $k);
|
28979 |
$b -= ($yadj * $k);
|
28980 |
$c += ($xadj * $k);
|
28981 |
$d -= ($yadj * $k);
|
28982 |
$e += ($xadj * $k);
|
28983 |
$f -= ($yadj * $k);
|
|
|
28984 |
return sprintf('%.3F %.3F %.3F %.3F %.3F %.3F', $a, $b, $c, $d, $e, $f) . ' c';
|
28985 |
}
|
28986 |
}
|
@@ -28991,7 +29220,9 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28991 |
function ConvertAngle($s, $makepositive = true)
|
28992 |
{
|
28993 |
if (preg_match('/([\-]*[0-9\.]+)(deg|grad|rad)/i', $s, $m)) {
|
|
|
28994 |
$angle = $m[1] + 0;
|
|
|
28995 |
if (strtolower($m[2]) == 'deg') {
|
28996 |
$angle = $angle;
|
28997 |
} elseif (strtolower($m[2]) == 'grad') {
|
@@ -28999,20 +29230,25 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
28999 |
} elseif (strtolower($m[2]) == 'rad') {
|
29000 |
$angle = rad2deg($angle);
|
29001 |
}
|
|
|
29002 |
while ($angle >= 360) {
|
29003 |
$angle -= 360;
|
29004 |
}
|
|
|
29005 |
while ($angle <= -360) {
|
29006 |
$angle += 360;
|
29007 |
}
|
|
|
29008 |
if ($makepositive) { // always returns an angle between 0 and 360deg
|
29009 |
if ($angle < 0) {
|
29010 |
$angle += 360;
|
29011 |
}
|
29012 |
}
|
|
|
29013 |
} else {
|
29014 |
$angle = $s + 0;
|
29015 |
}
|
|
|
29016 |
return $angle;
|
29017 |
}
|
29018 |
|
@@ -29025,6 +29261,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
29025 |
$html = str_replace("'", "'", $html);
|
29026 |
$html = str_replace(""", '"', $html);
|
29027 |
$html = str_replace("&", "&", $html);
|
|
|
29028 |
return $html;
|
29029 |
}
|
29030 |
|
@@ -29066,9 +29303,11 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
29066 |
|
29067 |
$html = preg_replace('/\f/', '', $html); // replace formfeed by nothing
|
29068 |
$html = preg_replace('/\r/', '', $html); // replace carriage return by nothing
|
|
|
29069 |
// Well formed XHTML end tags
|
29070 |
$html = preg_replace('/<(br|hr)>/i', "<\\1 />", $html); // mPDF 6
|
29071 |
$html = preg_replace('/<(br|hr)\/>/i', "<\\1 />", $html);
|
|
|
29072 |
// Get rid of empty <thead></thead> etc
|
29073 |
$html = preg_replace('/<tr>\s*<\/tr>/i', '', $html);
|
29074 |
$html = preg_replace('/<thead>\s*<\/thead>/i', '', $html);
|
@@ -29091,9 +29330,11 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
29091 |
|
29092 |
// Preserve '\n's in content between the tags <pre> and </pre>
|
29093 |
if (preg_match('/<pre/', $html)) {
|
|
|
29094 |
$html_a = preg_split('/(\<\/?pre[^\>]*\>)/', $html, -1, 2);
|
29095 |
$h = [];
|
29096 |
$c = 0;
|
|
|
29097 |
foreach ($html_a as $s) {
|
29098 |
if ($c > 1 && preg_match('/^<\/pre/i', $s)) {
|
29099 |
$c--;
|
@@ -29108,13 +29349,17 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
29108 |
}
|
29109 |
array_push($h, $s);
|
29110 |
}
|
29111 |
-
|
|
|
29112 |
}
|
|
|
29113 |
$thereispre = preg_match_all('#<pre(.*?)>(.*?)</pre>#si', $html, $temp);
|
|
|
29114 |
// Preserve '\n's in content between the tags <textarea> and </textarea>
|
29115 |
$thereistextarea = preg_match_all('#<textarea(.*?)>(.*?)</textarea>#si', $html, $temp2);
|
29116 |
$html = preg_replace('/[\n]/', ' ', $html); // replace linefeed by spaces
|
29117 |
$html = preg_replace('/[\t]/', ' ', $html); // replace tabs by spaces
|
|
|
29118 |
// Converts < to < when not a tag
|
29119 |
$html = preg_replace('/<([^!\/a-zA-Z_:])/i', '<\\1', $html); // mPDF 5.7.3
|
29120 |
$html = preg_replace("/[ ]+/", ' ', $html);
|
@@ -29151,6 +29396,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
29151 |
$thereispre--;
|
29152 |
$iterator++;
|
29153 |
}
|
|
|
29154 |
$iterator = 0;
|
29155 |
while ($thereistextarea) { // Recover <textarea attributes>content</textarea>
|
29156 |
$temp2[2][$iterator] = preg_replace('/\t/', str_repeat(" ", $tabSpaces), $temp2[2][$iterator]);
|
@@ -29159,6 +29405,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
29159 |
$thereistextarea--;
|
29160 |
$iterator++;
|
29161 |
}
|
|
|
29162 |
// Restore original tag names
|
29163 |
$html = str_replace("<erp", "<pre", $html);
|
29164 |
$html = str_replace("</erp>", "</pre>", $html);
|
@@ -29174,6 +29421,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
|
|
29174 |
|
29175 |
// Fixes <p>₹</p> which browser copes with even though it is wrong!
|
29176 |
$html = preg_replace("/(&#[x]{0,1}[0-9a-f]{1,5})</i", "\\1;<", $html);
|
|
|
29177 |
return $html;
|
29178 |
}
|
29179 |
|
55 |
class Mpdf implements \Psr\Log\LoggerAwareInterface
|
56 |
{
|
57 |
|
58 |
+
const VERSION = '7.1.5';
|
59 |
|
60 |
const SCALE = 72 / 25.4;
|
61 |
|
3692 |
$y5 = $y3 - ($y3 - $y4) / 2;
|
3693 |
|
3694 |
$s = '';
|
3695 |
+
$s .= sprintf('%.3F %.3F m %.3F %.3F l S', $x1 * Mpdf::SCALE, ($this->h - $y1) * Mpdf::SCALE, $x5 * Mpdf::SCALE, $y5 * Mpdf::SCALE);
|
3696 |
$this->_out($s);
|
3697 |
|
3698 |
$s = '';
|
3699 |
+
$s .= sprintf('%.3F %.3F m %.3F %.3F l %.3F %.3F l %.3F %.3F l %.3F %.3F l ', $x5 * Mpdf::SCALE, $y5 * Mpdf::SCALE, $x3 * Mpdf::SCALE, $y3 * Mpdf::SCALE, $x2 * Mpdf::SCALE, ($this->h - $y2) * Mpdf::SCALE, $x4 * Mpdf::SCALE, $y4 * Mpdf::SCALE, $x5 * Mpdf::SCALE, $y5 * Mpdf::SCALE);
|
3700 |
+
$s .= $fill;
|
3701 |
$this->_out($s);
|
3702 |
}
|
3703 |
|
4311 |
$aix = $aixextra . $aix;
|
4312 |
|
4313 |
if ($this->ColorFlag) {
|
4314 |
+
$s .= $this->TextColor . ' ';
|
4315 |
}
|
4316 |
|
4317 |
$this->CurrentFont['used'] = true;
|
4377 |
$ut = 60 / 1000 * $this->FontSize;
|
4378 |
}
|
4379 |
$olw = $this->LineWidth;
|
4380 |
+
$s .= ' ' . (sprintf(' %.3F w', $ut * Mpdf::SCALE));
|
4381 |
+
$s .= ' ' . $this->_dounderline($x, $y + $adjusty, $txt, $OTLdata, $textvar);
|
4382 |
+
$s .= ' ' . (sprintf(' %.3F w', $olw * Mpdf::SCALE));
|
4383 |
if ($this->FillColor != $c) {
|
4384 |
$s.= ' ' . $this->FillColor . ' ';
|
4385 |
}
|
4403 |
$ut = 60 / 1000 * $this->FontSize;
|
4404 |
}
|
4405 |
$olw = $this->LineWidth;
|
4406 |
+
$s .= ' ' . (sprintf(' %.3F w', $ut * Mpdf::SCALE));
|
4407 |
+
$s .= ' ' . $this->_dounderline($x, $y + $adjusty, $txt, $OTLdata, $textvar);
|
4408 |
+
$s .= ' ' . (sprintf(' %.3F w', $olw * Mpdf::SCALE));
|
4409 |
if ($this->FillColor != $c) {
|
4410 |
$s.= ' ' . $this->FillColor . ' ';
|
4411 |
}
|
4664 |
return [$charspacing, $ws, $kashida_space];
|
4665 |
}
|
4666 |
|
4667 |
+
/**
|
4668 |
+
* Output a cell
|
4669 |
+
*
|
4670 |
+
* Expects input to be mb_encoded if necessary and RTL reversed
|
4671 |
+
*
|
4672 |
+
* @since mPDF 5.7.1
|
4673 |
+
*/
|
4674 |
function Cell($w, $h = 0, $txt = '', $border = 0, $ln = 0, $align = '', $fill = 0, $link = '', $currentx = 0, $lcpaddingL = 0, $lcpaddingR = 0, $valign = 'M', $spanfill = 0, $exactWidth = false, $OTLdata = false, $textvar = 0, $lineBox = false)
|
4675 |
{
|
|
|
|
|
|
|
4676 |
// NON_BREAKING SPACE
|
4677 |
if ($this->usingCoreFont) {
|
4678 |
$txt = str_replace(chr(160), chr(32), $txt);
|
4681 |
}
|
4682 |
|
4683 |
$oldcolumn = $this->CurrCol;
|
4684 |
+
|
4685 |
// Automatic page break
|
4686 |
// Allows PAGE-BREAK-AFTER = avoid to work
|
4687 |
if (isset($this->blk[$this->blklvl])) {
|
4689 |
} else {
|
4690 |
$bottom = 0;
|
4691 |
}
|
4692 |
+
|
4693 |
+
if (!$this->tableLevel
|
4694 |
+
&& (
|
4695 |
+
($this->y + $this->divheight > $this->PageBreakTrigger)
|
4696 |
+
|| ($this->y + $h > $this->PageBreakTrigger)
|
4697 |
+
|| (
|
4698 |
+
$this->y + ($h * 2) + $bottom > $this->PageBreakTrigger
|
4699 |
+
&& $this->blk[$this->blklvl]['page_break_after_avoid']
|
4700 |
+
)
|
4701 |
+
)
|
4702 |
+
&& !$this->InFooter
|
4703 |
+
&& $this->AcceptPageBreak()
|
4704 |
+
) { // mPDF 5.7.2
|
4705 |
+
|
4706 |
$x = $this->x; // Current X position
|
4707 |
+
|
4708 |
// WORD SPACING
|
4709 |
$ws = $this->ws; // Word Spacing
|
4710 |
$charspacing = $this->charspacing; // Character Spacing
|
4711 |
$this->ResetSpacing();
|
4712 |
|
4713 |
$this->AddPage($this->CurOrientation);
|
4714 |
+
|
4715 |
// Added to correct for OddEven Margins
|
4716 |
$x += $this->MarginCorrection;
|
4717 |
if ($currentx) {
|
4725 |
// Test: to put line through centre of cell: $this->Line($this->x,$this->y+($h/2),$this->x+50,$this->y+($h/2));
|
4726 |
// Test: to put border around cell as it is specified: $border='LRTB';
|
4727 |
|
|
|
4728 |
/* -- COLUMNS -- */
|
4729 |
// COLS
|
4730 |
// COLUMN CHANGE
|
4749 |
if ($w == 0) {
|
4750 |
$w = $this->w - $this->rMargin - $this->x;
|
4751 |
}
|
4752 |
+
|
4753 |
$s = '';
|
4754 |
if ($fill == 1 && $this->FillColor) {
|
4755 |
if ((isset($this->pageoutput[$this->page]['FillColor']) && $this->pageoutput[$this->page]['FillColor'] != $this->FillColor) || !isset($this->pageoutput[$this->page]['FillColor'])) {
|
4758 |
$this->pageoutput[$this->page]['FillColor'] = $this->FillColor;
|
4759 |
}
|
4760 |
|
|
|
4761 |
if ($lineBox && isset($lineBox['boxtop']) && $txt) { // i.e. always from WriteFlowingBlock/finishFlowingBlock (but not objects -
|
4762 |
// which only have $lineBox['top'] set)
|
4763 |
$boxtop = $this->y + $lineBox['boxtop'];
|
4780 |
$bord_boxbottom = $this->y + $lineBox['border-boxbottom'] - $lineBox['border-baseline-shift'];
|
4781 |
$bord_boxheight = $bord_boxbottom - $bord_boxtop;
|
4782 |
}
|
4783 |
+
|
4784 |
} else {
|
4785 |
+
|
4786 |
$boxtop = $this->y;
|
4787 |
$boxheight = $h;
|
4788 |
$boxbottom = $this->y + $h;
|
4789 |
$baseline_shift = 0;
|
4790 |
+
|
4791 |
if ($txt != '') {
|
4792 |
+
|
4793 |
// FONT SIZE - this determines the baseline caculation
|
4794 |
$bfs = $this->FontSize;
|
4795 |
// Calculate baseline Superscript and Subscript Y coordinate adjustment
|
4798 |
|
4799 |
if ($textvar & TextVars::FA_SUPERSCRIPT) {
|
4800 |
$baseline_shift = $this->textparam['text-baseline'];
|
4801 |
+
} elseif ($textvar & TextVars::FA_SUBSCRIPT) {
|
|
|
4802 |
$baseline_shift = $this->textparam['text-baseline'];
|
4803 |
+
} elseif ($this->bullet) {
|
|
|
4804 |
$baseline += ($bfx - 0.7) * $this->FontSize;
|
4805 |
}
|
4806 |
|
4812 |
} else {
|
4813 |
$va = 0.5 * $h;
|
4814 |
} // Middle
|
4815 |
+
|
4816 |
// ONLY SET THESE IF WANT TO CONFINE BORDER +/- FILL TO FIT FONTSIZE - NOT FULL CELL AS IS ORIGINAL FUNCTION
|
4817 |
// spanfill or spanborder are set in FlowingBlock functions
|
4818 |
if ($spanfill || !empty($this->spanborddet) || $link != '') {
|
4821 |
$boxheight = $this->FontSize * (1 + $exth);
|
4822 |
$boxbottom = $boxtop + $boxheight;
|
4823 |
}
|
4824 |
+
|
4825 |
$glyphYorigin = $baseline + $va;
|
4826 |
}
|
4827 |
+
|
4828 |
$boxtop -= $baseline_shift;
|
4829 |
$boxbottom -= $baseline_shift;
|
4830 |
$bord_boxtop = $bg_boxtop = $boxtop;
|
4832 |
$bord_boxheight = $bg_boxheight = $boxheight = $boxbottom - $boxtop;
|
4833 |
}
|
4834 |
|
|
|
4835 |
$bbw = $tbw = $lbw = $rbw = 0; // Border widths
|
4836 |
if (!empty($this->spanborddet)) {
|
4837 |
+
|
4838 |
if (!isset($this->spanborddet['B'])) {
|
4839 |
$this->spanborddet['B'] = ['s' => 0, 'style' => '', 'w' => 0];
|
4840 |
}
|
4841 |
+
|
4842 |
if (!isset($this->spanborddet['T'])) {
|
4843 |
$this->spanborddet['T'] = ['s' => 0, 'style' => '', 'w' => 0];
|
4844 |
}
|
4845 |
+
|
4846 |
if (!isset($this->spanborddet['L'])) {
|
4847 |
$this->spanborddet['L'] = ['s' => 0, 'style' => '', 'w' => 0];
|
4848 |
}
|
4849 |
+
|
4850 |
if (!isset($this->spanborddet['R'])) {
|
4851 |
$this->spanborddet['R'] = ['s' => 0, 'style' => '', 'w' => 0];
|
4852 |
}
|
4853 |
+
|
4854 |
$bbw = $this->spanborddet['B']['w'];
|
4855 |
$tbw = $this->spanborddet['T']['w'];
|
4856 |
$lbw = $this->spanborddet['L']['w'];
|
4857 |
$rbw = $this->spanborddet['R']['w'];
|
4858 |
}
|
4859 |
+
|
4860 |
if ($fill == 1 || $border == 1 || !empty($this->spanborddet)) {
|
4861 |
+
|
4862 |
if (!empty($this->spanborddet)) {
|
4863 |
+
|
4864 |
if ($fill == 1) {
|
4865 |
+
$s .= sprintf('%.3F %.3F %.3F %.3F re f ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bg_boxtop + $tbw) * Mpdf::SCALE, ($w + $lbw + $rbw) * Mpdf::SCALE, (-$bg_boxheight - $tbw - $bbw) * Mpdf::SCALE);
|
4866 |
}
|
4867 |
+
|
4868 |
$s.= ' q ';
|
4869 |
$dashon = 3;
|
4870 |
$dashoff = 3.5;
|
4871 |
$dot = 2.5;
|
4872 |
+
|
4873 |
if ($tbw) {
|
4874 |
$short = 0;
|
4875 |
+
|
4876 |
if ($this->spanborddet['T']['style'] == 'dashed') {
|
4877 |
+
$s .= sprintf(' 0 j 0 J [%.3F %.3F] 0 d ', $tbw * $dashon * Mpdf::SCALE, $tbw * $dashoff * Mpdf::SCALE);
|
4878 |
} elseif ($this->spanborddet['T']['style'] == 'dotted') {
|
4879 |
+
$s .= sprintf(' 1 j 1 J [%.3F %.3F] %.3F d ', 0.001, $tbw * $dot * Mpdf::SCALE, -$tbw / 2 * Mpdf::SCALE);
|
4880 |
$short = $tbw / 2;
|
4881 |
} else {
|
4882 |
+
$s .= ' 0 j 0 J [] 0 d ';
|
4883 |
}
|
4884 |
+
|
4885 |
if ($this->spanborddet['T']['style'] != 'dotted') {
|
4886 |
$s .= 'q ';
|
4887 |
$s .= sprintf('%.3F %.3F m ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE);
|
4890 |
$s .= sprintf('%.3F %.3F l ', ($this->x) * Mpdf::SCALE, ($this->h - $bord_boxtop) * Mpdf::SCALE);
|
4891 |
$s .= ' h W n '; // Ends path no-op & Sets the clipping path
|
4892 |
}
|
4893 |
+
|
4894 |
$c = $this->SetDColor($this->spanborddet['T']['c'], true);
|
4895 |
+
|
4896 |
if ($this->spanborddet['T']['style'] == 'double') {
|
4897 |
+
$s .= sprintf(' %s %.3F w ', $c, $tbw / 3 * Mpdf::SCALE);
|
4898 |
+
$s .= sprintf('%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw * 5 / 6) * Mpdf::SCALE, ($this->x + $w + $rbw) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw * 5 / 6) * Mpdf::SCALE);
|
4899 |
+
$s .= sprintf('%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw / 6) * Mpdf::SCALE, ($this->x + $w + $rbw) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw / 6) * Mpdf::SCALE);
|
4900 |
} elseif ($this->spanborddet['T']['style'] == 'dotted') {
|
4901 |
+
$s .= sprintf(' %s %.3F w ', $c, $tbw * Mpdf::SCALE);
|
4902 |
+
$s .= sprintf('%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw / 2) * Mpdf::SCALE, ($this->x + $w + $rbw - $short) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw / 2) * Mpdf::SCALE);
|
4903 |
} else {
|
4904 |
+
$s .= sprintf(' %s %.3F w ', $c, $tbw * Mpdf::SCALE);
|
4905 |
+
$s .= sprintf('%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw / 2) * Mpdf::SCALE, ($this->x + $w + $rbw - $short) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw / 2) * Mpdf::SCALE);
|
4906 |
}
|
4907 |
+
|
4908 |
if ($this->spanborddet['T']['style'] != 'dotted') {
|
4909 |
$s .= ' Q ';
|
4910 |
}
|
4911 |
}
|
4912 |
if ($bbw) {
|
4913 |
+
|
4914 |
$short = 0;
|
4915 |
if ($this->spanborddet['B']['style'] == 'dashed') {
|
4916 |
+
$s .= sprintf(' 0 j 0 J [%.3F %.3F] 0 d ', $bbw * $dashon * Mpdf::SCALE, $bbw * $dashoff * Mpdf::SCALE);
|
4917 |
} elseif ($this->spanborddet['B']['style'] == 'dotted') {
|
4918 |
+
$s .= sprintf(' 1 j 1 J [%.3F %.3F] %.3F d ', 0.001, $bbw * $dot * Mpdf::SCALE, -$bbw / 2 * Mpdf::SCALE);
|
4919 |
$short = $bbw / 2;
|
4920 |
} else {
|
4921 |
+
$s .= ' 0 j 0 J [] 0 d ';
|
4922 |
}
|
4923 |
+
|
4924 |
if ($this->spanborddet['B']['style'] != 'dotted') {
|
4925 |
$s .= 'q ';
|
4926 |
$s .= sprintf('%.3F %.3F m ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw) * Mpdf::SCALE);
|
4929 |
$s .= sprintf('%.3F %.3F l ', ($this->x) * Mpdf::SCALE, ($this->h - $bord_boxbottom) * Mpdf::SCALE);
|
4930 |
$s .= ' h W n '; // Ends path no-op & Sets the clipping path
|
4931 |
}
|
4932 |
+
|
4933 |
$c = $this->SetDColor($this->spanborddet['B']['c'], true);
|
4934 |
+
|
4935 |
if ($this->spanborddet['B']['style'] == 'double') {
|
4936 |
+
$s .= sprintf(' %s %.3F w ', $c, $bbw / 3 * Mpdf::SCALE);
|
4937 |
+
$s .= sprintf('%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw / 6) * Mpdf::SCALE, ($this->x + $w + $rbw - $short) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw / 6) * Mpdf::SCALE);
|
4938 |
+
$s .= sprintf('%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw * 5 / 6) * Mpdf::SCALE, ($this->x + $w + $rbw - $short) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw * 5 / 6) * Mpdf::SCALE);
|
4939 |
} elseif ($this->spanborddet['B']['style'] == 'dotted') {
|
4940 |
+
$s .= sprintf(' %s %.3F w ', $c, $bbw * Mpdf::SCALE);
|
4941 |
+
$s .= sprintf('%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw / 2) * Mpdf::SCALE, ($this->x + $w + $rbw - $short) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw / 2) * Mpdf::SCALE);
|
4942 |
} else {
|
4943 |
+
$s .= sprintf(' %s %.3F w ', $c, $bbw * Mpdf::SCALE);
|
4944 |
+
$s .= sprintf('%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw / 2) * Mpdf::SCALE, ($this->x + $w + $rbw - $short) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw / 2) * Mpdf::SCALE);
|
4945 |
}
|
4946 |
+
|
4947 |
if ($this->spanborddet['B']['style'] != 'dotted') {
|
4948 |
$s .= ' Q ';
|
4949 |
}
|
4950 |
}
|
4951 |
+
|
4952 |
if ($lbw) {
|
4953 |
$short = 0;
|
4954 |
if ($this->spanborddet['L']['style'] == 'dashed') {
|
4955 |
+
$s .= sprintf(' 0 j 0 J [%.3F %.3F] 0 d ', $lbw * $dashon * Mpdf::SCALE, $lbw * $dashoff * Mpdf::SCALE);
|
4956 |
} elseif ($this->spanborddet['L']['style'] == 'dotted') {
|
4957 |
+
$s .= sprintf(' 1 j 1 J [%.3F %.3F] %.3F d ', 0.001, $lbw * $dot * Mpdf::SCALE, -$lbw / 2 * Mpdf::SCALE);
|
4958 |
$short = $lbw / 2;
|
4959 |
} else {
|
4960 |
+
$s .= ' 0 j 0 J [] 0 d ';
|
4961 |
}
|
4962 |
+
|
4963 |
if ($this->spanborddet['L']['style'] != 'dotted') {
|
4964 |
$s .= 'q ';
|
4965 |
$s .= sprintf('%.3F %.3F m ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw) * Mpdf::SCALE);
|
4968 |
$s .= sprintf('%.3F %.3F l ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE);
|
4969 |
$s .= ' h W n '; // Ends path no-op & Sets the clipping path
|
4970 |
}
|
4971 |
+
|
4972 |
$c = $this->SetDColor($this->spanborddet['L']['c'], true);
|
4973 |
if ($this->spanborddet['L']['style'] == 'double') {
|
4974 |
+
$s .= sprintf(' %s %.3F w ', $c, $lbw / 3 * Mpdf::SCALE);
|
4975 |
+
$s .= sprintf('%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw / 6) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE, ($this->x - $lbw / 6) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw + $short) * Mpdf::SCALE);
|
4976 |
+
$s .= sprintf('%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw * 5 / 6) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE, ($this->x - $lbw * 5 / 6) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw + $short) * Mpdf::SCALE);
|
4977 |
} elseif ($this->spanborddet['L']['style'] == 'dotted') {
|
4978 |
+
$s .= sprintf(' %s %.3F w ', $c, $lbw * Mpdf::SCALE);
|
4979 |
+
$s .= sprintf('%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw / 2) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE, ($this->x - $lbw / 2) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw + $short) * Mpdf::SCALE);
|
4980 |
} else {
|
4981 |
+
$s .= sprintf(' %s %.3F w ', $c, $lbw * Mpdf::SCALE);
|
4982 |
+
$s .= sprintf('%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw / 2) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE, ($this->x - $lbw / 2) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw + $short) * Mpdf::SCALE);
|
4983 |
}
|
4984 |
+
|
4985 |
if ($this->spanborddet['L']['style'] != 'dotted') {
|
4986 |
$s .= ' Q ';
|
4987 |
}
|
4988 |
}
|
4989 |
+
|
4990 |
if ($rbw) {
|
4991 |
+
|
4992 |
$short = 0;
|
4993 |
if ($this->spanborddet['R']['style'] == 'dashed') {
|
4994 |
+
$s .= sprintf(' 0 j 0 J [%.3F %.3F] 0 d ', $rbw * $dashon * Mpdf::SCALE, $rbw * $dashoff * Mpdf::SCALE);
|
4995 |
} elseif ($this->spanborddet['R']['style'] == 'dotted') {
|
4996 |
+
$s .= sprintf(' 1 j 1 J [%.3F %.3F] %.3F d ', 0.001, $rbw * $dot * Mpdf::SCALE, -$rbw / 2 * Mpdf::SCALE);
|
4997 |
$short = $rbw / 2;
|
4998 |
} else {
|
4999 |
+
$s .= ' 0 j 0 J [] 0 d ';
|
5000 |
}
|
5001 |
+
|
5002 |
if ($this->spanborddet['R']['style'] != 'dotted') {
|
5003 |
$s .= 'q ';
|
5004 |
$s .= sprintf('%.3F %.3F m ', ($this->x + $w + $rbw) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw) * Mpdf::SCALE);
|
5007 |
$s .= sprintf('%.3F %.3F l ', ($this->x + $w + $rbw) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE);
|
5008 |
$s .= ' h W n '; // Ends path no-op & Sets the clipping path
|
5009 |
}
|
5010 |
+
|
5011 |
$c = $this->SetDColor($this->spanborddet['R']['c'], true);
|
5012 |
if ($this->spanborddet['R']['style'] == 'double') {
|
5013 |
+
$s .= sprintf(' %s %.3F w ', $c, $rbw / 3 * Mpdf::SCALE);
|
5014 |
+
$s .= sprintf('%.3F %.3F m %.3F %.3F l S ', ($this->x + $w + $rbw / 6) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE, ($this->x + $w + $rbw / 6) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw + $short) * Mpdf::SCALE);
|
5015 |
+
$s .= sprintf('%.3F %.3F m %.3F %.3F l S ', ($this->x + $w + $rbw * 5 / 6) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE, ($this->x + $w + $rbw * 5 / 6) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw + $short) * Mpdf::SCALE);
|
5016 |
} elseif ($this->spanborddet['R']['style'] == 'dotted') {
|
5017 |
+
$s .= sprintf(' %s %.3F w ', $c, $rbw * Mpdf::SCALE);
|
5018 |
+
$s .= sprintf('%.3F %.3F m %.3F %.3F l S ', ($this->x + $w + $rbw / 2) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE, ($this->x + $w + $rbw / 2) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw + $short) * Mpdf::SCALE);
|
5019 |
} else {
|
5020 |
+
$s .= sprintf(' %s %.3F w ', $c, $rbw * Mpdf::SCALE);
|
5021 |
+
$s .= sprintf('%.3F %.3F m %.3F %.3F l S ', ($this->x + $w + $rbw / 2) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE, ($this->x + $w + $rbw / 2) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw + $short) * Mpdf::SCALE);
|
5022 |
}
|
5023 |
+
|
5024 |
if ($this->spanborddet['R']['style'] != 'dotted') {
|
5025 |
$s .= ' Q ';
|
5026 |
}
|
5027 |
}
|
5028 |
+
|
5029 |
$s.= ' Q ';
|
5030 |
+
|
5031 |
} else { // If "border", does not come from WriteFlowingBlock or FinishFlowingBlock
|
5032 |
+
|
5033 |
if ($fill == 1) {
|
5034 |
$op = ($border == 1) ? 'B' : 'f';
|
5035 |
} else {
|
5036 |
$op = 'S';
|
5037 |
}
|
5038 |
+
|
5039 |
+
$s .= sprintf('%.3F %.3F %.3F %.3F re %s ', $this->x * Mpdf::SCALE, ($this->h - $bg_boxtop) * Mpdf::SCALE, $w * Mpdf::SCALE, -$bg_boxheight * Mpdf::SCALE, $op);
|
5040 |
}
|
5041 |
}
|
5042 |
|
5043 |
if (is_string($border)) { // If "border", does not come from WriteFlowingBlock or FinishFlowingBlock
|
5044 |
+
|
5045 |
$x = $this->x;
|
5046 |
$y = $this->y;
|
5047 |
+
|
5048 |
if (is_int(strpos($border, 'L'))) {
|
5049 |
+
$s .= sprintf('%.3F %.3F m %.3F %.3F l S ', $x * Mpdf::SCALE, ($this->h - $bord_boxtop) * Mpdf::SCALE, $x * Mpdf::SCALE, ($this->h - ($bord_boxbottom)) * Mpdf::SCALE);
|
5050 |
}
|
5051 |
+
|
5052 |
if (is_int(strpos($border, 'T'))) {
|
5053 |
+
$s .= sprintf('%.3F %.3F m %.3F %.3F l S ', $x * Mpdf::SCALE, ($this->h - $bord_boxtop) * Mpdf::SCALE, ($x + $w) * Mpdf::SCALE, ($this->h - $bord_boxtop) * Mpdf::SCALE);
|
5054 |
}
|
5055 |
+
|
5056 |
if (is_int(strpos($border, 'R'))) {
|
5057 |
+
$s .= sprintf('%.3F %.3F m %.3F %.3F l S ', ($x + $w) * Mpdf::SCALE, ($this->h - $bord_boxtop) * Mpdf::SCALE, ($x + $w) * Mpdf::SCALE, ($this->h - ($bord_boxbottom)) * Mpdf::SCALE);
|
5058 |
}
|
5059 |
+
|
5060 |
if (is_int(strpos($border, 'B'))) {
|
5061 |
+
$s .= sprintf('%.3F %.3F m %.3F %.3F l S ', $x * Mpdf::SCALE, ($this->h - ($bord_boxbottom)) * Mpdf::SCALE, ($x + $w) * Mpdf::SCALE, ($this->h - ($bord_boxbottom)) * Mpdf::SCALE);
|
5062 |
}
|
5063 |
}
|
5064 |
|
5065 |
if ($txt != '') {
|
5066 |
+
|
5067 |
if ($exactWidth) {
|
5068 |
$stringWidth = $w;
|
5069 |
} else {
|
5729 |
$tj .= $this->_escape($tc);
|
5730 |
}
|
5731 |
$tj .= ')';
|
5732 |
+
$s .= sprintf(' %.3F Tc [%s] TJ', $this->charspacing, $tj);
|
5733 |
|
5734 |
|
5735 |
if (($i + 1) < count($t)) {
|
5736 |
+
$s .= sprintf(' %.3F Tc (%s) Tj', $this->ws + $this->charspacing, $space);
|
5737 |
}
|
5738 |
}
|
5739 |
+
$s .= ' ET ';
|
5740 |
} elseif (!$this->usingCoreFont) {
|
5741 |
$s = '';
|
5742 |
$tj = '(';
|
5751 |
$tj .= $this->_escape($tx);
|
5752 |
}
|
5753 |
$tj .= ')';
|
5754 |
+
$s .= sprintf(' BT ' . $aix . ' [%s] TJ ET ', $x * Mpdf::SCALE, ($this->h - $y) * Mpdf::SCALE, $tj);
|
5755 |
} else { // CORE Font
|
5756 |
$s = '';
|
5757 |
$tj = '(';
|
5764 |
$tj .= $this->_escape($txt[$i]);
|
5765 |
}
|
5766 |
$tj .= ')';
|
5767 |
+
$s .= sprintf(' BT ' . $aix . ' [%s] TJ ET ', $x * Mpdf::SCALE, ($this->h - $y) * Mpdf::SCALE, $tj);
|
5768 |
}
|
5769 |
|
5770 |
return $s;
|
5834 |
} else {
|
5835 |
$b2 = '';
|
5836 |
if (is_int(strpos($border, 'L'))) {
|
5837 |
+
$b2 .= 'L';
|
5838 |
}
|
5839 |
if (is_int(strpos($border, 'R'))) {
|
5840 |
+
$b2 .= 'R';
|
5841 |
}
|
5842 |
$b = is_int(strpos($border, 'T')) ? $b2 . 'T' : $b2;
|
5843 |
}
|
6049 |
}
|
6050 |
// Last chunk
|
6051 |
if ($border and is_int(strpos($border, 'B'))) {
|
6052 |
+
$b .= 'B';
|
6053 |
}
|
6054 |
if (!$this->usingCoreFont) {
|
6055 |
$tmp = rtrim(mb_substr($s, $j, $i - $j, $this->mb_enc));
|
9904 |
$this->_out('<</Type /Pages');
|
9905 |
$kids = '/Kids [';
|
9906 |
for ($i = 0; $i < $nb; $i++) {
|
9907 |
+
$kids .= (3 + 2 * $i) . ' 0 R ';
|
9908 |
}
|
9909 |
$this->_out($kids . ']');
|
9910 |
$this->_out('/Count ' . $nb);
|
10248 |
$this->kwt_Annots[$this->page][] = $an;
|
10249 |
return;
|
10250 |
}
|
10251 |
+
|
10252 |
if ($this->writingHTMLheader || $this->writingHTMLfooter) {
|
10253 |
$this->HTMLheaderPageAnnots[] = $an;
|
10254 |
return;
|
10255 |
}
|
10256 |
+
|
10257 |
// Put an Annotation on the page
|
10258 |
$this->PageAnnots[$page][] = $an;
|
10259 |
+
|
10260 |
/* -- COLUMNS -- */
|
10261 |
// Save cross-reference to Column buffer
|
10262 |
+
$ref = isset($this->PageAnnots[$this->page]) ? (count($this->PageAnnots[$this->page]) - 1) : -1;
|
10263 |
$this->columnAnnots[$this->CurrCol][intval($this->x)][intval($this->y)] = $ref;
|
10264 |
/* -- END COLUMNS -- */
|
10265 |
}
|
10452 |
$v = $v | 4;
|
10453 |
$v = $v & ~32;
|
10454 |
} // SYMBOLIC font flag
|
10455 |
+
$s .= ' /' . $kd . ' ' . $v . "\n";
|
10456 |
}
|
10457 |
+
$s .= '/FontFile2 ' . ($this->n + 2) . ' 0 R';
|
10458 |
$this->_out($s . '>>');
|
10459 |
$this->_out('endobj');
|
10460 |
|
10962 |
if (isset($info['trns']) and is_array($info['trns'])) {
|
10963 |
$trns = '';
|
10964 |
for ($i = 0; $i < count($info['trns']); $i++) {
|
10965 |
+
$trns .= $info['trns'][$i] . ' ' . $info['trns'][$i] . ' ';
|
10966 |
}
|
10967 |
$this->_out('/Mask [' . $trns . ']');
|
10968 |
}
|
20546 |
$style = '';
|
20547 |
foreach (['B', 'I'] as $s) {
|
20548 |
if ($this->$s) {
|
20549 |
+
$style .= $s;
|
20550 |
}
|
20551 |
}
|
20552 |
$this->currentfontstyle = $style;
|
20561 |
if (isset($arr[$s])) {
|
20562 |
if ($arr[$s]) {
|
20563 |
$this->$s = true;
|
20564 |
+
$style .= $s;
|
20565 |
} else {
|
20566 |
$this->$s = false;
|
20567 |
}
|
20568 |
} elseif ($this->$s) {
|
20569 |
+
$style .= $s;
|
20570 |
}
|
20571 |
}
|
20572 |
$this->currentfontstyle = $style;
|
20580 |
foreach (['B', 'I'] as $s) {
|
20581 |
if (strpos($str, $s) !== false) {
|
20582 |
$this->$s = true;
|
20583 |
+
$style .= $s;
|
20584 |
} else {
|
20585 |
$this->$s = false;
|
20586 |
}
|
22271 |
$h = $heightrow[$i];
|
22272 |
if (isset($cell['rowspan'])) {
|
22273 |
for ($k = $i + $cell['rowspan'] - 1; $k > $i; $k--) {
|
22274 |
+
if (array_key_exists($k, $heightrow)) {
|
22275 |
+
$h += $heightrow[$k];
|
22276 |
+
} else {
|
22277 |
+
$this->logger->debug('Possible non-wellformed HTML markup in a table', ['context' => LogContext::HTML_MARKUP]);
|
22278 |
+
}
|
22279 |
}
|
22280 |
}
|
22281 |
$cell['y0'] = $y;
|
27090 |
$this->links[$v['link']][1] = $this->y0;
|
27091 |
}
|
27092 |
/* -- END TOC -- */
|
27093 |
+
|
27094 |
$trans_on = false;
|
27095 |
foreach ($this->columnbuffer as $key => $s) {
|
27096 |
+
|
27097 |
if (isset($s['rel_y'])) { // only process position sensitive data
|
27098 |
+
|
27099 |
// Set ratio to expand y values or heights
|
27100 |
+
if (isset($this->ColDetails[$s['col']]['max_bottom']) && $this->ColDetails[$s['col']]['max_bottom']) {
|
27101 |
$ratio = ($lowest_bottom_y - ($this->y0)) / ($this->ColDetails[$s['col']]['max_bottom'] - ($this->y0));
|
27102 |
} else {
|
27103 |
$ratio = 1;
|
27104 |
}
|
27105 |
+
|
27106 |
if (($ratio > 1) && ($ratio <= $this->max_colH_correction)) {
|
27107 |
// Start Transformation
|
27108 |
$this->pages[$this->page] .= $this->StartTransform(true) . "\n";
|
27110 |
$trans_on = true;
|
27111 |
}
|
27112 |
}
|
27113 |
+
|
27114 |
// Now output the adjusted values
|
27115 |
$this->pages[$this->page] .= $s['s'] . "\n";
|
27116 |
if (isset($s['rel_y']) && ($ratio > 1) && ($ratio <= $this->max_colH_correction)) {
|
27119 |
$trans_on = false;
|
27120 |
}
|
27121 |
}
|
27122 |
+
|
27123 |
if ($trans_on) {
|
27124 |
$this->pages[$this->page] .= $this->StopTransform(true) . "\n";
|
27125 |
}
|
27127 |
if ($lowest_bottom_y > 0) {
|
27128 |
$this->y = $lowest_bottom_y;
|
27129 |
}
|
27130 |
+
|
27131 |
+
} else { // Just reproduce the page as it was
|
27132 |
+
|
27133 |
// If page has not ended but height adjustment was disabled by custom column-break - adjust y
|
27134 |
$lowest_bottom_y = 0;
|
27135 |
+
|
27136 |
if (!$this->ColActive && (!$this->ColumnAdjust || $this->keepColumns)) {
|
27137 |
+
|
27138 |
// calculate the lowest bottom margin
|
27139 |
foreach ($this->columnbuffer as $key => $s) {
|
27140 |
+
|
27141 |
// Only process output data
|
27142 |
$t = $s['s'];
|
27143 |
+
if ($t === 'ACROFORM'
|
27144 |
+
|| (preg_match('/BT \d+\.\d\d+ (\d+\.\d\d+) Td/', $t))
|
27145 |
+
|| (preg_match('/\d+\.\d\d+ (\d+\.\d\d+) \d+\.\d\d+ [\-]{0,1}\d+\.\d\d+ re/', $t))
|
27146 |
+
|| (preg_match('/\d+\.\d\d+ (\d+\.\d\d+) l/', $t))
|
27147 |
+
|| (preg_match('/q \d+\.\d\d+ 0 0 \d+\.\d\d+ \d+\.\d\d+ (\d+\.\d\d+) cm \/(I|FO)\d+ Do Q/', $t))
|
27148 |
+
|| (preg_match('/\d+\.\d\d+ (\d+\.\d\d+) m/', $t))
|
27149 |
+
|| (preg_match('/\d+\.\d\d+ (\d+\.\d\d+) \d+\.\d\d+ \d+\.\d\d+ \d+\.\d\d+ \d+\.\d\d+ c/', $t))) {
|
27150 |
+
|
27151 |
$clb = $s['y'] + $s['h'];
|
27152 |
+
|
27153 |
+
if (isset($this->ColDetails[$s['col']]['max_bottom']) && $clb > $this->ColDetails[$s['col']]['max_bottom'] || (!isset($this->ColDetails[$s['col']]['max_bottom']) && $clb)) {
|
27154 |
$this->ColDetails[$s['col']]['max_bottom'] = $clb;
|
27155 |
}
|
27156 |
+
|
27157 |
if ($clb > $lowest_bottom_y) {
|
27158 |
$lowest_bottom_y = $clb;
|
27159 |
}
|
27160 |
}
|
27161 |
}
|
27162 |
}
|
27163 |
+
|
27164 |
foreach ($this->columnbuffer as $key => $s) {
|
27165 |
if ($s['s'] != 'ACROFORM') {
|
27166 |
$this->pages[$this->page] .= $s['s'] . "\n";
|
27167 |
}
|
27168 |
}
|
27169 |
+
|
27170 |
if ($lowest_bottom_y > 0) {
|
27171 |
$this->y = $lowest_bottom_y;
|
27172 |
}
|
27173 |
+
|
27174 |
/* -- BOOKMARKS -- */
|
27175 |
// Output Bookmarks
|
27176 |
foreach ($this->col_BMoutlines as $v) {
|
27177 |
$this->BMoutlines[] = ['t' => $v['t'], 'l' => $v['l'], 'y' => $v['y'], 'p' => $v['p']];
|
27178 |
}
|
27179 |
/* -- END BOOKMARKS -- */
|
27180 |
+
|
27181 |
/* -- TOC -- */
|
27182 |
// Output ToC
|
27183 |
foreach ($this->col_toc as $v) {
|
27185 |
}
|
27186 |
/* -- END TOC -- */
|
27187 |
}
|
27188 |
+
|
27189 |
foreach ($this->internallink as $key => $f) {
|
27190 |
+
|
27191 |
if (isset($this->internallink[$key]['col'])) {
|
27192 |
unset($this->internallink[$key]['col']);
|
27193 |
}
|
27194 |
+
|
27195 |
if (isset($this->internallink[$key]['rel_y'])) {
|
27196 |
unset($this->internallink[$key]['rel_y']);
|
27197 |
}
|
27212 |
function columnAdjustPregReplace($type, $xadj, $yadj, $pattern, $subject)
|
27213 |
{
|
27214 |
preg_match($pattern, $subject, $matches);
|
27215 |
+
|
27216 |
if (!count($matches)) {
|
27217 |
return $subject;
|
27218 |
}
|
27219 |
+
|
27220 |
if (!isset($matches[3])) {
|
27221 |
$matches[3] = 0;
|
27222 |
}
|
27223 |
+
|
27224 |
if (!isset($matches[4])) {
|
27225 |
$matches[4] = 0;
|
27226 |
}
|
27227 |
+
|
27228 |
if (!isset($matches[5])) {
|
27229 |
$matches[5] = 0;
|
27230 |
}
|
27231 |
+
|
27232 |
if (!isset($matches[6])) {
|
27233 |
$matches[6] = 0;
|
27234 |
}
|
27235 |
+
|
27236 |
return str_replace($matches[0], $this->columnAdjustAdd($type, Mpdf::SCALE, $xadj, $yadj, $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]), $subject);
|
27237 |
}
|
|
|
27238 |
/* -- END COLUMNS -- */
|
27239 |
|
27240 |
// ==================================================================
|
27242 |
function printcellbuffer()
|
27243 |
{
|
27244 |
if (count($this->cellBorderBuffer)) {
|
27245 |
+
|
27246 |
sort($this->cellBorderBuffer);
|
27247 |
+
|
27248 |
foreach ($this->cellBorderBuffer as $cbb) {
|
27249 |
+
|
27250 |
$cba = unpack("A16dom/nbord/A1side/ns/dbw/a6ca/A10style/dx/dy/dw/dh/dmbl/dmbr/dmrt/dmrb/dmtl/dmtr/dmlt/dmlb/dcpd/dover/", $cbb);
|
27251 |
$side = $cba['side'];
|
27252 |
$color = str_pad($cba['ca'], 6, "\x00");
|
27253 |
+
|
27254 |
$details = [];
|
27255 |
+
|
27256 |
$details[$side]['dom'] = (float) $cba['dom'];
|
27257 |
$details[$side]['s'] = $cba['s'];
|
27258 |
$details[$side]['w'] = $cba['bw'];
|
27259 |
$details[$side]['c'] = $color;
|
27260 |
$details[$side]['style'] = trim($cba['style']);
|
27261 |
+
|
27262 |
$details['mbw']['BL'] = $cba['mbl'];
|
27263 |
$details['mbw']['BR'] = $cba['mbr'];
|
27264 |
$details['mbw']['RT'] = $cba['mrt'];
|
27267 |
$details['mbw']['TR'] = $cba['mtr'];
|
27268 |
$details['mbw']['LT'] = $cba['mlt'];
|
27269 |
$details['mbw']['LB'] = $cba['mlb'];
|
27270 |
+
|
27271 |
$details['cellposdom'] = $cba['cpd'];
|
27272 |
+
|
27273 |
$details['p'] = $side;
|
27274 |
+
|
27275 |
if ($cba['over'] == 1) {
|
27276 |
$details[$side]['overlay'] = true;
|
27277 |
} else {
|
27278 |
$details[$side]['overlay'] = false;
|
27279 |
}
|
27280 |
+
|
27281 |
$this->_tableRect($cba['x'], $cba['y'], $cba['w'], $cba['h'], $cba['bord'], $details, false, false);
|
27282 |
}
|
27283 |
+
|
27284 |
$this->cellBorderBuffer = [];
|
27285 |
}
|
27286 |
}
|
27290 |
{
|
27291 |
|
27292 |
if (!$this->table_rotate) {
|
27293 |
+
|
27294 |
$this->pages[$this->page] .= $this->tablebuffer;
|
27295 |
+
|
27296 |
foreach ($this->tbrot_Links as $p => $l) {
|
27297 |
foreach ($l as $v) {
|
27298 |
$this->PageLinks[$p][] = $v;
|
27299 |
}
|
27300 |
}
|
27301 |
$this->tbrot_Links = [];
|
27302 |
+
|
27303 |
/* -- ANNOTATIONS -- */
|
27304 |
foreach ($this->tbrot_Annots as $p => $l) {
|
27305 |
foreach ($l as $v) {
|
27327 |
|
27328 |
return;
|
27329 |
}
|
27330 |
+
|
27331 |
// elseif rotated
|
27332 |
$lm = $this->lMargin + $this->blk[$this->blklvl]['outer_left_margin'] + $this->blk[$this->blklvl]['border_left']['w'] + $this->blk[$this->blklvl]['padding_left'];
|
27333 |
$pw = $this->blk[$this->blklvl]['inner_width'];
|
27334 |
+
|
27335 |
// Start Transformation
|
27336 |
$this->pages[$this->page] .= $this->StartTransform(true) . "\n";
|
27337 |
|
27338 |
if ($this->table_rotate > 1) { // clockwise
|
27339 |
+
|
27340 |
if ($this->tbrot_align == 'L') {
|
27341 |
$xadj = $this->tbrot_h; // align L (as is)
|
27342 |
} elseif ($this->tbrot_align == 'R') {
|
27344 |
} else {
|
27345 |
$xadj = $lm - $this->tbrot_x0 + (($pw + $this->tbrot_h) / 2); // align C
|
27346 |
}
|
27347 |
+
|
27348 |
$yadj = 0;
|
27349 |
+
|
27350 |
} else { // anti-clockwise
|
27351 |
+
|
27352 |
if ($this->tbrot_align == 'L') {
|
27353 |
$xadj = 0; // align L (as is)
|
27354 |
} elseif ($this->tbrot_align == 'R') {
|
27356 |
} else {
|
27357 |
$xadj = $lm - $this->tbrot_x0 + (($pw - $this->tbrot_h) / 2); // align C
|
27358 |
}
|
27359 |
+
|
27360 |
$yadj = $this->tbrot_w;
|
27361 |
}
|
27362 |
|
27367 |
// Now output the adjusted values
|
27368 |
$this->pages[$this->page] .= $this->tablebuffer;
|
27369 |
|
|
|
27370 |
foreach ($this->tbrot_Links as $p => $l) {
|
27371 |
+
|
27372 |
foreach ($l as $v) {
|
27373 |
+
|
27374 |
$w = $v[2] / Mpdf::SCALE;
|
27375 |
$h = $v[3] / Mpdf::SCALE;
|
27376 |
$ax = ($v[0] / Mpdf::SCALE) - $this->tbrot_x0;
|
27377 |
$ay = (($this->hPt - $v[1]) / Mpdf::SCALE) - $this->tbrot_y0;
|
27378 |
+
|
27379 |
if ($this->table_rotate > 1) { // clockwise
|
27380 |
$bx = $this->tbrot_x0 + $xadj - $ay - $h;
|
27381 |
$by = $this->tbrot_y0 + $yadj + $ax;
|
27383 |
$bx = $this->tbrot_x0 + $xadj + $ay;
|
27384 |
$by = $this->tbrot_y0 + $yadj - $ax - $w;
|
27385 |
}
|
27386 |
+
|
27387 |
$v[0] = $bx * Mpdf::SCALE;
|
27388 |
$v[1] = ($this->h - $by) * Mpdf::SCALE;
|
27389 |
$v[2] = $h * Mpdf::SCALE; // swap width and height
|
27390 |
$v[3] = $w * Mpdf::SCALE;
|
27391 |
+
|
27392 |
$this->PageLinks[$p][] = $v;
|
27393 |
}
|
27394 |
}
|
27395 |
+
|
27396 |
$this->tbrot_Links = [];
|
27397 |
foreach ($this->internallink as $key => $f) {
|
27398 |
if (is_array($f) && isset($f['tbrot'])) {
|
27402 |
$this->internallink[$key] = $f;
|
27403 |
}
|
27404 |
}
|
27405 |
+
|
27406 |
/* -- ANNOTATIONS -- */
|
27407 |
foreach ($this->tbrot_Annots as $p => $l) {
|
27408 |
foreach ($l as $v) {
|
27409 |
$ax = abs($v['x']) - $this->tbrot_x0; // abs because -ve values are internally set and held for reference if annotMargin set
|
27410 |
$ay = $v['y'] - $this->tbrot_y0;
|
27411 |
+
|
27412 |
if ($this->table_rotate > 1) { // clockwise
|
27413 |
$bx = $this->tbrot_x0 + $xadj - $ay;
|
27414 |
$by = $this->tbrot_y0 + $yadj + $ax;
|
27416 |
$bx = $this->tbrot_x0 + $xadj + $ay;
|
27417 |
$by = $this->tbrot_y0 + $yadj - $ax;
|
27418 |
}
|
27419 |
+
|
27420 |
if ($v['x'] < 0) {
|
27421 |
$v['x'] = -$bx;
|
27422 |
} else {
|
27423 |
$v['x'] = $bx;
|
27424 |
}
|
27425 |
+
|
27426 |
$v['y'] = ($by);
|
27427 |
$this->PageAnnots[$p][] = $v;
|
27428 |
}
|
27429 |
}
|
27430 |
+
|
27431 |
$this->tbrot_Annots = [];
|
27432 |
/* -- END ANNOTATIONS -- */
|
27433 |
|
|
|
27434 |
/* -- BOOKMARKS -- */
|
|
|
27435 |
// Adjust Bookmarks
|
27436 |
foreach ($this->tbrot_BMoutlines as $v) {
|
27437 |
$v['y'] = $this->tbrot_y0;
|
27440 |
/* -- END BOOKMARKS -- */
|
27441 |
|
27442 |
/* -- TOC -- */
|
|
|
27443 |
// Adjust ToC - uses document page number
|
27444 |
foreach ($this->tbrot_toc as $v) {
|
27445 |
$this->tableOfContents->_toc[] = ['t' => $v['t'], 'l' => $v['l'], 'p' => $this->page, 'link' => $v['link'], 'toc_id' => $v['toc_id']];
|
27447 |
}
|
27448 |
/* -- END TOC -- */
|
27449 |
|
|
|
|
|
27450 |
$this->tbrot_BMoutlines = [];
|
27451 |
$this->tbrot_toc = [];
|
27452 |
|
27453 |
// Stop Transformation
|
27454 |
$this->pages[$this->page] .= $this->StopTransform(true) . "\n";
|
27455 |
|
|
|
27456 |
$this->y = $this->tbrot_y0 + $this->tbrot_w;
|
27457 |
$this->x = $this->lMargin;
|
27458 |
|
27459 |
$this->tablebuffer = '';
|
27460 |
}
|
27461 |
|
27462 |
+
/**
|
27463 |
+
* Keep-with-table This buffers contents of h1-6 to keep on page with table
|
27464 |
+
*/
|
27465 |
function printkwtbuffer()
|
27466 |
{
|
27467 |
if (!$this->kwt_moved) {
|
27468 |
+
|
27469 |
foreach ($this->kwt_buffer as $s) {
|
27470 |
$this->pages[$this->page] .= $s['s'] . "\n";
|
27471 |
}
|
27472 |
+
|
27473 |
foreach ($this->kwt_Links as $p => $l) {
|
27474 |
foreach ($l as $v) {
|
27475 |
$this->PageLinks[$p][] = $v;
|
27476 |
}
|
27477 |
}
|
27478 |
+
|
27479 |
$this->kwt_Links = [];
|
27480 |
+
|
27481 |
/* -- ANNOTATIONS -- */
|
27482 |
foreach ($this->kwt_Annots as $p => $l) {
|
27483 |
foreach ($l as $v) {
|
27490 |
/* -- INDEX -- */
|
27491 |
// Output Reference (index)
|
27492 |
foreach ($this->kwt_Reference as $v) {
|
27493 |
+
|
27494 |
$Present = 0;
|
27495 |
+
|
27496 |
for ($i = 0; $i < count($this->Reference); $i++) {
|
27497 |
if ($this->Reference[$i]['t'] == $v['t']) {
|
27498 |
$Present = 1;
|
27501 |
}
|
27502 |
}
|
27503 |
}
|
27504 |
+
|
27505 |
if ($Present == 0) {
|
27506 |
$this->Reference[] = ['t' => $v['t'], 'p' => [$v['op']]];
|
27507 |
}
|
27526 |
/* -- END TOC -- */
|
27527 |
|
27528 |
$this->pageoutput[$this->page] = []; // mPDF 6
|
27529 |
+
|
27530 |
return;
|
27531 |
}
|
27532 |
|
27553 |
$this->PageLinks[$p][] = $v;
|
27554 |
}
|
27555 |
}
|
27556 |
+
|
27557 |
foreach ($this->internallink as $key => $f) {
|
27558 |
if (is_array($f) && isset($f['kwt'])) {
|
27559 |
$f['Y'] += $yadj;
|
27562 |
$this->internallink[$key] = $f;
|
27563 |
}
|
27564 |
}
|
27565 |
+
|
27566 |
/* -- ANNOTATIONS -- */
|
27567 |
foreach ($this->kwt_Annots as $p => $l) {
|
27568 |
foreach ($l as $v) {
|
27591 |
/* -- END BOOKMARKS -- */
|
27592 |
|
27593 |
/* -- INDEX -- */
|
|
|
27594 |
// Adjust Reference (index)
|
27595 |
foreach ($this->kwt_Reference as $v) {
|
27596 |
+
|
27597 |
$Present = 0;
|
27598 |
+
|
27599 |
// Search the reference (AND Ref/PageNo) in the array
|
27600 |
for ($i = 0; $i < count($this->Reference); $i++) {
|
27601 |
if ($this->Reference[$i]['t'] == $v['t']) {
|
27605 |
}
|
27606 |
}
|
27607 |
}
|
27608 |
+
|
27609 |
if ($Present == 0) {
|
27610 |
$this->Reference[] = ['t' => $v['t'], 'p' => [$this->page]];
|
27611 |
}
|
27629 |
$this->kwt_Reference = [];
|
27630 |
$this->kwt_BMoutlines = [];
|
27631 |
$this->kwt_toc = [];
|
27632 |
+
|
27633 |
// Stop Transformation
|
27634 |
$this->pages[$this->page] .= $this->StopTransform(true) . "\n";
|
27635 |
|
27638 |
$this->y += $this->kwt_height;
|
27639 |
$this->pageoutput[$this->page] = []; // mPDF 6
|
27640 |
}
|
|
|
27641 |
/* -- END TABLES -- */
|
27642 |
|
|
|
|
|
27643 |
function printfloatbuffer()
|
27644 |
{
|
27645 |
if (count($this->floatbuffer)) {
|
27651 |
}
|
27652 |
}
|
27653 |
|
|
|
|
|
|
|
27654 |
function Circle($x, $y, $r, $style = 'S')
|
27655 |
{
|
27656 |
$this->Ellipse($x, $y, $r, $r, $style);
|
27658 |
|
27659 |
function Ellipse($x, $y, $rx, $ry, $style = 'S')
|
27660 |
{
|
27661 |
+
if ($style === 'F') {
|
27662 |
$op = 'f';
|
27663 |
+
} elseif ($style === 'FD' or $style === 'DF') {
|
27664 |
$op = 'B';
|
27665 |
} else {
|
27666 |
$op = 'S';
|
27667 |
}
|
27668 |
+
|
27669 |
$lx = 4 / 3 * (M_SQRT2 - 1) * $rx;
|
27670 |
$ly = 4 / 3 * (M_SQRT2 - 1) * $ry;
|
27671 |
+
|
27672 |
$h = $this->h;
|
27673 |
+
|
27674 |
$this->_out(sprintf('%.3F %.3F m %.3F %.3F %.3F %.3F %.3F %.3F c', ($x + $rx) * Mpdf::SCALE, ($h - $y) * Mpdf::SCALE, ($x + $rx) * Mpdf::SCALE, ($h - ($y - $ly)) * Mpdf::SCALE, ($x + $lx) * Mpdf::SCALE, ($h - ($y - $ry)) * Mpdf::SCALE, $x * Mpdf::SCALE, ($h - ($y - $ry)) * Mpdf::SCALE));
|
27675 |
$this->_out(sprintf('%.3F %.3F %.3F %.3F %.3F %.3F c', ($x - $lx) * Mpdf::SCALE, ($h - ($y - $ry)) * Mpdf::SCALE, ($x - $rx) * Mpdf::SCALE, ($h - ($y - $ly)) * Mpdf::SCALE, ($x - $rx) * Mpdf::SCALE, ($h - $y) * Mpdf::SCALE));
|
27676 |
$this->_out(sprintf('%.3F %.3F %.3F %.3F %.3F %.3F c', ($x - $rx) * Mpdf::SCALE, ($h - ($y + $ly)) * Mpdf::SCALE, ($x - $lx) * Mpdf::SCALE, ($h - ($y + $ry)) * Mpdf::SCALE, $x * Mpdf::SCALE, ($h - ($y + $ry)) * Mpdf::SCALE));
|
27678 |
}
|
27679 |
|
27680 |
/* -- DIRECTW -- */
|
|
|
|
|
27681 |
function AutosizeText($text, $w, $font, $style, $szfont = 72)
|
27682 |
{
|
27683 |
|
27696 |
// DIRECTIONALITY
|
27697 |
if (preg_match("/([" . $this->pregRTLchars . "])/u", $text)) {
|
27698 |
$this->biDirectional = true;
|
27699 |
+
}
|
27700 |
|
27701 |
$textvar = 0;
|
27702 |
$save_OTLtags = $this->OTLtags;
|
27703 |
$this->OTLtags = [];
|
27704 |
+
|
27705 |
if ($this->useKerning) {
|
27706 |
if ($this->CurrentFont['haskernGPOS']) {
|
27707 |
$this->OTLtags['Plus'] .= ' kern';
|
27717 |
$OTLdata = $this->otl->OTLdata;
|
27718 |
}
|
27719 |
/* -- END OTL -- */
|
27720 |
+
|
27721 |
$this->OTLtags = $save_OTLtags;
|
27722 |
|
27723 |
$this->magic_reverse_dir($text, $this->directionality, $OTLdata);
|
27724 |
|
|
|
27725 |
$width = $this->sizeConverter->convert($w);
|
27726 |
$loop = 0;
|
27727 |
+
|
27728 |
while ($loop == 0) {
|
27729 |
+
|
27730 |
$this->SetFont($font, $style, $szfont, false);
|
27731 |
$sz = $this->GetStringWidth($text, true, $OTLdata, $textvar);
|
27732 |
+
|
27733 |
if ($sz > $w) {
|
27734 |
$szfont --;
|
27735 |
} else {
|
27736 |
$loop ++;
|
27737 |
}
|
27738 |
}
|
27739 |
+
|
27740 |
$this->SetFont($font, $style, $szfont, true, true);
|
27741 |
$this->Cell($w, 0, $text, 0, 0, "C", 0, '', 0, 0, 0, 'M', 0, false, $OTLdata, $textvar);
|
27742 |
}
|
|
|
27743 |
/* -- END DIRECTW -- */
|
27744 |
|
27745 |
// ====================================================
|
27751 |
if ($this->usingCoreFont) {
|
27752 |
return 0;
|
27753 |
}
|
27754 |
+
|
27755 |
if ($chunk == '') {
|
27756 |
return 0;
|
27757 |
}
|
27758 |
|
27759 |
if ($this->biDirectional || $dir == 'rtl') {
|
27760 |
+
|
27761 |
// check if string contains RTL text
|
27762 |
// including any added from OTL tables (in PUA)
|
27763 |
$pregRTLchars = $this->pregRTLchars;
|
27764 |
+
|
27765 |
if (isset($this->CurrentFont['rtlPUAstr']) && $this->CurrentFont['rtlPUAstr']) {
|
27766 |
$pregRTLchars .= $this->CurrentFont['rtlPUAstr'];
|
27767 |
}
|
27768 |
+
|
27769 |
if (!preg_match("/[" . $pregRTLchars . "]/u", $chunk) && $dir != 'rtl') {
|
27770 |
return 0;
|
27771 |
} // Chunk doesn't contain RTL characters
|
27772 |
|
27773 |
$unicode = $this->UTF8StringToArray($chunk, false);
|
27774 |
|
27775 |
+
$isStrong = false;
|
27776 |
if (empty($chunkOTLdata)) {
|
27777 |
+
$this->getBasicOTLdata($chunkOTLdata, $unicode, $isStrong);
|
27778 |
}
|
27779 |
|
27780 |
+
$useGPOS = isset($this->CurrentFont['useOTL']) && ($this->CurrentFont['useOTL'] & 0x80);
|
|
|
|
|
|
|
|
|
27781 |
|
27782 |
// NB Returned $chunk may be a shorter string (with adjusted $cOTLdata) by removal of LRE, RLE etc embedding codes.
|
27783 |
list($chunk, $rtl_content) = $this->otl->bidiSort($unicode, $chunk, $dir, $chunkOTLdata, $useGPOS);
|
27784 |
|
27785 |
return $rtl_content;
|
27786 |
}
|
27787 |
+
|
27788 |
/* -- END OTL -- */
|
27789 |
return 0;
|
27790 |
}
|
27796 |
if (empty($this->otl)) {
|
27797 |
$this->otl = new Otl($this, $this->fontCache);
|
27798 |
}
|
27799 |
+
|
27800 |
$chunkOTLdata['group'] = '';
|
27801 |
$chunkOTLdata['GPOSinfo'] = [];
|
27802 |
$chunkOTLdata['char_data'] = [];
|
27803 |
+
|
27804 |
foreach ($unicode as $char) {
|
27805 |
+
|
27806 |
$ucd_record = Ucdn::get_ucd_record($char);
|
27807 |
$chunkOTLdata['char_data'][] = ['bidi_class' => $ucd_record[2], 'uni' => $char];
|
27808 |
+
|
27809 |
if ($ucd_record[2] == 0 || $ucd_record[2] == 3 || $ucd_record[2] == 4) {
|
27810 |
$is_strong = true;
|
27811 |
} // contains strong character
|
27812 |
+
|
27813 |
if ($ucd_record[0] == Ucdn::UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK) {
|
27814 |
$chunkOTLdata['group'] .= 'M';
|
27815 |
} elseif ($char == 32 || $char == 12288) {
|
27823 |
function _setBidiCodes($mode = 'start', $bdf = '')
|
27824 |
{
|
27825 |
$s = '';
|
27826 |
+
|
27827 |
if ($mode == 'end') {
|
27828 |
+
|
27829 |
// PDF comes before PDI to close isolate-override (e.g. "LRILROPDFPDI")
|
27830 |
if (strpos($bdf, 'PDF') !== false) {
|
27831 |
$s .= UtfString::code2utf(0x202C);
|
27832 |
} // POP DIRECTIONAL FORMATTING
|
27833 |
+
|
27834 |
if (strpos($bdf, 'PDI') !== false) {
|
27835 |
$s .= UtfString::code2utf(0x2069);
|
27836 |
} // POP DIRECTIONAL ISOLATE
|
27837 |
+
|
27838 |
} elseif ($mode == 'start') {
|
27839 |
+
|
27840 |
// LRI comes before LRO to open isolate-override (e.g. "LRILROPDFPDI")
|
27841 |
+
if (strpos($bdf, 'LRI') !== false) { // U+2066 LRI
|
27842 |
$s .= UtfString::code2utf(0x2066);
|
27843 |
+
} elseif (strpos($bdf, 'RLI') !== false) { // U+2067 RLI
|
|
|
27844 |
$s .= UtfString::code2utf(0x2067);
|
27845 |
+
} elseif (strpos($bdf, 'FSI') !== false) { // U+2068 FSI
|
|
|
27846 |
$s .= UtfString::code2utf(0x2068);
|
27847 |
+
}
|
27848 |
+
|
27849 |
+
if (strpos($bdf, 'LRO') !== false) { // U+202D LRO
|
27850 |
$s .= UtfString::code2utf(0x202D);
|
27851 |
+
} elseif (strpos($bdf, 'RLO') !== false) { // U+202E RLO
|
|
|
27852 |
$s .= UtfString::code2utf(0x202E);
|
27853 |
+
} elseif (strpos($bdf, 'LRE') !== false) { // U+202A LRE
|
|
|
27854 |
$s .= UtfString::code2utf(0x202A);
|
27855 |
+
} elseif (strpos($bdf, 'RLE') !== false) { // U+202B RLE
|
|
|
27856 |
$s .= UtfString::code2utf(0x202B);
|
27857 |
+
}
|
27858 |
}
|
27859 |
+
|
27860 |
return $s;
|
27861 |
}
|
|
|
27862 |
/* -- END OTL -- */
|
27863 |
|
|
|
|
|
|
|
|
|
|
|
27864 |
function SetSubstitutions()
|
27865 |
{
|
27866 |
$subsarray = [];
|
27884 |
$html .= $e;
|
27885 |
}
|
27886 |
}
|
27887 |
+
|
27888 |
return $html;
|
27889 |
}
|
27890 |
|
27902 |
return 4;
|
27903 |
}
|
27904 |
}
|
27905 |
+
|
27906 |
return 0;
|
27907 |
}
|
27908 |
|
27909 |
+
/**
|
27910 |
+
* If core font is selected in document which is not onlyCoreFonts - substitute with non-core font
|
27911 |
+
*/
|
27912 |
function SubstituteCharsNonCore(&$writehtml_a, &$writehtml_i, &$writehtml_e)
|
27913 |
{
|
27914 |
// Ignore if in Textarea
|
27915 |
if ($writehtml_i > 0 && strtolower(substr($writehtml_a[$writehtml_i - 1], 0, 8)) == 'textarea') {
|
27916 |
return 0;
|
27917 |
}
|
27918 |
+
|
27919 |
if (mb_convert_encoding(mb_convert_encoding($writehtml_e, $this->mb_enc, "UTF-8"), "UTF-8", $this->mb_enc) == $writehtml_e) {
|
27920 |
return 0;
|
27921 |
}
|
27922 |
+
|
27923 |
$cw = &$this->CurrentFont['cw'];
|
27924 |
$unicode = $this->UTF8StringToArray($writehtml_e, false);
|
27925 |
$start = -1;
|
27927 |
$flag = 0;
|
27928 |
$ftype = '';
|
27929 |
$u = [];
|
27930 |
+
|
27931 |
if (!$this->subArrMB) {
|
27932 |
+
|
27933 |
require __DIR__ . '/../data/subs_core.php';
|
27934 |
+
|
27935 |
$this->subArrMB['a'] = $aarr;
|
27936 |
$this->subArrMB['s'] = $sarr;
|
27937 |
$this->subArrMB['z'] = $zarr;
|
27938 |
}
|
27939 |
+
|
27940 |
foreach ($unicode as $c => $char) {
|
27941 |
+
|
27942 |
if (($char > 127 || ($flag == 1 && $char == 32)) && $char != 173 && (!isset($this->subArrMB['a'][$char]) || ($flag == 1 && $char == 32)) && ($char < 1536 || ($char > 1791 && $char < 2304) || $char > 3455)) {
|
27943 |
if ($flag == 0) {
|
27944 |
$start = $c;
|
27950 |
break;
|
27951 |
}
|
27952 |
}
|
27953 |
+
|
27954 |
if ($flag > 0 && !$end) {
|
27955 |
$end = count($unicode) - 1;
|
27956 |
}
|
27957 |
+
|
27958 |
if ($start == -1) {
|
27959 |
return 0;
|
27960 |
}
|
27961 |
|
27962 |
+
// Try in backup subs font
|
27963 |
if (!is_array($this->backupSubsFont)) {
|
27964 |
$this->backupSubsFont = ["$this->backupSubsFont"];
|
27965 |
}
|
27966 |
|
27967 |
foreach ($this->backupSubsFont as $bsfctr => $bsf) {
|
27968 |
+
|
27969 |
if ($this->fonttrans[$bsf] == 'chelvetica' || $this->fonttrans[$bsf] == 'ctimes' || $this->fonttrans[$bsf] == 'ccourier') {
|
27970 |
continue;
|
27971 |
}
|
28000 |
$writehtml_e = mb_substr($writehtml_e, 0, $start + 1, 'UTF-8');
|
28001 |
array_splice($writehtml_a, $writehtml_i + 1, 0, ['', $cont]);
|
28002 |
$this->subPos = $writehtml_i + 1;
|
28003 |
+
|
28004 |
return 2;
|
28005 |
} else {
|
28006 |
break;
|
28014 |
$writehtml_e = $m[1];
|
28015 |
array_splice($writehtml_a, $writehtml_i + 1, 0, ['span style="font-family: ' . $font . '"', $m[2], '/span', $m[3]]);
|
28016 |
$this->subPos = $writehtml_i + 3;
|
28017 |
+
|
28018 |
return 4;
|
28019 |
}
|
28020 |
}
|
28021 |
}
|
28022 |
|
28023 |
unset($cw);
|
28024 |
+
|
28025 |
return 0;
|
28026 |
}
|
28027 |
|
28031 |
if ($writehtml_i > 0 && strtolower(substr($writehtml_a[$writehtml_i - 1], 0, 8)) == 'textarea') {
|
28032 |
return 0;
|
28033 |
}
|
28034 |
+
|
28035 |
$cw = &$this->CurrentFont['cw'];
|
28036 |
$unicode = $this->UTF8StringToArray($writehtml_e, false);
|
28037 |
$start = -1;
|
28039 |
$flag = 0;
|
28040 |
$ftype = '';
|
28041 |
$u = [];
|
28042 |
+
|
28043 |
foreach ($unicode as $c => $char) {
|
28044 |
+
|
28045 |
if (($flag == 0 || $flag == 2) && (!$this->_charDefined($cw, $char) || ($flag == 2 && $char == 32)) && $this->checkSIP && $char > 131071) { // Unicode Plane 2 (SIP)
|
28046 |
+
|
28047 |
if (in_array($this->FontFamily, $this->available_CJK_fonts)) {
|
28048 |
return 0;
|
28049 |
}
|
28050 |
+
|
28051 |
if ($flag == 0) {
|
28052 |
$start = $c;
|
28053 |
}
|
28054 |
+
|
28055 |
$flag = 2;
|
28056 |
$u[] = $char;
|
28057 |
+
|
28058 |
+
// elseif (($flag == 0 || $flag==1) && $char != 173 && !$this->_charDefined($cw,$char) && ($char<1423 || ($char>3583 && $char < 11263))) {
|
28059 |
+
|
28060 |
+
} elseif (($flag == 0 || $flag == 1) && $char != 173 && (!$this->_charDefined($cw, $char) || ($flag == 1 && $char == 32)) && ($char < 1536 || ($char > 1791 && $char < 2304) || $char > 3455)) {
|
28061 |
+
|
28062 |
if ($flag == 0) {
|
28063 |
$start = $c;
|
28064 |
}
|
28065 |
+
|
28066 |
$flag = 1;
|
28067 |
$u[] = $char;
|
28068 |
+
|
28069 |
} elseif ($flag > 0) {
|
28070 |
+
|
28071 |
$end = $c - 1;
|
28072 |
break;
|
28073 |
+
|
28074 |
}
|
28075 |
}
|
28076 |
+
|
28077 |
if ($flag > 0 && !$end) {
|
28078 |
$end = count($unicode) - 1;
|
28079 |
}
|
28080 |
+
|
28081 |
if ($start == -1) {
|
28082 |
return 0;
|
28083 |
}
|
28084 |
|
28085 |
+
if ($flag == 2) { // SIP
|
28086 |
+
|
28087 |
// Check if current CJK font has a ext-B related font
|
28088 |
if (isset($this->CurrentFont['sipext']) && $this->CurrentFont['sipext']) {
|
28089 |
$font = $this->CurrentFont['sipext'];
|
28090 |
unset($cw);
|
28091 |
$cw = '';
|
28092 |
+
|
28093 |
if (isset($this->fonts[$font])) {
|
28094 |
$cw = &$this->fonts[$font]['cw'];
|
28095 |
} elseif ($this->fontCache->has($font . '.cw.dat')) {
|
28125 |
}
|
28126 |
}
|
28127 |
}
|
28128 |
+
|
28129 |
// Check Backup SIP font (defined in Config\FontVariables)
|
28130 |
if (isset($this->backupSIPFont) && $this->backupSIPFont) {
|
28131 |
+
|
28132 |
if ($this->currentfontfamily != $this->backupSIPFont) {
|
28133 |
$font = $this->backupSIPFont;
|
28134 |
} else {
|
28163 |
break;
|
28164 |
}
|
28165 |
}
|
28166 |
+
|
28167 |
if ($l > 0) {
|
28168 |
$patt = mb_substr($writehtml_e, $start, $l);
|
28169 |
if (preg_match("/(.*?)(" . preg_quote($patt, '/') . ")(.*)/u", $writehtml_e, $m)) {
|
28174 |
}
|
28175 |
}
|
28176 |
}
|
28177 |
+
|
28178 |
return 0;
|
28179 |
}
|
28180 |
|
|
|
28181 |
// FIRST TRY CORE FONTS (when appropriate)
|
28182 |
if (!$this->PDFA && !$this->PDFX && !$this->biDirectional) { // mPDF 6
|
28183 |
$repl = [];
|
28234 |
if (!is_array($this->backupSubsFont)) {
|
28235 |
$this->backupSubsFont = ["$this->backupSubsFont"];
|
28236 |
}
|
28237 |
+
|
28238 |
foreach ($this->backupSubsFont as $bsfctr => $bsf) {
|
28239 |
if ($this->currentfontfamily != $bsf) {
|
28240 |
$font = $bsf;
|
28277 |
}
|
28278 |
}
|
28279 |
}
|
28280 |
+
|
28281 |
if ($l > 0) {
|
28282 |
$patt = mb_substr($writehtml_e, $start, $l);
|
28283 |
if (preg_match("/(.*?)(" . preg_quote($patt, '/') . ")(.*)/u", $writehtml_e, $m)) {
|
28290 |
}
|
28291 |
|
28292 |
unset($cw);
|
28293 |
+
|
28294 |
return 0;
|
28295 |
}
|
28296 |
|
28297 |
function setHiEntitySubstitutions()
|
28298 |
{
|
28299 |
+
$entarr = include __DIR__ . '/../data/entity_substitutions.php';
|
28300 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28301 |
foreach ($entarr as $key => $val) {
|
28302 |
$this->entsearch[] = '&' . $key . ';';
|
28303 |
$this->entsubstitute[] = UtfString::code2utf($val);
|
28311 |
if (count($this->entsearch)) {
|
28312 |
$html = str_replace($this->entsearch, $this->entsubstitute, $html);
|
28313 |
}
|
28314 |
+
|
28315 |
return $html;
|
28316 |
}
|
28317 |
|
28318 |
+
/**
|
28319 |
+
* Edited v1.2 Pass by reference; option to continue if invalid UTF-8 chars
|
28320 |
+
*/
|
28321 |
function is_utf8(&$string)
|
28322 |
{
|
28323 |
if ($string === mb_convert_encoding(mb_convert_encoding($string, "UTF-32", "UTF-8"), "UTF-8", "UTF-32")) {
|
28332 |
}
|
28333 |
}
|
28334 |
|
28335 |
+
/**
|
28336 |
+
* For HTML
|
28337 |
+
*
|
28338 |
+
* Checks string is valid UTF-8 encoded
|
28339 |
+
* converts html_entities > ASCII 127 to UTF-8
|
28340 |
+
* Only exception - leaves low ASCII entities e.g. < & etc.
|
28341 |
+
* Leaves in particular < to distinguish from tag marker
|
28342 |
+
*/
|
28343 |
function purify_utf8($html, $lo = true)
|
28344 |
{
|
|
|
|
|
|
|
|
|
|
|
28345 |
if (!$this->is_utf8($html)) {
|
28346 |
+
|
28347 |
while (mb_convert_encoding(mb_convert_encoding($html, "UTF-32", "UTF-8"), "UTF-8", "UTF-32") != $html) {
|
28348 |
+
|
28349 |
+
$a = @iconv('UTF-8', 'UTF-8', $html);
|
28350 |
+
$error = error_get_last();
|
28351 |
+
if ($error && $error['message'] === 'iconv(): Detected an illegal character in input string') {
|
28352 |
+
throw new \Mpdf\MpdfException('Invalid input characters. Did you set $mpdf->in_charset properly?');
|
28353 |
+
}
|
28354 |
+
|
28355 |
$pos = $start = strlen($a);
|
28356 |
$err = '';
|
28357 |
while (ord(substr($html, $pos, 1)) > 128) {
|
28358 |
$err .= '[[#' . ord(substr($html, $pos, 1)) . ']]';
|
28359 |
$pos++;
|
28360 |
}
|
28361 |
+
|
28362 |
$this->logger->error($err, ['context' => LogContext::UTF8]);
|
28363 |
$html = substr($html, $pos);
|
28364 |
}
|
28365 |
+
|
28366 |
throw new \Mpdf\MpdfException("HTML contains invalid UTF-8 character(s). See log for further details");
|
28367 |
}
|
28368 |
+
|
28369 |
$html = preg_replace("/\r/", "", $html);
|
28370 |
|
28371 |
// converts html_entities > ASCII 127 to UTF-8
|
28375 |
// converts all &#nnn; or &#xHHH; to UTF-8 multibyte
|
28376 |
// If $lo==true then includes ASCII < 128
|
28377 |
$html = UtfString::strcode2utf($html, $lo);
|
28378 |
+
|
28379 |
+
return $html;
|
28380 |
}
|
28381 |
|
28382 |
+
/**
|
28383 |
+
* For TEXT
|
28384 |
+
*/
|
28385 |
function purify_utf8_text($txt)
|
28386 |
{
|
|
|
28387 |
// Make sure UTF-8 string of characters
|
28388 |
if (!$this->is_utf8($txt)) {
|
28389 |
throw new \Mpdf\MpdfException("Text contains invalid UTF-8 character(s)");
|
28407 |
return ($txt);
|
28408 |
}
|
28409 |
|
28410 |
+
/* -- BARCODES -- */
|
28411 |
+
/**
|
28412 |
+
* UPC/EAN barcode
|
28413 |
+
*
|
28414 |
+
* EAN13, EAN8, UPCA, UPCE, ISBN, ISSN
|
28415 |
+
* Accepts 12 or 13 digits with or without - hyphens
|
28416 |
+
*/
|
28417 |
function WriteBarcode($code, $showtext = 1, $x = '', $y = '', $size = 1, $border = 0, $paddingL = 1, $paddingR = 1, $paddingT = 2, $paddingB = 2, $height = 1, $bgcol = false, $col = false, $btype = 'ISBN', $supplement = '0', $supplement_code = '', $k = 1)
|
28418 |
{
|
28419 |
if (empty($code)) {
|
28420 |
return;
|
28421 |
}
|
28422 |
+
|
28423 |
$codestr = $code;
|
28424 |
$code = preg_replace('/\-/', '', $code);
|
28425 |
|
28433 |
if ($arrcode === false) {
|
28434 |
throw new \Mpdf\MpdfException('Error in barcode string: ' . $codestr);
|
28435 |
}
|
28436 |
+
|
28437 |
+
if ((($btype === 'EAN13' || $btype === 'ISBN' || $btype === 'ISSN') && strlen($code) === 12)
|
28438 |
+
|| ($btype == 'UPCA' && strlen($code) === 11)
|
28439 |
+
|| ($btype == 'UPCE' && strlen($code) === 11)
|
28440 |
+
|| ($btype == 'EAN8' && strlen($code) === 7)) {
|
28441 |
+
|
28442 |
$code .= $arrcode['checkdigit'];
|
28443 |
+
|
28444 |
if (stristr($codestr, '-')) {
|
28445 |
$codestr .= '-' . $arrcode['checkdigit'];
|
28446 |
} else {
|
28447 |
$codestr .= $arrcode['checkdigit'];
|
28448 |
}
|
28449 |
}
|
28450 |
+
|
28451 |
+
if ($btype === 'ISBN') {
|
28452 |
$codestr = 'ISBN ' . $codestr;
|
28453 |
}
|
28454 |
+
|
28455 |
+
if ($btype === 'ISSN') {
|
28456 |
$codestr = 'ISSN ' . $codestr;
|
28457 |
}
|
28458 |
|
28459 |
if (empty($x)) {
|
28460 |
$x = $this->x;
|
28461 |
}
|
28462 |
+
|
28463 |
if (empty($y)) {
|
28464 |
$y = $this->y;
|
28465 |
}
|
28466 |
+
|
28467 |
// set foreground color
|
28468 |
$prevDrawColor = $this->DrawColor;
|
28469 |
$prevTextColor = $this->TextColor;
|
28470 |
$prevFillColor = $this->FillColor;
|
28471 |
+
|
28472 |
$lw = $this->LineWidth;
|
28473 |
$this->SetLineWidth(0.01);
|
28474 |
|
28494 |
$codestr_fontsize = 2.1 * $size;
|
28495 |
$paddingT += $codestr_fontsize + $tisbnm;
|
28496 |
}
|
28497 |
+
|
28498 |
$oh = $fbh + $paddingT + $paddingB; // Full overall height incl. user-defined padding
|
28499 |
+
|
28500 |
// PRINT border background color
|
28501 |
$xpos = $x;
|
28502 |
$ypos = $y;
|
28503 |
+
|
28504 |
if ($col) {
|
28505 |
$this->SetDColor($col);
|
28506 |
$this->SetTColor($col);
|
28508 |
$this->SetDColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
|
28509 |
$this->SetTColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
|
28510 |
}
|
28511 |
+
|
28512 |
if ($bgcol) {
|
28513 |
$this->SetFColor($bgcol);
|
28514 |
} else {
|
28515 |
$this->SetFColor($this->colorConverter->convert(255, $this->PDFAXwarnings));
|
28516 |
}
|
28517 |
+
|
28518 |
if (!$bgcol && !$col) { // fn. called directly - not via HTML
|
28519 |
+
|
28520 |
if ($border) {
|
28521 |
$fillb = 'DF';
|
28522 |
} else {
|
28523 |
$fillb = 'F';
|
28524 |
}
|
28525 |
+
|
28526 |
$this->Rect($xpos, $ypos, $ow, $oh, $fillb);
|
28527 |
}
|
28528 |
|
28530 |
// PRINT BARS
|
28531 |
$xpos = $x + $paddingL + $llm;
|
28532 |
$ypos = $y + $paddingT;
|
28533 |
+
|
28534 |
if ($col) {
|
28535 |
$this->SetFColor($col);
|
28536 |
} else {
|
28537 |
$this->SetFColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
|
28538 |
}
|
28539 |
+
|
28540 |
if ($arrcode !== false) {
|
28541 |
foreach ($arrcode["bcode"] as $v) {
|
28542 |
$bw = ($v["w"] * $xres);
|
28548 |
}
|
28549 |
}
|
28550 |
|
|
|
28551 |
// print text
|
28552 |
$prevFontFamily = $this->FontFamily;
|
28553 |
$prevFontStyle = $this->FontStyle;
|
28554 |
$prevFontSizePt = $this->FontSizePt;
|
28555 |
|
28556 |
// ISBN string
|
28557 |
+
if (($btype === 'EAN13' && $showtext) || $btype === 'ISBN' || $btype === 'ISSN') {
|
28558 |
+
|
28559 |
if ($this->onlyCoreFonts) {
|
28560 |
$this->SetFont('chelvetica');
|
28561 |
} else {
|
28567 |
} else {
|
28568 |
$this->SetFColor($this->colorConverter->convert(255, $this->PDFAXwarnings));
|
28569 |
}
|
28570 |
+
|
28571 |
$this->x = $x + $paddingL + 1; // 1mm left margin (cf. $fbwi above)
|
28572 |
+
|
28573 |
// max width is $fbwi
|
28574 |
$loop = 0;
|
28575 |
while ($loop == 0) {
|
28576 |
$this->SetFontSize($codestr_fontsize * 1.4 * Mpdf::SCALE, false); // don't write
|
28577 |
$sz = $this->GetStringWidth($codestr);
|
28578 |
+
|
28579 |
if ($sz > $fbwi) {
|
28580 |
$codestr_fontsize -= 0.1;
|
28581 |
} else {
|
28582 |
$loop ++;
|
28583 |
}
|
28584 |
}
|
28585 |
+
|
28586 |
$this->SetFont('', '', $codestr_fontsize * 1.4 * Mpdf::SCALE, true, true); // * 1.4 because font height is only 7/10 of given mm
|
28587 |
// WORD SPACING
|
28588 |
if ($fbwi > $sz) {
|
28592 |
$this->_out(sprintf('BT %.3F Tc ET', $charspacing * Mpdf::SCALE));
|
28593 |
}
|
28594 |
}
|
28595 |
+
|
28596 |
$this->y = $y + $paddingT - ($codestr_fontsize ) - $tisbnm;
|
28597 |
$this->Cell($fbw, $codestr_fontsize, $codestr);
|
28598 |
+
|
28599 |
if ($charspacing) {
|
28600 |
$this->_out('BT 0 Tc ET');
|
28601 |
}
|
28611 |
$this->SetFont('ocrb');
|
28612 |
$fh = 1.06;
|
28613 |
}
|
28614 |
+
|
28615 |
$charRO = '';
|
28616 |
+
|
28617 |
+
if ($btype === 'EAN13' || $btype === 'ISBN' || $btype === 'ISSN') {
|
28618 |
+
|
28619 |
$outerfontsize = 3; // Inner fontsize = 3
|
28620 |
$outerp = $xres * 4;
|
28621 |
$innerp = $xres * 2.5;
|
28624 |
$charLO = substr($code, 0, 1); // Left Outer
|
28625 |
$charLI = substr($code, 1, 6); // Left Inner
|
28626 |
$charRI = substr($code, 7, 6); // Right Inner
|
28627 |
+
|
28628 |
if (!$supplement) {
|
28629 |
$charRO = '>'; // Right Outer
|
28630 |
}
|
28631 |
+
|
28632 |
+
} elseif ($btype === 'UPCA') {
|
28633 |
+
|
28634 |
$outerfontsize = 2.3; // Inner fontsize = 3
|
28635 |
$outerp = $xres * 10;
|
28636 |
$innerp = $xres * 2.5;
|
28640 |
$charLI = substr($code, 1, 5); // Left Inner
|
28641 |
$charRI = substr($code, 6, 5); // Right Inner
|
28642 |
$charRO = substr($code, 11, 1); // Right Outer
|
28643 |
+
|
28644 |
+
} elseif ($btype === 'UPCE') {
|
28645 |
+
|
28646 |
$outerfontsize = 2.3; // Inner fontsize = 3
|
28647 |
$outerp = $xres * 4;
|
28648 |
$innerp = 0;
|
28653 |
$charLI = substr($upce_code, 0, 3); // Left Inner
|
28654 |
$charRI = substr($upce_code, 3, 3); // Right Inner
|
28655 |
$charRO = substr($code, 11, 1); // Right Outer
|
28656 |
+
|
28657 |
+
} elseif ($btype === 'EAN8') {
|
28658 |
+
|
28659 |
$outerfontsize = 3; // Inner fontsize = 3
|
28660 |
$outerp = $xres * 4;
|
28661 |
$innerp = $xres * 2.5;
|
28664 |
$charLO = '<'; // Left Outer
|
28665 |
$charLI = substr($code, 0, 4); // Left Inner
|
28666 |
$charRI = substr($code, 4, 4); // Right Inner
|
28667 |
+
|
28668 |
if (!$supplement) {
|
28669 |
$charRO = '>'; // Right Outer
|
28670 |
}
|
28672 |
|
28673 |
$this->SetFontSize(($outerfontsize / 3) * 3 * $fh * $size * Mpdf::SCALE); // 3mm numerals (FontSize is larger to account for space above/below characters)
|
28674 |
|
28675 |
+
if (!$this->usingCoreFont) { // character width at 3mm
|
28676 |
$cw = $this->_getCharWidth($this->CurrentFont['cw'], 32) * 3 * $fh * $size / 1000;
|
28677 |
+
} else {
|
|
|
28678 |
$cw = 600 * 3 * $fh * $size / 1000;
|
28679 |
+
}
|
28680 |
+
|
28681 |
// Outer left character
|
28682 |
$y_text = $y + $paddingT + $bch - ($num_height / 2);
|
28683 |
$y_text_outer = $y + $paddingT + $bch - ($num_height * ($outerfontsize / 3) / 2);
|
28700 |
}
|
28701 |
|
28702 |
$this->SetFontSize(3 * $fh * $size * Mpdf::SCALE); // 3mm numerals (FontSize is larger to account for space above/below characters)
|
28703 |
+
|
28704 |
// Inner left half characters
|
28705 |
$this->x = $x + $paddingL + $llm + $outerp;
|
28706 |
$this->y = $y_text;
|
28725 |
if ($supplement) { // EAN-2 or -5 Supplement
|
28726 |
// PRINT BARS
|
28727 |
$supparrcode = $this->barcode->getBarcodeArray($supplement_code, 'EAN' . $supplement);
|
28728 |
+
|
28729 |
if ($supparrcode === false) {
|
28730 |
throw new \Mpdf\MpdfException('Error in barcode string (supplement): ' . $codestr . ' ' . $supplement_code);
|
28731 |
}
|
28732 |
+
|
28733 |
if (strlen($supplement_code) != $supplement) {
|
28734 |
throw new \Mpdf\MpdfException('Barcode supplement incorrect: ' . $supplement_code);
|
28735 |
}
|
28736 |
+
|
28737 |
$llm = $fbw - (($arrcode['lightmR'] - $supparrcode['sepM']) * $arrcode['nom-X'] * $size); // Left Light margin
|
28738 |
$rlm = $arrcode['lightmR'] * $arrcode['nom-X'] * $size; // Right Light margin
|
28739 |
|
28745 |
|
28746 |
$xpos = $x + $paddingL + $llm;
|
28747 |
$ypos = $y + $paddingT + $num_height + 0.5;
|
28748 |
+
|
28749 |
if ($col) {
|
28750 |
$this->SetFColor($col);
|
28751 |
} else {
|
28752 |
$this->SetFColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
|
28753 |
}
|
28754 |
+
|
28755 |
if ($supparrcode !== false) {
|
28756 |
foreach ($supparrcode["bcode"] as $v) {
|
28757 |
$bw = ($v["w"] * $xres);
|
28769 |
} else {
|
28770 |
$this->SetFColor($this->colorConverter->convert(255, $this->PDFAXwarnings));
|
28771 |
}
|
28772 |
+
|
28773 |
$this->SetFontSize(3 * $fh * $size * Mpdf::SCALE); // 3mm numerals (FontSize is larger to account for space above/below characters)
|
28774 |
$this->x = $x + $paddingL + $llm;
|
28775 |
$this->y = $y + $paddingT;
|
28791 |
$this->SetY($y);
|
28792 |
}
|
28793 |
|
28794 |
+
/**
|
28795 |
+
* POSTAL and OTHER barcodes
|
28796 |
+
*/
|
28797 |
function WriteBarcode2($code, $x = '', $y = '', $size = 1, $height = 1, $bgcol = false, $col = false, $btype = 'IMB', $print_ratio = '', $k = 1)
|
28798 |
{
|
28799 |
if (empty($code)) {
|
28806 |
if (empty($x)) {
|
28807 |
$x = $this->x;
|
28808 |
}
|
28809 |
+
|
28810 |
if (empty($y)) {
|
28811 |
$y = $this->y;
|
28812 |
}
|
28813 |
+
|
28814 |
$prevDrawColor = $this->DrawColor;
|
28815 |
$prevTextColor = $this->TextColor;
|
28816 |
$prevFillColor = $this->FillColor;
|
28819 |
$size /= $k; // in case resized in a table
|
28820 |
$xres = $arrcode['nom-X'] * $size;
|
28821 |
|
28822 |
+
if ($btype === 'IMB' || $btype === 'RM4SCC' || $btype === 'KIX' || $btype === 'POSTNET' || $btype === 'PLANET') {
|
28823 |
$llm = $arrcode['quietL'] / $k; // Left Quiet margin
|
28824 |
$rlm = $arrcode['quietR'] / $k; // Right Quiet margin
|
28825 |
$tlm = $blm = $arrcode['quietTB'] / $k;
|
28830 |
$tlm = $blm = $arrcode['lightTB'] * $xres * $height;
|
28831 |
}
|
28832 |
|
|
|
28833 |
$bcw = ($arrcode["maxw"] * $xres);
|
28834 |
$fbw = $bcw + $llm + $rlm; // Full barcode width incl. light margins
|
28835 |
|
28836 |
$bch = ($arrcode["nom-H"] * $size * $height);
|
28837 |
$fbh = $bch + $tlm + $blm; // Full barcode height
|
28838 |
+
|
28839 |
// PRINT border background color
|
28840 |
$xpos = $x;
|
28841 |
$ypos = $y;
|
28842 |
+
|
28843 |
if ($col) {
|
28844 |
$this->SetDColor($col);
|
28845 |
$this->SetTColor($col);
|
28847 |
$this->SetDColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
|
28848 |
$this->SetTColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
|
28849 |
}
|
28850 |
+
|
28851 |
if ($bgcol) {
|
28852 |
$this->SetFColor($bgcol);
|
28853 |
} else {
|
28886 |
$this->SetLineWidth($lw);
|
28887 |
$this->SetY($y);
|
28888 |
}
|
|
|
28889 |
/* -- END BARCODES -- */
|
28890 |
|
|
|
|
|
|
|
28891 |
function StartTransform($returnstring = false)
|
28892 |
{
|
28893 |
if ($returnstring) {
|
28911 |
if ($x === '') {
|
28912 |
$x = $this->x;
|
28913 |
}
|
28914 |
+
|
28915 |
if ($y === '') {
|
28916 |
$y = $this->y;
|
28917 |
}
|
28918 |
+
|
28919 |
if (($s_x == 0) or ( $s_y == 0)) {
|
28920 |
throw new \Mpdf\MpdfException('Please do not use values equal to zero for scaling');
|
28921 |
}
|
28922 |
+
|
28923 |
$y = ($this->h - $y) * Mpdf::SCALE;
|
28924 |
$x *= Mpdf::SCALE;
|
28925 |
+
|
28926 |
// calculate elements of transformation matrix
|
28927 |
$s_x /= 100;
|
28928 |
$s_y /= 100;
|
28933 |
$tm[3] = $s_y;
|
28934 |
$tm[4] = $x * (1 - $s_x);
|
28935 |
$tm[5] = $y * (1 - $s_y);
|
28936 |
+
|
28937 |
// scale the coordinate system
|
28938 |
if ($returnstring) {
|
28939 |
return($this->_transform($tm, true));
|
28952 |
$tm[3] = 1;
|
28953 |
$tm[4] = $t_x * Mpdf::SCALE;
|
28954 |
$tm[5] = -$t_y * Mpdf::SCALE;
|
28955 |
+
|
28956 |
// translate the coordinate system
|
28957 |
if ($returnstring) {
|
28958 |
return($this->_transform($tm, true));
|
28966 |
if ($x === '') {
|
28967 |
$x = $this->x;
|
28968 |
}
|
28969 |
+
|
28970 |
if ($y === '') {
|
28971 |
$y = $this->y;
|
28972 |
}
|
28973 |
+
|
28974 |
$angle = -$angle;
|
28975 |
$y = ($this->h - $y) * Mpdf::SCALE;
|
28976 |
$x *= Mpdf::SCALE;
|
28977 |
+
|
28978 |
// calculate elements of transformation matrix
|
28979 |
$tm = [];
|
28980 |
$tm[0] = cos(deg2rad($angle));
|
28983 |
$tm[3] = $tm[0];
|
28984 |
$tm[4] = $x + $tm[1] * $y - $tm[0] * $x;
|
28985 |
$tm[5] = $y - $tm[0] * $y - $tm[1] * $x;
|
28986 |
+
|
28987 |
// rotate the coordinate system around ($x,$y)
|
28988 |
if ($returnstring) {
|
28989 |
+
return $this->_transform($tm, true);
|
28990 |
} else {
|
28991 |
$this->_transform($tm);
|
28992 |
}
|
28993 |
}
|
28994 |
|
28995 |
+
/**
|
28996 |
+
* mPDF 5.7.3 TRANSFORMS
|
28997 |
+
*/
|
28998 |
function transformSkew($angle_x, $angle_y, $x = '', $y = '', $returnstring = false)
|
28999 |
{
|
29000 |
if ($x === '') {
|
29001 |
$x = $this->x;
|
29002 |
}
|
29003 |
+
|
29004 |
if ($y === '') {
|
29005 |
$y = $this->y;
|
29006 |
}
|
29007 |
+
|
29008 |
$angle_x = -$angle_x;
|
29009 |
$angle_y = -$angle_y;
|
29010 |
+
|
29011 |
$x *= Mpdf::SCALE;
|
29012 |
$y = ($this->h - $y) * Mpdf::SCALE;
|
29013 |
+
|
29014 |
// calculate elements of transformation matrix
|
29015 |
$tm = [];
|
29016 |
$tm[0] = 1;
|
29019 |
$tm[3] = 1;
|
29020 |
$tm[4] = -$tm[2] * $y;
|
29021 |
$tm[5] = -$tm[1] * $x;
|
29022 |
+
|
29023 |
// skew the coordinate system
|
29024 |
if ($returnstring) {
|
29025 |
+
return $this->_transform($tm, true);
|
29026 |
} else {
|
29027 |
$this->_transform($tm);
|
29028 |
}
|
29048 |
$a = preg_split('/<(.*?)>/ms', $html, -1, PREG_SPLIT_DELIM_CAPTURE);
|
29049 |
foreach ($a as $i => $e) {
|
29050 |
if ($i % 2 == 0) {
|
29051 |
+
|
29052 |
// ignore if in Textarea
|
29053 |
if ($i > 0 && strtolower(substr($a[$i - 1], 1, 8)) == 'textarea') {
|
29054 |
$a[$i] = $e;
|
29055 |
continue;
|
29056 |
}
|
29057 |
+
|
29058 |
$e = UtfString::strcode2utf($e);
|
29059 |
$e = $this->lesser_entity_decode($e);
|
29060 |
|
29066 |
$chardata = [];
|
29067 |
$subchunk = 0;
|
29068 |
$charctr = 0;
|
29069 |
+
|
29070 |
foreach ($earr as $char) {
|
29071 |
+
|
29072 |
$ucd_record = Ucdn::get_ucd_record($char);
|
29073 |
$sbl = $ucd_record[6];
|
29074 |
|
29107 |
|
29108 |
$o = '';
|
29109 |
for ($sch = 0; $sch <= $subchunk; $sch++) {
|
29110 |
+
|
29111 |
if (isset($chardata[$sch])) {
|
29112 |
$s = '';
|
29113 |
for ($j = 0; $j < count($chardata[$sch]); $j++) {
|
29114 |
$s .= UtfString::code2utf($chardata[$sch][$j]['uni']);
|
29115 |
}
|
29116 |
+
|
29117 |
// ZZZ99 Undo lesser_entity_decode as above - but only for <>&
|
29118 |
$s = str_replace("&", "&", $s);
|
29119 |
$s = str_replace("<", "<", $s);
|
29122 |
// Check Vietnamese if Latin script - even if Basescript
|
29123 |
if ($scriptblocks[$sch] == Ucdn::SCRIPT_LATIN && $this->autoVietnamese && preg_match("/([" . $this->scriptToLanguage->getLanguageDelimiters('viet') . "])/u", $s)) {
|
29124 |
$o .= '<span lang="vi" class="lang_vi">' . $s . '</span>';
|
29125 |
+
} elseif ($scriptblocks[$sch] == Ucdn::SCRIPT_ARABIC && $this->autoArabic) { // Check Arabic for different languages if Arabic script - even if Basescript
|
|
|
29126 |
if (preg_match("/[" . $this->scriptToLanguage->getLanguageDelimiters('sindhi') . "]/u", $s)) {
|
29127 |
$o .= '<span lang="sd" class="lang_sd">' . $s . '</span>';
|
29128 |
} elseif (preg_match("/[" . $this->scriptToLanguage->getLanguageDelimiters('urdu') . "]/u", $s)) {
|
29137 |
// Just output chars
|
29138 |
$o .= $s;
|
29139 |
}
|
29140 |
+
} elseif ($scriptblocks[$sch] > 0 && $scriptblocks[$sch] != $this->baseScript && $this->scriptToLanguage->getLanguageByScript($scriptblocks[$sch])) { // Identify Script block if not Basescript, and mark up as language
|
|
|
29141 |
// Encase in <span>
|
29142 |
$o .= '<span lang="' . $this->scriptToLanguage->getLanguageByScript($scriptblocks[$sch]) . '" class="lang_' . $this->scriptToLanguage->getLanguageByScript($scriptblocks[$sch]) . '">';
|
29143 |
$o .= $s;
|
29154 |
$a[$i] = '<' . $e . '>';
|
29155 |
}
|
29156 |
}
|
29157 |
+
|
29158 |
$n = implode('', $a);
|
29159 |
|
29160 |
return $n;
|
29161 |
}
|
29162 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29163 |
/* -- COLUMNS -- */
|
29164 |
+
/**
|
29165 |
+
* Callback function from function printcolumnbuffer in mpdf
|
29166 |
+
*/
|
29167 |
function columnAdjustAdd($type, $k, $xadj, $yadj, $a, $b, $c = 0, $d = 0, $e = 0, $f = 0)
|
29168 |
{
|
29169 |
+
if ($type === 'Td') { // xpos,ypos
|
29170 |
+
|
29171 |
$a += ($xadj * $k);
|
29172 |
$b -= ($yadj * $k);
|
29173 |
+
|
29174 |
return 'BT ' . sprintf('%.3F %.3F', $a, $b) . ' Td';
|
29175 |
+
|
29176 |
+
} elseif ($type === 're') { // xpos,ypos,width,height
|
29177 |
+
|
29178 |
$a += ($xadj * $k);
|
29179 |
$b -= ($yadj * $k);
|
29180 |
+
|
29181 |
return sprintf('%.3F %.3F %.3F %.3F', $a, $b, $c, $d) . ' re';
|
29182 |
+
|
29183 |
+
} elseif ($type === 'l') { // xpos,ypos,x2pos,y2pos
|
29184 |
+
|
29185 |
$a += ($xadj * $k);
|
29186 |
$b -= ($yadj * $k);
|
29187 |
+
|
29188 |
return sprintf('%.3F %.3F l', $a, $b);
|
29189 |
+
|
29190 |
+
} elseif ($type === 'img') { // width,height,xpos,ypos
|
29191 |
+
|
29192 |
$c += ($xadj * $k);
|
29193 |
$d -= ($yadj * $k);
|
29194 |
+
|
29195 |
return sprintf('q %.3F 0 0 %.3F %.3F %.3F', $a, $b, $c, $d) . ' cm /' . $e;
|
29196 |
+
|
29197 |
+
} elseif ($type === 'draw') { // xpos,ypos
|
29198 |
+
|
29199 |
$a += ($xadj * $k);
|
29200 |
$b -= ($yadj * $k);
|
29201 |
+
|
29202 |
return sprintf('%.3F %.3F m', $a, $b);
|
29203 |
+
|
29204 |
+
} elseif ($type === 'bezier') { // xpos,ypos,x2pos,y2pos,x3pos,y3pos
|
29205 |
+
|
29206 |
$a += ($xadj * $k);
|
29207 |
$b -= ($yadj * $k);
|
29208 |
$c += ($xadj * $k);
|
29209 |
$d -= ($yadj * $k);
|
29210 |
$e += ($xadj * $k);
|
29211 |
$f -= ($yadj * $k);
|
29212 |
+
|
29213 |
return sprintf('%.3F %.3F %.3F %.3F %.3F %.3F', $a, $b, $c, $d, $e, $f) . ' c';
|
29214 |
}
|
29215 |
}
|
29220 |
function ConvertAngle($s, $makepositive = true)
|
29221 |
{
|
29222 |
if (preg_match('/([\-]*[0-9\.]+)(deg|grad|rad)/i', $s, $m)) {
|
29223 |
+
|
29224 |
$angle = $m[1] + 0;
|
29225 |
+
|
29226 |
if (strtolower($m[2]) == 'deg') {
|
29227 |
$angle = $angle;
|
29228 |
} elseif (strtolower($m[2]) == 'grad') {
|
29230 |
} elseif (strtolower($m[2]) == 'rad') {
|
29231 |
$angle = rad2deg($angle);
|
29232 |
}
|
29233 |
+
|
29234 |
while ($angle >= 360) {
|
29235 |
$angle -= 360;
|
29236 |
}
|
29237 |
+
|
29238 |
while ($angle <= -360) {
|
29239 |
$angle += 360;
|
29240 |
}
|
29241 |
+
|
29242 |
if ($makepositive) { // always returns an angle between 0 and 360deg
|
29243 |
if ($angle < 0) {
|
29244 |
$angle += 360;
|
29245 |
}
|
29246 |
}
|
29247 |
+
|
29248 |
} else {
|
29249 |
$angle = $s + 0;
|
29250 |
}
|
29251 |
+
|
29252 |
return $angle;
|
29253 |
}
|
29254 |
|
29261 |
$html = str_replace("'", "'", $html);
|
29262 |
$html = str_replace(""", '"', $html);
|
29263 |
$html = str_replace("&", "&", $html);
|
29264 |
+
|
29265 |
return $html;
|
29266 |
}
|
29267 |
|
29303 |
|
29304 |
$html = preg_replace('/\f/', '', $html); // replace formfeed by nothing
|
29305 |
$html = preg_replace('/\r/', '', $html); // replace carriage return by nothing
|
29306 |
+
|
29307 |
// Well formed XHTML end tags
|
29308 |
$html = preg_replace('/<(br|hr)>/i', "<\\1 />", $html); // mPDF 6
|
29309 |
$html = preg_replace('/<(br|hr)\/>/i', "<\\1 />", $html);
|
29310 |
+
|
29311 |
// Get rid of empty <thead></thead> etc
|
29312 |
$html = preg_replace('/<tr>\s*<\/tr>/i', '', $html);
|
29313 |
$html = preg_replace('/<thead>\s*<\/thead>/i', '', $html);
|
29330 |
|
29331 |
// Preserve '\n's in content between the tags <pre> and </pre>
|
29332 |
if (preg_match('/<pre/', $html)) {
|
29333 |
+
|
29334 |
$html_a = preg_split('/(\<\/?pre[^\>]*\>)/', $html, -1, 2);
|
29335 |
$h = [];
|
29336 |
$c = 0;
|
29337 |
+
|
29338 |
foreach ($html_a as $s) {
|
29339 |
if ($c > 1 && preg_match('/^<\/pre/i', $s)) {
|
29340 |
$c--;
|
29349 |
}
|
29350 |
array_push($h, $s);
|
29351 |
}
|
29352 |
+
|
29353 |
+
$html = implode('', $h);
|
29354 |
}
|
29355 |
+
|
29356 |
$thereispre = preg_match_all('#<pre(.*?)>(.*?)</pre>#si', $html, $temp);
|
29357 |
+
|
29358 |
// Preserve '\n's in content between the tags <textarea> and </textarea>
|
29359 |
$thereistextarea = preg_match_all('#<textarea(.*?)>(.*?)</textarea>#si', $html, $temp2);
|
29360 |
$html = preg_replace('/[\n]/', ' ', $html); // replace linefeed by spaces
|
29361 |
$html = preg_replace('/[\t]/', ' ', $html); // replace tabs by spaces
|
29362 |
+
|
29363 |
// Converts < to < when not a tag
|
29364 |
$html = preg_replace('/<([^!\/a-zA-Z_:])/i', '<\\1', $html); // mPDF 5.7.3
|
29365 |
$html = preg_replace("/[ ]+/", ' ', $html);
|
29396 |
$thereispre--;
|
29397 |
$iterator++;
|
29398 |
}
|
29399 |
+
|
29400 |
$iterator = 0;
|
29401 |
while ($thereistextarea) { // Recover <textarea attributes>content</textarea>
|
29402 |
$temp2[2][$iterator] = preg_replace('/\t/', str_repeat(" ", $tabSpaces), $temp2[2][$iterator]);
|
29405 |
$thereistextarea--;
|
29406 |
$iterator++;
|
29407 |
}
|
29408 |
+
|
29409 |
// Restore original tag names
|
29410 |
$html = str_replace("<erp", "<pre", $html);
|
29411 |
$html = str_replace("</erp>", "</pre>", $html);
|
29421 |
|
29422 |
// Fixes <p>₹</p> which browser copes with even though it is wrong!
|
29423 |
$html = preg_replace("/(&#[x]{0,1}[0-9a-f]{1,5})</i", "\\1;<", $html);
|
29424 |
+
|
29425 |
return $html;
|
29426 |
}
|
29427 |
|