Version Description
September, 2016 =
Fixed: mPDF PHP7 errors (blank pages)
Download this release
Release Info
Developer | baaaaas |
Plugin | WooCommerce PDF Invoices |
Version | 2.4.8 |
Comparing to | |
See all releases |
Code changes from version 2.4.7 to 2.4.8
- bootstrap.php +2 -2
- lib/mpdf/.gitignore +2 -0
- lib/mpdf/.travis.yml +20 -0
- lib/mpdf/CHANGELOG.txt +3148 -0
- lib/mpdf/CREDITS.txt +91 -0
- lib/mpdf/LICENSE.txt +340 -0
- lib/mpdf/MpdfException.php +6 -0
- lib/mpdf/README.md +52 -0
- lib/mpdf/Tag.php +6118 -0
- lib/mpdf/classes/barcode.php +2102 -1972
- lib/mpdf/classes/bmp.php +260 -248
- lib/mpdf/classes/cssmgr.php +2043 -1721
- lib/mpdf/classes/directw.php +463 -412
- lib/mpdf/classes/gif.php +677 -700
- lib/mpdf/classes/grad.php +975 -724
- lib/mpdf/classes/indic.php +1864 -1714
- lib/mpdf/classes/meter.php +292 -282
- lib/mpdf/classes/mpdfform.php +0 -92
bootstrap.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: WooCommerce PDF Invoices
|
4 |
* Plugin URI: https://wordpress.org/plugins/woocommerce-pdf-invoices
|
5 |
* Description: Automatically generate and attach customizable PDF Invoices to WooCommerce emails and connect with Dropbox, Google Drive, OneDrive or Egnyte.
|
6 |
-
* Version: 2.4.
|
7 |
* Author: Bas Elbers
|
8 |
* Author URI: http://wcpdfinvoices.com
|
9 |
* License: GPL-2.0+
|
@@ -19,7 +19,7 @@ function bewpi_plugins_loaded() {
|
|
19 |
|
20 |
$wp_upload_dir = wp_upload_dir();
|
21 |
|
22 |
-
define( 'BEWPI_VERSION', '2.4.
|
23 |
define( 'BEWPI_URL', plugins_url( '', __FILE__ ) . '/' );
|
24 |
define( 'BEWPI_DIR', plugin_dir_path( __FILE__ ) . '/' );
|
25 |
define( 'BEWPI_TEMPLATES_DIR', plugin_dir_path( __FILE__ ) . 'includes/templates/' );
|
3 |
* Plugin Name: WooCommerce PDF Invoices
|
4 |
* Plugin URI: https://wordpress.org/plugins/woocommerce-pdf-invoices
|
5 |
* Description: Automatically generate and attach customizable PDF Invoices to WooCommerce emails and connect with Dropbox, Google Drive, OneDrive or Egnyte.
|
6 |
+
* Version: 2.4.8
|
7 |
* Author: Bas Elbers
|
8 |
* Author URI: http://wcpdfinvoices.com
|
9 |
* License: GPL-2.0+
|
19 |
|
20 |
$wp_upload_dir = wp_upload_dir();
|
21 |
|
22 |
+
define( 'BEWPI_VERSION', '2.4.8' );
|
23 |
define( 'BEWPI_URL', plugins_url( '', __FILE__ ) . '/' );
|
24 |
define( 'BEWPI_DIR', plugin_dir_path( __FILE__ ) . '/' );
|
25 |
define( 'BEWPI_TEMPLATES_DIR', plugin_dir_path( __FILE__ ) . 'includes/templates/' );
|
lib/mpdf/.gitignore
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
vendor/*
|
2 |
+
composer.lock
|
lib/mpdf/.travis.yml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
language: php
|
2 |
+
|
3 |
+
php:
|
4 |
+
- 5.4
|
5 |
+
- 5.5
|
6 |
+
- 5.6
|
7 |
+
- 7.0
|
8 |
+
- hhvm
|
9 |
+
|
10 |
+
matrix:
|
11 |
+
allow_failures:
|
12 |
+
- php: 7.0
|
13 |
+
- php: hhvm
|
14 |
+
|
15 |
+
install:
|
16 |
+
- composer self-update
|
17 |
+
- composer install
|
18 |
+
|
19 |
+
notifications:
|
20 |
+
email: change
|
lib/mpdf/CHANGELOG.txt
ADDED
@@ -0,0 +1,3148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
===========================
|
2 |
+
mPDF 6.1.0
|
3 |
+
26/04/2016
|
4 |
+
===========================
|
5 |
+
- Composer updates
|
6 |
+
- First release officially supporting Composer
|
7 |
+
- Updated license in composer.json
|
8 |
+
- Chmod 777 on dirs ttfontdata, tmp, graph_cache after composer install
|
9 |
+
- Requiring PHP 5.4.0+ with Composer
|
10 |
+
- Code style
|
11 |
+
- Reformated (almost) all PHP files to keep basic code style
|
12 |
+
- Removed trailing whitespaces
|
13 |
+
- Converted all txt, php, css, and htm files to utf8
|
14 |
+
- Removed closing PHP tags
|
15 |
+
- Change all else if calls to elseif
|
16 |
+
- Added base PHPUnit tests
|
17 |
+
- Added Travis CI integration with unit tests
|
18 |
+
- Changed all mPDF::Error and die() calls to throwing MpdfException
|
19 |
+
- PDF Import changes
|
20 |
+
- FPDI updated to 1.6.0 to fix incompatible licenses
|
21 |
+
- FPDI loaded from Composer or manually only
|
22 |
+
- Removed iccprofiles/CMYK directory
|
23 |
+
- Renamed example files: change spaces to underscores to make scripting easier
|
24 |
+
- Fixed LEDGER and TABLOID paper sizes
|
25 |
+
- Implemented static cache for mpdf function ConvertColor.
|
26 |
+
- Removed PHP4 style constructors
|
27 |
+
- Work with HTML tags separated to Tag class
|
28 |
+
- Fixed most Strict standards PHP errors
|
29 |
+
- Add config constant so we can define custom font data
|
30 |
+
- HTML
|
31 |
+
- fax & tel support in href attribute
|
32 |
+
- Check $html in $mpdf->WriteHTML() to see if it is an integer, float, string, boolean or
|
33 |
+
a class with __toString() and cast to a string, otherwise throw exception.
|
34 |
+
- PHP 7
|
35 |
+
- Fix getting image from internal variable in PHP7 (4dcc2b4)
|
36 |
+
- Fix PHP7 Fatal error: 'break' not in the 'loop' or 'switch' context (002bb8a)
|
37 |
+
- Fixed output file name for D and I output modes (issue #105, f297546)
|
38 |
+
|
39 |
+
===========================
|
40 |
+
mPDF 6.0
|
41 |
+
20/12/2014
|
42 |
+
===========================
|
43 |
+
New features / Improvements
|
44 |
+
---------------------------
|
45 |
+
Support for OpenTypeLayout tables / features for complex scripts and Advances Typography.
|
46 |
+
Improved bidirectional text handling.
|
47 |
+
Improved line-breaking, including for complex scripts e.g. Lao, Thai and Khmer.
|
48 |
+
Updated page-breaking options.
|
49 |
+
Automatic language mark-up and font selection using autoScriptToLang and autoLangToFont.
|
50 |
+
Kashida for text-justification in arabic scripts.
|
51 |
+
Index collation for non-ASCII characters.
|
52 |
+
Index mark-up allowing control over layout using CSS.
|
53 |
+
{PAGENO} and {nbpg} can use any of the number types as in list-style e.g. set in <pagebreak> using pagenumstyle.
|
54 |
+
CSS support for lists.
|
55 |
+
Default stylesheet - mpdf.css - updated.
|
56 |
+
|
57 |
+
|
58 |
+
Added CSS support
|
59 |
+
-----------------
|
60 |
+
- lang attribute selector e.g. :lang(fr), [lang="fr"]
|
61 |
+
- font-variant-position
|
62 |
+
- font-variant-caps
|
63 |
+
- font-variant-ligatures
|
64 |
+
- font-variant-numeric
|
65 |
+
- font-variant-alternates - Only [normal | historical-forms] supported (i.e. most are NOT supported)
|
66 |
+
- font-variant - as above, and except for: east-asian-variant-values, east-asian-width-values, ruby
|
67 |
+
- font-language-override
|
68 |
+
- font-feature-settings
|
69 |
+
- text-outline is now supported on TD/TH tags
|
70 |
+
- hebrew, khmer, cambodian, lao, and cjk-decimal recognised as values for "list-style-type" in numbered lists and page numbering.
|
71 |
+
- list-style-image and list-style-position
|
72 |
+
- transform (on <img> only)
|
73 |
+
- text-decoration:overline
|
74 |
+
- image-rendering
|
75 |
+
- unicode-bidi (also <bdi> tag)
|
76 |
+
- vertical-align can use lengths e.g. 0.5em
|
77 |
+
- line-stacking-strategy
|
78 |
+
- line-stacking-shift
|
79 |
+
|
80 |
+
================
|
81 |
+
mPDF 5.7.4
|
82 |
+
15/12/2014
|
83 |
+
================
|
84 |
+
Bug Fixes & Minor Additions
|
85 |
+
---------------------------
|
86 |
+
- SVG images now support embedded images e.g. <image xlink:href="image.png" width="100px" height="100px" />
|
87 |
+
- SVG images now supports <tspan> element e.g. <tspan x,y,dx,dy,text-anchor >, and also <tref>
|
88 |
+
- SVG images now can use Autofont (see top of classes/svg.php file)
|
89 |
+
- SVG images now has limited support for CSS classes (see top of classes/svg.php file)
|
90 |
+
- SVG images - style inheritance improved
|
91 |
+
- SVG images - improved handling of comments and other extraneous code
|
92 |
+
- SVG images - fix to ensure opacity is reset before another element
|
93 |
+
- SVG images - font-size not resetting after a <text> element
|
94 |
+
- SVG radial gradients bug (if the focus [fx,fy] lies outside circle defined by [cx,cy] and r) cf. pservers-grad-15-b.svg
|
95 |
+
- SVG allows spaces in attribute definitions in <use> or <defs> e.g. <use x = "0" y = "0" xlink:href = "#s3" />
|
96 |
+
- SVG text which contains a < sign, it will break the text - now processed as < (despite the fact that this does not conform to XML spec)
|
97 |
+
- SVG images - support automatic font selection and (minimal) use of CSS classes - cf. the defined constants at top of svg.php file
|
98 |
+
- SVG images - text-anchor now supported as a CSS style, as well as an HTML attribute
|
99 |
+
- CSS support for :nth-child() selector improved to fully support the draft CSS3 spec - http://www.w3.org/TR/selectors/#nth-child-pseudo
|
100 |
+
[NB only works on table columns or rows]
|
101 |
+
- text-indent when set as "em" - incorrectly calculated if last text in line in different font size than for block
|
102 |
+
- CSS not applying cascaded styles on <A> elements - [changed MergeCSS() type to INLINE for 'A', LEGEND, METER and PROGRESS]
|
103 |
+
- fix for underline/strikethrough/overline so that line position(s) are based correctly on font-size/font in nested situations
|
104 |
+
- Error: Strict warning: Only variables should be passed by reference - in PHP5.5.9
|
105 |
+
- bug accessing images from some servers (HTTP 403 Forbidden whn accessed using fopen etc.)
|
106 |
+
- Setting page format incorrectly set default twice and missed some options
|
107 |
+
- bug fixed in Overwrite() when specifying replacement as a string
|
108 |
+
- barcode C93 - updated C93 code from TCPDF because of bug - incorrect checksum character for "153-2-4"
|
109 |
+
- Tables - bug when using colspan across columns which may have a cell width specified
|
110 |
+
cf. http://www.mpdf1.com/forum/discussion/2221/colspan-bug
|
111 |
+
- Tables - cell height (when specified) is not resized when table is shrunk
|
112 |
+
- Tables - if table width specified, but narrower than minimum cell wdith, and less than page width - table will expand to
|
113 |
+
minimum cell width(s) as long as $keep_table_proportions = true
|
114 |
+
- Tables - if using packTableData, and borders-collapse, wider border is overwriting content of adjacent cell
|
115 |
+
Test case:
|
116 |
+
<table style="border-collapse: collapse;">
|
117 |
+
<tr><td style="border-bottom: 42px solid #0FF; "> Hallo world </td></tr>
|
118 |
+
<tr><td style="border-top: 14px solid #0F0; "> Hallo world </td></tr>
|
119 |
+
</table>
|
120 |
+
- Images - image height is reset proportional to original if width is set to maximum e.g. <img width="100%" height="20mm"
|
121 |
+
- URL handling changed to work with special characters in path fragments; affects <a> links, <mg> images and
|
122 |
+
CSS url() e.g background-image
|
123 |
+
- also to ignore "../" included as a query value
|
124 |
+
- Barcodes with bottom numerals e.g. EAN-13 - incorrect numeral size when using core fonts
|
125 |
+
--------------------------------
|
126 |
+
NB Spec. for embedded SVG images:
|
127 |
+
as per http://www.w3.org/TR/2003/REC-SVG11-20030114/struct.html#ImageElement
|
128 |
+
Attributes supported:
|
129 |
+
x
|
130 |
+
y
|
131 |
+
xlink:href (required) - can be jpeg, png or gif image - not vector (SVG or WMF) image
|
132 |
+
width (required)
|
133 |
+
height (required)
|
134 |
+
preserveAspectRatio
|
135 |
+
|
136 |
+
Note: all attribute names and values are case-sensitive
|
137 |
+
width and height cannot be assigned by CSS - must be attributes
|
138 |
+
---------------------------------
|
139 |
+
================
|
140 |
+
mPDF 5.7.3
|
141 |
+
24/8/2014
|
142 |
+
================
|
143 |
+
Bug Fixes & Minor Additions
|
144 |
+
---------------------------
|
145 |
+
- Tables - cellSpacing and cellPadding taking preference over CSS stylesheet
|
146 |
+
- Tables - background images in table inside HTML Footer incorrectly positioned
|
147 |
+
- Tables - cell in a nested table with a specified width, should determine width of parent table cell
|
148 |
+
(cf. http://www.mpdf1.com/forum/discussion/1648/nested-table-bug-)
|
149 |
+
- Tables - colspan (on a row after first row) exceeds number of columns in table
|
150 |
+
- Gradients in Imported documents (mPDFI) causing error in some browsers
|
151 |
+
- Fatal error after page-break-after:always on root level block element
|
152 |
+
- Support for 'https/SSL' if file_get_contents_by_socket required (e.g. getting images with allow_url_fopen turned off)
|
153 |
+
- Improved support for specified ports when getting external CSS stylesheets e.g. www.domain.com:80
|
154 |
+
- error accessing local .css files with dummy queries (cache-busting) e.g. mpdfstyleA4.css?v=2.0.18.9
|
155 |
+
- start of end tag in PRE incorrectly changed to <
|
156 |
+
- error thrown when open.basedir restriction in effect (deleting temporary files)
|
157 |
+
- image which forces pagebreak incorrectly positioned at top of page
|
158 |
+
- [changes to avoid warning notices by checking if (isset(x)) before referencing it]
|
159 |
+
- text with letter-spacing set inside table which needs to be resixed (shrunk) - letter-spacing was not adjusted
|
160 |
+
- nested table incorrectly calculating width and unnecessarily wrapping text
|
161 |
+
- vertical-align:super|sub can be nested using <span> elements
|
162 |
+
- inline elements can be nested e.g. text <sup>text<sup>13</sup>text</sup> text
|
163 |
+
- CSS vertical-align:0.5em (or %) now supported
|
164 |
+
- underline and strikethrough now use the parent inline block baseline/fontsize/color for child inline elements *** change in behaviour
|
165 |
+
(Adjusts line height to take account of superscript and subscript except in tables)
|
166 |
+
- nested table incorrectly calculating width and unnecessarily wrapping text
|
167 |
+
- tables - font size carrying over from one nested table to the next nested table
|
168 |
+
- tables - border set as attribute on <TABLE> overrides border set as CSS on <TD>
|
169 |
+
- tables - if table width set to 100% and one cell/column is empty with no padding/border, sizing incorrectly
|
170 |
+
(http://www.mpdf1.com/forum/discussion/1886/td-fontsize-in-nested-table-bug-#Item_5)
|
171 |
+
- <main> added as recognised tag
|
172 |
+
- CSS style transform supported on <img> element (only)
|
173 |
+
All transform functions are supported except matrix() i.e. translate(), translateX(), translateY(), skew(), skewX(), skewY(),
|
174 |
+
scale(), scaleX(), scaleY(), rotate()
|
175 |
+
NB When using Columns or Keep-with-table (use_kwt), cannot use transform
|
176 |
+
- CSS background-color now supported on <img> element
|
177 |
+
- @page :first not recognised unless @page {} has styles set
|
178 |
+
- left/right margins not allowed on @page :first
|
179 |
+
|
180 |
+
|
181 |
+
|
182 |
+
================
|
183 |
+
mPDF 5.7.2
|
184 |
+
28/12/2013
|
185 |
+
================
|
186 |
+
Bug Fixes
|
187 |
+
---------
|
188 |
+
- <tfoot> not printing at all (since v5.7)
|
189 |
+
- list-style incorrectly overriding list-style-type in cascading CSS
|
190 |
+
- page-break-after:avoid not taking into account bottom padding and margin when estimating if next line can fit on page
|
191 |
+
- images not displayed when using "https://" if images are referenced by src="//domain.com/image"
|
192 |
+
- +aCJK incorrectly parsed when instantiating class e.g. new mpDF('ja+aCJK')
|
193 |
+
- line-breaking - zero-width object at end of line (e.g. index entry) causing a space left untrimmed at end of line
|
194 |
+
- ToC since v5.7 incorrectly handling non-ascii characters, entities or tags
|
195 |
+
- cell height miscalculated when using hard-hyphenate
|
196 |
+
- border colors set with transparency not working
|
197 |
+
- transparency settings for stroke and fill interfering with one another
|
198 |
+
- 'float' inside a HTML header/footer - not clearing the float before first line of text
|
199 |
+
- error if script run across date change at midnight
|
200 |
+
- temporary file name collisions (e.g. when processing images) if numerous users
|
201 |
+
- <watermarkimage> position attribute not working
|
202 |
+
- < (less-than sign) inside a PRE element, and NOT start of a valid tag, was incorrectly removed
|
203 |
+
- file attachments not opening in Reader XI
|
204 |
+
- JPG images not recognised if not containing JFIF or Exif markers
|
205 |
+
- instance of preg_replace with /e modifier causing error in PHP 5.5
|
206 |
+
- correctly handle CSS URLs with no scheme
|
207 |
+
- Index entries causing errors when repeat entries are used within page-break-inside:avoid, rotated tables etc.
|
208 |
+
- table with fixed width column and long word in cell set to colspan across this column (adding spare width to all columns)
|
209 |
+
- incorrect hyphenation if multiple soft-hyphens on line before break
|
210 |
+
- SVG images - objects contained in <defs> being displayed
|
211 |
+
- SVG images - multiple, or quoted fonts e.g. style="font-family:'lucida grande', verdana" not recognised
|
212 |
+
- SVG images - line with opacity=0 still visible (only in some PDF viewers/browsers)
|
213 |
+
- text in an SVG image displaying with incorrect font in some PDF viewers/browsers
|
214 |
+
- SVG images - fill:RGB(0,0,0) not recognised when uppercase
|
215 |
+
- background images using data:image\/(jpeg|gif|png);base64 format - error when reading in stylesheet
|
216 |
+
|
217 |
+
New CSS support
|
218 |
+
---------------
|
219 |
+
- added support for style="opacity:0.6;" in SVG images - previously only supported style="fill-opacity:0.6; stroke-opacity: 0.6;"
|
220 |
+
- improved PNG image handling for some cases of alpha channel transparency
|
221 |
+
- khmer, cambodian and lao recognised as list-style-type for numbered lists
|
222 |
+
|
223 |
+
SVG Images
|
224 |
+
----------
|
225 |
+
Limited support for <use> and <defs>
|
226 |
+
|
227 |
+
================
|
228 |
+
mPDF 5.7.1
|
229 |
+
1/09/2013
|
230 |
+
================
|
231 |
+
1) FILES: mpdf.php
|
232 |
+
Bug fix; Dollar sign enclosed by <pre> tag causing error.
|
233 |
+
Test e.g.: <pre>Test $1.00 Test</pre> <pre>Test $2.00 Test</pre> <pre>Test $3.00 Test</pre> <pre>Test $4.00 Test</pre>
|
234 |
+
-----------------------------
|
235 |
+
2) FILES: includes/functions.php AND mpdf.php
|
236 |
+
Changes to preg_replace with /e modifier to use preg_replace_callback
|
237 |
+
(/e depracated from PHP 5.5)
|
238 |
+
-----------------------------
|
239 |
+
3) FILES: classes/barcode.php
|
240 |
+
Small change to function barcode_c128() which allows ASCII 0 - 31 to be used in C128A e.g. chr(13) in:
|
241 |
+
<barcode code="5432
1068" type="C128A" />
|
242 |
+
-----------------------------
|
243 |
+
4) FILES: mpdf.php
|
244 |
+
Using $use_kwt ("keep-[heading]-with-table") if <h4></h4> before table is on 2 lines and pagebreak occurs after first line
|
245 |
+
the first line is displayed at the bottom of the 2nd page.
|
246 |
+
Edited so that $use_kwt only works if the HEADING is only one line. Else ignores (but prints correctly)
|
247 |
+
-----------------------------
|
248 |
+
5) FILES: mpdf.php
|
249 |
+
Clearing old temporary files from _MPDF_TEMP_PATH will now ignore "hidden" files e.g. starting with a "." .htaccess, .gitignore etc.
|
250 |
+
and also leave dummy.txt alone
|
251 |
+
-----------------------------
|
252 |
+
|
253 |
+
|
254 |
+
===========================
|
255 |
+
mPDF 5.7
|
256 |
+
14/07/2013
|
257 |
+
===========================
|
258 |
+
|
259 |
+
Files changed
|
260 |
+
-------------
|
261 |
+
config.php
|
262 |
+
mpdf.php
|
263 |
+
classes/tocontents.php
|
264 |
+
classes/cssmgr.php
|
265 |
+
classes/svg.php
|
266 |
+
includes/functions.php
|
267 |
+
includes/out.php
|
268 |
+
examples/formsubmit.php [Important - Security update]
|
269 |
+
|
270 |
+
Updated Example Files in /examples/
|
271 |
+
-----------------------------------
|
272 |
+
All example files
|
273 |
+
mpdfstyleA4.css
|
274 |
+
|
275 |
+
|
276 |
+
config.php
|
277 |
+
----------
|
278 |
+
Removed:
|
279 |
+
$this->hyphenateTables
|
280 |
+
$this->hyphenate
|
281 |
+
$this->orphansAllowed
|
282 |
+
Edited:
|
283 |
+
"hyphens: manual" - Added to $this->defaultCSS
|
284 |
+
$this->allowedCSStags now includes '|TEXTCIRCLE|DOTTAB'
|
285 |
+
New:
|
286 |
+
$this->decimal_align = array('DP'=>'.', 'DC'=>',', 'DM'=>"\xc2\xb7", 'DA'=>"\xd9\xab", 'DD'=>'-');
|
287 |
+
$this->h2toc = array('H1'=>0, 'H2'=>1, 'H3'=>2);
|
288 |
+
$this->h2bookmarks = array('H1'=>0, 'H2'=>1, 'H3'=>2);
|
289 |
+
$this->CJKforceend = false; // Forces overflowng punctuation to hang outside right margin (used with CJK script)
|
290 |
+
|
291 |
+
|
292 |
+
Backwards compatability
|
293 |
+
-----------------------
|
294 |
+
Changes in mPDF 5.7 may cause some changes to the way your documents appear. There are two main differences:
|
295 |
+
1) Hyphenation. To retain appearance compatible with earlier versions, set the CSS property "hyphens: auto" whenever
|
296 |
+
you previously used $mpdf->hyphenate=true;
|
297 |
+
2) Table of Contents - appearance can now be controlled with CSS styles. By default, in mPDF 5.7, no styling is applied so you will get:
|
298 |
+
- No indent (previous default of 5mm) - ($tocindent is ignored)
|
299 |
+
- Any font, font-size set ($tocfont or $tocfontsize) will not work
|
300 |
+
- HyperLinks will appear with your default appearance - usually blue and underlined
|
301 |
+
- line spacing will be narrower (can use line-height or margin-top in CSS)
|
302 |
+
|
303 |
+
|
304 |
+
New features / Improvements
|
305 |
+
---------------------------
|
306 |
+
Layout of Table of Content ToC now controlled using CSS styles
|
307 |
+
Text alignment on decimal mark inside tables
|
308 |
+
Automatically generated bookmarks and/or ToC entries from H1 - H6 tags
|
309 |
+
Support for unit of "rem" as size e.g. font-size: 1rem;
|
310 |
+
Origin and clipping for background images and gradients controlled by CSS i.e. background-origin, background-size, background-clip
|
311 |
+
Text-outline controlled by CSS (compatible with CSS3 spec.)
|
312 |
+
Use of <dottab> enhanced by custom CSS "outdent" property
|
313 |
+
Image HTML attributes <img> added: max-height, max-width, min-height and min-width
|
314 |
+
Spotcolor can now be defined as it is used e.g. color: spot(PANTONE 534 EC, 100%, 85, 65, 47, 9);
|
315 |
+
Lists - added support for "start" attribute in <ol> e.g. <ol start="5">
|
316 |
+
Hyphenation controlled using CSS, consistent with CSS3 spec.
|
317 |
+
Line breaking improved to avoid breaks within words where HTML tags are used e.g. H<sub>2<sub>0
|
318 |
+
Line breaking in CJK scripts improved (and ability to force hanging punctuation)
|
319 |
+
Numerals in a CJK script are kept together
|
320 |
+
RTL improved support for phrases containing numerals and \ and /
|
321 |
+
Bidi override codes supported - Right-to-Left Embedding [RLE] U+202B, Left-to-Right Embedding [LRE] U+202A,
|
322 |
+
U+202C POP DIRECTIONAL FORMATTING (PDF)
|
323 |
+
Support for <base href=""> in HTML - uses it to SetBasePath for relative URLs.
|
324 |
+
HTML tag - added support for <wbr> or <wbr /> - converted to a soft-hyphen
|
325 |
+
CSS now takes precedence over HTML attribute e.g. <table bgcolor="black" style="background-color:yellow">
|
326 |
+
|
327 |
+
|
328 |
+
|
329 |
+
Added CSS support
|
330 |
+
-----------------
|
331 |
+
- max-height, max-width, min-height and min-width for images <img>
|
332 |
+
- "hyphens: none|manual|auto" as per CSS3 spec.
|
333 |
+
- Decimal mark alignment e.g. text-align: "." center;
|
334 |
+
- "rem" accepted as a valid (font)size in CSS e.g. font-size: 1.5rem
|
335 |
+
- text-outline, text-outline-width and text-outline-color supported everywhere except in tables (blur not supported)
|
336 |
+
- background-origin, background-size, background-clip are now supported everywhere except in tables
|
337 |
+
- "visibility: hidden|visible|printonly|screenonly" for inline elements e.g. <span>
|
338 |
+
- Colors: device-cmyk(c,m,y,k) as per CSS3 spec. For consistency, device-cmyka also supported (not CSS3 spec)
|
339 |
+
- "z-index" can be used to utilise layers in the PDF document
|
340 |
+
- Custom CSS property added: "outdent" - opposite of indent
|
341 |
+
|
342 |
+
The HTML elements <dottab> and <textcircle> can now have CSS properties applied to them.
|
343 |
+
|
344 |
+
|
345 |
+
Bug fixes
|
346 |
+
---------
|
347 |
+
- SVG images - path including e.g. 1.234E-15 incorrectly parsed (not recognising capital E)
|
348 |
+
- Tables - if a table starts when the Y position on page is below bottom margin caused endless loop
|
349 |
+
- Float-ing DIVs - starting a float at bottom of page and it causes page break before anything output, second new page is forced
|
350 |
+
- Tables - Warning notice now given in Table footer or header if <tfoot> placed after <tbody> and table spans page
|
351 |
+
- Columns - block with border-width wider than the length of the border line, line overflows
|
352 |
+
- Columns - block with no padding containing a block with borders but no backgound colour, borders not printed
|
353 |
+
- Table in Columns - when background color set by surrounding block element - colour missing for height of half bottom border.
|
354 |
+
- TOCpagebreakByArray() when called by function was not adding the pagebreak
|
355 |
+
- Border around block element - dashed not showing correctly (not resetting linewidth between different edges)
|
356 |
+
- Double border in table - when background colour set in surrounding block element - shows as black line between the 2 bits of double
|
357 |
+
- Borders around DIVs - "double" border problem if not all 4 sides equally - fixed
|
358 |
+
- Borders around DIVs - solid (and double) borders overlap as in tables - now fixed so mitred joins as in browser
|
359 |
+
[Inadvertently improves borders in Columns because of change in LineCap]
|
360 |
+
- Page numbering - $mpdf->pagenumSuffix etc not suppressed in HTML headers/footers if number suppressed
|
361 |
+
- Page numbering - Page number total {nbpg} incorrect - e.g. showing decreasing numbers through document, when ToC present
|
362 |
+
- RTL numerals - incorrectly reversing a number followed by a comma
|
363 |
+
- Transform to uppercase/lowercase not working for chars > ASCII 128 when using core fonts
|
364 |
+
- TOCpagebreak - Not setting TOC-FOOTER
|
365 |
+
- TOCpagebreak - toc-even-header-name etc. not working
|
366 |
+
- Parsing some relative URLs incorrectly
|
367 |
+
- Textcircle - when moved to next page by "page-break-inside: avoid"
|
368 |
+
- Bookmarks will now work if jump more than one level e.g. 0,2,1 Inserts a new blank entry at level 1
|
369 |
+
- Paths to img or stylesheets - incorrectly reading "//www.domain.com" i.e. when starting with two /
|
370 |
+
- data:image as background url() - incorrectly adjusting path on server if MPDF_PATH not specified (included in release mPDF 5.6.1)
|
371 |
+
- Image problem if spaces or commas in path using http:// URL (included in release mPDF 5.6.1)
|
372 |
+
- Image URL parsing rewritten to handle both urlencoded URLs and not urlencoded (included in release mPDF 5.6.1)
|
373 |
+
- <dottab> fixed to allow color, font-size and font-family to be correctly used, avoid dots being moved to new page, and to work in RTL
|
374 |
+
- Table {colsum} summed figures in table header
|
375 |
+
- list-style-type (custom) colour not working
|
376 |
+
- <tocpagebreak> toc-preHTML and toc-postHTML can now contain quotes
|
377 |
+
|
378 |
+
|
379 |
+
|
380 |
+
===========================
|
381 |
+
mPDF 5.6
|
382 |
+
20/01/2013
|
383 |
+
===========================
|
384 |
+
|
385 |
+
Files changed
|
386 |
+
-------------
|
387 |
+
mpdf.php
|
388 |
+
config.php
|
389 |
+
includes/functions.php
|
390 |
+
classes/meter.php
|
391 |
+
classes/directw.php
|
392 |
+
|
393 |
+
|
394 |
+
config.php changes
|
395 |
+
------------------
|
396 |
+
$this->allowedCSStags - added HTML5 tags + textcircle AND
|
397 |
+
$this->outerblocktags - added HTML5 tags
|
398 |
+
$this->defaultCSS - added default CSS properties
|
399 |
+
|
400 |
+
|
401 |
+
New features / Improvements
|
402 |
+
---------------------------
|
403 |
+
CSS support added for for min-height, min-width, max-height and max-width in <img>
|
404 |
+
|
405 |
+
Images embedded in CSS
|
406 |
+
<img src="data:image/gif;base64,...."> improved to make it more robust, and
|
407 |
+
background: url(data:image... now added to work
|
408 |
+
|
409 |
+
HTML5 tags supported
|
410 |
+
- as generic block elements: <article><aside><details><figure><figcaption><footer><header><hgroup><nav><section><summary>
|
411 |
+
- as in-line elements: <mark><time><meter><progress>
|
412 |
+
- <mark> has a default CSS set in config.php to yellow highlight
|
413 |
+
- <meter> and <progress> support attributes as for HTML5
|
414 |
+
- custom appearances for <meter> and <progress> can be made by editing classes/meter.php file
|
415 |
+
- <meter> and <progress> suppress text inside the tags
|
416 |
+
|
417 |
+
Textcircle/Circular
|
418 |
+
font: "auto" added: automatically sizes text to fill semicircle (if both set) or full circle (if only one set)
|
419 |
+
NB for this AND ALL CSS on <textcircle>: does not inherit CSS styles
|
420 |
+
attribute: divider="[characters including HTML entities]" added
|
421 |
+
<textcircle r="30mm" top-text="Text Circular Text Circular" bottom-text="Text Circular Text Circular"
|
422 |
+
divider=" • " style="font-size: auto" />
|
423 |
+
|
424 |
+
» ’ ‚ „ are now included in "orphan"-management at the end of lines
|
425 |
+
|
426 |
+
Improved CJK line wrapping (if CJK character at end of line, breaks there rather than previous wordspace)
|
427 |
+
|
428 |
+
NB mPDF 5.5 added support for <fieldset> and <legend> (omitted from ChangeLog)
|
429 |
+
|
430 |
+
Bug fixes
|
431 |
+
---------
|
432 |
+
- embedded fonts: Panose string incorrectly output as decimals - changed to hexadecimal
|
433 |
+
Only a problem in limited circumstances.
|
434 |
+
*****Need to delete all ttfontdata/ files in order for fix to have effect.
|
435 |
+
- <textCircle> background white even when set to none/transparent
|
436 |
+
- border="0" causing mPDF to add border to table CELLS as well as table
|
437 |
+
- iteration counter in THEAD crashed in some circumstances
|
438 |
+
- CSS color now supports spaces in the rgb() format e.g. border: 1px solid rgb(170, 170, 170);
|
439 |
+
- CJK not working in table following changes made in v5.4
|
440 |
+
- images fixed to work with Google Chart API (now mPDF does not urldecode the query part of the src)
|
441 |
+
- CSS <style> within HTML page crashed if CSS is too large (? > 32Kb)
|
442 |
+
- SVG image nested int eht HTML failed to show if code too large (? > 32Kb)
|
443 |
+
- cyrillic character p р at end of table cell caused cell height to be incorrectly calculated
|
444 |
+
|
445 |
+
|
446 |
+
===========================
|
447 |
+
mPDF 5.5
|
448 |
+
02/03/2012
|
449 |
+
===========================
|
450 |
+
|
451 |
+
Files changed
|
452 |
+
-------------
|
453 |
+
mpdf.php
|
454 |
+
classes/ttfontsuni.php
|
455 |
+
classes/svg.php
|
456 |
+
classes/tocontents.php
|
457 |
+
config.php
|
458 |
+
config_fonts.php
|
459 |
+
utils/font_collections.php
|
460 |
+
utils/font_coverage.php
|
461 |
+
utils/font_dump.php
|
462 |
+
|
463 |
+
Files added
|
464 |
+
-----------
|
465 |
+
classes/ttfontsuni_analysis.php
|
466 |
+
|
467 |
+
config.php changes
|
468 |
+
------------------
|
469 |
+
To avoid just the border/background-color of the (empty) end of a block being moved on to next page (</div></div>)
|
470 |
+
$this->margBuffer = 0; // Allow an (empty) end of block to extend beyond the bottom margin by this amount (mm)
|
471 |
+
|
472 |
+
config_fonts.php changes
|
473 |
+
------------------------
|
474 |
+
Added to (arabic) fonts to allow "use non-mapped Arabic Glyphs" e.g. for Pashto
|
475 |
+
'unAGlyphs' => true,
|
476 |
+
|
477 |
+
Arabic text
|
478 |
+
-----------
|
479 |
+
Arabic text (RTL) rewritten with improved support for Pashto/Sindhi/Urdu/Kurdish
|
480 |
+
Presentation forms added:
|
481 |
+
U+0649, U+0681, U+0682, U+0685, U+069A-U+069E, U+06A0, U+06A2, U+06A3, U+06A5, U+06AB-U+06AE,
|
482 |
+
U+06B0-U+06B4, U+06B5-U+06B9, U+06BB, U+06BC, U+06BE, U+06BF, U+06C0, U+06CD, U+06CE, U+06D1, U+06D3, U+0678
|
483 |
+
Joining improved:
|
484 |
+
U+0672, U+0675, U+0676, U+0677, U+0679-U+067D, U+067F, U+0680, U+0683, U+0684, U+0687, U+0687, U+0688-U+0692,
|
485 |
+
U+0694, U+0695, U+0697, U+0699, U+068F, U+06A1, U+06A4, U+06A6, U+06A7, U+06A8, U+06AA, U+06BA, U+06C2-U+06CB, U+06CF
|
486 |
+
|
487 |
+
Note -
|
488 |
+
Some characters in Pashto/Sindhi/Urdu/Kurdish do not have Unicode values for the final/initial/medial forms of the characters.
|
489 |
+
However, some fonts include these characters "un-mapped" to Unicode (including XB Zar and XB Riyaz, which are bundled with mPDF).
|
490 |
+
'unAGlyphs' => true,
|
491 |
+
added to the config_fonts.php file for appropriate fonts will
|
492 |
+
|
493 |
+
This requires the font file to include a Format 2.0 POST table which references the glyphs as e.g. uni067C.med or uni067C.medi:
|
494 |
+
e.g. XB Riyaz, XB Zar, Arabic Typesetting (MS), Arial (MS)
|
495 |
+
NB If you want to know if a font file is suitable, you can open a .ttf file in a text editor and search for "uni067C.med"
|
496 |
+
- if it exists, it may work!
|
497 |
+
Using "unAGlyphs" forces subsetting of fonts, and will not work with SIP/SMP fonts (using characters beyond the Unicode BMP Plane).
|
498 |
+
|
499 |
+
mPDF maps these characters to part of the Private Use Area allocated by Unicode U+F500-F7FF. This could interfere with correct use
|
500 |
+
if the font already utilises these codes (unlikely).
|
501 |
+
|
502 |
+
mPDF now deletes U+200C,U+200D,U+200E,U+200F zero-widthjoiner/non-joiner, LTR and RTL marks so they will not appear
|
503 |
+
even though some fonts contain glyphs for these characters.
|
504 |
+
|
505 |
+
|
506 |
+
Other New features / Improvements
|
507 |
+
---------------------------------
|
508 |
+
Avoid just the border/background-color of the (empty) end of a block being moved on to next page (</div></div>)
|
509 |
+
using configurable variable: $this->margBuffer;
|
510 |
+
|
511 |
+
|
512 |
+
The TTFontsUni class contained a long function (extractcoreinfo) which is not used routinely in mPDF
|
513 |
+
This has been moved to a new file: classes/ttfontsuni_analysis.php
|
514 |
+
The 3 utility scripts have been updated to use the new extended class:
|
515 |
+
- utils/font_collections.php
|
516 |
+
- utils/font_coverage.php
|
517 |
+
- utils/font_dump.php
|
518 |
+
|
519 |
+
|
520 |
+
Bug fixes
|
521 |
+
---------
|
522 |
+
- Border & background when closing 2 blocks (e.g. </div></div>) incorrectly being moved to next page because incorrectly
|
523 |
+
calculating how much space required
|
524 |
+
- Fixed/Absolute-positioned elements not inheriting letter-spacing style
|
525 |
+
- Rotated cell - error if text-rotate set on a table cell, but no text content in cell
|
526 |
+
- SVG images, text-anchor not working
|
527 |
+
- Nested table - not resetting cell style (font, color etc) after nested table, if text follows immediately
|
528 |
+
- Nested table - font-size 70% set in extenal style sheet; if repeated nested tables, sets 70% of 70% etc etc
|
529 |
+
- SVG setting font-size as percent on successive <text> elements gives progressively smaller text
|
530 |
+
- mPDF will check if magic_quotes_runtime set ON even >= PHP 5.3 (will now cause an error message)
|
531 |
+
- not resetting after 2 nested tags of same type e.g. <b><b>bold</b></b> still bold
|
532 |
+
- When using charset_in other than utf-8, HTML Footers using tags e.g. <htmlpageheader> do not decode correctly
|
533 |
+
- ToC if nested > 3 levels, line spacing reduces and starts to overlap
|
534 |
+
|
535 |
+
|
536 |
+
|
537 |
+
|
538 |
+
===========================
|
539 |
+
mPDF 5.4
|
540 |
+
14/02/2012
|
541 |
+
===========================
|
542 |
+
Files changed
|
543 |
+
-------------
|
544 |
+
mpdf.php
|
545 |
+
config.php
|
546 |
+
compress.php
|
547 |
+
classes/ttfontsuni.php
|
548 |
+
classes/barcode.php
|
549 |
+
classes/indic.php
|
550 |
+
classes/svg.php
|
551 |
+
examples/show_code.php ----- SECURITY RISK**
|
552 |
+
examples/example49_changelog.php
|
553 |
+
examples/example57_new_mPDF_v5-3_active_forms_b (replace example57_new_mPDF_v5-3_active_forms)
|
554 |
+
includes/out.php
|
555 |
+
mpdfi/fpdi_pdf_parser.php
|
556 |
+
|
557 |
+
Files added
|
558 |
+
-----------
|
559 |
+
classes/bmp.php
|
560 |
+
classes/directw.php
|
561 |
+
classes/form.php
|
562 |
+
classes/grad.php
|
563 |
+
classes/tocontents.php
|
564 |
+
classes/wmf.php
|
565 |
+
examples/example58_new_mPDF_v5-4_features
|
566 |
+
|
567 |
+
config.php changes
|
568 |
+
------------------
|
569 |
+
Edited: $this->allowedCSStags, $this->innerblocktags, $this->defaultCSS; (CAPTION added in each case)
|
570 |
+
Moved: Numerous $form_.. variables are now in /classes/form.php
|
571 |
+
|
572 |
+
New config variables
|
573 |
+
--------------------
|
574 |
+
$this->bookmarkStyles = array();
|
575 |
+
$this->cacheTables = true;
|
576 |
+
|
577 |
+
New methods
|
578 |
+
-----------
|
579 |
+
function CircularText()
|
580 |
+
function SetVisibility()
|
581 |
+
|
582 |
+
New/Extended CSS
|
583 |
+
----------------
|
584 |
+
box-shadow (block elements - does NOT support "inset")
|
585 |
+
text-shadow (all text elements - does NOT support "blur")
|
586 |
+
visibility: visible|hidden|printonly|screenonly (block-level elements and images IMG only)
|
587 |
+
text-transform: capitalize|uppercase|lowercase (extended to support TD/TH)
|
588 |
+
tr|td|th:nth-child(odd|even|2n+1)
|
589 |
+
color, strikethrough, underline and background-color (extended to support rotated TD/TH)
|
590 |
+
underline and strike-through (extended to support TD/TH)
|
591 |
+
underline (line colour) (extended to work correctly in watermark)
|
592 |
+
page-break-after: left|right|always (block elements and tables)
|
593 |
+
NB respects $mpdf->restoreBlockPagebreaks = true; i.e. will make pagebreak act like formfeed
|
594 |
+
background[-color]: extended to support rgba|cmyka|cmyk|hsla|hsl|spot
|
595 |
+
border(extended to support inline elements)
|
596 |
+
|
597 |
+
|
598 |
+
New HTML
|
599 |
+
--------
|
600 |
+
<caption>
|
601 |
+
<textcircle />
|
602 |
+
|
603 |
+
|
604 |
+
New features / Improvements
|
605 |
+
---------------------------
|
606 |
+
Tables - Zebra Stripes
|
607 |
+
Tables: overlapping rowspans (partially) supported
|
608 |
+
Tables - Disk caching
|
609 |
+
Using progress bars (or $showStats) now reports 'real' memory usage i.e. get_memory_usage(true)
|
610 |
+
Support for query string in the URLs for external stylesheets e.g. @import url("style.css?ltcyy7");
|
611 |
+
Table caption partially supported
|
612 |
+
CircularText
|
613 |
+
BookMark styling
|
614 |
+
Spread tables i.e. can split table (columns) across several pages width.
|
615 |
+
Can use chelvetica, ctimes and ccourier to specify core fonts in a non-core font document
|
616 |
+
Spread tables i.e. can split table (columns) across several pages width.
|
617 |
+
{colsum} in <tfoot> cell will insert a column total per page.
|
618 |
+
SVG embedded as island in HTML supported
|
619 |
+
Active Forms
|
620 |
+
textarea and input (text types) now accept javascript as:
|
621 |
+
onKeystroke, onValidate, onCalculate and onFormat
|
622 |
+
onChange is depracated but works as onCalculate (for textarea and input)
|
623 |
+
(PS Select still accepts onChange cf. 5.3.37)
|
624 |
+
Ledger and Tabloid added as page formats recognised. NB Ledger is same as tabloid but landscape. In mPDF, both give the same size (portrait)
|
625 |
+
so need to add -L e.g. Ledger-L for landscape.
|
626 |
+
|
627 |
+
|
628 |
+
Internal script changes
|
629 |
+
-----------------------
|
630 |
+
Changed this->k to _MPDFK throughout all scripts
|
631 |
+
Changes to color (packed binary data in string rather than array) to reduce memory usage esp in tables
|
632 |
+
Internal variables Removed
|
633 |
+
$usetableheader;
|
634 |
+
$tableheadernrows;
|
635 |
+
$tablefooternrows;
|
636 |
+
vars $ChangePage, $p_bottom_border, $img_margin_top(+) $issetcolor + other similar removed
|
637 |
+
|
638 |
+
Removed a whole load of // comments
|
639 |
+
Updates to remove some more Warning Notices (not all marked in text)
|
640 |
+
Border set on TR - changed so set on each cell, rather than retrospectively at end of TR
|
641 |
+
All references to table['text'] removed as not needed - uses ['textbuffer'] instead
|
642 |
+
OpenTag(TD) changes to reduce memory usage with tables
|
643 |
+
Includes different method to set a default timezone
|
644 |
+
fn _smallCaps does not need (undefined) $space
|
645 |
+
this->chrs and this->ords replaced by chr() and ord()
|
646 |
+
Headers in out.php updated to match those used in Output()
|
647 |
+
Change to SetFont() to improve performance time
|
648 |
+
Change to GetStringWidth() to improve performance time
|
649 |
+
Corrected copying of Glyphs 0,1,2, to all subset fonts (non-SMP/SIP), and only setting 32->127 in subset
|
650 |
+
Subset fonts (non-SMP/SIP) have additionally Unicode CMap tables (0,0,4 and 0,3,4) as well as Microsoft (3,1,4)
|
651 |
+
Subset fonts (SMP/SIP) have CMap tables (1,0,6 and 3,0,4) - rather than 1,0,6 and 3,0,6
|
652 |
+
Subset fonts (SMP/SIP) have 'name' table changed to give 1,0 and 3,0. As it is a symbol font (not Unicode encoded) :
|
653 |
+
needs to have a name entry in 3,0 (e.g. symbol) - original font will have 3,1 (i.e. Unicode)
|
654 |
+
Automatically checks for HTML code length > 100000 characters and gives error warning if
|
655 |
+
PHP < 5.2.0 (as not configurable) or increases pcre.backtrack_limit if PHP < 5.3.7
|
656 |
+
|
657 |
+
Removed/Depracated
|
658 |
+
------------------
|
659 |
+
function UseTableHeader($opt=true) fn removed / depracated
|
660 |
+
function UsePRE($opt=true) removed
|
661 |
+
$attr['REPEAT_HEADER'] == true CSS removed / depracated
|
662 |
+
$this->usepre=true; removed / depracated as never needed - always respects PRE whitespace
|
663 |
+
|
664 |
+
ToC: NB Values can no longer be set directly e.g. as in example
|
665 |
+
$mpdf->TOCheader = array(); // array as for setting header/footer
|
666 |
+
$mpdf->TOCfooter = array(); // array as for setting header/footer
|
667 |
+
$mpdf->TOCpreHTML = '<h2>Contents - Portrait</h2>'; // HTML text to appear before table of contents
|
668 |
+
$mpdf->TOCpostHTML = ''; // HTML text to appear after table of contents
|
669 |
+
$mpdf->TOCbookmarkText = 'Content list'; // Text as it will appear in the Bookmarks (leave blank for none)
|
670 |
+
Need to use TOCpagebreak either direct (or array version) or as HTML
|
671 |
+
OR if absolutley necessary, could use:
|
672 |
+
$mpdf->tocontents->TOCheader = array(); // array as for setting header/footer
|
673 |
+
$mpdf->tocontents->TOCfooter = array(); // array as for setting header/footer
|
674 |
+
$mpdf->tocontents->TOCpreHTML = '<h2>Contents - Portrait</h2>'; // HTML text to appear before table of contents
|
675 |
+
$mpdf->tocontents->TOCpostHTML = ''; // HTML text to appear after table of contents
|
676 |
+
$mpdf->tocontents->TOCbookmarkText = 'Content list'; // Text as it will appear in the Bookmarks (leave blank for none)
|
677 |
+
|
678 |
+
|
679 |
+
|
680 |
+
Further Details
|
681 |
+
===============
|
682 |
+
|
683 |
+
CSS border on inline elements
|
684 |
+
-----------------------------
|
685 |
+
Support for CSS border (and variants) on inline elements e.g. <span style="border-bottom: 1px dashed #000000;">
|
686 |
+
Border styles solid|dotted|dashed|double only are supported. Border radius not supported.
|
687 |
+
Nested inline elements will have repeat left|right borders on the nested content (unlike browsers)
|
688 |
+
|
689 |
+
Tables - Zebra Stripes
|
690 |
+
----------------------
|
691 |
+
TABLE - striped rows cf. http://dev.opera.com/articles/view/zebra-striping-tables-with-css3/
|
692 |
+
tr:nth-child(odd) { background-color: #99ff99; }
|
693 |
+
thead tr:nth-child(3n+2) { background-color: #FFBBFF; }
|
694 |
+
td:nth-child(2n+1) { background-color: #BBBBFF; }
|
695 |
+
table.zebraTable td:nth-child(2n+1) { background-color: #BBBBFF; }
|
696 |
+
table.zebraTable th:nth-child(2n+1) { background-color: #BBBBFF; }
|
697 |
+
|
698 |
+
NB mPDF does NOT correctly apply specificity to all CSS
|
699 |
+
table.zebra tbody tr:nth-child(2n+1) td { background-color: #FFFFBB; }
|
700 |
+
table.zebra tbody td:nth-child(odd) { background-color: #BBBBFF; }
|
701 |
+
|
702 |
+
should make every odd row yellow, and every odd coloumn blue, but with the row/yellow overriding the column/blue.
|
703 |
+
In mPDF the td:nth-child(odd) trumps the plain td, so the column colour wins out. You can force the effect you want by using
|
704 |
+
table.zebra tbody tr:nth-child(2n+1) td:nth-child(1n+0) { background-color: #FFFFBB; }
|
705 |
+
|
706 |
+
(The :nth-child(1n+0) selector just selects every td cell.)
|
707 |
+
|
708 |
+
|
709 |
+
|
710 |
+
Tables - Disk caching
|
711 |
+
---------------------
|
712 |
+
TABLES: using disk caching
|
713 |
+
// Using disk to cache table data can reduce memory usage dramatically, but at a cost of increased
|
714 |
+
// executon time and disk access (read and write)
|
715 |
+
$this->cacheTables = true;
|
716 |
+
NB $this->packTableData will be overridden to => true; // required for cacheTables
|
717 |
+
$this->simpleTables will be overridden to => false; // Cannot co-exist with cacheTables
|
718 |
+
|
719 |
+
|
720 |
+
Table caption
|
721 |
+
-------------
|
722 |
+
Must come immediately after <table...>
|
723 |
+
CSS caption-side and HTML align attribute of top|bottom supported (not attribute left|right)
|
724 |
+
Handled as a separate block element brought outside the table, so:
|
725 |
+
CSS will not cascade correctly on the table
|
726 |
+
width of caption block is that of page or of the block element containing the table
|
727 |
+
so alignment will be to the page-width not the table width
|
728 |
+
if table page-break-after: always, the caption will follow the pagebreak.
|
729 |
+
This does work:
|
730 |
+
<style>
|
731 |
+
.tablecaption { caption-side: bottom; text-align: left; font-weight: bold; color: green; }
|
732 |
+
</style>
|
733 |
+
...
|
734 |
+
<table>
|
735 |
+
<caption class="tablecaption">Caption title here</caption>
|
736 |
+
<tbody>
|
737 |
+
|
738 |
+
CSS visibility: printonly, screenonly
|
739 |
+
-------------------------------------
|
740 |
+
Roughly based on CSS
|
741 |
+
|
742 |
+
Works on Block elements P, DIV etc, or Image
|
743 |
+
Cannot nest / layer.
|
744 |
+
Inner blocks/image with set visibility are ignored if already set on enclosing block element.
|
745 |
+
(Block element) does not work inside table (image does)
|
746 |
+
So 'visible' does nothing but is set as default
|
747 |
+
(NB Changes output to PDF version 1.5)
|
748 |
+
Incompatible with PDFA / PDFX
|
749 |
+
|
750 |
+
'visibility'
|
751 |
+
Value: visible | hidden | (collapse | inherit)
|
752 |
+
Initial: visible
|
753 |
+
Applies to: all elements
|
754 |
+
Inherited: yes
|
755 |
+
|
756 |
+
The 'visibility' property specifies whether the boxes generated by an element are rendered.
|
757 |
+
Invisible boxes still affect layout (set the 'display' property to 'none' to suppress box generation altogether).
|
758 |
+
Values have the following meanings:
|
759 |
+
|
760 |
+
visible
|
761 |
+
The generated box is visible.
|
762 |
+
hidden
|
763 |
+
The generated box is invisible (fully transparent, nothing is drawn), but still affects layout.
|
764 |
+
Furthermore, descendants of the element will be visible if they have 'visibility: visible'.
|
765 |
+
collapse | inherit
|
766 |
+
NOT supported in mPDF
|
767 |
+
|
768 |
+
CUSTOM:
|
769 |
+
printonly | screenonly
|
770 |
+
|
771 |
+
|
772 |
+
Added VISIBILITY function
|
773 |
+
$mpdf->SetVisibility('screenonly'); or 'printonly' 'visible' or 'hidden'
|
774 |
+
(NB Changes output to PDF version 1.5)
|
775 |
+
Incompatible with PDFA / PDFX
|
776 |
+
|
777 |
+
CircularText
|
778 |
+
------------
|
779 |
+
function CircularText($x, $y, $r, $text, $align='top', $kerning=120, $fontwidth=100) {
|
780 |
+
x: abscissa of center
|
781 |
+
y: ordinate of center
|
782 |
+
r: radius of circle
|
783 |
+
text: text to be printed
|
784 |
+
align: text alignment: top or bottom. Default value: top
|
785 |
+
kerning: spacing between letters in percentage. Default value: 120. Zero is not allowed.
|
786 |
+
fontwidth: width of letters in percentage. Default value: 100. Zero is not allowed
|
787 |
+
|
788 |
+
- now uses Kerning between letters if useKerning == true (set manually see example)
|
789 |
+
|
790 |
+
BookMark styling
|
791 |
+
----------------
|
792 |
+
New configurable variable to control appearance of Bookmarks e.g.
|
793 |
+
$this->bookmarkStyles = array(
|
794 |
+
0 => array('color'=> array(0,64,128), 'style'=>'B'),
|
795 |
+
1 => array('color'=> array(128,0,0), 'style'=>''),
|
796 |
+
2 => array('color'=> array(0,128,0), 'style'=>'I'),
|
797 |
+
);
|
798 |
+
|
799 |
+
Column sums
|
800 |
+
-----------
|
801 |
+
(Also changed some preg_replace to str_replace to improve performance)
|
802 |
+
To use: just add {colsum} to any cells of the table footer <tfoot>
|
803 |
+
Add a number to specify a fixed number of decimal points e.g. <td>£{colsum2}</td> will give you £123.40
|
804 |
+
The width of the column will be calculated using the actual string {colsum} as a placeholder.
|
805 |
+
If you need the column to be wider, use underscores "_" to pad it e.g. {colsum2_____}
|
806 |
+
|
807 |
+
|
808 |
+
Spread tables
|
809 |
+
-------------
|
810 |
+
i.e. can split table (columns) across several pages width.
|
811 |
+
CSS <table style="overflow: visible">
|
812 |
+
Cannot use with:
|
813 |
+
$this->kwt - ignored
|
814 |
+
$this->table_rotate - ignored
|
815 |
+
$this->table_keep_together - ignored
|
816 |
+
$this->ColActive - cancels spread tables
|
817 |
+
|
818 |
+
Messes up with:
|
819 |
+
$mpdf->forcePortraitHeaders = true;
|
820 |
+
$mpdf->forcePortraitMargins = true;
|
821 |
+
Problems with CJK, and RTL
|
822 |
+
|
823 |
+
Will do no resizing of fonts at all.
|
824 |
+
Maximum width of column = page width i.e. will not split columns across pages - NB will keep colspan>1 on one page
|
825 |
+
If table row too high for page will die with error message.
|
826 |
+
Will override some specs for width if this creates conflicts
|
827 |
+
Recommended to specify absolute value of width on each column.
|
828 |
+
|
829 |
+
|
830 |
+
|
831 |
+
|
832 |
+
Bug fixes
|
833 |
+
=========
|
834 |
+
Dottab - if text after dottab is hyperlinked <a></a> then dots are underlined
|
835 |
+
|
836 |
+
page-break-before now respects $mpdf->restoreBlockPagebreaks = true; i.e. will make pagebreak act like formfeed
|
837 |
+
Annotation() function called directly with colorarray(r,g,b)
|
838 |
+
|
839 |
+
Added urldecode to _getImage to cope with ../name%20of%20image.jpg
|
840 |
+
Added urldecode AND htmlspecials_decode to href in <a> link e.g. https://www.google.com/search?hl=en&q=mpdf&filename=name%20of%20file
|
841 |
+
[barcode.php] Allow in C39 codes - will be changed to spaces
|
842 |
+
|
843 |
+
<table> inside a <div position:fixed, left:300px;> not calculating table width correctly
|
844 |
+
- leading to either upside down table or error width less than 1 character
|
845 |
+
|
846 |
+
Depracated magic_quotes_runtime() in compress.php
|
847 |
+
|
848 |
+
DIRECTW included twice in compress.php
|
849 |
+
FORMS mark up for compress.php corrected
|
850 |
+
|
851 |
+
double backslashes not preserved inside <pre> or <textarea>
|
852 |
+
|
853 |
+
font-weight and font-style not recognised in <pageheader>
|
854 |
+
|
855 |
+
Progress bars causing corrupt PDF file (out.php) changed fopen from "r" mode to "rb" (binary)
|
856 |
+
Target around image - <a href="#internaltarget"><img ... /></a> - not working
|
857 |
+
|
858 |
+
SmallCaps in <thead> error
|
859 |
+
|
860 |
+
Fonts with "name" table in format 1 not recognised correctly
|
861 |
+
Rotated table which does not fit on remaining page, forces a new page even if already at top of page
|
862 |
+
|
863 |
+
Locale causing problems - all instances of sprintf() using %.3f changed to %.3F so not locale aware
|
864 |
+
|
865 |
+
CSS border radius not implemented on fixed/absolute positioned block element
|
866 |
+
|
867 |
+
Background color in rotated table extending way beyond bottom of table
|
868 |
+
|
869 |
+
Nested table containing <thead> or <tfoot> was confused with <thead> or <tfoot> of parent table
|
870 |
+
|
871 |
+
Correct handling of spaces, < or & in textarea
|
872 |
+
|
873 |
+
<option> and <input ..> attributes value/title decoded with fn lesser_entity_decode instead of htmlspecialchars_decode to include '
|
874 |
+
|
875 |
+
line width not restored to correct value after "line-through" text in Cell()
|
876 |
+
|
877 |
+
Kannada - incorrect positioning of Reph
|
878 |
+
|
879 |
+
Forms - In <input> or <option> (select) not correctly handling HTML named entities e.g. < in value or title
|
880 |
+
Active forms - as Value or Title incorrectly showing as Euro - PDFDocEncoding fixed
|
881 |
+
|
882 |
+
Unicode data in embedded fonts not encrypted when doc encrypted
|
883 |
+
|
884 |
+
Nested block elements which are empty including innermost one, top margin of innermost block was ignored
|
885 |
+
|
886 |
+
font-size: xx% inside a block was setting on block's parent font-size
|
887 |
+
|
888 |
+
Active forms - radio buttons (removed name from Widget - leave on Radio group)
|
889 |
+
causing problems accessing field for radio buttons
|
890 |
+
|
891 |
+
When using simple tables and border-collapse, if table border set, but cell borders not set, should display table border (fixed)
|
892 |
+
position:fixed block - if neither top nor bottom nor height specified, was positioned incorrectly (y)
|
893 |
+
Leave - if top, bottom, margin-top, margiin-bottom and height are all left unspecified (or auto), will centre vertically
|
894 |
+
on the page (specific to mPDF - not consistent with CSS2.1)
|
895 |
+
But if any one of them are specified (including e.g. margin-top=0), follows CSS spec, so top is the current "static" position
|
896 |
+
|
897 |
+
background-image-opacity=0 not working on BODY or BLOCK
|
898 |
+
|
899 |
+
Lists - if LI continues after a nested List, would add as a new LI item (should continue as part of earlier LI item)
|
900 |
+
|
901 |
+
fn WriteCell() converts to 'windows-1252' when required
|
902 |
+
if multiple calls to mPDF used, cannot redefine function cmp()
|
903 |
+
internal link targets <a name="xx" /> in ToC not moved when using: page-break-inside:avoid
|
904 |
+
internal link targets <a name="xx" /> not moved when using: columns, page-break-inside:avoid, keep-with-table or table rotate
|
905 |
+
|
906 |
+
Active Forms - onChange not working for SELECT (cf. 5.3.25) Example 57 only worked by chance as JS was carried over from Select to Text field
|
907 |
+
Bug is fixed, but example file needed updating to onCalculate for the display field.
|
908 |
+
|
909 |
+
Table cell: if height set as %, currently sets it as % of page-width; instead this now ignores it.
|
910 |
+
|
911 |
+
Bengali letter Khanda Ta (U+09CE) character not recognised; was added in Unicode v4.1 and prior to this, (U+09A4 U+09CD U+200D)
|
912 |
+
so mPDF converts to this string and seems to work.
|
913 |
+
|
914 |
+
OCR characters wrong size in barcodes if using different ocr font - fixed
|
915 |
+
|
916 |
+
===========================
|
917 |
+
mPDF v5.3 (21/07/2011)
|
918 |
+
===========================
|
919 |
+
|
920 |
+
New Features
|
921 |
+
------------
|
922 |
+
- Active forms (see on-line manual for details)
|
923 |
+
- 128-bit encryption (optional) with additional user-permissions (see on-line manual)
|
924 |
+
|
925 |
+
PLEASE READ - Change in Font management
|
926 |
+
---------------------------------------
|
927 |
+
The font name imported from the font and included by mPDF in the PDF file was stripping any '-' in the name.
|
928 |
+
This is the PostScript name which is utilised by some PostScript programmes.
|
929 |
+
mPDF has been changed to leave the PostScript font name unchanged. In 99% cases no difference will be noted, but
|
930 |
+
you MUST delete all the temporary font data files cached in the /ttfontdata/ folder for this to be effective.
|
931 |
+
|
932 |
+
|
933 |
+
Minor changes
|
934 |
+
-------------
|
935 |
+
If @page CSS is used to select a first page with settings different from the default, mPDF did create a blank page
|
936 |
+
then pagebreak to the new @page settings - this has been changed so it now will start with the new page settings.
|
937 |
+
|
938 |
+
New function added: DeletePages($start_page, $end_page=-1) e.g. $mpdf->DeletePages(1);
|
939 |
+
Can be used just before calling Output()
|
940 |
+
|
941 |
+
compress.php utility extended to exclude active forms and images-svg
|
942 |
+
|
943 |
+
|
944 |
+
Bug fixes
|
945 |
+
---------
|
946 |
+
- list-style-type: (custom version, user-defined bullet) colour change not working if colour is set on the list item line
|
947 |
+
- background-image: SVG or WMF images as background-images in tables/tr/cells not working
|
948 |
+
- font-weight: bold font not always reset after inline <b>...</b> thus miscalculating width
|
949 |
+
- forms (inactive) in 'c' core fonts using unicode characters 127-255 incorrect display in input text and button text
|
950 |
+
- form elements (inactive) if in-line with mixed size fonts, error in vertical positioning of text related to box
|
951 |
+
- ToC: wrapped lines in ToC not retaining formatting e.g. bold style
|
952 |
+
- HTMLHeaders: using setAutoTopMargin="pad"; not correctly setting top margin for first page
|
953 |
+
- output headers changed: Content-length not used if server uses output compression
|
954 |
+
- embedded font subsets from fonts which contain non-BMP plane 0 characters (incl. e.g. dejavusanscondensed)
|
955 |
+
- causing Adobe Reader to create a CJK encoded font subset internally when loading interactive Forms
|
956 |
+
- Changed so unsets the flag in the subset font to show no non-BMP characters.
|
957 |
+
|
958 |
+
|
959 |
+
Configurable variables added (see config.php file):
|
960 |
+
--------------------------------------------------
|
961 |
+
All for Active Forms:
|
962 |
+
$this->useActiveForms
|
963 |
+
$this->formExportType
|
964 |
+
$this->formSubmitNoValueFields
|
965 |
+
$this->formSelectDefaultOption
|
966 |
+
$this->form_border_color
|
967 |
+
$this->form_background_color
|
968 |
+
$this->form_border_width
|
969 |
+
$this->form_border_style
|
970 |
+
$this->form_button_border_color
|
971 |
+
$this->form_button_background_color
|
972 |
+
$this->form_button_border_width
|
973 |
+
$this->form_button_border_style
|
974 |
+
$this->form_radio_color
|
975 |
+
$this->form_radio_background_color
|
976 |
+
|
977 |
+
PLUS: see additional values added to $this->allowedCSStags close to bottom of file - required for Active forms
|
978 |
+
|
979 |
+
|
980 |
+
Updated files
|
981 |
+
-------------
|
982 |
+
mpdf.php
|
983 |
+
config.php (NB as well as form stuff at top, 5.2.07 $this->allowedCSStags close to bottom of file)
|
984 |
+
compress.php
|
985 |
+
classes/ttfontsuni.php
|
986 |
+
examples/example57...
|
987 |
+
examples/formsubmit.php
|
988 |
+
|
989 |
+
|
990 |
+
|
991 |
+
===========================
|
992 |
+
mPDF v5.2 (18/06/2011)
|
993 |
+
===========================
|
994 |
+
|
995 |
+
New Features
|
996 |
+
------------------
|
997 |
+
Improvements in font handling resulting in clearer display of fonts on screen, and improved compatibility with PostScript drivers
|
998 |
+
(e.g. use with GSView/GhostScript, see below)
|
999 |
+
|
1000 |
+
CJK line-breaking implemented (roughly) according to rules. Configurable variables allow control of behaviour (except in tables).
|
1001 |
+
|
1002 |
+
Viewer preferences: added options for initial 2 page display where you can specify whether
|
1003 |
+
1st page is on left or right (cf. SetDisplayMode).
|
1004 |
+
|
1005 |
+
Custom list-style-type for a list (ul,ol) or a list-item (li) in which you can determine the character and colour of the bullet:
|
1006 |
+
list-style-type: U+263Argb(255,0,0); - where U+263A is the Unicode HEX value of the character you want for the bullet
|
1007 |
+
- character MUST be included in the font used for that list item. rgb() bit is optional
|
1008 |
+
|
1009 |
+
|
1010 |
+
Bug fixes
|
1011 |
+
---------
|
1012 |
+
- Fonts: embedding a BMP TTC font (e.g. Cambria) as a full font caused error
|
1013 |
+
- Table: If cell width set by CSS as %, and page-break-inside avoid requires a new page, was losing the sizing
|
1014 |
+
- Table: table borders CSS parsing error; if border-width, border-style, border-color set, not inherited correctly
|
1015 |
+
- Table: Table background image or gradient not working in HTMLHeader/Footer
|
1016 |
+
- Table: background color set on table (anywhere) will overwrite image/gradient
|
1017 |
+
- Table Background image/gradient: If left/right margin is set on table, gradient/image set on table is too wide
|
1018 |
+
- Table: rotated table - height (after first page does not correctly allow for thead i.e. too much)
|
1019 |
+
- Table: blank <tr></tr> causes error
|
1020 |
+
- Table/Letter-spacing: If letter-spacing set inside table, not calculating table width correctly, and if oversized, freezes
|
1021 |
+
- ToC: ToC at top of page (non-mirrored or already ODD) did not reset page_number if told
|
1022 |
+
- Character subsititutions: characters missed if first element in a $html code e.g. WriteHTML('Not in a tag ✓');
|
1023 |
+
- Kerning: kerning info: if reading font file for first time (or if not cached in ttfontdata/) did not register kerning info
|
1024 |
+
- Textarea: multiple new lines run into only one newline
|
1025 |
+
- QRCode - colors wrong because QRcode class only accepts RGB input (hardcoded now to always give black on white)
|
1026 |
+
- QRCode always producing "Your message here"
|
1027 |
+
- Columns: if transforming height of column, not always closing transform Q
|
1028 |
+
- CakePHP compatibility
|
1029 |
+
- compress.php - error due to markup comments in mpdf.php script file
|
1030 |
+
|
1031 |
+
Backwards compatibility
|
1032 |
+
-----------------------
|
1033 |
+
Changes in mPDF 5.2 are backwards compatible with version 5.1
|
1034 |
+
Your document fonts may appear slightly different in the PDF viewer because of the changes to embedded font subsets (cf.)
|
1035 |
+
The new Indic fonts may result in a change in spacing (due to the different character width of the space character from the original font)
|
1036 |
+
|
1037 |
+
PostScript e.g. GSView/GhostScript
|
1038 |
+
----------------------------------
|
1039 |
+
A number of errors have been reported when opening mPDF-created PDF files with a PostScript programme. Some of the errors were due to mPDF,
|
1040 |
+
but others were due to peculiarities of GSView/GhostScript.
|
1041 |
+
- Diacritic Characters were not displayed when embedding a font subset
|
1042 |
+
- Fonts containing SIP/SMP characters (supplementary Unicode planes) caused errors
|
1043 |
+
- Error with text justification (word-spacing) when embedding a full font can occur in some fonts*
|
1044 |
+
The first 2 problems should now be fixed in v5.2
|
1045 |
+
*The error with text justification can be optionally fixed by setting the configurable variable in config.php:
|
1046 |
+
$this->repackageTTF = true;
|
1047 |
+
When mPDF embeds a full font, it simply embeds the whole original TTF file into the PDF document. For some fonts (containing
|
1048 |
+
a GSUB table) this was causing problems. $this->repackageTTF forces mPDF to repackage the original TTF file excluding some of
|
1049 |
+
the tables like GSUB.
|
1050 |
+
(See ADDITIONAL INFO FONTS.txt in downloaded files)
|
1051 |
+
|
1052 |
+
|
1053 |
+
Font appearance in PDF viewer
|
1054 |
+
-----------------------------
|
1055 |
+
Font subsetting has been improved to include additional information in the embedded file. Overall the effects are of greater clarity
|
1056 |
+
when viewing the document on a screen (it will not affect print output), but the changes are dependent on:
|
1057 |
+
- the original TTF font i.e. the options that the font's author has built into the file
|
1058 |
+
- the PDF viewer i.e. whether the programme chooses to use the available information
|
1059 |
+
- the resolution (zoom) of the page you are viewing
|
1060 |
+
(See ADDITIONAL INFO FONTS.txt in downloaded files)
|
1061 |
+
|
1062 |
+
|
1063 |
+
Indic fonts
|
1064 |
+
-----------
|
1065 |
+
A new set of Indic fonts (ind_xx_1_001) is distributed with version 5.2 containing the additional font information as described above.
|
1066 |
+
In addition, some changes have been made to the ASCII characters in the font from the files previously distributed:
|
1067 |
+
The original files (Raghu font files) do not contain the characters a-z and A-Z. When the first version indic files were created for mPDF,
|
1068 |
+
ALL of the ASCII characters (32-127) were inserted/overwritten from DejaVuSansCondensed to make the font more usable.
|
1069 |
+
In the latest version, only the missing characters are taken from DejaVuSansCondensed, leaving punctuation and numerals from the original
|
1070 |
+
fonts. This also means that the space character has a different width, and this will cause slight changes to the word spacing in documents.
|
1071 |
+
(See ADDITIONAL INFO FONTS.txt in downloaded files)
|
1072 |
+
|
1073 |
+
|
1074 |
+
CJK line-breaking (text wrapping)
|
1075 |
+
---------------------------------
|
1076 |
+
CJK (chinese-japanese-korean) text often contains no spaces. mPDF previously has wrapped text whenever a character reached the end of
|
1077 |
+
the line. mPDF version 5.2 attempts to follow the line-breaking rules described for each of the languages. Configurable variables
|
1078 |
+
allow some control over this behaviour, especially whether to squeeze a character into the space available at the end of a line, or
|
1079 |
+
whether to allow it to overflow the right margin.
|
1080 |
+
|
1081 |
+
|
1082 |
+
Configurable variables (see config.php file):
|
1083 |
+
----------------------
|
1084 |
+
Control wrapping of CJK text:
|
1085 |
+
$this->allowCJKorphans = true; // FALSE=always wrap to next line; TRUE=squeeze or overflow
|
1086 |
+
$this->allowCJKoverflow = false; // FALSE=squeeze; TRUE=overflow (only selected)
|
1087 |
+
When Embedding full TTF font files, remakes the font file using only core tables
|
1088 |
+
May improve function with PostScript printers
|
1089 |
+
$this->repackageTTF = false;
|
1090 |
+
|
1091 |
+
Updated files
|
1092 |
+
-------------
|
1093 |
+
mpdf.php
|
1094 |
+
compress.php
|
1095 |
+
utils/font_dump.php
|
1096 |
+
classes/ttfontsuni.php
|
1097 |
+
config.php (3 new variables - see above)
|
1098 |
+
|
1099 |
+
All ttfonts/ind_*
|
1100 |
+
New set of Indic fonts for PostScript compatibilty - and clearer font display
|
1101 |
+
|
1102 |
+
|
1103 |
+
|
1104 |
+
===========================
|
1105 |
+
mPDF v5.1 (27/02/2011)
|
1106 |
+
===========================
|
1107 |
+
|
1108 |
+
New Features
|
1109 |
+
------------
|
1110 |
+
- CSS background (images, colours or gradients) on <TR> and <TABLE>
|
1111 |
+
- CSS border on <TR> (only in border-collapsed mode)
|
1112 |
+
- support for Mozilla and CSS3 gradient syntax:
|
1113 |
+
-moz-linear-gradient, linear-gradient
|
1114 |
+
-moz-radial-gradient, radial-gradient
|
1115 |
+
-moz-repeating-linear-gradient, linear-repeating-gradient
|
1116 |
+
-moz-repeating-radial-gradient, radial-repeating-gradient
|
1117 |
+
- expanded support for gradients (including in SVG images):
|
1118 |
+
- multiple colour 'stops'
|
1119 |
+
- opacity (transparency)
|
1120 |
+
- angle and/or position can be specified
|
1121 |
+
- gradient can be used as an image mask (custom mPDF styles: gradient-mask)
|
1122 |
+
- image-orientation supported for <IMG> (similar to existing custom mPDF attribute: rotate) [CSS3]
|
1123 |
+
- image-resolution supported for <IMG> [CSS3]
|
1124 |
+
- background-image-resolution (custom mPDF CSS-type style) to define resolution of background images
|
1125 |
+
- improved support for SVG images
|
1126 |
+
- SVG and WMF images supported in background-image
|
1127 |
+
- file attachments
|
1128 |
+
- numeric list-styles added e.g. arabic-indic, bengali, devanagari, persian, thai [CSS3]
|
1129 |
+
- font kerning supported (inter-character spacing between specific pairs)
|
1130 |
+
- letter-spacing and word-spacing supported [CSS3]
|
1131 |
+
- colors supported as rgb(), rgba(), hsl(), hsla(), cmyk(), cmyka(), or spot()
|
1132 |
+
- spot colors supported e.g PANTONE 310 EC
|
1133 |
+
- PDF/X compatible files
|
1134 |
+
- optionally force use of grayscale, RGB or CMYK colorspace
|
1135 |
+
- automatic colour conversion for most objects between grayscale, RGB and CMYK
|
1136 |
+
|
1137 |
+
Backwards compatibility
|
1138 |
+
-----------------------
|
1139 |
+
Most changes in mPDF 5.1 are backwards compatible with version 5.0 i.e. your documents should
|
1140 |
+
look the same running 5.1 However some changes may alter display from previous versions:
|
1141 |
+
- RTL (right-to-left) languages - see below
|
1142 |
+
- bleed margins when using @page CSS - see below
|
1143 |
+
- Default distance for "cross" from inner margin changed 10->5mm [hardcoded in fn. Footer()]
|
1144 |
+
- If height set on a block element, will force a new page if set-height will not fit on page
|
1145 |
+
- If table rotated, 5mm margin at bottom is now reduced to 1mm
|
1146 |
+
- If image is too big for page and automatically sixed to maximum height of page, 10mm margin at bottom reduced to 1mm
|
1147 |
+
|
1148 |
+
Colours may appear more vibrant
|
1149 |
+
-------------------------------
|
1150 |
+
Unless specifically set, Adobe Reader uses the RGB colorSpace by default when displaying documents. However
|
1151 |
+
if an image or gradient using transparency (or alpha channel) is included in the document, Adobe Reader
|
1152 |
+
automatically sets the default colorSpace to CMYK - which makes the colours look less vibrant/bright on screen.
|
1153 |
+
mPDF 5.1 now specifies by default a colorSpace RGB for each page, and this will maintain the more
|
1154 |
+
vibrant colours. This is overridden if you use on of the options to restrict the colorSpace (cf.)
|
1155 |
+
|
1156 |
+
RTL
|
1157 |
+
---
|
1158 |
+
**** IMPORTANT - PLEASE READ IF USING RTL SCRIPTS ****
|
1159 |
+
Handling of RTL (right-to-left) languages has been significantly rewritten, and is likely to cause
|
1160 |
+
changes to the resulting files if you have previously been using mPDF. The changes have made mPDF
|
1161 |
+
act more like a browser, respecting the HTML/CSS rules.
|
1162 |
+
Changes include:
|
1163 |
+
- the document now has a baseline direction; this determines the
|
1164 |
+
- behaviour of blocks for which text-align has not been specifically set
|
1165 |
+
- layout of mirrored page-margins, columns, ToC and Indexes, headers and footers
|
1166 |
+
- base direction can be set by any of:
|
1167 |
+
- $mpdf->SetDirectionality('rtl');
|
1168 |
+
- <html dir="rtl" or style="direction: rtl;">
|
1169 |
+
- <body dir="rtl" or style="direction: rtl;">
|
1170 |
+
- base direction is an inherited CSS property, so will affect all content, unless...
|
1171 |
+
- direction can be set for all HTML block elements e.g. <DIV><P><TABLE><UL> etc using
|
1172 |
+
- CSS property < style="direction: rtl;">
|
1173 |
+
- direction can only be set on the top-level element of nested lists
|
1174 |
+
- direction can only be set on <TABLE>, NOT on THEAD, TBODY, TD etc.
|
1175 |
+
- nested tables CAN have different directions
|
1176 |
+
- NOTE that block/table margins/paddings are NOT reversed by direction
|
1177 |
+
NB mPDF <5.1 reversed the margins/paddings for blocks when RTL set.
|
1178 |
+
- language (either CSS "lang", using Autofont, or through initial set-up e.g. $mpdf = new mPDF('ar') )
|
1179 |
+
no longer affects direction in any way.
|
1180 |
+
NB config_cp.php has been changed as a result; any values of "dir" set here are now ineffective
|
1181 |
+
- default text-align is now as per CSS spec: "a nameless value which is dependent on direction"
|
1182 |
+
NB default text-align removed in default stylesheet in config.php
|
1183 |
+
- once text-align is specified, it is respected and inherited
|
1184 |
+
NB mPDF <5.1 reversed the text-align property for all blocks when RTL set.
|
1185 |
+
- the configurable value $rtlcss is depracated, as it is no longer required
|
1186 |
+
- improved algorithm for dtermining text direction
|
1187 |
+
- english word blocks are handled in text reversal as one block i.e. dir="rtl"
|
1188 |
+
[arabic text] this will not be reversed [arabic text]
|
1189 |
+
- arabic numerals 0-9 handled correctly
|
1190 |
+
|
1191 |
+
Although the control of direction for block elements is now more configurable, the control of
|
1192 |
+
text direction (RTL arabic characters) remains fully automatic and unconfigurable.
|
1193 |
+
<BDO> etc has no effect. Enclosing text in silent tags can sometimes help e.g.
|
1194 |
+
content<span>[arabic text]</span>content
|
1195 |
+
|
1196 |
+
Justified text
|
1197 |
+
--------------
|
1198 |
+
Text-align: justify - no longer uses configurable variable $jSpacing= C | W | ''
|
1199 |
+
The default value is for mixed letter- and word-spacing, set by jSWord and jSmaxChar
|
1200 |
+
If a line contains a cursive script (RTL or Indic [devanagari, punjabi, bengali]) then it prevents letter-spacing
|
1201 |
+
for justification on that line - effectively the same as setting letter-spacing:0
|
1202 |
+
Spacing values have been removed from the config_cp.php configuration file, so the "lang" property
|
1203 |
+
(in config_cp) no longer determines justification behaviour (this includes the use of Autofont()).
|
1204 |
+
When using RTL or Indic [devanagari, punjabi, bengali] scripts, you should set CSS letter-spacing:0
|
1205 |
+
whenever you use text-align:justify.
|
1206 |
+
|
1207 |
+
|
1208 |
+
@page media
|
1209 |
+
-----------
|
1210 |
+
When using @page to create a print publication with page-size less than sheet-size
|
1211 |
+
- bleed margin is now configurable (also crop- and cross-mark margins)
|
1212 |
+
- backgrounds/gradients/images now use the bleed box as their "container box"
|
1213 |
+
- odd-header-name: supports the value "_default" - allows current non-HTML header to remain unchanged
|
1214 |
+
- marks: crop cross; i.e. both together supported
|
1215 |
+
- background-image-opacity and background-image-resize now work with @page CSS
|
1216 |
+
|
1217 |
+
|
1218 |
+
SVG images - extended support
|
1219 |
+
-----------------------------
|
1220 |
+
- support for spreadMethod property for gradients (repeat and reflect)
|
1221 |
+
- support for style="font-family; font-size; font-style; font-weight" i.e. inline CSS
|
1222 |
+
- when viewPort="" and width="" height="" all specified, uses width to set SVG size of a "pixel"
|
1223 |
+
- support for opacity and multiple "stops" (and colorspace) in gradients
|
1224 |
+
|
1225 |
+
|
1226 |
+
|
1227 |
+
Minor Enhancements
|
1228 |
+
------------------
|
1229 |
+
- support for colors as rgb(87%, 56%, 25%) [used especially in SVG]
|
1230 |
+
- added option of "NoPrintScaling" in SetDisplayPreferences
|
1231 |
+
- compress.php - now combines BACKGROUND-IMAGES and GRADIENTS as BACKGROUNDS, and added PROGRESS-BAR
|
1232 |
+
- table with THEAD row will force a new page if no room for the THEAD AND a row from TBODY
|
1233 |
+
- Small-Caps now works properly together with text-align justify
|
1234 |
+
- embedded font subsets restructured (minor) for greater compatibility e.g. with Postscript printers
|
1235 |
+
- PDF/A will convert everything except grayscale to RGB (by default) or CMYK (optionally)
|
1236 |
+
|
1237 |
+
|
1238 |
+
|
1239 |
+
|
1240 |
+
Bug fixes
|
1241 |
+
---------
|
1242 |
+
- Display changed to CMYK colour gamut when document contained an object with transparency set.
|
1243 |
+
Now will retain RGB colorspace (brighter colours)
|
1244 |
+
- If using dir="rtl", tables containing nested tables were not properly reversed
|
1245 |
+
- "text-rotate: 0" set in CSS stylesheet did not 'undo' any text-rotate set on the row (TR)
|
1246 |
+
- Malayalam - character re-ordering
|
1247 |
+
- If height set on a block element, was not taking account of padding top/bottom
|
1248 |
+
- embedded font subsets: error in array of Font Widths fixed
|
1249 |
+
- <style>..</style> containing /* import url() */ the comments were not ignored
|
1250 |
+
- If call mPDF class more than once, error using multiple barcodes or gif files because classes not reinstantiated
|
1251 |
+
- Floating blocks were collapsing bottom/top margins - incorrectly
|
1252 |
+
- Table: if colspan>1 contents are wider than the width of the included columns, did not increase column width(s) to accommodate
|
1253 |
+
- Resizing table - script hanging and new page forced when not required (still)
|
1254 |
+
- If a table style="page-break-inside:avoid" not fit on the page, was adding new page before resizing EVEN IF on a blank page
|
1255 |
+
- End of 2 blocks (e.g. </div></div>) at very bottom of page, forcing unwanted pagebreak
|
1256 |
+
- Corrected handling of tags inside <pre>
|
1257 |
+
- RTL left-aligned text - line ending with <br /> not correctly left-aligned
|
1258 |
+
- <input type=submit|reset etc name="xxx" e.g. Google button showed as I&039;m feeling lucky
|
1259 |
+
- Annotations all linked to Page 1 (parent object)
|
1260 |
+
- Error "division by zero" using columns
|
1261 |
+
- MultiCell() and Write() [direct writing functions] - miscalculating length of line in non-core fonts (+ other bugs)
|
1262 |
+
- error if CJK space at end or beginning of line with 0x20 spaces in as well
|
1263 |
+
|
1264 |
+
Configurable variables (see config.php file):
|
1265 |
+
----------------------
|
1266 |
+
$this->printers_info
|
1267 |
+
$this->bleedMargin
|
1268 |
+
$this->crossMarkMargin
|
1269 |
+
$this->cropMarkMargin
|
1270 |
+
$this->cropMarkLength
|
1271 |
+
$this->nonPrintMargin
|
1272 |
+
$this->restrictColorSpace
|
1273 |
+
$this->PDFX
|
1274 |
+
$this->PDFXauto;
|
1275 |
+
$this->useKerning
|
1276 |
+
[$this->rtlcss removed]
|
1277 |
+
|
1278 |
+
Updated files
|
1279 |
+
-------------
|
1280 |
+
mpdf.php
|
1281 |
+
config.php
|
1282 |
+
config_cp.php (removed references to dir - but not essential to update - just redundant information)
|
1283 |
+
compress.php
|
1284 |
+
includes/out.php
|
1285 |
+
includes/functions.php
|
1286 |
+
classes/svg.php
|
1287 |
+
classes/ttfontsuni.php
|
1288 |
+
classes/indic.php
|
1289 |
+
/font/helvetica*.php and /times*.php
|
1290 |
+
|
1291 |
+
Added CSS support
|
1292 |
+
=================
|
1293 |
+
All Block elements including <BODY> <TABLE> <TR>
|
1294 |
+
------------------------------------------------
|
1295 |
+
background-image-resolution: normal | [ from-image || <dpi> ]
|
1296 |
+
direction: [ rtl | ltr ] (HTML attribute dir also supported)
|
1297 |
+
background: [ gradients ]
|
1298 |
+
background-image: [gradients ]
|
1299 |
+
|
1300 |
+
For [ gradients ] syntax see:
|
1301 |
+
- Mozilla linear - https://developer.mozilla.org/en/CSS/-moz-linear-gradient
|
1302 |
+
- Mozilla radial - https://developer.mozilla.org/en/CSS/-moz-radial-gradient
|
1303 |
+
- Mozilla gradients use - https://developer.mozilla.org/en/Using_gradients
|
1304 |
+
- CSS3 linear gradients - http://dev.w3.org/csswg/css3-images/#linear-gradients
|
1305 |
+
- CSS3 radial gradients - http://dev.w3.org/csswg/css3-images/#radial-gradients
|
1306 |
+
|
1307 |
+
|
1308 |
+
Almost all elements - block and in-line
|
1309 |
+
---------------------------------------
|
1310 |
+
font-kerning: auto | normal | none // need to set $mpdf->useKerning = true;
|
1311 |
+
letter-spacing: normal | <length>
|
1312 |
+
word-spacing: normal | <length>
|
1313 |
+
|
1314 |
+
Colours
|
1315 |
+
-------
|
1316 |
+
Anywhere that color is specified (e.g. color, background-color, borders)
|
1317 |
+
- rgb(255,255,255)
|
1318 |
+
- rgba(255,255,255,1) // last value is transparency (alpha) - between 0-1
|
1319 |
+
- rgb(100%,100%,100%)
|
1320 |
+
- hsl(360,100%,100%) // H: 0-360; S/L: 0-100%; a:0-1
|
1321 |
+
- hsla(360,100%,100%,1)
|
1322 |
+
- cmyk(100,100,100,100) // or 0-100%
|
1323 |
+
- spot(COLOR NAME, 100%) // e.g PANTONE 310 EC; use AddSpotColor() to define first
|
1324 |
+
|
1325 |
+
<TR>
|
1326 |
+
border:
|
1327 |
+
|
1328 |
+
<TABLE> <TR>
|
1329 |
+
background:
|
1330 |
+
background-color:
|
1331 |
+
background-image:
|
1332 |
+
|
1333 |
+
<IMG>
|
1334 |
+
gradient-mask: [can use any of the gradient syntax]
|
1335 |
+
image-orientation: <angle> - supports deg, rad or grad
|
1336 |
+
image-resolution: normal | [ from-image || <dpi> ]
|
1337 |
+
|
1338 |
+
<OL|UL>
|
1339 |
+
list-style: arabic-indic | bengali | devanagari | gujarati | gurmukhi | kannada | malayalam | oriya |
|
1340 |
+
persian | telugu | thai | urdu | tamil
|
1341 |
+
|
1342 |
+
|
1343 |
+
@page
|
1344 |
+
marks: [ crop || cross ] - i.e. crop and cross can be used together
|
1345 |
+
odd-header-name: "_default" - allows current non-HTML header to remain unchanged
|
1346 |
+
background-image-opacity: [ 0-1 ]
|
1347 |
+
background-image-resize: [ 1-6 ] - see Manual
|
1348 |
+
|
1349 |
+
|
1350 |
+
===========================
|
1351 |
+
mPDF v5.0 (30/09/2010)
|
1352 |
+
===========================
|
1353 |
+
|
1354 |
+
New Features
|
1355 |
+
------------
|
1356 |
+
- Font handling simplified, reads TrueType font files directly
|
1357 |
+
|
1358 |
+
|
1359 |
+
Minor Enhancements
|
1360 |
+
------------------
|
1361 |
+
- rotation of fixed-position block elements (see example 10 and manual for supported CSS)
|
1362 |
+
- support for CSS Small-Caps font-variant added
|
1363 |
+
- utility scripts in /utils/ folder to help font management
|
1364 |
+
- new simplified functions AddPageByArray() and TOCPageBreakByArray() added
|
1365 |
+
- progress bar simplified and customisable
|
1366 |
+
- improved word-wrapping for CJK langauges
|
1367 |
+
- improved recognition of CJK/Indic/Arabic characters
|
1368 |
+
- invalid UTF-8 input now outputs a meaningful error by displaying input html with errors marked
|
1369 |
+
- GIF or PNG images with transparency/interlaced/non-standard compression handled as internal data
|
1370 |
+
if /tmp/ folder is not present or writeable
|
1371 |
+
- support for <html dir="rtl">
|
1372 |
+
- support for "display: none" on inline elements
|
1373 |
+
- annotations supported in fixed-position block elements
|
1374 |
+
|
1375 |
+
|
1376 |
+
Bug fixes
|
1377 |
+
---------
|
1378 |
+
- <br /> preceded by space does not correctly text-align to right
|
1379 |
+
- zero-width character in middle of line caused line-break (e.g. diacritic or U+200C = ZWNJ)
|
1380 |
+
- HTML attributes not recognised if spaces e.g. 'src = "..."'
|
1381 |
+
- Headers changed for output - problem reported on IE8 64-bit using SSL
|
1382 |
+
- using SetAutoPageBreak(false) used caused unexpected behaviour with table rows at page break
|
1383 |
+
- (from Beta) incorrect check for temporary font data folder causing errors
|
1384 |
+
- artificial Bold/Italic not working in table cell when using rotated text
|
1385 |
+
- allow <dottab> to inherit font color correctly
|
1386 |
+
- SVG now works with Adobe 7
|
1387 |
+
- background in header overwriting text
|
1388 |
+
- vertical text in table header not correctly horizontally positioned when repeated
|
1389 |
+
- compatibility with PHP >= 4.3 (htmlspecialchars_decode, stripos)
|
1390 |
+
- updated depracated script PHP 5.3.0 ($string{1} to $string[1], $var =& new Object(), set_magic_quotes_runtime)
|
1391 |
+
- index (CreateIndex) number string incorrect if arabic(rtl) text anywhere in document
|
1392 |
+
- MultiCell incorrectly calculate string length/width when using core fonts
|
1393 |
+
- page-break-inside:avoid - used with non-HTML footer had space inserted for footer height
|
1394 |
+
- page-break-inside:avoid - error if more than 1 page height but not enough to trigger second pagebreak
|
1395 |
+
- page-break-inside:avoid - incorrectly layering page backgrounds (headers and content brought forward)
|
1396 |
+
|
1397 |
+
|
1398 |
+
Changes from 5.0 Beta
|
1399 |
+
---------------------
|
1400 |
+
If you are upgrading from the Beta version - you MUST delete all files in the /ttfontdata/ temporary directory
|
1401 |
+
- config.php file has been changed (extra CJK characters to recognise CJK blocks)
|
1402 |
+
- $this->backupSubsFont (in config_fonts.php) optionally now takes an array
|
1403 |
+
- no need to define 'cjk'=>true or 'sip|smp'=>true in config_fonts.php (ignored; cf. $this->BMPonly)
|
1404 |
+
- Indic language fonts have been altered to add Latin and Latin-1 Supplement characters
|
1405 |
+
- progress bars now has an external progbar.css and configurable main heading
|
1406 |
+
- added initial parameter new mPDF('+aCJK') or '-aCJK' to override default useAdobeCJK at runtime
|
1407 |
+
- QRCode is not included in main download (but as an extra package)
|
1408 |
+
|
1409 |
+
BACKWARD COMPATIBILITY
|
1410 |
+
----------------------
|
1411 |
+
If you have been using earlier versions of mPDF, most scripts should work as before. But note:
|
1412 |
+
- Arial, Helvetica, Times and Courier are now treated like any other font
|
1413 |
+
- the whole CSS font string is parsed e.g. style="font-family:'Lucida Grande';" will look for a font 'lucidagrande'
|
1414 |
+
and not 'lucida'
|
1415 |
+
|
1416 |
+
Configurable variables (see config.php file):
|
1417 |
+
----------------------
|
1418 |
+
- $mpdf->useSubstitutionsMB is now depracated, but will work as an alias for $mpdf->useSubstitutions
|
1419 |
+
The initial parameters e.g. new mPDF('utf-8') have all changed. Old ones may be recognised, or will be ignored.
|
1420 |
+
- $mpdf->useOnlyCoreFonts is now depracated and is ignored. Use new mPDF('c')
|
1421 |
+
- $this->use_CJK_only is now depracated and is ignored. See $this->useAdobeCJK and new mPDF('+aCJK') or '-aCJK'
|
1422 |
+
Control SmallCaps appearance
|
1423 |
+
- $mpdf->smCapsScale = 0.75; // Factor of 1 to scale capital letters
|
1424 |
+
- $mpdf->smCapsStretch = 115; // % to stretch small caps horizontally
|
1425 |
+
Customisable Progress bar
|
1426 |
+
- $mpdf->progbar_heading = 'mPDF file progress';
|
1427 |
+
- $mpdf->progbar_altHTML = '';
|
1428 |
+
Control fonts/subsetting
|
1429 |
+
- $mpdf->maxTTFFilesize = 2000;
|
1430 |
+
- $mpdf->percentSubset = 30;
|
1431 |
+
- $mpdf->debugfonts // show font errors and warnings
|
1432 |
+
Replaceable alias
|
1433 |
+
- $mpdf->iterationCounter = false; // Allow use of {iteration varname} in THEAD
|
1434 |
+
|
1435 |
+
|
1436 |
+
===========================
|
1437 |
+
mPDF v5.0Beta (21/07/2010)
|
1438 |
+
===========================
|
1439 |
+
|
1440 |
+
New features
|
1441 |
+
------------
|
1442 |
+
The main change in mPDF v5 is the handling of TTF and TTC fonts directly.
|
1443 |
+
See README.txt and FONT INFO.txt for more information
|
1444 |
+
|
1445 |
+
|
1446 |
+
QR-code (2-dimensional barcode) Added
|
1447 |
+
-------------------------------------
|
1448 |
+
type="QR"
|
1449 |
+
Size=1 is an arbitrary 25mm widthxheight. error="L|M|H|Q"
|
1450 |
+
text="" can be numeric, alphanumeric or binary(?)
|
1451 |
+
Required whitespace is always included around it
|
1452 |
+
|
1453 |
+
|
1454 |
+
Enhancements
|
1455 |
+
------------
|
1456 |
+
- progress-bar is simplified (no javascript class)
|
1457 |
+
- dir="rtl" supported in <html> or <body> tag
|
1458 |
+
|
1459 |
+
Bug fixes
|
1460 |
+
---------
|
1461 |
+
- artificial Bold/Italic now working in table cells with rotated text
|
1462 |
+
- "-" is now allowed in a font name e.g. sun-exta
|
1463 |
+
- <dottab> now inherits font color correctly
|
1464 |
+
- SVG class bugs fixed (was crashing in Adobe Reader v 7)
|
1465 |
+
- background color/image in header no longer overwrites the header text
|
1466 |
+
|
1467 |
+
Changed Config variables
|
1468 |
+
------------------------
|
1469 |
+
$this->useSubstitutionsMB is depracated
|
1470 |
+
Character substitution always occurs when using core fonts.
|
1471 |
+
Use $this->useSubstitutions for all cases.
|
1472 |
+
|
1473 |
+
|
1474 |
+
New Configurable variables
|
1475 |
+
--------------------------
|
1476 |
+
$this->useAdobeCJK = true; // Uses Adobe CJK fonts for CJK languages
|
1477 |
+
// default TRUE; only set false if you have defined some available fonts that support CJK
|
1478 |
+
// If true this will not stop other CJK fonts if specified by font-family:
|
1479 |
+
// and vice versa i.e. only dictates behaviour when specified by lang="" incl. AutoFont()
|
1480 |
+
|
1481 |
+
// Set maximum size of TTF font file to allow non-subsets - in kB
|
1482 |
+
// Used to avoid e.g. Arial Unicode MS (perhaps used for substituteCharsMB) to ever be fully embedded
|
1483 |
+
// NB Free serif is 1.5MB, most files are <= 600kB (most 200-400KB)
|
1484 |
+
$this->maxTTFFilesize = 2000;
|
1485 |
+
|
1486 |
+
// If not -s (i.e. forced subset) this value determines whether to subset or not
|
1487 |
+
// 0 - 100 = percent characters
|
1488 |
+
// i.e. if ==40, mPDF will embed whole font if >40% characters in that font
|
1489 |
+
// or embed subset if <40% characters
|
1490 |
+
// 0 will force whole file to be embedded
|
1491 |
+
// 100 will force always to subset
|
1492 |
+
$this->percentSubset = 30;
|
1493 |
+
|
1494 |
+
$this->debugfonts - show errors and warnings for font parsing
|
1495 |
+
|
1496 |
+
Config variables removed
|
1497 |
+
------------------------
|
1498 |
+
$this->use_CJK_only
|
1499 |
+
$this->useOnlyCoreFonts
|
1500 |
+
|
1501 |
+
================================================================================
|
1502 |
+
|
1503 |
+
====
|
1504 |
+
4.6
|
1505 |
+
====
|
1506 |
+
|
1507 |
+
mPDF
|
1508 |
+
|
1509 |
+
files changed:
|
1510 |
+
mpdf.php
|
1511 |
+
config.php
|
1512 |
+
makefonts/makefonts.php
|
1513 |
+
class/t1asm.php
|
1514 |
+
class/svg.php
|
1515 |
+
graph.php
|
1516 |
+
|
1517 |
+
examples_04 (images)
|
1518 |
+
|
1519 |
+
config var added:
|
1520 |
+
$this->tableMinSizePriority
|
1521 |
+
|
1522 |
+
4.5.015
|
1523 |
+
Bug fix:
|
1524 |
+
Complex page with ToC entries ++ (example_ToC_bug4_5_015.php) caused Apache to crash
|
1525 |
+
AdjustHTML() preg_pattern for matching <hx>... </hx> <table for keep-together - altered and fixed ? matching
|
1526 |
+
Seemed to crash when content="Graph 12" between the <h> - 2 numbers (12) crash, 1 didn't!!!
|
1527 |
+
|
1528 |
+
|
1529 |
+
4.5.014
|
1530 |
+
Bug fix:
|
1531 |
+
Using TrueType fonts, unused font is not embedded in the PDF doc. This was fine except an error message appeared after printing in Adobe Reader,
|
1532 |
+
because Font reference /F1 still present in doc pointing to non-existent resource.
|
1533 |
+
Edited so that the reference is now removed from the page if font unused.
|
1534 |
+
|
1535 |
+
|
1536 |
+
4.5.013
|
1537 |
+
Enhancement
|
1538 |
+
TrueTypeUnicode fonts width array inserted as shortened form array (smaller file size)
|
1539 |
+
|
1540 |
+
4.5.012
|
1541 |
+
Bug fix: Incorrect handling orphan characters in table
|
1542 |
+
(cf. http://mpdf.bpm1.com/forum/comments.php?DiscussionID=193 fixed in 4.2 - but going back to it still problems)
|
1543 |
+
If xxxxx. fits but xxxxx.. doesn't: WriteFlowingBlock wraps it to next line, TableWordWrap sqeezed it onto one line
|
1544 |
+
TableWordWrap fixed to only allow one orphan char. even if it fits with that one.
|
1545 |
+
|
1546 |
+
|
1547 |
+
4.5.011
|
1548 |
+
Added Windows BMP image support
|
1549 |
+
|
1550 |
+
4.5.010
|
1551 |
+
SVG class:
|
1552 |
+
- improved recognition of lineargradients/radialgradients referenced by xlink:href
|
1553 |
+
- does not die if empty text string
|
1554 |
+
- support for many text properties as style="" as well as currently as attributes (bold, fill etc)
|
1555 |
+
- if using MB font, was respecting "Times" and "Courier" from the SVG file but using as ANSI not utf-8
|
1556 |
+
|
1557 |
+
4.5.009
|
1558 |
+
graph.php updated to include SVG - need to define in graph.php (as well as set up TTF fonts)
|
1559 |
+
(SVG graph does not include CSIM, 3D skew.)
|
1560 |
+
|
1561 |
+
4.5.008
|
1562 |
+
t1asm.php has an error in the error message if .dat fontfile not found (".char.dat")
|
1563 |
+
|
1564 |
+
4.5.007
|
1565 |
+
Bug fix: Using page-break-inside:avoid, if nothing would have been printed on page 1 before next page, elements going all over the place!
|
1566 |
+
Also problem shifting images - fixed
|
1567 |
+
Also wasn't shifting WMF/SVG images - fixed
|
1568 |
+
|
1569 |
+
4.5.006
|
1570 |
+
New config var
|
1571 |
+
$this->tableMinSizePriority = false;
|
1572 |
+
If page-break-inside:avoid but cannot fit on full page without
|
1573 |
+
exceeding autosize; setting this value to true will force respsect for
|
1574 |
+
autosize, and disable the page-break-inside:avoid
|
1575 |
+
[NB edit Manual Table>>autolayout algorithm]
|
1576 |
+
|
1577 |
+
|
1578 |
+
4.5.005
|
1579 |
+
Bug fix
|
1580 |
+
Table set to avoid page-break-inside: in some circumstances entered loop with recalculating size
|
1581 |
+
Fudge factor added of 0.001 in tbsqrt to calculate shrink factor
|
1582 |
+
|
1583 |
+
4.5.004
|
1584 |
+
Bug fix
|
1585 |
+
If table set to avoid page-break-inside and table height (resized) exactly==remaining page - was triggering page break
|
1586 |
+
Fudge factor added of 0.001 in tablewrite to query pagebreak
|
1587 |
+
|
1588 |
+
4.5.003
|
1589 |
+
Bug fix in makefonts/makefonts.php
|
1590 |
+
Also changed the links in Step4 & 8 which move the newly created files to the font directory - will now show error message if error -
|
1591 |
+
will NOT overwrite existing files. (Put in manual already)
|
1592 |
+
|
1593 |
+
4.5.002
|
1594 |
+
Bug fix in class/t1asm.php
|
1595 |
+
If you have magic_quotes_runtime set On - problems using embedded subset.
|
1596 |
+
|
1597 |
+
4.5.001
|
1598 |
+
JPG "Exif" file recognised from header, and handled much more quickly and efficiently (not using GD)
|
1599 |
+
|
1600 |
+
|
1601 |
+
|
1602 |
+
===========================
|
1603 |
+
mPDF v4.5 (21/04/2010)
|
1604 |
+
===========================
|
1605 |
+
|
1606 |
+
New Features
|
1607 |
+
------------
|
1608 |
+
The main change in 4.5 is the improved class for importing SVG images. (See details below)
|
1609 |
+
|
1610 |
+
Font files
|
1611 |
+
----------
|
1612 |
+
Some bugs in the "makefonts" utility caused some errors in the files produced for embedding font subsets.
|
1613 |
+
Surprisingly these are not easily detectable (I have yet to find one!).
|
1614 |
+
All the font files used for embedding font subsets (the .dat and .dat.php files in /unifont/ folder)
|
1615 |
+
have been re-generated. Download them if you are having problems with any fonts - otherwise, you probably
|
1616 |
+
don't need to bother.
|
1617 |
+
|
1618 |
+
Minor Enhancements
|
1619 |
+
------------------
|
1620 |
+
If keepColumns = true (i.e. disable readjustment of column length), mPDF will now reproduce
|
1621 |
+
table header/footer rows in each column [4.4.015]
|
1622 |
+
|
1623 |
+
A number of changes to improve processing time [4.4.012]
|
1624 |
+
[Thanks to carlholmberg http://mpdf.bpm1.com/forum/comments.php?DiscussionID=274&page=1#Item_3]
|
1625 |
+
|
1626 |
+
JPG files with header marked as "progressive DCT-based JPEG" are now supported [4.4.004]
|
1627 |
+
|
1628 |
+
Configurable variable (config.php) $dpi can be set to vary size interpreted from "px" values in HTML/CSS
|
1629 |
+
NB Recommended that $dpi should always be set the same as $img_dpi
|
1630 |
+
|
1631 |
+
Support added for "ex" as a size value (approximates "ex" as half of font height)
|
1632 |
+
|
1633 |
+
Configurable variable (config.php) $watermarkImgAlphaBlend will determine how watermark images
|
1634 |
+
will blend with underlying objects.
|
1635 |
+
|
1636 |
+
|
1637 |
+
Bug fixes
|
1638 |
+
---------
|
1639 |
+
- Make-fonts utility : makefonts/makefonts.php [4.4.016]
|
1640 |
+
(All font files have been updated)
|
1641 |
+
- Table header of only one column width - not printing right border [4.4.014]
|
1642 |
+
- WMF and SVG images not rotating correctly to 90 or -90 degrees [4.4.013]
|
1643 |
+
- Using templates, error if imported doc contains templates itself [4.4.001]
|
1644 |
+
|
1645 |
+
|
1646 |
+
Updated Files
|
1647 |
+
-------------
|
1648 |
+
mpdf.php
|
1649 |
+
config.php
|
1650 |
+
classes/svg.php
|
1651 |
+
makefonts/makefonts.php
|
1652 |
+
ALL subset font files (/unifont/ .dat and .dat.php files), and all garuda and norasi files
|
1653 |
+
|
1654 |
+
New files
|
1655 |
+
---------
|
1656 |
+
None
|
1657 |
+
|
1658 |
+
New config variables
|
1659 |
+
--------------------
|
1660 |
+
$this->watermarkImgAlphaBlend
|
1661 |
+
$this->dpi
|
1662 |
+
|
1663 |
+
BACKWARD COMPATIBILITY
|
1664 |
+
----------------------
|
1665 |
+
All but one changes in mPDF 4.5 are fully backwards compatible.
|
1666 |
+
The configurable variable $this->watermarkImgBehind was introduced in v4.4 and was unintentionally set to TRUE
|
1667 |
+
In v4.5 this is set to FALSE in the config.php file.
|
1668 |
+
|
1669 |
+
|
1670 |
+
SVG Images
|
1671 |
+
----------
|
1672 |
+
[svg.php CHANGED]
|
1673 |
+
- Text stroke-width default changed to 1 [4.4.011]
|
1674 |
+
- Text stroke - line-join type changed [4.4.010]
|
1675 |
+
- Default value for fill changed to "black" [4.4.008]
|
1676 |
+
- Bug fixes:
|
1677 |
+
* to correct calculation of text-length (and therefore alignment R and C) [4.4.009]
|
1678 |
+
* Corrected errors in path implementation esp. quadratic Bezier curves
|
1679 |
+
* rounded corners to rectangles - error corrected
|
1680 |
+
* Recognition of font-family improved
|
1681 |
+
* remove \n (and other non-printable chars) from text
|
1682 |
+
* zero length shapes are not output e.g. zero-width rectangle, zero-length line, zero-radius circle
|
1683 |
+
- Support added for:
|
1684 |
+
* gradient stop offsets and gradientUnits="userSpaceOnUse" [4.4.007]
|
1685 |
+
In mpdf.php enabled define inner radius for radial gradients - only used internally by SVG at present
|
1686 |
+
* user defined <ENTITY /> cf. 'render-elems-03-t.svg' in SVG Test Suite [4.4.006]
|
1687 |
+
* "color" attribute and "currentColor" value for fill and stroke [4.4.005]
|
1688 |
+
* fill:url(#...) in a style as well as attribute
|
1689 |
+
* xlink:href for gradients
|
1690 |
+
* 1.3002e-005 in svg path
|
1691 |
+
* text-style changes (e.g. text-anchor) set on <g> element - not just on <text>
|
1692 |
+
* fill-rule=evenodd|nozero
|
1693 |
+
* dashed lines / stroke-dasharray & stroke-dashoffset
|
1694 |
+
* gradientUnits=userSpaceOnUse;
|
1695 |
+
* units e.g. 3mm or 14pt in Rectangle, Circle, Ellipse, Line and Text position
|
1696 |
+
* transform on <text> element
|
1697 |
+
* stroke as well as fill on text
|
1698 |
+
|
1699 |
+
NB The following are still NOT supported for SVG
|
1700 |
+
- filters
|
1701 |
+
- <marker>
|
1702 |
+
- images
|
1703 |
+
- DOM
|
1704 |
+
- <pattern>
|
1705 |
+
- textlength; lengthadjust; tspan, tref, toap, textPath;
|
1706 |
+
- <use ../>
|
1707 |
+
- gradient on stroke/text;
|
1708 |
+
- <clipPath>
|
1709 |
+
- text-underline and strikethrough
|
1710 |
+
- text opacity
|
1711 |
+
- colors as rgb(87%, 56%, 25%)
|
1712 |
+
- rect using units for dimensions
|
1713 |
+
- Only uses default spreadMethod = "pad" for gradients
|
1714 |
+
|
1715 |
+
|
1716 |
+
|
1717 |
+
|
1718 |
+
|
1719 |
+
===========================
|
1720 |
+
mPDF v4.4 (24/03/2010)
|
1721 |
+
===========================
|
1722 |
+
|
1723 |
+
New Features
|
1724 |
+
------------
|
1725 |
+
- Support SVG image files (partial)
|
1726 |
+
- Rotate images or graphs (by multiples of 90 degrees)
|
1727 |
+
- Set opacity (transparency) for background images
|
1728 |
+
- Control resizing of background images
|
1729 |
+
- Set whether to print watermark images behind or in front of page contents
|
1730 |
+
- Reduced memory usage when printing tables (partly configurable)
|
1731 |
+
- Option to set path to folder for temporary files
|
1732 |
+
- Improved compliance for CSS text-align justify
|
1733 |
+
- Increased support for CSS "media"
|
1734 |
+
- Improved performance when accessing local image files
|
1735 |
+
|
1736 |
+
|
1737 |
+
Minor Enhancements
|
1738 |
+
------------------
|
1739 |
+
- Allows space in output file name e.g. $mpdf->Output('t est.pdf','D'); [4.3.007B]
|
1740 |
+
- Header changed in Output to improve compatability with IE6 (affects 'D' and 'I') [4.3.012B]
|
1741 |
+
- background-images do not show noimage.jpg if missing [4.3.012D]
|
1742 |
+
- simpleTables (which improves performance) now also allows: background-color, -gradient and -image, padding
|
1743 |
+
and rotated text to be set for each cell. Only borders are not supported cell-by-cell. [4.3.006]
|
1744 |
+
|
1745 |
+
|
1746 |
+
Bug fixes
|
1747 |
+
---------
|
1748 |
+
- Page width not correctly reset when defining default page margins (L/R) by @page [4.3.007C]
|
1749 |
+
- Table row <TR> with a background-color, paints the whole row, including the spaces between cells [4.3.005]
|
1750 |
+
NB This should have been fixed in [4.2.028] but got left out!
|
1751 |
+
- UseSubstitutionsMB causes errors inside <textarea> and <select> so now disabled in these 2 situations [4.3.004]
|
1752 |
+
- CSS background: 'none' did not cancel background-image/background-color if it comes later [4.3.002, 4.3.011]
|
1753 |
+
- Warning message 'depracated' (as of PHP 5.3) when using Templates [4.3.007]
|
1754 |
+
- AutoFont incorrectly altering multibyte characters ending in \xa0 [4.3.012C]
|
1755 |
+
- "Initial" default value for border-width changed from 1px to 'medium' e.g. border-top: solid #000000; [4.3.010]
|
1756 |
+
- WMF image sometimes inverted [4.3.016]
|
1757 |
+
|
1758 |
+
Updated Files
|
1759 |
+
-------------
|
1760 |
+
mpdf.php
|
1761 |
+
config.php
|
1762 |
+
changelog.txt
|
1763 |
+
|
1764 |
+
|
1765 |
+
New files
|
1766 |
+
---------
|
1767 |
+
classes/svg.php
|
1768 |
+
|
1769 |
+
|
1770 |
+
New config variables
|
1771 |
+
--------------------
|
1772 |
+
$this->justifyB4br=false;
|
1773 |
+
$this->CSSselectMedia='print';
|
1774 |
+
$this->watermarkImgBehind = false;
|
1775 |
+
|
1776 |
+
BACKWARD COMPATIBILITY
|
1777 |
+
----------------------
|
1778 |
+
All changes are backwards compatible except the handling of some background-images - please see notes below.
|
1779 |
+
|
1780 |
+
|
1781 |
+
Watermark Image z-order
|
1782 |
+
-----------------------
|
1783 |
+
By default mPDF prints watermarks on top of the page contents to ensure that they are not hidden by backgrounds
|
1784 |
+
(especially table cells).
|
1785 |
+
You can specify watermark images to be printed behind page contents by setting a configurable variable:
|
1786 |
+
$this->watermarkImgBehind = true; // default=false
|
1787 |
+
[4.3.018]
|
1788 |
+
|
1789 |
+
|
1790 |
+
Rotating Images and Graphs
|
1791 |
+
--------------------------
|
1792 |
+
Images or graphs can be rotated (by multiples of 90 degrees) using a custom HTML attribute e.g.
|
1793 |
+
<img rotate="90|-90|180" ... />
|
1794 |
+
<jpgraph rotate="90" ... />
|
1795 |
+
Valid options are: 90|-90|180.
|
1796 |
+
Positive values are clockwise.
|
1797 |
+
If width is specified e.g. width="3cm" this is applied to the rotated image i.e. will be width 3cm after rotating
|
1798 |
+
[4.3.016]
|
1799 |
+
|
1800 |
+
|
1801 |
+
Background Image Opacity
|
1802 |
+
------------------------
|
1803 |
+
A custom CSS property "background-image-opacity": is now supported on BODY, DIV+ (block elements) and TD
|
1804 |
+
Takes values between 0 and 1.0
|
1805 |
+
|
1806 |
+
|
1807 |
+
Resizing Background Images
|
1808 |
+
--------------------------
|
1809 |
+
A custom CSS property "background-image-resize": is now supported on BODY, DIV+ (block elements) and TD
|
1810 |
+
0 - No resizing (default)
|
1811 |
+
1 - Shrink-to-fit w (keep aspect ratio)
|
1812 |
+
2 - Shrink-to-fit h (keep aspect ratio)
|
1813 |
+
3 - Shrink-to-fit w and/or h (keep aspect ratio)
|
1814 |
+
4 - Resize-to-fit w (keep aspect ratio)
|
1815 |
+
5 - Resize-to-fit h (keep aspect ratio)
|
1816 |
+
6 - Resize-to-fit w and h
|
1817 |
+
|
1818 |
+
N.B. Prior to v4.4 background-images were incorrectly constrained to maximum width of the containing block.
|
1819 |
+
The default is now to do NO resizing on background-images. Setting "background-image-resize:3" should be used
|
1820 |
+
for backwards compatibility.
|
1821 |
+
[4.3.015, 4.3.012D]
|
1822 |
+
|
1823 |
+
|
1824 |
+
SVG Image files
|
1825 |
+
---------------
|
1826 |
+
SVG image files are now partially supported (but as for WMF - not as background-images).
|
1827 |
+
viewBox (preserveAspectRatio is not supported) viewBox="0 0 400 200" width="400" height="200"
|
1828 |
+
Takes viewBox in preference to width/height if present on <svg>
|
1829 |
+
If neither present, will size to width of page (square) as the containing box.
|
1830 |
+
Units are interpreted as pixels if undefined.
|
1831 |
+
Doesn't recognise internal CSS <style> elements
|
1832 |
+
Gradients only take 2 colours which are taken as stop-offset 0% and 100%
|
1833 |
+
[4.3.013 & 4.3.017]
|
1834 |
+
|
1835 |
+
|
1836 |
+
Reduced Memory Usage printing Tables
|
1837 |
+
------------------------------------
|
1838 |
+
mPDF uses a lot of memory when processing large tables. Parts of the script have been rewritten to
|
1839 |
+
reduce memory consumption when writing tables which use collapsed borders (10-25% saving).
|
1840 |
+
|
1841 |
+
Memory usage can be reduced further by setting a configurable variable:
|
1842 |
+
$this->packTableData = true; // default=false
|
1843 |
+
but note that this causes a significant increase in processing time.
|
1844 |
+
[4.3.008, 4.3.019, 4.3.014]
|
1845 |
+
|
1846 |
+
|
1847 |
+
|
1848 |
+
User-defined path to Temporary folder
|
1849 |
+
-------------------------------------
|
1850 |
+
mPDF uses a folder to write and store temporary files when processing images. By default this is the
|
1851 |
+
[your_path_to_mpdf]/tmp/
|
1852 |
+
This is now user-definable by defining the constant _MPDF_TEMP_PATH before including mpdf.php script.
|
1853 |
+
|
1854 |
+
|
1855 |
+
Text Justification
|
1856 |
+
------------------
|
1857 |
+
In a justified text block, an inline image, textarea, input, or select causing a new line will now force
|
1858 |
+
the previous line to be justified. HR and BR do NOT force justification (as in browsers).
|
1859 |
+
For optional compliance of MS Word behaviour, there is a new configurable variable:
|
1860 |
+
$this->justifyB4br = false; // Change to true to force justification before a <BR> (as in MS Word)
|
1861 |
+
[4.3.003]
|
1862 |
+
|
1863 |
+
|
1864 |
+
CSS support for @media
|
1865 |
+
----------------------
|
1866 |
+
Now supports media-dependent CSS styles e.g.
|
1867 |
+
@media print {
|
1868 |
+
p { color: red; }
|
1869 |
+
}
|
1870 |
+
as well as
|
1871 |
+
<style media="...">...</style> and
|
1872 |
+
<link rel="stylesheet" media="print" href="..." />
|
1873 |
+
Proper matching of CSS media to select using configurable variable:
|
1874 |
+
$this->CSSselectMedia='print'; // default="print" set in config.php : screen, print, or any other CSS @media type (not "all")
|
1875 |
+
N.B. $this->disablePrintCSS in now depracated
|
1876 |
+
[4.3.001]
|
1877 |
+
|
1878 |
+
|
1879 |
+
|
1880 |
+
|
1881 |
+
===========================
|
1882 |
+
mPDF v4.3 (28/02/2010)
|
1883 |
+
===========================
|
1884 |
+
|
1885 |
+
NEW FEATURES
|
1886 |
+
------------
|
1887 |
+
- Page (sheet) size can be reset within document (https://mpdf.github.io/paging/different-page-sizes.html) [4.2.024, 4.2.025]
|
1888 |
+
- PDF/A1-b compliant files (https://mpdf.github.io/what-else-can-i-do/pdf-a1-b-compliance.html)
|
1889 |
+
- Improve performance using simpleTables (https://mpdf.github.io/reference/mpdf-variables/simpletables.html)
|
1890 |
+
- mPDFI incorporated into main mPDF class (https://mpdf.github.io/reference/mpdf-functions/setimportuse.html)
|
1891 |
+
- <dottab> added as custom HTML tag: inserts dots to the following text, which is right-aligned [4.2.031]
|
1892 |
+
|
1893 |
+
See Example files 38 and 39 for PDFA compliant file and <dottab>
|
1894 |
+
|
1895 |
+
BACKWARD COMPATIBILITY
|
1896 |
+
----------------------
|
1897 |
+
All changes are backwards compatible except the use of mPDFI. You will need to make minor changes to your scripts.
|
1898 |
+
See the manual https://mpdf.github.io/reference/mpdf-functions/setimportuse.html for details.
|
1899 |
+
|
1900 |
+
BUG FIXES
|
1901 |
+
---------
|
1902 |
+
- When using Table of Contents and not resetting page numbers: HTML headers/footers showed incorrect page number [4.2.020]
|
1903 |
+
- Table of Contents: last page not printing page background-color [4.2.023]
|
1904 |
+
- Image file with space " " in the file name failing [4.2.016]
|
1905 |
+
- Image file path unnecessarily resolved to full URI - changed to use relative path if possible [4.2.029] ***
|
1906 |
+
- Table - not calculating height of cell correctly [4.2.015, 4.2.012, 4.2.011, 4.2.009]
|
1907 |
+
- Table row breaking after/during cell when image in cell taller than font-height [4.2.008]
|
1908 |
+
- When Table row(cell) greater height than the page-height but requiring resizing greater than allowed by autosize - not resizing [4.2.005]
|
1909 |
+
- Table cell border not resized correctly [4.2.002]
|
1910 |
+
- Table row <TR> with a background-color, paints the whole row, including the spaces between cells [4.2.028] ****
|
1911 |
+
- Background-image in HTMLFooter not correctly setting 0,0 origin [4.2.014]
|
1912 |
+
- Background-image set as an in-line style not working [4.2.013]
|
1913 |
+
- Background-image set in CSS @page or <body> was being constrained to less than page size [4.2.032]
|
1914 |
+
- Imported Templates overwriting Headers (with images or gradients) [4.2.004]
|
1915 |
+
- When using imports/templates, HTML header with background-image causing page to disappear [4.2.001]
|
1916 |
+
- block-style element breaking over more than 2 pages incorrectly adjusting L/R margins [4.2.022]
|
1917 |
+
- CSS @page property "size" set on :left :right or :first pseudo-selectors - disabled [4.2.022]
|
1918 |
+
- Annotations default colour incorrectly set in PDF as [100 100 0] corrected to [1 1 0] (seemed to work ok?) [4.2.026]
|
1919 |
+
- Overwrite() now parses input file more tolerantly recognising more source files [4.2.030]
|
1920 |
+
|
1921 |
+
**** Bug fix 4.2.028 never got into the release of v4.3 Included in next release [4.3.005]
|
1922 |
+
**** Bug fix 4.2.029 never not fully implmented in v4.3 Included in next release [4.3.012]
|
1923 |
+
|
1924 |
+
Changed files
|
1925 |
+
-------------
|
1926 |
+
mpdf.php
|
1927 |
+
compress.php
|
1928 |
+
config.php
|
1929 |
+
classes/t1asm.php
|
1930 |
+
includes/functions.php
|
1931 |
+
mpdfi/fpdi_pdf_parser.php
|
1932 |
+
Added files/folder: /mpdfi/filters/*.*
|
1933 |
+
Added file/folder: /iccprofiles/sRGB_IEC61966-2-1.icc
|
1934 |
+
mpdfi/mpdfi.php (no longer required)
|
1935 |
+
|
1936 |
+
New Configuration variables
|
1937 |
+
---------------------------
|
1938 |
+
[config.php]
|
1939 |
+
$this->enableImports
|
1940 |
+
$this->simpleTables
|
1941 |
+
$this->PDFA
|
1942 |
+
$this->ICCProfile
|
1943 |
+
$this->PDFAauto
|
1944 |
+
|
1945 |
+
|
1946 |
+
Minor changes
|
1947 |
+
-------------
|
1948 |
+
Increased PDF file compatibility with spec 1.4
|
1949 |
+
- PDF version changed to 1.4
|
1950 |
+
- A binary file marker (a comment line with 4 characters > 127 ASCII) is added just after the first line
|
1951 |
+
- %%EOF no longer has line break after it [4.2.010]
|
1952 |
+
- /ID object is added to trailer object when not encrypted [4.2.010]
|
1953 |
+
|
1954 |
+
When using progress bars, one of the JS scripts is now referenced as an external file
|
1955 |
+
to allow it to be cached by user's browser and improve performance for end-user [4.2.007]
|
1956 |
+
|
1957 |
+
Importing external PDF files: LZW encoded PDF files are now supported
|
1958 |
+
|
1959 |
+
When adding an annotation, the popup window can be set be either open or closed when the document is opened [4.2.027]
|
1960 |
+
- size and position of the popup can also be specified
|
1961 |
+
|
1962 |
+
|
1963 |
+
|
1964 |
+
===========================
|
1965 |
+
mPDF v4.2 (27/01/2010)
|
1966 |
+
===========================
|
1967 |
+
|
1968 |
+
NEW FEATURES
|
1969 |
+
------------
|
1970 |
+
- image handling improved
|
1971 |
+
- table layout - additional control over resizing
|
1972 |
+
- vertical-alignment of images - better support for all CSS types
|
1973 |
+
- top and bottom margins collapse between block elements
|
1974 |
+
- improved support for CSS line-height
|
1975 |
+
- display progress bar whilst generating file
|
1976 |
+
- CSS @page selector can be specified when adding a pagebreak
|
1977 |
+
- CSS @page selector allows different margins, backgrounds, headers/footers on :first :left and :right pages
|
1978 |
+
- PNG images with alpha channel fully supported
|
1979 |
+
- ability to generate italic and bold font variants from base font file
|
1980 |
+
- CJK fonts to embed as subsets
|
1981 |
+
- "double" border on block elements
|
1982 |
+
- character substitution for missing characters in UTF-8 fonts
|
1983 |
+
- direct passing of dynamically produced image data
|
1984 |
+
- background-gradient and background-image can now co-exist
|
1985 |
+
|
1986 |
+
|
1987 |
+
|
1988 |
+
Bug fixes
|
1989 |
+
---------
|
1990 |
+
- empty variable (undefined var, false, null, array() etc.) sent to WriteHTML produced error message "Invalid UTF-8"
|
1991 |
+
- CJK in tables when not using CJK (utf-8-s) autosized very small as characters did not word-wrap
|
1992 |
+
- parsing stylesheets: background image not recognised if containbed uppercase characters in file name
|
1993 |
+
- "double" border on table used white between the lines instead of current background colour
|
1994 |
+
- $this->shrink_tables_to_fit = 0 or false caused fatal errors
|
1995 |
+
- background color or images not printing correctly when breaking across pages
|
1996 |
+
- background not printed for List inside a block element
|
1997 |
+
- columns starting near end of page with no room for a line triggering column change (resulting in text misplaced) not page break
|
1998 |
+
- table cell not calculating cell height correctly when "orphan" characters (;:,.?! etc.) at end of line
|
1999 |
+
- table breaking page in column 2 when col 1 is rowspan'ned
|
2000 |
+
- margin-collapse at top of page not working if bookmark/annotation/indexentry/toc
|
2001 |
+
- column break triggered by HR triggering a second column break
|
2002 |
+
- an empty 'position:fixed' element with no/auto width or height caused fatal error
|
2003 |
+
- mPDFI: template documents were overwriting HTML headers
|
2004 |
+
- mPDFI: function Overwrite (to change text in existing PDF) - fatal error if using with encrypted file
|
2005 |
+
|
2006 |
+
Bug - not fixed
|
2007 |
+
- WriteHTML('',2) with '2' parameter not recognising 'margin-collapse:collapse' for DIVs or 'line-height' set in default CSS 'BODY'
|
2008 |
+
|
2009 |
+
|
2010 |
+
|
2011 |
+
New or Updated Files
|
2012 |
+
--------------------
|
2013 |
+
mpdf.php
|
2014 |
+
compress.php
|
2015 |
+
config.php
|
2016 |
+
config_cp.php
|
2017 |
+
config_fonts.php
|
2018 |
+
mpdf.css
|
2019 |
+
classes/gif.php
|
2020 |
+
classes/indic.php
|
2021 |
+
includes/subs_core.php
|
2022 |
+
mpdfi/mpdfi.php
|
2023 |
+
unifont/ar_k_001.uni2gn.php
|
2024 |
+
All files in new folder: /progress/*.*
|
2025 |
+
|
2026 |
+
NEW FOLDER /tmp/ required with read/write permissions - used for temporary image files or progress bars
|
2027 |
+
|
2028 |
+
|
2029 |
+
|
2030 |
+
|
2031 |
+
===========================
|
2032 |
+
mPDF v4.1.1 (21/12/2009)
|
2033 |
+
===========================
|
2034 |
+
Error corrected in /makefont/makefonts.php file (moved completed Unicode files to font folder instead of unifont)
|
2035 |
+
|
2036 |
+
===========================
|
2037 |
+
mPDF v4.1 (20/12/2009)
|
2038 |
+
===========================
|
2039 |
+
MySQL support for embedded font subsets abandoned, and replaced with file-based.
|
2040 |
+
|
2041 |
+
|
2042 |
+
Files no longer required
|
2043 |
+
------------------------
|
2044 |
+
config_db.php
|
2045 |
+
/unifont/RUNME.php
|
2046 |
+
/unifont/*.ufm and /unifont/*.t1a font files
|
2047 |
+
|
2048 |
+
MySQL Database no longer required
|
2049 |
+
|
2050 |
+
Files Updated
|
2051 |
+
-------------
|
2052 |
+
mpdf.php
|
2053 |
+
/classes/t1asm.php
|
2054 |
+
/makefont/makefonts.php
|
2055 |
+
|
2056 |
+
New files
|
2057 |
+
---------
|
2058 |
+
/unifont/*.dat and /unifont/*.dat.php font files
|
2059 |
+
|
2060 |
+
|
2061 |
+
Bug-fixes
|
2062 |
+
---------
|
2063 |
+
- Image - If automatically resizing to fit maximum page size incorrectly subtracted margin-header
|
2064 |
+
- Annotation and textarea in same HTML chunk causes mPDF to crash (preg_replace textarea with /u modifier in AdjustHTML)
|
2065 |
+
- set_magic_quotes_runtime error ($mgr not $mqr)
|
2066 |
+
- Table align did not reverse when using RTL document
|
2067 |
+
|
2068 |
+
Alteration: Image - if writing Image in fixedpos div position:absolute - to allow Image to be resized to full page size
|
2069 |
+
|
2070 |
+
|
2071 |
+
===========================
|
2072 |
+
mPDF v4.0 (17/12/2009)
|
2073 |
+
===========================
|
2074 |
+
|
2075 |
+
Major additions
|
2076 |
+
---------------
|
2077 |
+
- Ability to embed font subsets (creating much smaller files)
|
2078 |
+
- Much improved support for Arabic languages
|
2079 |
+
- Support for Indic languages including consonant conjuncts
|
2080 |
+
- Support for Fixed position block elements
|
2081 |
+
- New utility to help create your own fonts
|
2082 |
+
- PNG alpha channel transparency supported
|
2083 |
+
- New utility to create smaller mpdf script with reduced functionality (less memory)
|
2084 |
+
- Multiple Barcode types supported
|
2085 |
+
|
2086 |
+
**********************************************************************************************
|
2087 |
+
* For more details see the documentation manual: http://mpdf1.com/manual/index.php?tid=410 *
|
2088 |
+
**********************************************************************************************
|
2089 |
+
|
2090 |
+
Bug fixes (parsing CSS)
|
2091 |
+
-----------------------
|
2092 |
+
- <link href="" ... was not recognised if > 1 space between words
|
2093 |
+
- #Content p em { font-style:italic; } was applied to "#Content p"
|
2094 |
+
- @import url() embedded in a stylesheet file requires path fixed relative to stylesheet file
|
2095 |
+
- background-image url() embedded in a stylesheet file requires path fixed relative to stylesheet file
|
2096 |
+
- comment tags inside CSS <style> embedded in the HTML were removed
|
2097 |
+
Now fixed so <style><!-- ... --></style> works; <!-- <style>...</style> --> is removed
|
2098 |
+
|
2099 |
+
Bug fixes (other)
|
2100 |
+
-----------------
|
2101 |
+
- clear (CSS property for floating elements) caused properties for that element to reset to defaults
|
2102 |
+
- width: auto caused collapse of border and padding on L & R of ordinary block elements
|
2103 |
+
- text-indent not inherited correctly (including em and % values)
|
2104 |
+
- named colour "steelblue" corrected RRGGBB hex code
|
2105 |
+
- table cell widths in %: if width of table cells set to >=100%, and not all columns are set
|
2106 |
+
This was fixed in 3.2 but led to problem where 2 cols: 1) 80% and 2) not set (see Table sizing test)
|
2107 |
+
Now fixed again to work for both(?)
|
2108 |
+
- parse PNG error fixed
|
2109 |
+
- bachground-image not correctly positioned in HTMLFooter and HTMLHeader (Not fixed properly in 3.2!)
|
2110 |
+
- fonts not supported with 0-9 in the name
|
2111 |
+
- font list in GetCodepage() in htmltoolkit.php (now config_cp.php) containing space " " not recognised
|
2112 |
+
- list number positioning
|
2113 |
+
- list font size set in CSS for UL/OL not working for first level list
|
2114 |
+
- table width (real value, not %) not working in nested table
|
2115 |
+
- GIF file failed if PDF file not compressed
|
2116 |
+
- list-style-type incorrectly inherited
|
2117 |
+
- line-height inheritance in lists
|
2118 |
+
- SetColumns added a new line - not required if at start of document/page
|
2119 |
+
- footer_line_spacing did not work
|
2120 |
+
- table cellPadding="" overwrote cell padding set on cell CSS
|
2121 |
+
- could not turn off Default non-HTML foter LINE
|
2122 |
+
- border specified as "em"
|
2123 |
+
- default values set in mpdf.css overriden by inherited properties e.g. <div><h1>Here</h1></div> lost font-size for H1
|
2124 |
+
|
2125 |
+
|
2126 |
+
|
2127 |
+
===========================
|
2128 |
+
mPDF v3.2 (25/10/2009)
|
2129 |
+
===========================
|
2130 |
+
Bug fixes
|
2131 |
+
---------
|
2132 |
+
- Table cell widths in %: if width of table cells set to >=100%, and not all columns are set -> froze, because tries to produce a column of no width
|
2133 |
+
- Ouput download file changed to allow compatability with IE6 (http://mpdf.bpm1.com/forum/comments.php?DiscussionID=120&page=1#Item_4)
|
2134 |
+
- Image error if relative path used on domain root (e.g. img src="image.png" and basepath is http://www.yourdomain.com) [attempted fix in 3.1 not working]
|
2135 |
+
- Table: if font changed in cell, font was not retoring properly afterwards causing errors (restoreInlineProperties())
|
2136 |
+
- Lists: list items containing <br />, font not restoring after bullet
|
2137 |
+
- Graceful support for block elements inside list items e.g. <li><p>... (not supported, but tolerated)
|
2138 |
+
- Index: Created dividing letters separately for Uppercase and lowercase
|
2139 |
+
- Incorrectly changing input character set when encountering e.g. charset=iso-8859-1 in the text of the document
|
2140 |
+
- Changed so only detects it if within <head>...</head>
|
2141 |
+
- If Keep-with-table (i.e. H1-6 before table and use_kwt true), if pagebreak forced anyway, borders did not print on previous page
|
2142 |
+
- Background-image used in HTML footer not appearing (correctly)
|
2143 |
+
- RTL tables: nested tables will not automatically transpose L->R
|
2144 |
+
- "Keep heading with table" - changed to allow <h1 style=".."> not just <h1>
|
2145 |
+
- "Keep heading with table" - backgrounds (bgcolor, image or gradient) incorrectly handled - now removed
|
2146 |
+
- Rotated table spread over more than 1 page caused enclosing block background colours to be be rotated along with table
|
2147 |
+
- CSS text-indent % now correctly suported (% of containing block width)
|
2148 |
+
- CSS width em on a block element e.g. DIV now correctly suported
|
2149 |
+
- calculating _tableheight, if remainingpage==0, get error (div by zero)
|
2150 |
+
- Table moved to next page with page-break-inside=avoid, produced an enlarged table (font)
|
2151 |
+
- RTL text-align override on BODY text was not working consistently
|
2152 |
+
- Arab characters: Character ه (HEH) appearing in Final presentation form instead of Isolated
|
2153 |
+
- Vertical position of background-image on whole page incorrect
|
2154 |
+
- SetProtection can now be used with no permissions set (was not working unless at least one permission set)
|
2155 |
+
|
2156 |
+
|
2157 |
+
Developers
|
2158 |
+
----------
|
2159 |
+
Some more undefined indexes and variables declared (courtesy of DSmart http://mpdf.bpm1.com/forum/comments.php?DiscussionID=117&page=1#Item_0 )
|
2160 |
+
Comment lines removed for < v3.0 to tidy up code
|
2161 |
+
|
2162 |
+
|
2163 |
+
Enhancements
|
2164 |
+
------------
|
2165 |
+
CSS style height now partially supported on block elements DIV, P, H1 etc. --IF--
|
2166 |
+
- block is all on one page
|
2167 |
+
- will extend the block but not shorten it
|
2168 |
+
- will not force a pagebreak (max. at bottom of page)
|
2169 |
+
- % is interpreted as % of printable page height (inside margins)
|
2170 |
+
<TFOOT> now supported (placed at start as in HTML spec) displays at end of table, and repeats as a footer
|
2171 |
+
Background-image and background-gradient now supported in TD and TH (works in all cases except: background-image is not rotated or
|
2172 |
+
positioned correctly if table is rotated)
|
2173 |
+
NB Background images and background-gradients do not work if Columns are being used, or if $use_kwt is TRUE (keep-with-table),
|
2174 |
+
or if page-break-inside:avoid is active.
|
2175 |
+
|
2176 |
+
|
2177 |
+
Updated files
|
2178 |
+
-------------
|
2179 |
+
mpdf.php
|
2180 |
+
htmltoolkit.php
|
2181 |
+
|
2182 |
+
|
2183 |
+
|
2184 |
+
|
2185 |
+
===========================
|
2186 |
+
mPDF v3.1 (30/08/2009)
|
2187 |
+
===========================
|
2188 |
+
|
2189 |
+
Bug fixes
|
2190 |
+
---------
|
2191 |
+
- Image error if relative path used on domain root (e.g. img src="image.png" and basepath is http://www.yourdomain.com
|
2192 |
+
was giving http://www.yourdomain.com//image.png) [3.1]
|
2193 |
+
- Errors in parsing background CSS (background-repeat, background-position etc) [3.1]
|
2194 |
+
- Textarea did not corectly convert width or height in units relating to font e.g. em [3.0beta_01]
|
2195 |
+
- If page margin-bottom set to zero, SetHTMLfooter() crashes with "Division by zero" error [3.0beta_01]
|
2196 |
+
- Table with header row and rowspan in tbody, not calculating maxrowheightcorrectly
|
2197 |
+
- Prevent Index breaking column just after a dividing letter
|
2198 |
+
- Select or input form field when text around it is justified had text in the form field justified
|
2199 |
+
- TocBookMarkText needs to be htmlspecialchar-ed - decoded when entered inside <tocpagebreak>
|
2200 |
+
- <img src="" /> caused crash
|
2201 |
+
- DisplayPreferences used as a variable name and a function: function renamed to SetDisplayPreferences()
|
2202 |
+
- Image with src file not including a "." incorrectly parsed (e.g. http://www.domain.com/imagegenerator?params=23)
|
2203 |
+
|
2204 |
+
New Features
|
2205 |
+
------------
|
2206 |
+
- var $debug (true|false) default false; show or hide error reporting at output stage [3.1]
|
2207 |
+
- var $autoPageBreak (true|false) default true; allows overriding of automatic page breaks [3.0beta_02]
|
2208 |
+
- <indexinsert /> HTML equivalent of CreateIndex() [was CreateReference()]
|
2209 |
+
- 2nd attribute/parameter "xref" in IndexEntry() and <indexentry> - works like IndexEntrySee() as cross-reference entry
|
2210 |
+
- function SetWatermarkText allows null parameters to be passed i.e. SetWatermarkText() - will clear the WatermarkText
|
2211 |
+
- <watermarktext content="" alpha="" /> - HTML equivalent of SetWatermarkText()
|
2212 |
+
- <watermarkimage src="" alpha="" position="" size="" /> - HTML equivalent of SetWatermarkImage()
|
2213 |
+
|
2214 |
+
Documentation
|
2215 |
+
-------------
|
2216 |
+
See Manual at http://mpdf.bpm1.com/manual/ for more information - especially:
|
2217 |
+
- User's Guide>>What Else Can I Do?>>Backgrounds & Borders
|
2218 |
+
- User's Guide>>What Else Can I Do?>>Floating blocks
|
2219 |
+
|
2220 |
+
Files updated:
|
2221 |
+
-------------
|
2222 |
+
mpdf.php
|
2223 |
+
htmltoolkit.php
|
2224 |
+
graph.php
|
2225 |
+
|
2226 |
+
|
2227 |
+
Developers only
|
2228 |
+
---------------
|
2229 |
+
mPDF<=3.1 generated a large number of warning "Notices" if run with full eror_reporting on, due to array indexes not being initiated e.g.
|
2230 |
+
$arr = array();
|
2231 |
+
...
|
2232 |
+
if ($arr['index'] == 5 ) {...}
|
2233 |
+
|
2234 |
+
To prevent this, lines were added at the start of the mpdf.php script to turn error notices OFF.
|
2235 |
+
In a move towards making mPDF able to run with full error_reporting on, a large amount of the script has been altered
|
2236 |
+
e.g. the line above would be changed to:
|
2237 |
+
if (isset($arr['index'] && $arr['index'] == 5 ) {...}
|
2238 |
+
|
2239 |
+
Although I have tested this with a number of examples, it is almost certainly not complete. Therefore the error_reporting for Notices is still turned
|
2240 |
+
off in mPDF 3.1
|
2241 |
+
If you care to test it, please uncomment line 43 (//error_reporting(E_ALL);) and report any warning notices that you get.
|
2242 |
+
NB This has added about 40kB to the script size.
|
2243 |
+
|
2244 |
+
|
2245 |
+
|
2246 |
+
===========================
|
2247 |
+
mPDF v3.0beta (14/06/2009)
|
2248 |
+
===========================
|
2249 |
+
|
2250 |
+
|
2251 |
+
New Features
|
2252 |
+
------------
|
2253 |
+
- CSS "float" partially supported (as well as clear:left|right|both)
|
2254 |
+
- CSS "background-image" "background-position" "background-repeat" "background-color" "background" supported for block-level elements
|
2255 |
+
- CSS background-color and background-image for <body > element added: this covers the whole page i.e. not just inside the "margins"
|
2256 |
+
- CSS background-color and background-image can be defined for CSS @page{}
|
2257 |
+
- Background gradients (linear or radial) can be defined using a custom CSS style property
|
2258 |
+
- Border radius can be defined to give rounded edges to block elements (uses draft CSS3 spec.)
|
2259 |
+
- page number can be reset to any value during the document (in AddPage() <pagebreak> etc.)
|
2260 |
+
- PNG images: Interlaced and alpha-channel-set PNG images now supported
|
2261 |
+
- internal links supported in Indexes (parameter added to CreateIndex()/CreateReference(): $useLinking=true;)
|
2262 |
+
- HTML Headers and footers now support hyperlinks
|
2263 |
+
- improved handling of <br>, block elements, and text lines inside table - approximates better to browser handling
|
2264 |
+
- borders of block-level elements & table cell borders supported (partially) in columns
|
2265 |
+
- optional error reporting for problems with Images ($showImageErrors)
|
2266 |
+
- ToC will word-wrap long entries
|
2267 |
+
- internal links (Bookmarks, IndexEntry and ToCEntry) rewritten to give more accurate positioning (when used as <tag>)
|
2268 |
+
- autofont algorithm improved for CJK languages
|
2269 |
+
- define text before and after page numbers ($pagenumPrefix; $pagenumSuffix; $nbpgPrefix; $nbpgSuffix;)
|
2270 |
+
- Additional color names supported - full list from SVG1.0
|
2271 |
+
|
2272 |
+
Bug fixes
|
2273 |
+
---------
|
2274 |
+
- Column width not resetting after an automatic pagebreak, or after setting HTMLheader
|
2275 |
+
- using AutoFont unnecssarily changed htmlspecialchars to code causing errors
|
2276 |
+
- Lists inside a table - incorrectly calculating table cell height
|
2277 |
+
- CJK - 4-byte utf-8 chars not displaying properly (includes HKCS characters)
|
2278 |
+
- mailto: links incorrectly handled
|
2279 |
+
- TOCpagebreak() - usePaging default clarified: true unless specified as '', 0, '0' or false; (null ->true)
|
2280 |
+
- <tocpagebreak> (as html tag) with no "name" defined, used at start of page, added a further blank page(s)
|
2281 |
+
- Lists - inaccurate calculation of space required for numbers in certain circumstances
|
2282 |
+
- Generated images (.php) only working if cURL enabled - (fixed, but rquires allow_url_fopen if remote file)
|
2283 |
+
- flag added to turn off error reporting when buffering used ($allow_output_buffering = false;)
|
2284 |
+
- RTL text in Bookmark, Title, Author, Creator, Keywords, and Subject was reversed - Adobe Reader 9 now correctly handles RTL text ( which Reader 8 did not)
|
2285 |
+
- TOC - if not using ODD/EVEN paging, did not add extra page and messed up
|
2286 |
+
- Rotated table which did not fit on remaining page resized to bigger than default
|
2287 |
+
- HR of width less than 100% - text continued on line after it
|
2288 |
+
- HR alignment not working (fixed so both CSS text-align and margin: 0 0 0 auto etc work)
|
2289 |
+
- HR in table did not correctly re-size when necessary
|
2290 |
+
- characters in symbols/zapfdingbats which in non-utf-8 mode are represented as chr(173) incorrectly handled as soft-hyphens
|
2291 |
+
(bug introduced 2.5 with soft-hyphens - affects symbols ↑ arrow-up and Zapfdingbats ② encircled 2)
|
2292 |
+
- Internal links (anchors) - Annotation/Bookmarks etc. incorrectly positioned when page orientation changed
|
2293 |
+
- ToC - when using multiple ToCs, internal links were not correctly adjusted
|
2294 |
+
- anchor (a name="") used inside a table was incorrectly positioned at the end of table
|
2295 |
+
- Tables: cell height calculated incorrectly when BR used
|
2296 |
+
- Table rotated with "page-break-inside:avoid" not kept on one page
|
2297 |
+
- Table rotated and split over > 1 page - vertical alignment inaccurate
|
2298 |
+
- Headers/Footers (non_html) when no style set caused errors
|
2299 |
+
- Table: breaking page when using rowspan error (line 17142)
|
2300 |
+
- ToC: If no indent defined in HTML tag <tocpagebreak> or defined as 0 gave error
|
2301 |
+
|
2302 |
+
Note
|
2303 |
+
----
|
2304 |
+
In mPDF 3.0 the following sections of code have been significantly rewritten:
|
2305 |
+
- painting of borders and background colours for block-elements
|
2306 |
+
- table of contents
|
2307 |
+
- Index
|
2308 |
+
- vertical justification in columns (uses scaling to stretch vertically)
|
2309 |
+
|
2310 |
+
NB changed htmltoolkit AdjustHTML - does not now remove <br> before </div>
|
2311 |
+
Warning - may display differently in normal text as well as tables
|
2312 |
+
|
2313 |
+
|
2314 |
+
Files updated:
|
2315 |
+
-------------
|
2316 |
+
mpdf.php
|
2317 |
+
htmltoolkit.php
|
2318 |
+
|
2319 |
+
|
2320 |
+
Developers only
|
2321 |
+
---------------
|
2322 |
+
- Background-color handling in CSS changed so only inherited/cascaded when Columns active or Keep-block-together
|
2323 |
+
- otherwise would overwrite background image with inherited color
|
2324 |
+
- all %.2f used in sprintf() changed to %.3f in htmltoolkit.php and mpdf.php to increase accuracy of div border lines in columns etc.
|
2325 |
+
- variable $use_embeddedfonts_1252 renamed to $useOnlyCoreFonts as more precise: depracated but still supported.
|
2326 |
+
- this version included quite abit of tidying up/future-proofing some code:
|
2327 |
+
$var{0} changed to substr($var,0,1) etc. (due to go in PHP6)
|
2328 |
+
ereg_ changed to preg_ (depracated in PHP5.3) - (NB mainly in htmltoolkit.php)
|
2329 |
+
|
2330 |
+
|
2331 |
+
|
2332 |
+
===========================
|
2333 |
+
mPDF v2.5 (01/05/2009)
|
2334 |
+
===========================
|
2335 |
+
|
2336 |
+
New Features
|
2337 |
+
------------
|
2338 |
+
- Automatic Hyphenation added, and support for soft-hyphens
|
2339 |
+
- Encryption works now for CJK language documents
|
2340 |
+
- Improved text justification
|
2341 |
+
- Support for 'generated' images e.g. "../ontheflyimage.php"
|
2342 |
+
|
2343 |
+
|
2344 |
+
Bug fixes
|
2345 |
+
---------
|
2346 |
+
- Tables: cell height did not reduce if font-size used was smaller than table default
|
2347 |
+
- Columns: if setcolumns() to the same number already active - did not print out last bit of previous columns
|
2348 |
+
- Page-break in the middle of a block caused incorrect margin and padding on next lines until end of block ($cMargin reset to 0 in AddPage)
|
2349 |
+
- <HR> in table cell was printing in incorrect position (bug introduced in mPDF 2.4)
|
2350 |
+
- Justification
|
2351 |
+
- if only one word on line, did not respect maximum character spacing
|
2352 |
+
- last character of line incorrectly had character spacing applied
|
2353 |
+
- Space at the end of last line of a Right Justify block - e.g. "end. </p>" now correctly ignored
|
2354 |
+
- incorrectly treated as a character when justifying text with word/char spacing
|
2355 |
+
- CJK punctuation (.,) added as 'orphans' to keep at end of line
|
2356 |
+
- PNG files - was still buggy reading larger PNG files (due to fread)
|
2357 |
+
|
2358 |
+
|
2359 |
+
Files updated:
|
2360 |
+
-------------
|
2361 |
+
mpdf.php
|
2362 |
+
htmltoolkit.php
|
2363 |
+
CJKdata.php
|
2364 |
+
/patterns/.. (new files)
|
2365 |
+
|
2366 |
+
|
2367 |
+
Developers only
|
2368 |
+
---------------
|
2369 |
+
Variables renamed as more accurate or appropriate:
|
2370 |
+
- var $isunicode renamed as $is_MB
|
2371 |
+
- var $usingembeddedfonts renamed as $usingCoreFont
|
2372 |
+
CJK changed to act internally as UTF-8 encoded
|
2373 |
+
- (NB CJK Half-widths not supported from 2.5+ i.e. big5-hw gb-hw)
|
2374 |
+
|
2375 |
+
|
2376 |
+
|
2377 |
+
===========================
|
2378 |
+
mPDF v2.4 (23/04/2009)
|
2379 |
+
===========================
|
2380 |
+
Files updated
|
2381 |
+
-------------
|
2382 |
+
mpdf.php
|
2383 |
+
htmltoolkit.php
|
2384 |
+
mpdfi/mpdfi.php
|
2385 |
+
|
2386 |
+
New files
|
2387 |
+
---------
|
2388 |
+
graph.php
|
2389 |
+
Graphs - Requires new folder: path_to_mpdf/graph_cache/ (must be writeable)
|
2390 |
+
|
2391 |
+
New features
|
2392 |
+
------------
|
2393 |
+
Annotations improved so they appear as a pop-up
|
2394 |
+
Re-use Document Templates (cf. RestartDocTemplate() in manual)
|
2395 |
+
Limited support for CSS float property on an IMG element allowing text wrapping e.g. <img style="float: right;"> (cf. Images in manual)
|
2396 |
+
Utility function PreparePreText() allows output of a text file which may include <pre>
|
2397 |
+
Automatic generation of graphs from data in tables (requires integration with JPGraph) (cf. Graphs in manual)
|
2398 |
+
|
2399 |
+
Other Changes
|
2400 |
+
-------------
|
2401 |
+
IMPORTANT - User rights removed as not working with newer version of Adobe Reader 9 (affects Active forms and ability for users to modify annotations)
|
2402 |
+
Corrects text alignment when using {nb} or {nbpg} in (non-HTML) headers/footers
|
2403 |
+
Sets default timezone if not already set (at top of mpdf.php) to prevent E_STRICT ERROR message
|
2404 |
+
Suppresses E_NOTICE error reporting (at top of mpdf.php)
|
2405 |
+
Error capture in Output() to avoid PDF header being sent when error messages generated
|
2406 |
+
A function str_ireplace added to htmltoolkit to allow PHP4 to function
|
2407 |
+
|
2408 |
+
Bug fixes
|
2409 |
+
---------
|
2410 |
+
WMF images incorrectly positioned when in-line
|
2411 |
+
PNG images > 8kB failed to load - (fix in 2.3 didn't work - fixed properly this time)
|
2412 |
+
Annotations containing a new line (\n) causing an error
|
2413 |
+
Evaluation of <pre> text: "<code>[TAB] " evaluated incorrect number of spaces to follow to align tabs, because < was calculated as 4 chars (<)
|
2414 |
+
|
2415 |
+
|
2416 |
+
|
2417 |
+
===========================
|
2418 |
+
mPDF v2.3 (22/03/2009)
|
2419 |
+
===========================
|
2420 |
+
|
2421 |
+
New Features
|
2422 |
+
------------
|
2423 |
+
- Optionally detect language and when to use special fonts i.e. RTL (arabic), CJK (chinese), Thai (see SetAutoFont() etc.)
|
2424 |
+
- Supports HTML attribute "lang" in all tags and uses special fonts when required (see $useLang)
|
2425 |
+
- Joins Arabic and Farsi/Persian text into presentation forms
|
2426 |
+
- Import another PDF file and use as templates in your document (see UseTemplate() and mPDFI in the manual.)
|
2427 |
+
- Replace specified text strings in an existing PDF file (see OverWrite() etc.)
|
2428 |
+
- More than one Table of Contents can be used in a document (see tocpagebreak etc.)
|
2429 |
+
- Restore properties of open HTML block elements after a page break (variable $restoreBlockPagebreaks or new tag <formfeed>)
|
2430 |
+
- <annotation> <bookmark> <indexentry> <tocentry> can now accept characters <>'"& as htmlentities - htmlspecialchars(..., ENT_QUOTES)
|
2431 |
+
- <annotation> can now accept "\n" for new line
|
2432 |
+
- support for opacity (CSS3 property) for images
|
2433 |
+
- specify the number of spaces to substitute for TAB when parsing <pre> tags
|
2434 |
+
- greater control over margins and display when changing page orientation during document (see $forcePortraitMargins and $displayDefaultOrientation)
|
2435 |
+
|
2436 |
+
|
2437 |
+
|
2438 |
+
Bug fixes
|
2439 |
+
---------
|
2440 |
+
Fonts in CSS - Not parsing font-family: Trebuchet MS; correctly as trebuchet
|
2441 |
+
Fonts in CSS - CSS font-family: [unknown]; setting first $available_unifont rather than ignoring
|
2442 |
+
Images - not displaying on IIS platform
|
2443 |
+
Images - .wmf not displaying if (allow_url_fopen) not set
|
2444 |
+
Table borders - in defaultCSS, 'MARGIN-COLLAPSE'=> collapase not quoted therefore not working
|
2445 |
+
Line-break inside table - printing a blank background across page rather than just going down a line
|
2446 |
+
Form fields inside tables - will now resize if the table is autosized (shrunk)
|
2447 |
+
<pre> containing a '<' was changed to '<'
|
2448 |
+
Tabs inside <pre> were all changed to 8 spaces, not the remainder following a string
|
2449 |
+
Header on first page was inset by 1mm left and right ($cMarginL and $cMarginR not set to zero)
|
2450 |
+
Table nested inside a cell with colspan > 1 was incorrectly handled
|
2451 |
+
PNG file crashed (?incorrectly defined PNG file) [adapted _parsepng to account for unexpected]
|
2452 |
+
Table or Cell - if font-size not recognised, mPDF set font-size to zero
|
2453 |
+
Font-sizes - [xx-small|x-small|small|medium|large|x-large|xx-large] were not recognised in tables
|
2454 |
+
|
2455 |
+
|
2456 |
+
===========================
|
2457 |
+
mPDF v2.2.1 (17/02/2009)
|
2458 |
+
===========================
|
2459 |
+
Bug fix - (bug introduced in 2.2)
|
2460 |
+
Table - header row did not return to top of page when repeating across pages.
|
2461 |
+
|
2462 |
+
|
2463 |
+
===========================
|
2464 |
+
mPDF v2.2 (15/02/2009)
|
2465 |
+
===========================
|
2466 |
+
Updated files from mPDF 2.1
|
2467 |
+
mpdf.php
|
2468 |
+
htmltoolkit.php
|
2469 |
+
mpdf.css (new)
|
2470 |
+
===========================
|
2471 |
+
New files from mPDF <2.0 (only required for EAN Barcodes)
|
2472 |
+
font/ocrb.xx (several)
|
2473 |
+
unifont/ocrb.xx (several)
|
2474 |
+
IMPORTANT - you need to make sure the ocrb font is added to the config.php file
|
2475 |
+
- add 'ocrb' to the end of 3 arrays: $this->available_fonts $this->available_unifonts and $this->mono_fonts
|
2476 |
+
===========================
|
2477 |
+
|
2478 |
+
Summary of changes
|
2479 |
+
- external stylesheet file (mpdf.css) is used to configure default values ($useDefaultCSS2 and $defaultCSS2 are no longer used)
|
2480 |
+
- special comment tags to hide mPDF tags from browsers: <!--mpdf ... mpdf-->
|
2481 |
+
- AddColumn() function added (equivalent to <columnbreak>)
|
2482 |
+
- annotations - pop-up messages the reader can move or delete (if you set permissions)
|
2483 |
+
- support for WMF images as well as GIF, JPG, PNG
|
2484 |
+
- watermark image can be set instead of, or as well as text
|
2485 |
+
- nested tables can include other content
|
2486 |
+
- improved control over table layout
|
2487 |
+
- margin: auto now supported for table and block elements
|
2488 |
+
|
2489 |
+
A number of methods and variables have been renamed or reCapitalised for consistency.
|
2490 |
+
Changes should be backwards comaptible.
|
2491 |
+
All user methods start with a Capital, all user-defined variables start with lowercase.
|
2492 |
+
Affected:
|
2493 |
+
Reference() -> IndexEntry()
|
2494 |
+
CreateReference() -> CreateIndex()
|
2495 |
+
$TopicIsUnvalidated -> $showWatermark
|
2496 |
+
setUnvalidatedText() -> SetWatermarkText()
|
2497 |
+
|
2498 |
+
PHP appears at present to be case-insensitive for function/method names
|
2499 |
+
All the following functions have been renamed in the script with a capital first letter:
|
2500 |
+
setUserRights()
|
2501 |
+
setBasePath()
|
2502 |
+
setAnchor2Bookmark()
|
2503 |
+
setHeader()
|
2504 |
+
setFooter()
|
2505 |
+
defHeaderByName()
|
2506 |
+
defFooterByName()
|
2507 |
+
setHeaderByName()
|
2508 |
+
setFooterByName()
|
2509 |
+
setHTMLHeader()
|
2510 |
+
setHTMLFooter()
|
2511 |
+
defHTMLHeaderByName()
|
2512 |
+
defHTMLFooterByName()
|
2513 |
+
setHTMLHeaderByName()
|
2514 |
+
setHTMLFooterByName()
|
2515 |
+
shaded_box()
|
2516 |
+
writeBarcode()
|
2517 |
+
|
2518 |
+
Variable names changed to lowercase first letter:
|
2519 |
+
(Variables are case-sensitive therefore aliases have been set up)
|
2520 |
+
Anchor2Bookmark
|
2521 |
+
BiDirectional
|
2522 |
+
KeepColumns
|
2523 |
+
AliasNbPg
|
2524 |
+
AliasNbPgGp
|
2525 |
+
|
2526 |
+
=========
|
2527 |
+
Bug fixes
|
2528 |
+
=========
|
2529 |
+
Columns - $keepColumns=true was incorrectly calculating the place to continue printing after 1 and half columns (of 3)
|
2530 |
+
Table cell height - incorrectly setting table cell height when cell contained a line of text of large size which wrapped to more than one line
|
2531 |
+
HR in Table cell - if table cell contains only HR (and column otherwise empty), HR was printed outside cell
|
2532 |
+
HR in Table cell - if table cell ended with a HR, height was one line too much
|
2533 |
+
Table page-break-inside:avoid - caused mPDF into permanent loop in some circumstances
|
2534 |
+
Paging - Total Pages/Group {nb} and {nbgp} didn't work in CJK
|
2535 |
+
CSS - Border size thin, medium and thick were only recognised in lowercase
|
2536 |
+
Table-header - rowspan not correctly output in THEAD
|
2537 |
+
Default CSS - table empty-cell:hide changed to show (CSS specification)
|
2538 |
+
|
2539 |
+
===========================
|
2540 |
+
mPDF v2.1 (24/01/2009)
|
2541 |
+
===========================
|
2542 |
+
|
2543 |
+
New Features in Version 2.1
|
2544 |
+
---------------------------
|
2545 |
+
- CSS support improved generally (especially for cascading CSS, lists)
|
2546 |
+
- TableHeader changed to allow multiple rows in THEAD
|
2547 |
+
|
2548 |
+
|
2549 |
+
CSS changes
|
2550 |
+
-----------
|
2551 |
+
- display: none (block elements only - not lists or tables, nor HR)
|
2552 |
+
- width (TD/TH)
|
2553 |
+
- list-style-type (will also recognise the list-style-type from list-style) (OL/UL)
|
2554 |
+
recognised values: disc|circle|square|decimal|lower-roman|upper-roman|lower-latin|upper-latin|lower-alpha|upper-alpha|none
|
2555 |
+
- CSS support for <LI>: font-family, font-size, font-style, font-weight, color, background-color, text-decoration, text-transform, and list-style-type (will also recognise the list-style-type from list-style)
|
2556 |
+
- table cell borders - CSS rules have been adapted slightly - if a coloured/black line conflicts with a white line, and is the same width, coloured/black will overwrite even if Bottom or Right
|
2557 |
+
|
2558 |
+
|
2559 |
+
Numbered Lists
|
2560 |
+
--------------
|
2561 |
+
Variables set at the top of mpdf.php can be set to change:
|
2562 |
+
- text alignment of numbers in numbered lists (default Right)
|
2563 |
+
var $list_align_style = 'R';
|
2564 |
+
- content to follow a numbered list marker e.g. '.' gives 1. or IV. whereas ')' gives 1) or a)
|
2565 |
+
var $list_number_suffix = '.';
|
2566 |
+
(These can be altered at run time, but are not changeable through stylesheets or in-line style)
|
2567 |
+
|
2568 |
+
|
2569 |
+
Writing broken segments of HTML
|
2570 |
+
-------------------------------
|
2571 |
+
2 new parameters have been added to WriteHTML()
|
2572 |
+
function WriteHTML($html,$sub=0,$init=true,$close=true) {
|
2573 |
+
$close - Leaves buffers/variables etc. in current state, so that it can continue to write the HTML where it leaves off
|
2574 |
+
$init - Clears and resets buffers/variables
|
2575 |
+
(N.B. You must end with a WriteHTML that calls $close=true)
|
2576 |
+
Example:
|
2577 |
+
$mpdf->WriteHTML('<p>This is the beginning...', 2, true, false);
|
2578 |
+
$mpdf->WriteHTML('...this is the middle...', 2, false, false);
|
2579 |
+
$mpdf->WriteHTML('...and this is the end</p>', 2, false, true);
|
2580 |
+
|
2581 |
+
|
2582 |
+
Rotated text in table cells
|
2583 |
+
---------------------------
|
2584 |
+
NB This UPDATE will change expected output from previous versions******
|
2585 |
+
|
2586 |
+
Prior to v2.1 any cell set to rotate text anticlockwise was forced to vertical align = bottom.
|
2587 |
+
This has been changed so that it only overrides when the rotate angle is between 45 and 89 degrees: text rotated exactly 90 degrees will respect the set value for vertical-align.
|
2588 |
+
|
2589 |
+
|
2590 |
+
=========
|
2591 |
+
Bug fixes
|
2592 |
+
=========
|
2593 |
+
- List - list starting after "<div>Then some text not in a block element<ol>" incorrectly output
|
2594 |
+
- Tables - if cell font-size set smaller than default for the table, does not shrink the cell height
|
2595 |
+
- Columns (tables) - columns breaking across rows e.g. in the middle of a table cell
|
2596 |
+
- Tables - if table width set to e.g. 100% but cols are less, was not making up to set width
|
2597 |
+
- Watermark - was not printing if using HTMLFooter
|
2598 |
+
- Lists - not aligning numbering correctly if different font sizes used for bullet & text etc.
|
2599 |
+
- Lists - indent of text did not correctly allow for Maximum number in <ol> list
|
2600 |
+
- Table does not always move correctly to a new page
|
2601 |
+
- Table cell incorrectly calculated height causing text to overflow cell when printed
|
2602 |
+
- Table borders in columns not being correctly handled (bug since 2.0 introduced a buffer to save the borders and print at the end of the table - fixed so does not use buffer if in columns - potentially does not deal with conflicting borders as well, but works in columns)
|
2603 |
+
- Table cell width if set as a percent was being downsized when autosizing table
|
2604 |
+
- Table CSS was buggy - improved
|
2605 |
+
- SetBasePath (when fetching remote website) - now handles string with query string on it e.g. http://www.domain.com/index.php?tid=42
|
2606 |
+
- Table cells with Rotated text - text not positioned correctly
|
2607 |
+
- Page number totals not working in utf-8 mode
|
2608 |
+
|
2609 |
+
|
2610 |
+
============================
|
2611 |
+
Code efficiency improvements
|
2612 |
+
============================
|
2613 |
+
- BIG speed improvement (compared with 2.0) with tables (especially large tables)
|
2614 |
+
- considerable increase in speed if writing long HTML segments to mPDF
|
2615 |
+
- speed improvement for tables (may be very significant if some cells have a lot of text in them causing uneven column widths)
|
2616 |
+
|
2617 |
+
NB To speed up program more, consider setting $mpdf->useSubstitutions=false; if you do not use any characters outside the codepage selected
|
2618 |
+
|
2619 |
+
|
2620 |
+
===============
|
2621 |
+
Keep-with-table
|
2622 |
+
===============
|
2623 |
+
(This was introduced in v2.0 but I forgot to document it)
|
2624 |
+
If you set $this->use_kwt = true;
|
2625 |
+
All H1-H6 elements will try to keep with a table that follows immediately afterwards - (this is done in htmltoolkit, by adding an attribute KEEP-WITH-TABLE)
|
2626 |
+
See Known Issues re: Using kwt inside a div with border/background (doesn't work)
|
2627 |
+
|
2628 |
+
|
2629 |
+
|
2630 |
+
|
2631 |
+
===========================
|
2632 |
+
mPDF v2.0 (07/12/2008)
|
2633 |
+
===========================
|
2634 |
+
Main New Features in Version 2.0
|
2635 |
+
- nested tables are supported
|
2636 |
+
- supports both models of table border: separate and collapsed
|
2637 |
+
- improved parsing of CSS stylesheets, and better handling of styles throughout
|
2638 |
+
- additional recognised CSS styles
|
2639 |
+
- page orientation, size, and margins can be changed within the document, using PHP script or custom HTML
|
2640 |
+
- some limited support for @page CSS to define page-box areas, with crop/cross marks for printing
|
2641 |
+
- improved control over headers and footers (including HTML headers/footers)
|
2642 |
+
- improved presentation of Form elements including image-type input fields
|
2643 |
+
- generates an EAN barcode suitable for a book/printed publication
|
2644 |
+
- active forms can be generated - EXPERIMENTAL at present
|
2645 |
+
- change document permissions to allow the user to make annotations - EXPERIMENTAL at present
|
2646 |
+
|
2647 |
+
NB Lines are commented in mPDF script as changes for mPDF 1.4 - this became v2.0
|
2648 |
+
|
2649 |
+
=========
|
2650 |
+
UPGRADING
|
2651 |
+
=========
|
2652 |
+
IMPORTANT - Before Upgrading: Please note that some of the changes will cause mPDF 2.0 to render the pages differently from earlier versions i.e. it is not totally backwards comaptible. Read the notes on Backward compatibility before deleting your original set-up.
|
2653 |
+
|
2654 |
+
To upgrade from v<=1.3 to v2.0 you only need to copy and overwrite the following 2 files:
|
2655 |
+
mpdf.php
|
2656 |
+
htmltoolkit.php
|
2657 |
+
|
2658 |
+
Plus (optionally) if you want to use the EAN Barcode function, you will also need:
|
2659 |
+
font/ocrb.xx (several)
|
2660 |
+
unifont/ocrb.xx (several)
|
2661 |
+
IMPORTANT - you need to make sure the ocrb font is added to the config.php file
|
2662 |
+
- add 'ocrb' to the end of 3 arrays: $this->available_fonts $this->available_unifonts and $this->mono_fonts
|
2663 |
+
|
2664 |
+
|
2665 |
+
==========
|
2666 |
+
Bug Fixes
|
2667 |
+
==========
|
2668 |
+
<columns column-count="0"> did not turn off columns - Fixed
|
2669 |
+
|
2670 |
+
Margins as % - e.g. margin-right: 50% set from CSS incorrectly applied 50% of the fontsize
|
2671 |
+
(Fixed - adding parameter to fn. ConvertSize in htmltoolkit.php and in calls to that function)
|
2672 |
+
|
2673 |
+
DIV Width - e.g. div style="width: 50% was not working
|
2674 |
+
(Fixed - fn.SetCSS and OpenTag()'DIV')
|
2675 |
+
|
2676 |
+
CSS values as Zero - p { margin: 0; } did not work in stylesheet unless 0 had a unit
|
2677 |
+
|
2678 |
+
Multiple Non-breaking spaces collapsed - e.g. "1 2" - was contracted to "1 2"
|
2679 |
+
(Fixed - fn.adjustHTML in htmltoolkit.php)
|
2680 |
+
|
2681 |
+
Table cell too narrow causing incorrect printing - If two characters are too wide to print (only likely within a table cf. example tables - Periodic table) the first character was not printed, just a new line
|
2682 |
+
(Fixed in fn.WriteFlowingBlock)
|
2683 |
+
|
2684 |
+
Font size by inline style for form elements <input> <textarea> gave wrong size when using a relative size 0.9em
|
2685 |
+
(Fixed - fn.ConvertSize in htmltoolkit.php)
|
2686 |
+
|
2687 |
+
Creation Date not correctly showing
|
2688 |
+
(Fixed - did not need to convert to UTF16)
|
2689 |
+
|
2690 |
+
New block element started at end of page - block borders not painted
|
2691 |
+
(Fixed - fn.AddPage)
|
2692 |
+
|
2693 |
+
DL did not close block correctly
|
2694 |
+
(Fixed - mistype in fn. CloseTag)
|
2695 |
+
|
2696 |
+
Transparent not recognised as color/background-color
|
2697 |
+
(Attempted a fix by setting to ignore it! - fn. convertcolor in htmltoolkit.php)
|
2698 |
+
|
2699 |
+
Zero (0) not displaying if only thing in table cell or tags e.g. <td>0</td> <p>0</p>
|
2700 |
+
(Fixed - fn.WriteHTML)
|
2701 |
+
|
2702 |
+
Page Headers/Footers - Simple Headers or Footers defined as e.g. '|{PAGENO}|' were not split into 3 components, but output |6| in the outer margin.
|
2703 |
+
(Fixed)
|
2704 |
+
|
2705 |
+
Could not copy from a completed PDF doc to clipboard when using a TrueTypeUnicode font
|
2706 |
+
(Fixed - fn._puttruetypeunicode - added CIDToGIDMap)
|
2707 |
+
|
2708 |
+
Creating an Index (confusing called CreateReference in mPDF) based on only 1 column (i.e. columns off) caused it to print FAIL
|
2709 |
+
(Fixed - fn. CreateReference())
|
2710 |
+
|
2711 |
+
Table of Contents - If a ToC entry reached other side of page a warning notice was produced
|
2712 |
+
Fixed - printing is now suppressed and it is moved down a line (but not when using rtl)
|
2713 |
+
|
2714 |
+
"Keep Block Together" (i.e. page-break-inside: avoid for a block element)
|
2715 |
+
If this property causes some text to be moved to the next page, internal link targets (i.e. <a name="xxx">) were incremented pagenumber by +1 - as this used the calculated document page number, didn't work if using e.g. roman numerals
|
2716 |
+
(Fixed)
|
2717 |
+
NB This is now ALWAYS disabled when it meets a table - can use page-break-inside:avoid for the table
|
2718 |
+
|
2719 |
+
@import url(style.css) without quotation marks "" was not picked up, although it is valid HTML
|
2720 |
+
(Fixed - fn.ReadCSS())
|
2721 |
+
|
2722 |
+
Reading CSS from external style sheets included all media
|
2723 |
+
Now set by default to ignore media="aural|braille"
|
2724 |
+
Allows media="print" but can exclude by: $mpdf->disablePrintCSS = true; (default = false)
|
2725 |
+
Works on both <link... and <style media="print">@import...
|
2726 |
+
See the web page example - this stops the CSS stylesheets specifically marked for "print" to be ignored
|
2727 |
+
|
2728 |
+
Table borders (in collapsed model) incorrectly calculated which border had dominance (mPDF <=1.3 determined the overriding border by its color)
|
2729 |
+
(Fixed to follow CSS 2.1 specifications: width >> CSS dominance (cell>table) >> T & L > B & R)
|
2730 |
+
In the border-collapse=collapse mode, the following rules determine which border style "wins" in case of a conflict:
|
2731 |
+
1. Borders with the 'border-style' of 'hidden' take precedence over all other conflicting borders.
|
2732 |
+
2. narrow borders are discarded in favor of wider ones.
|
2733 |
+
3. styles are preferred in this order: 'double', 'solid', 'dashed', 'dotted', 'ridge', 'outset', 'groove', and the lowest: 'inset'.
|
2734 |
+
4. If border styles differ only in color, then a style set on a cell wins over one on a table.
|
2735 |
+
5. When two elements of the same type conflict, then the one further to the left or top wins out.
|
2736 |
+
|
2737 |
+
Parsing CSS, a missed level would not be picked up i.e. CSS = div.refstr1 p {...} would not pick up:
|
2738 |
+
<div class="refstr1"> <div class="another"> <p>...
|
2739 |
+
(Fixed - fn. MergeCSS by carrying everything forwards)
|
2740 |
+
Note: I removed - && !$this->blk[$this->blklvl-1]['cascadeCSS']['CLASS>>'.$attr['CLASS']]['depth']
|
2741 |
+
Not sure why I put it there in the first place!
|
2742 |
+
In a later bit of function - && $this->blk[$this->blklvl-1]['cascadeCSS'][$tag]['depth']>1
|
2743 |
+
Haven't removed this, but is it needed???
|
2744 |
+
|
2745 |
+
CSS inline style set in TD/TH (font-size, color, weight, font-family or italic) didn't turn off at the end of the cell (and also formatted the top left cell)
|
2746 |
+
(Fixed)
|
2747 |
+
|
2748 |
+
CSS properties color, font-weight, and font-style set on a table were not inherited by the table cells
|
2749 |
+
(Fixed - var $base_table_properties)
|
2750 |
+
|
2751 |
+
When rotating a table, the text following was positioned incorrectly
|
2752 |
+
(Fixed - fn. printtablebuffer)
|
2753 |
+
|
2754 |
+
When rotating a table, links were not adjusted in position e.g. <a href="">...
|
2755 |
+
(Fixed - fn. printtablebuffer)
|
2756 |
+
|
2757 |
+
If a larger border-thickness was set for a cell in the middle of a table, cells before that inaccurately calculated the cell wdith needed
|
2758 |
+
(Fixed)
|
2759 |
+
|
2760 |
+
Text in a table cell which was not in a block and followed a list, there was no line break e.g. </ol>Text following</td>
|
2761 |
+
(Fixed - var $listjustfinished;)
|
2762 |
+
|
2763 |
+
Setting the default font-family from the body tag using in-line CSS did not work e.g. <body style="font-family:mono"> (did work in external stylesheets)
|
2764 |
+
(Fixed - fn.WriteHTML)
|
2765 |
+
|
2766 |
+
<link href="..." rel="stylesheet"> was not recognised (because the href comes before the rel)
|
2767 |
+
(Fixed)
|
2768 |
+
|
2769 |
+
Read linked CSS stylesheet OR @import stylesheet - now includes both.
|
2770 |
+
|
2771 |
+
<tag class="class1 class2"> did not set either class1 or class2. Fixed so that it will now pick out class1 (better than nothing!)
|
2772 |
+
|
2773 |
+
CSS line-height as % - interpreted 120% as 120 (x the font-size) - Fixed so it now accepts % and numbers
|
2774 |
+
|
2775 |
+
Setting the basepath (used for relative links/external stylesheets etc) with $mpdf->setBasePath() was generally buggy!
|
2776 |
+
Now allows a domain e.g. $mpdf->setBasePath("http://www.domain.com"); (previously needed slash on end)
|
2777 |
+
(Fixed - hopefully!)
|
2778 |
+
|
2779 |
+
If you were repeatedly calling mPDF in a loop to produce more than one PDF file, it would crash with error: "You have restricted the number of available fonts to 0". Fixed by editing line 751 require(_MPDF_PATH.'mpdf_config.php'); to require(...
|
2780 |
+
|
2781 |
+
|
2782 |
+
=============
|
2783 |
+
Improvements(?)
|
2784 |
+
=============
|
2785 |
+
Unsupported image files - mPDF died with an error message if image files didn't meet expected format e.g. an interlaced PNG file
|
2786 |
+
Changed so images are now replaced by the NOIMG image.
|
2787 |
+
|
2788 |
+
Footer margin (HTML and normal footers) now determines the lowest point that is printed (rather than the place to start printing the footer)
|
2789 |
+
NB IMPORTANT CHANGE - not backwards comaptible
|
2790 |
+
|
2791 |
+
Tabs in <pre> or <textarea> are now replaced by 8 spaces rather than 6 (consistent with http://www.w3.org/TR/1998/REC-html40-19980424/struct/text.html#edef-PRE) [fn. AdjustHTML() in htmltoolkit.php]
|
2792 |
+
|
2793 |
+
To insert the total number of pages in the document anywhere in the doc, just use '{nb}'
|
2794 |
+
The line: $mpdf->AliasNbPages();
|
2795 |
+
has now been uncommented allowing {nb} to be used
|
2796 |
+
NB This will always give the total no. of pages in the whole document regardless of any changes you have made to page numbering.
|
2797 |
+
You can change the default placeholder '{nb}' to any string using: $mpdf->AliasNbPages('[**my Chars**]');
|
2798 |
+
|
2799 |
+
$mpdf->AliasNbPageGroups(); default="{nbpg}"
|
2800 |
+
Can be used to set the total number of pages in the current group i.e. between where page numbering is reset
|
2801 |
+
|
2802 |
+
CSS border correctly fixes "solid 3mm #000000" i.e. (style width color) - (not a bug, but this is often incorrectly specified)
|
2803 |
+
|
2804 |
+
Can now print div background behind a rotated table.
|
2805 |
+
|
2806 |
+
You can keep columns as they are i.e. 1st column will finish page then start on second, by setting
|
2807 |
+
$mpdf->KeepColumns = true;
|
2808 |
+
|
2809 |
+
Image constrain
|
2810 |
+
===============
|
2811 |
+
Image size is constrained to current margins and page position. Extra parameter added to end of fn. allows you to override this.
|
2812 |
+
$mpdf->Image('files/images/frontcover.jpg',0,0,210,297,'jpg','',true, false); // e.g. the last "false" allows a full page picture
|
2813 |
+
Useful for e.g. a cover page for your document
|
2814 |
+
|
2815 |
+
Cumulative CSS
|
2816 |
+
==============
|
2817 |
+
In version <=1.3, if you call:
|
2818 |
+
$mpdf->WriteHTML($stylesheet,1);
|
2819 |
+
$mpdf->WriteHTML($html); // this one cleared the array $this->cascadeCSS; conatining cascaded CSS information from stylesheets
|
2820 |
+
You were meant to call:
|
2821 |
+
$mpdf->WriteHTML($html,2); // which doesn't re-parse the CSS information
|
2822 |
+
v2.0 changed so that
|
2823 |
+
$mpdf->WriteHTML($html); no longers clears the array $this->cascadeCSS and so can be used repeatedly;
|
2824 |
+
|
2825 |
+
|
2826 |
+
|
2827 |
+
================================================
|
2828 |
+
Additional CSSstyles & HTML attributes supported
|
2829 |
+
================================================
|
2830 |
+
<BODY> - font-style, font-weight, color
|
2831 |
+
|
2832 |
+
<IMG> - html attributes width="" and height=""
|
2833 |
+
|
2834 |
+
<TABLE|TD|TH> - border: 'thin' 'medium' and 'thick' are now converted to 1px, 3px and 5px
|
2835 |
+
<TABLE|TD|TH> - border now respects all types - e.g. 'double', 'solid', 'dashed', 'dotted', 'ridge', 'outset', 'groove', and 'inset'
|
2836 |
+
(NB mPDF only supports a full declaration of border e.g. "border: thin double #000000;")
|
2837 |
+
|
2838 |
+
<TD|TH> - CSS style="white-space: nowrap" and HTML attribute nowrap="nowrap"
|
2839 |
+
<TABLE> - page-break-inside: avoid
|
2840 |
+
<TABLE> - border-collapse: separate|collapse
|
2841 |
+
<TABLE> - border-spacing: 2px 2px; (horizontal/vertical) or just one figure (both) NB same as cellSpacing
|
2842 |
+
<TABLE> - empty-cells: hide|show (border-collapse:separate only)
|
2843 |
+
<TABLE> - margin-left and margin-right (previously only supported top and bottom)
|
2844 |
+
<TABLE> - padding: (this was incorrectly used for TD/TH before) (border-collapse:separate only)
|
2845 |
+
<TD|TH> - padding:
|
2846 |
+
<TABLE|TD|TH> - inline style "background" works (with a color only) the same as "background-color"
|
2847 |
+
|
2848 |
+
NB Table page-break-inside, autosize values and rotate are only respected for that set on first level table of nested tables
|
2849 |
+
|
2850 |
+
<TABLE> - cellSpacing and cellPadding HTML attributes:
|
2851 |
+
NB cellSpacing is the same as CSS style "border-spacing"
|
2852 |
+
NB cellPadding is a <table> attribute, but sets the cell padding - not table padding
|
2853 |
+
|
2854 |
+
<TABLE> - align="..." now works with a rotated table - but sets the alignment ignoring the rotation i.e. align=right sets the table to the right side of the page (looking as though it is bottom-aligned)
|
2855 |
+
|
2856 |
+
<BLOCK ELEMENTS> - page-break-before: always|left|right - NB any surrounding block tags will be closed before the new page is inserted.
|
2857 |
+
|
2858 |
+
@page - see notes on Paged Media
|
2859 |
+
|
2860 |
+
==========================
|
2861 |
+
Unsupported HTML attribute
|
2862 |
+
==========================
|
2863 |
+
<TD border="1"> - not valid HTML - no longer supported
|
2864 |
+
|
2865 |
+
|
2866 |
+
=========
|
2867 |
+
Additions
|
2868 |
+
=========
|
2869 |
+
"Keep-with-table"
|
2870 |
+
$mpdf->use_kwt = true; // default=false
|
2871 |
+
If set to true, will force any H1-H6 header immediately preceding a table to be kept together with the table
|
2872 |
+
- automatically sets the table to fit on one page (i.e. page-break-inside=avoid) if it is a rotated table
|
2873 |
+
- ignored if: Columns on, Keep-block-together active (page-break-inside=avoid for surrounding BLOCK), active Forms
|
2874 |
+
|
2875 |
+
|
2876 |
+
=====
|
2877 |
+
Notes
|
2878 |
+
=====
|
2879 |
+
|
2880 |
+
NB Not a change - but note you can use this to allow you to feed html code encoded in other than utf-8:
|
2881 |
+
$mpdf->allow_charset_conversion=true;
|
2882 |
+
$mpdf->charset_in='windows-1252'; (needs suitable codes for iconv i.e. windows-1252 not win-1252)
|
2883 |
+
|
2884 |
+
Fixing Optional tags
|
2885 |
+
====================
|
2886 |
+
php.net website has illegal nesting of <dt>.. <dd> .. </dd> .. </dt> and <p>.. <div> .. </div> .. </p>
|
2887 |
+
The example wich parses the php.net webpage will not show correctly unless you change: $mpdf->allow_html_optional_endtags=false;
|
2888 |
+
Trying to fix incorrect (X)HTML with $mpdf->allow_html_optional_endtags==true cancels the P when it meets a DIV etc.
|
2889 |
+
|
2890 |
+
|
2891 |
+
|
2892 |
+
EAN barcode
|
2893 |
+
===========
|
2894 |
+
An EAN barcode can be generated
|
2895 |
+
function writeBarcode($code, $showisbn=1, $x='', $y='', $size=1, $border=0, $paddingL=1, $paddingR=1, $paddingT=2, $paddingB=2) {
|
2896 |
+
It accepts 12 or 13 digits with or without - hyphens as $code e.g.
|
2897 |
+
$mpdf->writeBarcode('978-1234-567-890', 1, $mpdf->x, $mpdf->y);
|
2898 |
+
NB - IMPORTANT***
|
2899 |
+
A new font - OCR-B font/unifont is required, and needs to be added to the config.php file
|
2900 |
+
cf. http://www.gs1uk.org/downloads/bar_code/Bar coding getting it right.pdf
|
2901 |
+
Barcode size must be between 0.8 and 2.0 (80% to 200%)
|
2902 |
+
|
2903 |
+
CMYK Colors
|
2904 |
+
===========
|
2905 |
+
Functions - SetDrawColor, SetTextColor and SetFillColor all now take an optional 4th parameter.
|
2906 |
+
If defined this will interpret the input as CMYK color i.e.
|
2907 |
+
SetDrawColor(15,82,0,10) // NB all values out of 100 - not 255 as for RGB
|
2908 |
+
|
2909 |
+
htmltoolkit.php fn.ConvertColor() - now interprets custom color definition: cmyk(15,82,0,10)
|
2910 |
+
like rgb(r,g,b) except values out of 100
|
2911 |
+
Intended to be used for calling the functions separately - BUT works in a limited way with CSS - does not get reset or inherited correctly
|
2912 |
+
<p style="color:cmyk(215,31,15,10)"> does work
|
2913 |
+
|
2914 |
+
|
2915 |
+
DEFAULT CSS
|
2916 |
+
===========
|
2917 |
+
$defaultCSS has been updated to reflect better the standard HTML default e.g. using serif, table borders separate, cell vertical-align top
|
2918 |
+
To keep mPDF 1.3 (my favourites) I have introduced:
|
2919 |
+
$mpdf->useDefaultCSS2 = true;
|
2920 |
+
|
2921 |
+
|
2922 |
+
===================================
|
2923 |
+
Permissions - forms and Annotations - Experimental!
|
2924 |
+
===================================
|
2925 |
+
You can set the Permissions for the PDF file to allow the user to make Comments (annotations)
|
2926 |
+
$mpdf->setUserRights($enabled=true[default]|false, $annots="/Create/Delete/Modify/Copy/Import/Export",
|
2927 |
+
$form="/Add/Delete/FillIn/Import/Export/SubmitStandalone/SpawnTemplate", $signature="/Modify") )
|
2928 |
+
|
2929 |
+
If you encrypt the file, make sure the permissions match e.g.:
|
2930 |
+
$mpdf->setUserRights();
|
2931 |
+
$mpdf->SetProtection(array('print','annots'),'yourPassword','myPassword');
|
2932 |
+
|
2933 |
+
To allow this, changed the PDF-file version to %PDF1.5 (NB Probably needs PDF version > 1.5 but can't test for this...)
|
2934 |
+
|
2935 |
+
NOTE: If you output the PDF file straight to the browser, it will only allow annotations after you save the document
|
2936 |
+
|
2937 |
+
|
2938 |
+
===========================
|
2939 |
+
Active Forms - Experimental!
|
2940 |
+
===========================
|
2941 |
+
At present , using active forms will prevent any internal and external links - that appear before active forms(?) - from working (why?)
|
2942 |
+
May need to save form for proper use - see example, when scroll forwards and back, the form disappears??
|
2943 |
+
Need to set Userrights (see above), and $mpdf->useActiveForms=true;
|
2944 |
+
For Output options, see separate notes.
|
2945 |
+
|
2946 |
+
|
2947 |
+
|
2948 |
+
============================
|
2949 |
+
Internal Programming changes
|
2950 |
+
============================
|
2951 |
+
NB fn. tablerotate in htmltoolkit no longer used; now uses a 'transform' to shift the whole block of PDF code
|
2952 |
+
|
2953 |
+
Graphics State
|
2954 |
+
==============
|
2955 |
+
ExtGState does not need to be redefined - e.g. if a watermark added on every page, turning on and off alpha/transparency
|
2956 |
+
Unnecessary file size.
|
2957 |
+
function AddExtGState() edited to check if graphics state already exists before adding new one
|
2958 |
+
|
2959 |
+
ASCII-proof code
|
2960 |
+
================
|
2961 |
+
"»¤¬" used as a special identifier in the program changed to "\xbb\xa4\xac" to make the mpdf.php script file immune from someone saving it as a utf-8 encoded file
|
2962 |
+
|
2963 |
+
Images
|
2964 |
+
======
|
2965 |
+
1) When copying remote images locally - incorrectly used "unset" now changed to "unlink"
|
2966 |
+
2) When parsing image files - was using CURL for any image src="http://... - even if this was on the local server - edited so it only uses CURL if necessary/appropriate.
|
2967 |
+
NB Handling images was updated in v1.3 because my ISP changed allow_url_fopen to false
|
2968 |
+
Fixed so mPDF tests if the file is available as a local call e.g. getimage('images/test.jpg') even if it is defined as a full URI e.g. http://www.mydomain.com/images/test.jpg as this is quicker(?), and permitted even if allow_url_fopen is false.
|
2969 |
+
If not available as a local file (and allow_url_fopen is set) mPDF tries to use fopen/file_get_contents using an http wrapper;
|
2970 |
+
Else, if CURL is available and allow_url_fopen is false: then tries using CURL.
|
2971 |
+
(Clear as mud???!!)
|
2972 |
+
|
2973 |
+
|
2974 |
+
===========================
|
2975 |
+
mPDF v1.3 (21/09/2008)
|
2976 |
+
===========================
|
2977 |
+
--------------
|
2978 |
+
Page Numbering
|
2979 |
+
--------------
|
2980 |
+
Program changes:
|
2981 |
+
fn. startPageNums() replaced with blank function
|
2982 |
+
fn. stopPageNums() - deleted
|
2983 |
+
fn. numPageNo() - deleted (all it did was return this->page anyway).
|
2984 |
+
var $_numbering - deleted
|
2985 |
+
var $_numberingFooter - deleted
|
2986 |
+
var $_numPageNum - deleted
|
2987 |
+
|
2988 |
+
NEW
|
2989 |
+
New: fn. AddPages() (as for AddPage but with type=NEXT-ODD or NEXT-EVEN see below)
|
2990 |
+
Edited: fn. AddPage() - new parameters added
|
2991 |
+
AddPage(orientation(NO),type="E|O", resetpagenum="1|0", pagenumstyle="I|i|A|a|1", suppress="on|off")
|
2992 |
+
New: fn. docPageNum() - returns the document page number (or '') based on...
|
2993 |
+
New : PageNumSubstitutions(array)
|
2994 |
+
New attributes:
|
2995 |
+
<pagebreak resetpagenum="1" // resets document page numbering to 1 from the new page onwards
|
2996 |
+
<pagebreak suppress="on" // turns on suppression of page numbering i.e. in headers and footers, {PAGENO} is replaced by blank string
|
2997 |
+
// ="0" turns suppression off
|
2998 |
+
<pagebreak pagenumstyle="I|i|A|a|1" // (re)sets page number stle/type from the new page onwards - as for lists
|
2999 |
+
// 1 - decimal; A/a - alpha (uppercase/lowercase); I/i - Roman (uppercase/lowercase)
|
3000 |
+
<pagebreak type="NEXT-ODD" // always adds a page + another if required to make odd
|
3001 |
+
<pagebreak type="NEXT-EVEN" // always adds a page + another if required to make even
|
3002 |
+
|
3003 |
+
Edited: fn. TOC() // sets the marker for a Table of Contents
|
3004 |
+
New parameters allow the page-numbering details to be set
|
3005 |
+
NB the page-numbering details set are for the page which follows on after the TOC marker is inserted. The page-numbering for the actual ToC is set later, when the ToC is generated and inserted here
|
3006 |
+
new parameters as above for pagebreak resetpagenum="1|0", pagenumstyle="I|i|A|a|1", suppress="on|off"
|
3007 |
+
|
3008 |
+
Can also be set by attribute in the <TOC>
|
3009 |
+
<TOC resetpagenum="1" pagenumstyle="I|i|A|a|1", suppress="on|off" />
|
3010 |
+
|
3011 |
+
--------------------------------------------
|
3012 |
+
Changes to allow Rotated Text in table Cells
|
3013 |
+
--------------------------------------------
|
3014 |
+
Edited:
|
3015 |
+
fn. OpenTag()
|
3016 |
+
fn. _tableColumnWidth()
|
3017 |
+
fn. _tableHeight()
|
3018 |
+
fn. _tableWrite()
|
3019 |
+
fn. tableHeader()
|
3020 |
+
|
3021 |
+
New custom style or attribute -- "text-rotate" -- can be set for either <tr> or <th|td>
|
3022 |
+
Allowed values: 45 - 90 (written as integers) - rotates text anticlockwise, and -90 (clockwise)
|
3023 |
+
Positive values less than 90 force cell to: vertical-align:bottom
|
3024 |
+
|
3025 |
+
Limitations:
|
3026 |
+
Only allows single line of text;
|
3027 |
+
Font, font-size, and style are determined by those set fro the cell, and cannot be changed;
|
3028 |
+
No changes in font (or any other in-line changes e.g. <sup>) are supported within the text
|
3029 |
+
|
3030 |
+
Example: <tr style="text-rotate:90">...
|
3031 |
+
|
3032 |
+
---------
|
3033 |
+
Bug fixes
|
3034 |
+
---------
|
3035 |
+
1) HTML footer containing table was triggering page break.
|
3036 |
+
Added $this->InHTMLFooter as flag to prevent page triggering in footers containing table
|
3037 |
+
Set in fn.writeHTMLFooters() -> in fn.tableWrite() stops the pageBreak being reset
|
3038 |
+
|
3039 |
+
2) Crashing when libcurl not installed.
|
3040 |
+
Edited OpenTag() curl_init - added if (function_exists) to exclude crash when libcurl not installed
|
3041 |
+
|
3042 |
+
3) Single cell with borders not showing the borders.
|
3043 |
+
e.g. <table><tr><td style="border:1px solid #000000?>Hi</td></tr></table>
|
3044 |
+
Problem: mPDF overrides cell border properties with table border properties for external borders. $defaultCSS had CSS defined for table as '0px solid #000000'
|
3045 |
+
Quick fix - line 273 removed. A more complete fix will require reprogramming to distinguish between "border property not set" and border property set as "none".
|
3046 |
+
|
3047 |
+
4) Empty textarea incorrectly handled (the following HTML code being output in the textarea)
|
3048 |
+
The html code for an empty textarea was incorrectly handled in htmltoolkit fn. AdjustHTML which has been edited
|
3049 |
+
|
3050 |
+
|
3051 |
+
===========================
|
3052 |
+
mPDF v1.2 (2008-05-01)
|
3053 |
+
===========================
|
3054 |
+
// Added v1.2 option to continue if invalid UTF-8 chars - used in function is_utf8()
|
3055 |
+
var $ignore_invalid_utf8 = false;
|
3056 |
+
|
3057 |
+
Reading CSS in fn. ReadCSS() and applying in fn. MergeCSS() -
|
3058 |
+
Edited to allow Tags, class and id with the same name to be distinct i.e. h5 {...} .h5 {...} #h5 {...}
|
3059 |
+
* mPDF 1.2 This version supports: .class {...} / #id { .... }
|
3060 |
+
* ADDED p {...} h1[-h6] {...} a {...} table {...} thead {...} th {...} td {...} hr {...}
|
3061 |
+
* body {...} sets default font and fontsize
|
3062 |
+
* It supports some cascaded CSS e.g. div.topic table.type1 td
|
3063 |
+
* Does not support non-block level e.g. a#hover { ... }
|
3064 |
+
|
3065 |
+
Table: font-size, weight, style, family and color should all work
|
3066 |
+
TD/TH: font-size, weight, style, family and color should all work
|
3067 |
+
|
3068 |
+
Added to htmltoolkit - fn.array_merge_recursive_unique()
|
3069 |
+
|
3070 |
+
memory_opt Removed in mPDF v1.2 - not working properly
|
3071 |
+
|
3072 |
+
fn. _begindoc() - changed to %PDF1.4 (was 1.3) as PDF version
|
3073 |
+
|
3074 |
+
Write HTML Headers and Footers
|
3075 |
+
------------------------------
|
3076 |
+
fn. Close() - calls writeHTMLHeaders/Footers() before finishing doc
|
3077 |
+
fn. WriteHTML() - added parameter
|
3078 |
+
fn. _out - writes to outputbuffer when writing HTML footers/headers
|
3079 |
+
|
3080 |
+
New
|
3081 |
+
fn. writeHTMLHeaders()
|
3082 |
+
fn. writeHTMLFooters()
|
3083 |
+
|
3084 |
+
|
3085 |
+
|
3086 |
+
|
3087 |
+
=======================
|
3088 |
+
mPDF v1.1 (2008-05-01)
|
3089 |
+
=======================
|
3090 |
+
|
3091 |
+
Programming changes to increase efficiency
|
3092 |
+
------------------------------------------
|
3093 |
+
fn. WriteHTML() - added lines to combine substituted characters <tta> etc
|
3094 |
+
|
3095 |
+
Memory Optimization added (script from FPDF site) - edited fn. _putpages() and fn. _endpage()
|
3096 |
+
|
3097 |
+
fn. SetFont() edited to return val quicker if font already set (increase efficiency)
|
3098 |
+
|
3099 |
+
new vars chrs and ords are used to store chr() and ord() - quicker than using functions
|
3100 |
+
|
3101 |
+
fn.setMBencoding() - only call mb_internal_encoding if need to change
|
3102 |
+
|
3103 |
+
Bugs
|
3104 |
+
----
|
3105 |
+
fn. SetDefaultFontSize() - edited to allow to override that set in defaultCSS
|
3106 |
+
|
3107 |
+
fn. Output() - Added temporary(?) disablement of encryption in CJK as it doesn't work!
|
3108 |
+
|
3109 |
+
fn. OpenTag() [LI] $this->blockjustfinished=false to prevents newline after first bullet of list within table
|
3110 |
+
|
3111 |
+
Uses of mb_ereg_replace removed, and mb_split changed - requires regex_encoding (regex_encoding only used as UTF-8)
|
3112 |
+
|
3113 |
+
fn. WriteHTML: attributes are trimmed with trim() to allow correct handling of e.g. class="bpmBook "
|
3114 |
+
|
3115 |
+
fn. printbuffer() and fn. openTag() to ensure
|
3116 |
+
<div><div><p> outputs top margins/padding for both 1st and 2nd div
|
3117 |
+
and </p></div></div> ...
|
3118 |
+
|
3119 |
+
fn. SetFont() added line - bug fixing in CJK fonts
|
3120 |
+
|
3121 |
+
CSS functionality
|
3122 |
+
-----------------
|
3123 |
+
Added special CSS 'thead-underline' (similar to topntail)
|
3124 |
+
|
3125 |
+
var $thead_font_weight; added (openTag) to enable setting of font-weight for <TH> cells
|
3126 |
+
|
3127 |
+
Fixed table border inheritance: Table border inherits border="1" to cells, but not table style="border..."
|
3128 |
+
|
3129 |
+
"page-break-inside: avoid" added (var keep_block_together) to allow a DIV or P to be kept on one page
|
3130 |
+
- not compatible with table autosize or table rotate
|
3131 |
+
- only works over maximum of 2 pages
|
3132 |
+
|
3133 |
+
Enhancements
|
3134 |
+
------------
|
3135 |
+
Orphans in line justification: R. Bracket ) added to defined list of orphans
|
3136 |
+
|
3137 |
+
allow_url_open
|
3138 |
+
--------------
|
3139 |
+
Following a change in the PHP ini config set on my website by my ISP, changes made to allow mPDF to work with allow_url_open=OFF.
|
3140 |
+
- file_get_contents() changed to use libcurl (for CSS files)
|
3141 |
+
- openTag('IMG') @fopen() and 3 functions _parsegif, _parseJPG, _parsePNG, edited to copy remote image files to local file to include images
|
3142 |
+
|
3143 |
+
FlowChart
|
3144 |
+
---------
|
3145 |
+
Changes to enable mPDF work with a custom script producing Flowcharts:
|
3146 |
+
- WriteHTML() second parameter=3 will allow HTML to be parsed but not output
|
3147 |
+
- fn. Arrow() added
|
3148 |
+
- TableWordWrap() added parameter to force array return
|
lib/mpdf/CREDITS.txt
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
|
3 |
+
/*******************************************************************************
|
4 |
+
* Software: FPDF *
|
5 |
+
* Version: 1.53 *
|
6 |
+
* Date: 2004-12-31 *
|
7 |
+
* Author: Olivier PLATHEY *
|
8 |
+
* License: Freeware *
|
9 |
+
* *
|
10 |
+
* You may use and modify this software as you wish. *
|
11 |
+
*******************************************************************************/
|
12 |
+
|
13 |
+
/*******************************************************************************
|
14 |
+
* HTML2FPDF is a php script to read a HTML text and generate a PDF file. *
|
15 |
+
* Copyright (C) 2004-2005 Renato Coelho *
|
16 |
+
* *
|
17 |
+
* html2fpdf.php, htmltoolkit.php *
|
18 |
+
*******************************************************************************/
|
19 |
+
|
20 |
+
CREDITS From HTML2FPDF:
|
21 |
+
|
22 |
+
-Olivier Plathey for the fpdf.php class [http://www.fpdf.org]
|
23 |
+
-Damon Kohler for the Flowing Block script [mailto:damonkohler@yahoo.com]
|
24 |
+
-Clément Lavoillotte for HTML-oriented FPDF idea
|
25 |
+
-Yamasoft for the gif.php class [http://www.yamasoft.com/]
|
26 |
+
-Jérôme Fenal for the _parsegif() function
|
27 |
+
-"VIETCOM" for the PDFTable code [http://www.freepgs.com/vietcom/tool/pdftable/] [mailto:vncommando@yahoo.com]
|
28 |
+
-Yukihiro O. for the SetDash() function [mailto:yukihiro_o@infoseek.jp]
|
29 |
+
-Ron Korving for the WordWrap() function
|
30 |
+
-Michel Poulain for the DisplayPreferences() function
|
31 |
+
-Patrick Benny for the MultiCellBlt() function idea [no longer in use]
|
32 |
+
-Seb for the _SetTextRendering() and SetTextOutline() functions [mailto:captainseb@wanadoo.fr]
|
33 |
+
-MorphSoft for the colornames list idea
|
34 |
+
-W3SCHOOLS for HTML-related reference info [http://www.w3schools.com/]
|
35 |
+
|
36 |
+
|
37 |
+
|
38 |
+
/****************************************************************************
|
39 |
+
* Software: FPDF_Protection *
|
40 |
+
* Version: 1.02 *
|
41 |
+
* Date: 2005/05/08 *
|
42 |
+
* Author: Klemen VODOPIVEC *
|
43 |
+
* License: Freeware *
|
44 |
+
* *
|
45 |
+
* You may use and modify this software as you wish as stated in original *
|
46 |
+
* FPDF package. *
|
47 |
+
****************************************************************************/
|
48 |
+
|
49 |
+
/****************************************************************************
|
50 |
+
// FPDI - Version 1.2
|
51 |
+
//
|
52 |
+
// Copyright 2004-2007 Setasign - Jan Slabon
|
53 |
+
//
|
54 |
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
55 |
+
// you may not use this file except in compliance with the License.
|
56 |
+
// You may obtain a copy of the License at
|
57 |
+
//
|
58 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
59 |
+
//
|
60 |
+
// Unless required by applicable law or agreed to in writing, software
|
61 |
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
62 |
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
63 |
+
// See the License for the specific language governing permissions and
|
64 |
+
// limitations under the License.
|
65 |
+
****************************************************************************/
|
66 |
+
|
67 |
+
/****************************************************************************
|
68 |
+
* @copyright Khaled Al-Shamaa 2008
|
69 |
+
* @link http://www.ar-php.org
|
70 |
+
* @author Khaled Al-Shamaa <khaled@ar-php.org>
|
71 |
+
* @desc Set of PHP5 / UTF-8 Classes developed to enhance Arabic web
|
72 |
+
* applications by providing set of tools includes stem-based searching,
|
73 |
+
* translitiration, soundex, Hijri calendar, charset detection and
|
74 |
+
* converter, spell numbers, keyboard language, Muslim prayer time,
|
75 |
+
* auto-summarization, and more...
|
76 |
+
* @package Arabic
|
77 |
+
*
|
78 |
+
* @version 1.8 released in Feb 15, 2009
|
79 |
+
*
|
80 |
+
* @license LGPL
|
81 |
+
****************************************************************************/
|
82 |
+
|
83 |
+
|
84 |
+
This library is free software; you can redistribute it and/or
|
85 |
+
modify it under the terms of the GNU Lesser General Public
|
86 |
+
License as published by the Free Software Foundation;
|
87 |
+
This library is distributed in the hope that it will be useful,
|
88 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
89 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
90 |
+
Lesser General Public License for more details.
|
91 |
+
[http://www.opensource.org/licenses/lgpl-license.php]
|
lib/mpdf/LICENSE.txt
ADDED
@@ -0,0 +1,340 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GNU GENERAL PUBLIC LICENSE
|
2 |
+
Version 2, June 1991
|
3 |
+
|
4 |
+
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
5 |
+
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
6 |
+
Everyone is permitted to copy and distribute verbatim copies
|
7 |
+
of this license document, but changing it is not allowed.
|
8 |
+
|
9 |
+
Preamble
|
10 |
+
|
11 |
+
The licenses for most software are designed to take away your
|
12 |
+
freedom to share and change it. By contrast, the GNU General Public
|
13 |
+
License is intended to guarantee your freedom to share and change free
|
14 |
+
software--to make sure the software is free for all its users. This
|
15 |
+
General Public License applies to most of the Free Software
|
16 |
+
Foundation's software and to any other program whose authors commit to
|
17 |
+
using it. (Some other Free Software Foundation software is covered by
|
18 |
+
the GNU Library General Public License instead.) You can apply it to
|
19 |
+
your programs, too.
|
20 |
+
|
21 |
+
When we speak of free software, we are referring to freedom, not
|
22 |
+
price. Our General Public Licenses are designed to make sure that you
|
23 |
+
have the freedom to distribute copies of free software (and charge for
|
24 |
+
this service if you wish), that you receive source code or can get it
|
25 |
+
if you want it, that you can change the software or use pieces of it
|
26 |
+
in new free programs; and that you know you can do these things.
|
27 |
+
|
28 |
+
To protect your rights, we need to make restrictions that forbid
|
29 |
+
anyone to deny you these rights or to ask you to surrender the rights.
|
30 |
+
These restrictions translate to certain responsibilities for you if you
|
31 |
+
distribute copies of the software, or if you modify it.
|
32 |
+
|
33 |
+
For example, if you distribute copies of such a program, whether
|
34 |
+
gratis or for a fee, you must give the recipients all the rights that
|
35 |
+
you have. You must make sure that they, too, receive or can get the
|
36 |
+
source code. And you must show them these terms so they know their
|
37 |
+
rights.
|
38 |
+
|
39 |
+
We protect your rights with two steps: (1) copyright the software, and
|
40 |
+
(2) offer you this license which gives you legal permission to copy,
|
41 |
+
distribute and/or modify the software.
|
42 |
+
|
43 |
+
Also, for each author's protection and ours, we want to make certain
|
44 |
+
that everyone understands that there is no warranty for this free
|
45 |
+
software. If the software is modified by someone else and passed on, we
|
46 |
+
want its recipients to know that what they have is not the original, so
|
47 |
+
that any problems introduced by others will not reflect on the original
|
48 |
+
authors' reputations.
|
49 |
+
|
50 |
+
Finally, any free program is threatened constantly by software
|
51 |
+
patents. We wish to avoid the danger that redistributors of a free
|
52 |
+
program will individually obtain patent licenses, in effect making the
|
53 |
+
program proprietary. To prevent this, we have made it clear that any
|
54 |
+
patent must be licensed for everyone's free use or not licensed at all.
|
55 |
+
|
56 |
+
The precise terms and conditions for copying, distribution and
|
57 |
+
modification follow.
|
58 |
+
|
59 |
+
GNU GENERAL PUBLIC LICENSE
|
60 |
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
61 |
+
|
62 |
+
0. This License applies to any program or other work which contains
|
63 |
+
a notice placed by the copyright holder saying it may be distributed
|
64 |
+
under the terms of this General Public License. The "Program", below,
|
65 |
+
refers to any such program or work, and a "work based on the Program"
|
66 |
+
means either the Program or any derivative work under copyright law:
|
67 |
+
that is to say, a work containing the Program or a portion of it,
|
68 |
+
either verbatim or with modifications and/or translated into another
|
69 |
+
language. (Hereinafter, translation is included without limitation in
|
70 |
+
the term "modification".) Each licensee is addressed as "you".
|
71 |
+
|
72 |
+
Activities other than copying, distribution and modification are not
|
73 |
+
covered by this License; they are outside its scope. The act of
|
74 |
+
running the Program is not restricted, and the output from the Program
|
75 |
+
is covered only if its contents constitute a work based on the
|
76 |
+
Program (independent of having been made by running the Program).
|
77 |
+
Whether that is true depends on what the Program does.
|
78 |
+
|
79 |
+
1. You may copy and distribute verbatim copies of the Program's
|
80 |
+
source code as you receive it, in any medium, provided that you
|
81 |
+
conspicuously and appropriately publish on each copy an appropriate
|
82 |
+
copyright notice and disclaimer of warranty; keep intact all the
|
83 |
+
notices that refer to this License and to the absence of any warranty;
|
84 |
+
and give any other recipients of the Program a copy of this License
|
85 |
+
along with the Program.
|
86 |
+
|
87 |
+
You may charge a fee for the physical act of transferring a copy, and
|
88 |
+
you may at your option offer warranty protection in exchange for a fee.
|
89 |
+
|
90 |
+
2. You may modify your copy or copies of the Program or any portion
|
91 |
+
of it, thus forming a work based on the Program, and copy and
|
92 |
+
distribute such modifications or work under the terms of Section 1
|
93 |
+
above, provided that you also meet all of these conditions:
|
94 |
+
|
95 |
+
a) You must cause the modified files to carry prominent notices
|
96 |
+
stating that you changed the files and the date of any change.
|
97 |
+
|
98 |
+
b) You must cause any work that you distribute or publish, that in
|
99 |
+
whole or in part contains or is derived from the Program or any
|
100 |
+
part thereof, to be licensed as a whole at no charge to all third
|
101 |
+
parties under the terms of this License.
|
102 |
+
|
103 |
+
c) If the modified program normally reads commands interactively
|
104 |
+
when run, you must cause it, when started running for such
|
105 |
+
interactive use in the most ordinary way, to print or display an
|
106 |
+
announcement including an appropriate copyright notice and a
|
107 |
+
notice that there is no warranty (or else, saying that you provide
|
108 |
+
a warranty) and that users may redistribute the program under
|
109 |
+
these conditions, and telling the user how to view a copy of this
|
110 |
+
License. (Exception: if the Program itself is interactive but
|
111 |
+
does not normally print such an announcement, your work based on
|
112 |
+
the Program is not required to print an announcement.)
|
113 |
+
|
114 |
+
These requirements apply to the modified work as a whole. If
|
115 |
+
identifiable sections of that work are not derived from the Program,
|
116 |
+
and can be reasonably considered independent and separate works in
|
117 |
+
themselves, then this License, and its terms, do not apply to those
|
118 |
+
sections when you distribute them as separate works. But when you
|
119 |
+
distribute the same sections as part of a whole which is a work based
|
120 |
+
on the Program, the distribution of the whole must be on the terms of
|
121 |
+
this License, whose permissions for other licensees extend to the
|
122 |
+
entire whole, and thus to each and every part regardless of who wrote it.
|
123 |
+
|
124 |
+
Thus, it is not the intent of this section to claim rights or contest
|
125 |
+
your rights to work written entirely by you; rather, the intent is to
|
126 |
+
exercise the right to control the distribution of derivative or
|
127 |
+
collective works based on the Program.
|
128 |
+
|
129 |
+
In addition, mere aggregation of another work not based on the Program
|
130 |
+
with the Program (or with a work based on the Program) on a volume of
|
131 |
+
a storage or distribution medium does not bring the other work under
|
132 |
+
the scope of this License.
|
133 |
+
|
134 |
+
3. You may copy and distribute the Program (or a work based on it,
|
135 |
+
under Section 2) in object code or executable form under the terms of
|
136 |
+
Sections 1 and 2 above provided that you also do one of the following:
|
137 |
+
|
138 |
+
a) Accompany it with the complete corresponding machine-readable
|
139 |
+
source code, which must be distributed under the terms of Sections
|
140 |
+
1 and 2 above on a medium customarily used for software interchange; or,
|
141 |
+
|
142 |
+
b) Accompany it with a written offer, valid for at least three
|
143 |
+
years, to give any third party, for a charge no more than your
|
144 |
+
cost of physically performing source distribution, a complete
|
145 |
+
machine-readable copy of the corresponding source code, to be
|
146 |
+
distributed under the terms of Sections 1 and 2 above on a medium
|
147 |
+
customarily used for software interchange; or,
|
148 |
+
|
149 |
+
c) Accompany it with the information you received as to the offer
|
150 |
+
to distribute corresponding source code. (This alternative is
|
151 |
+
allowed only for noncommercial distribution and only if you
|
152 |
+
received the program in object code or executable form with such
|
153 |
+
an offer, in accord with Subsection b above.)
|
154 |
+
|
155 |
+
The source code for a work means the preferred form of the work for
|
156 |
+
making modifications to it. For an executable work, complete source
|
157 |
+
code means all the source code for all modules it contains, plus any
|
158 |
+
associated interface definition files, plus the scripts used to
|
159 |
+
control compilation and installation of the executable. However, as a
|
160 |
+
special exception, the source code distributed need not include
|
161 |
+
anything that is normally distributed (in either source or binary
|
162 |
+
form) with the major components (compiler, kernel, and so on) of the
|
163 |
+
operating system on which the executable runs, unless that component
|
164 |
+
itself accompanies the executable.
|
165 |
+
|
166 |
+
If distribution of executable or object code is made by offering
|
167 |
+
access to copy from a designated place, then offering equivalent
|
168 |
+
access to copy the source code from the same place counts as
|
169 |
+
distribution of the source code, even though third parties are not
|
170 |
+
compelled to copy the source along with the object code.
|
171 |
+
|
172 |
+
4. You may not copy, modify, sublicense, or distribute the Program
|
173 |
+
except as expressly provided under this License. Any attempt
|
174 |
+
otherwise to copy, modify, sublicense or distribute the Program is
|
175 |
+
void, and will automatically terminate your rights under this License.
|
176 |
+
However, parties who have received copies, or rights, from you under
|
177 |
+
this License will not have their licenses terminated so long as such
|
178 |
+
parties remain in full compliance.
|
179 |
+
|
180 |
+
5. You are not required to accept this License, since you have not
|
181 |
+
signed it. However, nothing else grants you permission to modify or
|
182 |
+
distribute the Program or its derivative works. These actions are
|
183 |
+
prohibited by law if you do not accept this License. Therefore, by
|
184 |
+
modifying or distributing the Program (or any work based on the
|
185 |
+
Program), you indicate your acceptance of this License to do so, and
|
186 |
+
all its terms and conditions for copying, distributing or modifying
|
187 |
+
the Program or works based on it.
|
188 |
+
|
189 |
+
6. Each time you redistribute the Program (or any work based on the
|
190 |
+
Program), the recipient automatically receives a license from the
|
191 |
+
original licensor to copy, distribute or modify the Program subject to
|
192 |
+
these terms and conditions. You may not impose any further
|
193 |
+
restrictions on the recipients' exercise of the rights granted herein.
|
194 |
+
You are not responsible for enforcing compliance by third parties to
|
195 |
+
this License.
|
196 |
+
|
197 |
+
7. If, as a consequence of a court judgment or allegation of patent
|
198 |
+
infringement or for any other reason (not limited to patent issues),
|
199 |
+
conditions are imposed on you (whether by court order, agreement or
|
200 |
+
otherwise) that contradict the conditions of this License, they do not
|
201 |
+
excuse you from the conditions of this License. If you cannot
|
202 |
+
distribute so as to satisfy simultaneously your obligations under this
|
203 |
+
License and any other pertinent obligations, then as a consequence you
|
204 |
+
may not distribute the Program at all. For example, if a patent
|
205 |
+
license would not permit royalty-free redistribution of the Program by
|
206 |
+
all those who receive copies directly or indirectly through you, then
|
207 |
+
the only way you could satisfy both it and this License would be to
|
208 |
+
refrain entirely from distribution of the Program.
|
209 |
+
|
210 |
+
If any portion of this section is held invalid or unenforceable under
|
211 |
+
any particular circumstance, the balance of the section is intended to
|
212 |
+
apply and the section as a whole is intended to apply in other
|
213 |
+
circumstances.
|
214 |
+
|
215 |
+
It is not the purpose of this section to induce you to infringe any
|
216 |
+
patents or other property right claims or to contest validity of any
|
217 |
+
such claims; this section has the sole purpose of protecting the
|
218 |
+
integrity of the free software distribution system, which is
|
219 |
+
implemented by public license practices. Many people have made
|
220 |
+
generous contributions to the wide range of software distributed
|
221 |
+
through that system in reliance on consistent application of that
|
222 |
+
system; it is up to the author/donor to decide if he or she is willing
|
223 |
+
to distribute software through any other system and a licensee cannot
|
224 |
+
impose that choice.
|
225 |
+
|
226 |
+
This section is intended to make thoroughly clear what is believed to
|
227 |
+
be a consequence of the rest of this License.
|
228 |
+
|
229 |
+
8. If the distribution and/or use of the Program is restricted in
|
230 |
+
certain countries either by patents or by copyrighted interfaces, the
|
231 |
+
original copyright holder who places the Program under this License
|
232 |
+
may add an explicit geographical distribution limitation excluding
|
233 |
+
those countries, so that distribution is permitted only in or among
|
234 |
+
countries not thus excluded. In such case, this License incorporates
|
235 |
+
the limitation as if written in the body of this License.
|
236 |
+
|
237 |
+
9. The Free Software Foundation may publish revised and/or new versions
|
238 |
+
of the General Public License from time to time. Such new versions will
|
239 |
+
be similar in spirit to the present version, but may differ in detail to
|
240 |
+
address new problems or concerns.
|
241 |
+
|
242 |
+
Each version is given a distinguishing version number. If the Program
|
243 |
+
specifies a version number of this License which applies to it and "any
|
244 |
+
later version", you have the option of following the terms and conditions
|
245 |
+
either of that version or of any later version published by the Free
|
246 |
+
Software Foundation. If the Program does not specify a version number of
|
247 |
+
this License, you may choose any version ever published by the Free Software
|
248 |
+
Foundation.
|
249 |
+
|
250 |
+
10. If you wish to incorporate parts of the Program into other free
|
251 |
+
programs whose distribution conditions are different, write to the author
|
252 |
+
to ask for permission. For software which is copyrighted by the Free
|
253 |
+
Software Foundation, write to the Free Software Foundation; we sometimes
|
254 |
+
make exceptions for this. Our decision will be guided by the two goals
|
255 |
+
of preserving the free status of all derivatives of our free software and
|
256 |
+
of promoting the sharing and reuse of software generally.
|
257 |
+
|
258 |
+
NO WARRANTY
|
259 |
+
|
260 |
+
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
261 |
+
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
262 |
+
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
263 |
+
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
264 |
+
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
265 |
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
266 |
+
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
267 |
+
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
268 |
+
REPAIR OR CORRECTION.
|
269 |
+
|
270 |
+
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
271 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
272 |
+
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
273 |
+
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
274 |
+
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
275 |
+
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
276 |
+
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
277 |
+
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
278 |
+
POSSIBILITY OF SUCH DAMAGES.
|
279 |
+
|
280 |
+
END OF TERMS AND CONDITIONS
|
281 |
+
|
282 |
+
How to Apply These Terms to Your New Programs
|
283 |
+
|
284 |
+
If you develop a new program, and you want it to be of the greatest
|
285 |
+
possible use to the public, the best way to achieve this is to make it
|
286 |
+
free software which everyone can redistribute and change under these terms.
|
287 |
+
|
288 |
+
To do so, attach the following notices to the program. It is safest
|
289 |
+
to attach them to the start of each source file to most effectively
|
290 |
+
convey the exclusion of warranty; and each file should have at least
|
291 |
+
the "copyright" line and a pointer to where the full notice is found.
|
292 |
+
|
293 |
+
<one line to give the program's name and a brief idea of what it does.>
|
294 |
+
Copyright (C) <year> <name of author>
|
295 |
+
|
296 |
+
This program is free software; you can redistribute it and/or modify
|
297 |
+
it under the terms of the GNU General Public License as published by
|
298 |
+
the Free Software Foundation; either version 2 of the License, or
|
299 |
+
(at your option) any later version.
|
300 |
+
|
301 |
+
This program is distributed in the hope that it will be useful,
|
302 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
303 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
304 |
+
GNU General Public License for more details.
|
305 |
+
|
306 |
+
You should have received a copy of the GNU General Public License
|
307 |
+
along with this program; if not, write to the Free Software
|
308 |
+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
309 |
+
|
310 |
+
|
311 |
+
Also add information on how to contact you by electronic and paper mail.
|
312 |
+
|
313 |
+
If the program is interactive, make it output a short notice like this
|
314 |
+
when it starts in an interactive mode:
|
315 |
+
|
316 |
+
Gnomovision version 69, Copyright (C) year name of author
|
317 |
+
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
318 |
+
This is free software, and you are welcome to redistribute it
|
319 |
+
under certain conditions; type `show c' for details.
|
320 |
+
|
321 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
322 |
+
parts of the General Public License. Of course, the commands you use may
|
323 |
+
be called something other than `show w' and `show c'; they could even be
|
324 |
+
mouse-clicks or menu items--whatever suits your program.
|
325 |
+
|
326 |
+
You should also get your employer (if you work as a programmer) or your
|
327 |
+
school, if any, to sign a "copyright disclaimer" for the program, if
|
328 |
+
necessary. Here is a sample; alter the names:
|
329 |
+
|
330 |
+
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
331 |
+
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
332 |
+
|
333 |
+
<signature of Ty Coon>, 1 April 1989
|
334 |
+
Ty Coon, President of Vice
|
335 |
+
|
336 |
+
This General Public License does not permit incorporating your program into
|
337 |
+
proprietary programs. If your program is a subroutine library, you may
|
338 |
+
consider it more useful to permit linking proprietary applications with the
|
339 |
+
library. If this is what you want to do, use the GNU Library General
|
340 |
+
Public License instead of this License.
|
lib/mpdf/MpdfException.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class MpdfException extends Exception
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
lib/mpdf/README.md
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
mPDF is a PHP class which generates PDF files from UTF-8 encoded HTML. It is based on [FPDF](http://www.fpdf.org/)
|
2 |
+
and [HTML2FPDF](http://html2fpdf.sourceforge.net/) (see [CREDITS](CREDITS.txt)), with a number of enhancements.
|
3 |
+
mPDF was written by Ian Back and is released under the [GNU GPL v2 licence](LICENSE.txt).
|
4 |
+
|
5 |
+
[![Build Status](https://travis-ci.org/mpdf/mpdf.svg?branch=development)](https://travis-ci.org/mpdf/mpdf)
|
6 |
+
|
7 |
+
Installation
|
8 |
+
============
|
9 |
+
|
10 |
+
Preferred installation method is via composer and its packagist package [mpdf/mpdf](https://packagist.org/packages/mpdf/mpdf).
|
11 |
+
|
12 |
+
Manual installation
|
13 |
+
-------------------
|
14 |
+
|
15 |
+
* Download the [.zip release file](https://github.com/mpdf/mpdf/releases) and unzip it
|
16 |
+
* Create a folder e.g. /mpdf on your server
|
17 |
+
* Upload all of the files to the server, maintaining the folders as they are
|
18 |
+
* Ensure that you have write permissions set (CHMOD 6xx or 7xx) for the following folders:
|
19 |
+
|
20 |
+
/ttfontdata/ - used to cache font data; improves performance a lot
|
21 |
+
|
22 |
+
/tmp/ - used for some images and ProgressBar
|
23 |
+
|
24 |
+
/graph_cache/ - if you are using [JpGraph](http://jpgraph.net) in conjunction with mPDF
|
25 |
+
|
26 |
+
To test the installation, point your browser to the basic example file:
|
27 |
+
|
28 |
+
[path_to_mpdf_folder]/mpdf/examples/example01_basic.php
|
29 |
+
|
30 |
+
If you wish to define a different folder for temporary files rather than /tmp/ see the note on
|
31 |
+
[Folder for temporary files](https://mpdf.github.io/installation-setup/folders-for-temporary-files.html)
|
32 |
+
in the section on Installation & Setup in the [manual](https://mpdf.github.io/).
|
33 |
+
|
34 |
+
If you have problems, please read the section on [troubleshooting](https://mpdf.github.io/troubleshooting/known-issues.html) in the manual.
|
35 |
+
|
36 |
+
Online manual
|
37 |
+
=============
|
38 |
+
|
39 |
+
Online manual is available at https://mpdf.github.io/.
|
40 |
+
|
41 |
+
Unit Testing
|
42 |
+
============
|
43 |
+
|
44 |
+
Unit testing for mPDF is done using [PHPUnit](https://phpunit.de/).
|
45 |
+
|
46 |
+
To get started, run `composer install` from the command line while in the mPDF root directory
|
47 |
+
(you'll need [composer installed first](https://getcomposer.org/download/)).
|
48 |
+
|
49 |
+
To execute tests, run `vendor/bin/phpunit` from the command line while in the mPDF root directory.
|
50 |
+
|
51 |
+
Any assistance writing unit tests for mPDF is greatly appreciated. If you'd like to help, please
|
52 |
+
note that any PHP file located in the `/tests/` directory will be autoloaded when unit testing.
|
lib/mpdf/Tag.php
ADDED
@@ -0,0 +1,6118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tag
|
4 |
+
{
|
5 |
+
|
6 |
+
private $mpdf;
|
7 |
+
|
8 |
+
public function __construct(mPDF $mpdf)
|
9 |
+
{
|
10 |
+
$this->mpdf = $mpdf;
|
11 |
+
}
|
12 |
+
|
13 |
+
function OpenTag($tag, $attr, &$ahtml, &$ihtml)
|
14 |
+
{ // mPDF 6
|
15 |
+
//Opening tag
|
16 |
+
// mPDF 6
|
17 |
+
// Correct for tags where HTML5 specifies optional end tags excluding table elements (cf WriteHTML() )
|
18 |
+
if ($this->mpdf->allow_html_optional_endtags) {
|
19 |
+
if (isset($this->mpdf->blk[$this->mpdf->blklvl]['tag'])) {
|
20 |
+
$closed = false;
|
21 |
+
// li end tag may be omitted if immediately followed by another li element
|
22 |
+
if (!$closed && $this->mpdf->blk[$this->mpdf->blklvl]['tag'] == 'LI' && $tag == 'LI') {
|
23 |
+
$this->CloseTag('LI', $ahtml, $ihtml);
|
24 |
+
$closed = true;
|
25 |
+
}
|
26 |
+
// dt end tag may be omitted if immediately followed by another dt element or a dd element
|
27 |
+
if (!$closed && $this->mpdf->blk[$this->mpdf->blklvl]['tag'] == 'DT' && ($tag == 'DT' || $tag == 'DD')) {
|
28 |
+
$this->CloseTag('DT', $ahtml, $ihtml);
|
29 |
+
$closed = true;
|
30 |
+
}
|
31 |
+
// dd end tag may be omitted if immediately followed by another dd element or a dt element
|
32 |
+
if (!$closed && $this->mpdf->blk[$this->mpdf->blklvl]['tag'] == 'DD' && ($tag == 'DT' || $tag == 'DD')) {
|
33 |
+
$this->CloseTag('DD', $ahtml, $ihtml);
|
34 |
+
$closed = true;
|
35 |
+
}
|
36 |
+
// p end tag may be omitted if immediately followed by an address, article, aside, blockquote, div, dl, fieldset, form,
|
37 |
+
// h1, h2, h3, h4, h5, h6, hgroup, hr, main, nav, ol, p, pre, section, table, ul
|
38 |
+
if (!$closed && $this->mpdf->blk[$this->mpdf->blklvl]['tag'] == 'P' && ($tag == 'P' || $tag == 'DIV' || $tag == 'H1' || $tag == 'H2' || $tag == 'H3' || $tag == 'H4' || $tag == 'H5' || $tag == 'H6' || $tag == 'UL' || $tag == 'OL' || $tag == 'TABLE' || $tag == 'PRE' || $tag == 'FORM' || $tag == 'ADDRESS' || $tag == 'BLOCKQUOTE' || $tag == 'CENTER' || $tag == 'DL' || $tag == 'HR' || $tag == 'ARTICLE' || $tag == 'ASIDE' || $tag == 'FIELDSET' || $tag == 'HGROUP' || $tag == 'MAIN' || $tag == 'NAV' || $tag == 'SECTION')) {
|
39 |
+
$this->CloseTag('P', $ahtml, $ihtml);
|
40 |
+
$closed = true;
|
41 |
+
}
|
42 |
+
// option end tag may be omitted if immediately followed by another option element (or if it is immediately followed by an optgroup element)
|
43 |
+
if (!$closed && $this->mpdf->blk[$this->mpdf->blklvl]['tag'] == 'OPTION' && $tag == 'OPTION') {
|
44 |
+
$this->CloseTag('OPTION', $ahtml, $ihtml);
|
45 |
+
$closed = true;
|
46 |
+
}
|
47 |
+
// Table elements - see also WriteHTML()
|
48 |
+
if (!$closed && ($tag == 'TD' || $tag == 'TH') && $this->mpdf->lastoptionaltag == 'TD') {
|
49 |
+
$this->CloseTag($this->mpdf->lastoptionaltag, $ahtml, $ihtml);
|
50 |
+
$closed = true;
|
51 |
+
} // *TABLES*
|
52 |
+
if (!$closed && ($tag == 'TD' || $tag == 'TH') && $this->mpdf->lastoptionaltag == 'TH') {
|
53 |
+
$this->CloseTag($this->mpdf->lastoptionaltag, $ahtml, $ihtml);
|
54 |
+
$closed = true;
|
55 |
+
} // *TABLES*
|
56 |
+
if (!$closed && $tag == 'TR' && $this->mpdf->lastoptionaltag == 'TR') {
|
57 |
+
$this->CloseTag($this->mpdf->lastoptionaltag, $ahtml, $ihtml);
|
58 |
+
$closed = true;
|
59 |
+
} // *TABLES*
|
60 |
+
if (!$closed && $tag == 'TR' && $this->mpdf->lastoptionaltag == 'TD') {
|
61 |
+
$this->CloseTag($this->mpdf->lastoptionaltag, $ahtml, $ihtml);
|
62 |
+
$this->CloseTag('TR', $ahtml, $ihtml);
|
63 |
+
$this->CloseTag('THEAD', $ahtml, $ihtml);
|
64 |
+
$closed = true;
|
65 |
+
} // *TABLES*
|
66 |
+
if (!$closed && $tag == 'TR' && $this->mpdf->lastoptionaltag == 'TH') {
|
67 |
+
$this->CloseTag($this->mpdf->lastoptionaltag, $ahtml, $ihtml);
|
68 |
+
$this->CloseTag('TR', $ahtml, $ihtml);
|
69 |
+
$this->CloseTag('THEAD', $ahtml, $ihtml);
|
70 |
+
$closed = true;
|
71 |
+
} // *TABLES*
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
$align = array('left' => 'L', 'center' => 'C', 'right' => 'R', 'top' => 'T', 'text-top' => 'TT', 'middle' => 'M', 'baseline' => 'BS', 'bottom' => 'B', 'text-bottom' => 'TB', 'justify' => 'J');
|
76 |
+
|
77 |
+
switch ($tag) {
|
78 |
+
|
79 |
+
case 'DOTTAB':
|
80 |
+
$objattr = array();
|
81 |
+
$objattr['type'] = 'dottab';
|
82 |
+
$dots = str_repeat('.', 3) . " "; // minimum number of dots
|
83 |
+
$objattr['width'] = $this->mpdf->GetStringWidth($dots);
|
84 |
+
$objattr['margin_top'] = 0;
|
85 |
+
$objattr['margin_bottom'] = 0;
|
86 |
+
$objattr['margin_left'] = 0;
|
87 |
+
$objattr['margin_right'] = 0;
|
88 |
+
$objattr['height'] = 0;
|
89 |
+
$objattr['colorarray'] = $this->mpdf->colorarray;
|
90 |
+
$objattr['border_top']['w'] = 0;
|
91 |
+
$objattr['border_bottom']['w'] = 0;
|
92 |
+
$objattr['border_left']['w'] = 0;
|
93 |
+
$objattr['border_right']['w'] = 0;
|
94 |
+
$objattr['vertical_align'] = 'BS'; // mPDF 6 DOTTAB
|
95 |
+
|
96 |
+
$properties = $this->mpdf->cssmgr->MergeCSS('INLINE', $tag, $attr);
|
97 |
+
if (isset($properties['OUTDENT'])) {
|
98 |
+
$objattr['outdent'] = $this->mpdf->ConvertSize($properties['OUTDENT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
99 |
+
} else if (isset($attr['OUTDENT'])) {
|
100 |
+
$objattr['outdent'] = $this->mpdf->ConvertSize($attr['OUTDENT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
101 |
+
} else {
|
102 |
+
$objattr['outdent'] = 0;
|
103 |
+
}
|
104 |
+
|
105 |
+
$objattr['fontfamily'] = $this->mpdf->FontFamily;
|
106 |
+
$objattr['fontsize'] = $this->mpdf->FontSizePt;
|
107 |
+
|
108 |
+
$e = "\xbb\xa4\xactype=dottab,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
|
109 |
+
/* -- TABLES -- */
|
110 |
+
// Output it to buffers
|
111 |
+
if ($this->mpdf->tableLevel) {
|
112 |
+
if (!isset($this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['maxs'])) {
|
113 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['maxs'] = $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s'];
|
114 |
+
} elseif ($this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['maxs'] < $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s']) {
|
115 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['maxs'] = $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s'];
|
116 |
+
}
|
117 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s'] = 0; // reset
|
118 |
+
$this->mpdf->_saveCellTextBuffer($e);
|
119 |
+
} else {
|
120 |
+
/* -- END TABLES -- */
|
121 |
+
$this->mpdf->_saveTextBuffer($e);
|
122 |
+
} // *TABLES*
|
123 |
+
break;
|
124 |
+
|
125 |
+
case 'PAGEHEADER':
|
126 |
+
case 'PAGEFOOTER':
|
127 |
+
$this->mpdf->ignorefollowingspaces = true;
|
128 |
+
if ($attr['NAME']) {
|
129 |
+
$pname = $attr['NAME'];
|
130 |
+
} else {
|
131 |
+
$pname = '_nonhtmldefault';
|
132 |
+
} // mPDF 6
|
133 |
+
|
134 |
+
$p = array(); // mPDF 6
|
135 |
+
$p['L'] = array();
|
136 |
+
$p['C'] = array();
|
137 |
+
$p['R'] = array();
|
138 |
+
$p['L']['font-style'] = '';
|
139 |
+
$p['C']['font-style'] = '';
|
140 |
+
$p['R']['font-style'] = '';
|
141 |
+
|
142 |
+
if (isset($attr['CONTENT-LEFT'])) {
|
143 |
+
$p['L']['content'] = $attr['CONTENT-LEFT'];
|
144 |
+
}
|
145 |
+
if (isset($attr['CONTENT-CENTER'])) {
|
146 |
+
$p['C']['content'] = $attr['CONTENT-CENTER'];
|
147 |
+
}
|
148 |
+
if (isset($attr['CONTENT-RIGHT'])) {
|
149 |
+
$p['R']['content'] = $attr['CONTENT-RIGHT'];
|
150 |
+
}
|
151 |
+
|
152 |
+
if (isset($attr['HEADER-STYLE']) || isset($attr['FOOTER-STYLE'])) { // font-family,size,weight,style,color
|
153 |
+
if ($tag == 'PAGEHEADER') {
|
154 |
+
$properties = $this->mpdf->cssmgr->readInlineCSS($attr['HEADER-STYLE']);
|
155 |
+
} else {
|
156 |
+
$properties = $this->mpdf->cssmgr->readInlineCSS($attr['FOOTER-STYLE']);
|
157 |
+
}
|
158 |
+
if (isset($properties['FONT-FAMILY'])) {
|
159 |
+
$p['L']['font-family'] = $properties['FONT-FAMILY'];
|
160 |
+
$p['C']['font-family'] = $properties['FONT-FAMILY'];
|
161 |
+
$p['R']['font-family'] = $properties['FONT-FAMILY'];
|
162 |
+
}
|
163 |
+
if (isset($properties['FONT-SIZE'])) {
|
164 |
+
$p['L']['font-size'] = $this->mpdf->ConvertSize($properties['FONT-SIZE']) * _MPDFK;
|
165 |
+
$p['C']['font-size'] = $this->mpdf->ConvertSize($properties['FONT-SIZE']) * _MPDFK;
|
166 |
+
$p['R']['font-size'] = $this->mpdf->ConvertSize($properties['FONT-SIZE']) * _MPDFK;
|
167 |
+
}
|
168 |
+
if (isset($properties['FONT-WEIGHT']) && $properties['FONT-WEIGHT'] == 'bold') {
|
169 |
+
$p['L']['font-style'] = 'B';
|
170 |
+
$p['C']['font-style'] = 'B';
|
171 |
+
$p['R']['font-style'] = 'B';
|
172 |
+
}
|
173 |
+
if (isset($properties['FONT-STYLE']) && $properties['FONT-STYLE'] == 'italic') {
|
174 |
+
$p['L']['font-style'] .= 'I';
|
175 |
+
$p['C']['font-style'] .= 'I';
|
176 |
+
$p['R']['font-style'] .= 'I';
|
177 |
+
}
|
178 |
+
if (isset($properties['COLOR'])) {
|
179 |
+
$p['L']['color'] = $properties['COLOR'];
|
180 |
+
$p['C']['color'] = $properties['COLOR'];
|
181 |
+
$p['R']['color'] = $properties['COLOR'];
|
182 |
+
}
|
183 |
+
}
|
184 |
+
if (isset($attr['HEADER-STYLE-LEFT']) || isset($attr['FOOTER-STYLE-LEFT'])) {
|
185 |
+
if ($tag == 'PAGEHEADER') {
|
186 |
+
$properties = $this->mpdf->cssmgr->readInlineCSS($attr['HEADER-STYLE-LEFT']);
|
187 |
+
} else {
|
188 |
+
$properties = $this->mpdf->cssmgr->readInlineCSS($attr['FOOTER-STYLE-LEFT']);
|
189 |
+
}
|
190 |
+
if (isset($properties['FONT-FAMILY'])) {
|
191 |
+
$p['L']['font-family'] = $properties['FONT-FAMILY'];
|
192 |
+
}
|
193 |
+
if (isset($properties['FONT-SIZE'])) {
|
194 |
+
$p['L']['font-size'] = $this->mpdf->ConvertSize($properties['FONT-SIZE']) * _MPDFK;
|
195 |
+
}
|
196 |
+
if (isset($properties['FONT-WEIGHT']) && $properties['FONT-WEIGHT'] == 'bold') {
|
197 |
+
$p['L']['font-style'] = 'B';
|
198 |
+
}
|
199 |
+
if (isset($properties['FONT-STYLE']) && $properties['FONT-STYLE'] == 'italic') {
|
200 |
+
$p['L']['font-style'] .='I';
|
201 |
+
}
|
202 |
+
if (isset($properties['COLOR'])) {
|
203 |
+
$p['L']['color'] = $properties['COLOR'];
|
204 |
+
}
|
205 |
+
}
|
206 |
+
if (isset($attr['HEADER-STYLE-CENTER']) || isset($attr['FOOTER-STYLE-CENTER'])) {
|
207 |
+
if ($tag == 'PAGEHEADER') {
|
208 |
+
$properties = $this->mpdf->cssmgr->readInlineCSS($attr['HEADER-STYLE-CENTER']);
|
209 |
+
} else {
|
210 |
+
$properties = $this->mpdf->cssmgr->readInlineCSS($attr['FOOTER-STYLE-CENTER']);
|
211 |
+
}
|
212 |
+
if (isset($properties['FONT-FAMILY'])) {
|
213 |
+
$p['C']['font-family'] = $properties['FONT-FAMILY'];
|
214 |
+
}
|
215 |
+
if (isset($properties['FONT-SIZE'])) {
|
216 |
+
$p['C']['font-size'] = $this->mpdf->ConvertSize($properties['FONT-SIZE']) * _MPDFK;
|
217 |
+
}
|
218 |
+
if (isset($properties['FONT-WEIGHT']) && $properties['FONT-WEIGHT'] == 'bold') {
|
219 |
+
$p['C']['font-style'] = 'B';
|
220 |
+
}
|
221 |
+
if (isset($properties['FONT-STYLE']) && $properties['FONT-STYLE'] == 'italic') {
|
222 |
+
$p['C']['font-style'] .= 'I';
|
223 |
+
}
|
224 |
+
if (isset($properties['COLOR'])) {
|
225 |
+
$p['C']['color'] = $properties['COLOR'];
|
226 |
+
}
|
227 |
+
}
|
228 |
+
if (isset($attr['HEADER-STYLE-RIGHT']) || isset($attr['FOOTER-STYLE-RIGHT'])) {
|
229 |
+
if ($tag == 'PAGEHEADER') {
|
230 |
+
$properties = $this->mpdf->cssmgr->readInlineCSS($attr['HEADER-STYLE-RIGHT']);
|
231 |
+
} else {
|
232 |
+
$properties = $this->mpdf->cssmgr->readInlineCSS($attr['FOOTER-STYLE-RIGHT']);
|
233 |
+
}
|
234 |
+
if (isset($properties['FONT-FAMILY'])) {
|
235 |
+
$p['R']['font-family'] = $properties['FONT-FAMILY'];
|
236 |
+
}
|
237 |
+
if (isset($properties['FONT-SIZE'])) {
|
238 |
+
$p['R']['font-size'] = $this->mpdf->ConvertSize($properties['FONT-SIZE']) * _MPDFK;
|
239 |
+
}
|
240 |
+
if (isset($properties['FONT-WEIGHT']) && $properties['FONT-WEIGHT'] == 'bold') {
|
241 |
+
$p['R']['font-style'] = 'B';
|
242 |
+
}
|
243 |
+
if (isset($properties['FONT-STYLE']) && $properties['FONT-STYLE'] == 'italic') {
|
244 |
+
$p['R']['font-style'] .= 'I';
|
245 |
+
}
|
246 |
+
if (isset($properties['COLOR'])) {
|
247 |
+
$p['R']['color'] = $properties['COLOR'];
|
248 |
+
}
|
249 |
+
}
|
250 |
+
if (isset($attr['LINE']) && $attr['LINE']) { // 0|1|on|off
|
251 |
+
if ($attr['LINE'] == '1' || strtoupper($attr['LINE']) == 'ON') {
|
252 |
+
$lineset = 1;
|
253 |
+
} else {
|
254 |
+
$lineset = 0;
|
255 |
+
}
|
256 |
+
$p['line'] = $lineset;
|
257 |
+
}
|
258 |
+
// mPDF 6
|
259 |
+
if ($tag == 'PAGEHEADER') {
|
260 |
+
$this->mpdf->DefHeaderByName($pname, $p);
|
261 |
+
} else {
|
262 |
+
$this->mpdf->DefFooterByName($pname, $p);
|
263 |
+
}
|
264 |
+
break;
|
265 |
+
|
266 |
+
|
267 |
+
case 'SETPAGEHEADER': // mPDF 6
|
268 |
+
case 'SETPAGEFOOTER':
|
269 |
+
case 'SETHTMLPAGEHEADER':
|
270 |
+
case 'SETHTMLPAGEFOOTER':
|
271 |
+
$this->mpdf->ignorefollowingspaces = true;
|
272 |
+
if (isset($attr['NAME']) && $attr['NAME']) {
|
273 |
+
$pname = $attr['NAME'];
|
274 |
+
} else if ($tag == 'SETPAGEHEADER' || $tag == 'SETPAGEFOOTER') {
|
275 |
+
$pname = '_nonhtmldefault';
|
276 |
+
} // mPDF 6
|
277 |
+
else {
|
278 |
+
$pname = '_default';
|
279 |
+
}
|
280 |
+
if (isset($attr['PAGE']) && $attr['PAGE']) { // O|odd|even|E|ALL|[blank]
|
281 |
+
if (strtoupper($attr['PAGE']) == 'O' || strtoupper($attr['PAGE']) == 'ODD') {
|
282 |
+
$side = 'odd';
|
283 |
+
} else if (strtoupper($attr['PAGE']) == 'E' || strtoupper($attr['PAGE']) == 'EVEN') {
|
284 |
+
$side = 'even';
|
285 |
+
} else if (strtoupper($attr['PAGE']) == 'ALL') {
|
286 |
+
$side = 'both';
|
287 |
+
} else {
|
288 |
+
$side = 'odd';
|
289 |
+
}
|
290 |
+
} else {
|
291 |
+
$side = 'odd';
|
292 |
+
}
|
293 |
+
if (isset($attr['VALUE']) && $attr['VALUE']) { // -1|1|on|off
|
294 |
+
if ($attr['VALUE'] == '1' || strtoupper($attr['VALUE']) == 'ON') {
|
295 |
+
$set = 1;
|
296 |
+
} else if ($attr['VALUE'] == '-1' || strtoupper($attr['VALUE']) == 'OFF') {
|
297 |
+
$set = 0;
|
298 |
+
} else {
|
299 |
+
$set = 1;
|
300 |
+
}
|
301 |
+
} else {
|
302 |
+
$set = 1;
|
303 |
+
}
|
304 |
+
if (isset($attr['SHOW-THIS-PAGE']) && $attr['SHOW-THIS-PAGE'] && ($tag == 'SETHTMLPAGEHEADER' || $tag == 'SETPAGEHEADER')) {
|
305 |
+
$write = 1;
|
306 |
+
} else {
|
307 |
+
$write = 0;
|
308 |
+
}
|
309 |
+
if ($side == 'odd' || $side == 'both') {
|
310 |
+
if ($set && ($tag == 'SETHTMLPAGEHEADER' || $tag == 'SETPAGEHEADER')) {
|
311 |
+
$this->mpdf->SetHTMLHeader($this->mpdf->pageHTMLheaders[$pname], 'O', $write);
|
312 |
+
} else if ($set && ($tag == 'SETHTMLPAGEFOOTER' || $tag == 'SETPAGEFOOTER')) {
|
313 |
+
$this->mpdf->SetHTMLFooter($this->mpdf->pageHTMLfooters[$pname], 'O');
|
314 |
+
} else if ($tag == 'SETHTMLPAGEHEADER' || $tag == 'SETPAGEHEADER') {
|
315 |
+
$this->mpdf->SetHTMLHeader('', 'O');
|
316 |
+
} else {
|
317 |
+
$this->mpdf->SetHTMLFooter('', 'O');
|
318 |
+
}
|
319 |
+
}
|
320 |
+
if ($side == 'even' || $side == 'both') {
|
321 |
+
if ($set && ($tag == 'SETHTMLPAGEHEADER' || $tag == 'SETPAGEHEADER')) {
|
322 |
+
$this->mpdf->SetHTMLHeader($this->mpdf->pageHTMLheaders[$pname], 'E', $write);
|
323 |
+
} else if ($set && ($tag == 'SETHTMLPAGEFOOTER' || $tag == 'SETPAGEFOOTER')) {
|
324 |
+
$this->mpdf->SetHTMLFooter($this->mpdf->pageHTMLfooters[$pname], 'E');
|
325 |
+
} else if ($tag == 'SETHTMLPAGEHEADER' || $tag == 'SETPAGEHEADER') {
|
326 |
+
$this->mpdf->SetHTMLHeader('', 'E');
|
327 |
+
} else {
|
328 |
+
$this->mpdf->SetHTMLFooter('', 'E');
|
329 |
+
}
|
330 |
+
}
|
331 |
+
break;
|
332 |
+
|
333 |
+
|
334 |
+
|
335 |
+
/* -- TOC -- */
|
336 |
+
case 'TOC': //added custom-tag - set Marker for insertion later of ToC
|
337 |
+
if (!class_exists('tocontents', false)) {
|
338 |
+
include(_MPDF_PATH . 'classes/tocontents.php');
|
339 |
+
}
|
340 |
+
if (empty($this->mpdf->tocontents)) {
|
341 |
+
$this->mpdf->tocontents = new tocontents($this);
|
342 |
+
}
|
343 |
+
$this->mpdf->tocontents->openTagTOC($attr);
|
344 |
+
break;
|
345 |
+
|
346 |
+
|
347 |
+
case 'TOCPAGEBREAK': // custom-tag - set Marker for insertion later of ToC AND adds PAGEBREAK
|
348 |
+
if (!class_exists('tocontents', false)) {
|
349 |
+
include(_MPDF_PATH . 'classes/tocontents.php');
|
350 |
+
}
|
351 |
+
if (empty($this->mpdf->tocontents)) {
|
352 |
+
$this->mpdf->tocontents = new tocontents($this->mpdf);
|
353 |
+
}
|
354 |
+
list($isbreak, $toc_id) = $this->mpdf->tocontents->openTagTOCPAGEBREAK($attr);
|
355 |
+
if ($isbreak)
|
356 |
+
break;
|
357 |
+
if (!isset($attr['RESETPAGENUM']) || $attr['RESETPAGENUM'] < 1) {
|
358 |
+
$attr['RESETPAGENUM'] = 1;
|
359 |
+
} // mPDF 6
|
360 |
+
// No break - continues as PAGEBREAK...
|
361 |
+
/* -- END TOC -- */
|
362 |
+
|
363 |
+
|
364 |
+
case 'PAGE_BREAK': //custom-tag
|
365 |
+
case 'PAGEBREAK': //custom-tag
|
366 |
+
case 'NEWPAGE': //custom-tag
|
367 |
+
case 'FORMFEED': //custom-tag
|
368 |
+
|
369 |
+
if (isset($attr['SHEET-SIZE'])) {
|
370 |
+
// Convert to same types as accepted in initial mPDF() A4, A4-L, or array(w,h)
|
371 |
+
$prop = preg_split('/\s+/', trim($attr['SHEET-SIZE']));
|
372 |
+
if (count($prop) == 2) {
|
373 |
+
$newformat = array($this->mpdf->ConvertSize($prop[0]), $this->mpdf->ConvertSize($prop[1]));
|
374 |
+
} else {
|
375 |
+
$newformat = $attr['SHEET-SIZE'];
|
376 |
+
}
|
377 |
+
} else {
|
378 |
+
$newformat = '';
|
379 |
+
}
|
380 |
+
|
381 |
+
$save_blklvl = $this->mpdf->blklvl;
|
382 |
+
$save_blk = $this->mpdf->blk;
|
383 |
+
$save_silp = $this->mpdf->saveInlineProperties();
|
384 |
+
$save_ilp = $this->mpdf->InlineProperties;
|
385 |
+
$save_bflp = $this->mpdf->InlineBDF;
|
386 |
+
$save_bflpc = $this->mpdf->InlineBDFctr; // mPDF 6
|
387 |
+
|
388 |
+
$mgr = $mgl = $mgt = $mgb = $mgh = $mgf = '';
|
389 |
+
if (isset($attr['MARGIN-RIGHT'])) {
|
390 |
+
$mgr = $this->mpdf->ConvertSize($attr['MARGIN-RIGHT'], $this->mpdf->w, $this->mpdf->FontSize, false);
|
391 |
+
}
|
392 |
+
if (isset($attr['MARGIN-LEFT'])) {
|
393 |
+
$mgl = $this->mpdf->ConvertSize($attr['MARGIN-LEFT'], $this->mpdf->w, $this->mpdf->FontSize, false);
|
394 |
+
}
|
395 |
+
if (isset($attr['MARGIN-TOP'])) {
|
396 |
+
$mgt = $this->mpdf->ConvertSize($attr['MARGIN-TOP'], $this->mpdf->w, $this->mpdf->FontSize, false);
|
397 |
+
}
|
398 |
+
if (isset($attr['MARGIN-BOTTOM'])) {
|
399 |
+
$mgb = $this->mpdf->ConvertSize($attr['MARGIN-BOTTOM'], $this->mpdf->w, $this->mpdf->FontSize, false);
|
400 |
+
}
|
401 |
+
if (isset($attr['MARGIN-HEADER'])) {
|
402 |
+
$mgh = $this->mpdf->ConvertSize($attr['MARGIN-HEADER'], $this->mpdf->w, $this->mpdf->FontSize, false);
|
403 |
+
}
|
404 |
+
if (isset($attr['MARGIN-FOOTER'])) {
|
405 |
+
$mgf = $this->mpdf->ConvertSize($attr['MARGIN-FOOTER'], $this->mpdf->w, $this->mpdf->FontSize, false);
|
406 |
+
}
|
407 |
+
$ohname = $ehname = $ofname = $efname = '';
|
408 |
+
if (isset($attr['ODD-HEADER-NAME'])) {
|
409 |
+
$ohname = $attr['ODD-HEADER-NAME'];
|
410 |
+
}
|
411 |
+
if (isset($attr['EVEN-HEADER-NAME'])) {
|
412 |
+
$ehname = $attr['EVEN-HEADER-NAME'];
|
413 |
+
}
|
414 |
+
if (isset($attr['ODD-FOOTER-NAME'])) {
|
415 |
+
$ofname = $attr['ODD-FOOTER-NAME'];
|
416 |
+
}
|
417 |
+
if (isset($attr['EVEN-FOOTER-NAME'])) {
|
418 |
+
$efname = $attr['EVEN-FOOTER-NAME'];
|
419 |
+
}
|
420 |
+
$ohvalue = $ehvalue = $ofvalue = $efvalue = 0;
|
421 |
+
if (isset($attr['ODD-HEADER-VALUE']) && ($attr['ODD-HEADER-VALUE'] == '1' || strtoupper($attr['ODD-HEADER-VALUE']) == 'ON')) {
|
422 |
+
$ohvalue = 1;
|
423 |
+
} else if (isset($attr['ODD-HEADER-VALUE']) && ($attr['ODD-HEADER-VALUE'] == '-1' || strtoupper($attr['ODD-HEADER-VALUE']) == 'OFF')) {
|
424 |
+
$ohvalue = -1;
|
425 |
+
}
|
426 |
+
if (isset($attr['EVEN-HEADER-VALUE']) && ($attr['EVEN-HEADER-VALUE'] == '1' || strtoupper($attr['EVEN-HEADER-VALUE']) == 'ON')) {
|
427 |
+
$ehvalue = 1;
|
428 |
+
} else if (isset($attr['EVEN-HEADER-VALUE']) && ($attr['EVEN-HEADER-VALUE'] == '-1' || strtoupper($attr['EVEN-HEADER-VALUE']) == 'OFF')) {
|
429 |
+
$ehvalue = -1;
|
430 |
+
}
|
431 |
+
if (isset($attr['ODD-FOOTER-VALUE']) && ($attr['ODD-FOOTER-VALUE'] == '1' || strtoupper($attr['ODD-FOOTER-VALUE']) == 'ON')) {
|
432 |
+
$ofvalue = 1;
|
433 |
+
} else if (isset($attr['ODD-FOOTER-VALUE']) && ($attr['ODD-FOOTER-VALUE'] == '-1' || strtoupper($attr['ODD-FOOTER-VALUE']) == 'OFF')) {
|
434 |
+
$ofvalue = -1;
|
435 |
+
}
|
436 |
+
if (isset($attr['EVEN-FOOTER-VALUE']) && ($attr['EVEN-FOOTER-VALUE'] == '1' || strtoupper($attr['EVEN-FOOTER-VALUE']) == 'ON')) {
|
437 |
+
$efvalue = 1;
|
438 |
+
} else if (isset($attr['EVEN-FOOTER-VALUE']) && ($attr['EVEN-FOOTER-VALUE'] == '-1' || strtoupper($attr['EVEN-FOOTER-VALUE']) == 'OFF')) {
|
439 |
+
$efvalue = -1;
|
440 |
+
}
|
441 |
+
|
442 |
+
if (isset($attr['ORIENTATION']) && (strtoupper($attr['ORIENTATION']) == 'L' || strtoupper($attr['ORIENTATION']) == 'LANDSCAPE')) {
|
443 |
+
$orient = 'L';
|
444 |
+
} else if (isset($attr['ORIENTATION']) && (strtoupper($attr['ORIENTATION']) == 'P' || strtoupper($attr['ORIENTATION']) == 'PORTRAIT')) {
|
445 |
+
$orient = 'P';
|
446 |
+
} else {
|
447 |
+
$orient = $this->mpdf->CurOrientation;
|
448 |
+
}
|
449 |
+
|
450 |
+
if (isset($attr['PAGE-SELECTOR']) && $attr['PAGE-SELECTOR']) {
|
451 |
+
$pagesel = $attr['PAGE-SELECTOR'];
|
452 |
+
} else {
|
453 |
+
$pagesel = '';
|
454 |
+
}
|
455 |
+
|
456 |
+
// mPDF 6 pagebreaktype
|
457 |
+
$pagebreaktype = $this->mpdf->defaultPagebreakType;
|
458 |
+
if ($tag == 'FORMFEED') {
|
459 |
+
$pagebreaktype = 'slice';
|
460 |
+
} // can be overridden by PAGE-BREAK-TYPE
|
461 |
+
$startpage = $this->mpdf->page;
|
462 |
+
if (isset($attr['PAGE-BREAK-TYPE'])) {
|
463 |
+
if (strtolower($attr['PAGE-BREAK-TYPE']) == 'cloneall' || strtolower($attr['PAGE-BREAK-TYPE']) == 'clonebycss' || strtolower($attr['PAGE-BREAK-TYPE']) == 'slice') {
|
464 |
+
$pagebreaktype = strtolower($attr['PAGE-BREAK-TYPE']);
|
465 |
+
}
|
466 |
+
}
|
467 |
+
if ($tag == 'TOCPAGEBREAK') {
|
468 |
+
$pagebreaktype = 'cloneall';
|
469 |
+
} else if ($this->mpdf->ColActive) {
|
470 |
+
$pagebreaktype = 'cloneall';
|
471 |
+
}
|
472 |
+
// Any change in headers/footers (may need to _getHtmlHeight), or page size/orientation, @page selector, or margins - force cloneall
|
473 |
+
else if ($mgr !== '' || $mgl !== '' || $mgt !== '' || $mgb !== '' || $mgh !== '' || $mgf !== '' ||
|
474 |
+
$ohname !== '' || $ehname !== '' || $ofname !== '' || $efname !== '' ||
|
475 |
+
$ohvalue || $ehvalue || $ofvalue || $efvalue ||
|
476 |
+
$orient != $this->mpdf->CurOrientation || $newformat || $pagesel) {
|
477 |
+
$pagebreaktype = 'cloneall';
|
478 |
+
}
|
479 |
+
|
480 |
+
// mPDF 6 pagebreaktype
|
481 |
+
$this->mpdf->_preForcedPagebreak($pagebreaktype);
|
482 |
+
|
483 |
+
$this->mpdf->ignorefollowingspaces = true;
|
484 |
+
|
485 |
+
|
486 |
+
$resetpagenum = '';
|
487 |
+
$pagenumstyle = '';
|
488 |
+
$suppress = '';
|
489 |
+
if (isset($attr['RESETPAGENUM'])) {
|
490 |
+
$resetpagenum = $attr['RESETPAGENUM'];
|
491 |
+
}
|
492 |
+
if (isset($attr['PAGENUMSTYLE'])) {
|
493 |
+
$pagenumstyle = $attr['PAGENUMSTYLE'];
|
494 |
+
}
|
495 |
+
if (isset($attr['SUPPRESS'])) {
|
496 |
+
$suppress = $attr['SUPPRESS'];
|
497 |
+
}
|
498 |
+
|
499 |
+
if ($tag == 'TOCPAGEBREAK') {
|
500 |
+
$type = 'NEXT-ODD';
|
501 |
+
} else if (isset($attr['TYPE'])) {
|
502 |
+
$type = strtoupper($attr['TYPE']);
|
503 |
+
} else {
|
504 |
+
$type = '';
|
505 |
+
}
|
506 |
+
|
507 |
+
if ($type == 'E' || $type == 'EVEN') {
|
508 |
+
$this->mpdf->AddPage($orient, 'E', $resetpagenum, $pagenumstyle, $suppress, $mgl, $mgr, $mgt, $mgb, $mgh, $mgf, $ohname, $ehname, $ofname, $efname, $ohvalue, $ehvalue, $ofvalue, $efvalue, $pagesel, $newformat);
|
509 |
+
} else if ($type == 'O' || $type == 'ODD') {
|
510 |
+
$this->mpdf->AddPage($orient, 'O', $resetpagenum, $pagenumstyle, $suppress, $mgl, $mgr, $mgt, $mgb, $mgh, $mgf, $ohname, $ehname, $ofname, $efname, $ohvalue, $ehvalue, $ofvalue, $efvalue, $pagesel, $newformat);
|
511 |
+
} else if ($type == 'NEXT-ODD') {
|
512 |
+
$this->mpdf->AddPage($orient, 'NEXT-ODD', $resetpagenum, $pagenumstyle, $suppress, $mgl, $mgr, $mgt, $mgb, $mgh, $mgf, $ohname, $ehname, $ofname, $efname, $ohvalue, $ehvalue, $ofvalue, $efvalue, $pagesel, $newformat);
|
513 |
+
} else if ($type == 'NEXT-EVEN') {
|
514 |
+
$this->mpdf->AddPage($orient, 'NEXT-EVEN', $resetpagenum, $pagenumstyle, $suppress, $mgl, $mgr, $mgt, $mgb, $mgh, $mgf, $ohname, $ehname, $ofname, $efname, $ohvalue, $ehvalue, $ofvalue, $efvalue, $pagesel, $newformat);
|
515 |
+
} else {
|
516 |
+
$this->mpdf->AddPage($orient, '', $resetpagenum, $pagenumstyle, $suppress, $mgl, $mgr, $mgt, $mgb, $mgh, $mgf, $ohname, $ehname, $ofname, $efname, $ohvalue, $ehvalue, $ofvalue, $efvalue, $pagesel, $newformat);
|
517 |
+
}
|
518 |
+
|
519 |
+
/* -- TOC -- */
|
520 |
+
if ($tag == 'TOCPAGEBREAK') {
|
521 |
+
if ($toc_id) {
|
522 |
+
$this->mpdf->tocontents->m_TOC[$toc_id]['TOCmark'] = $this->mpdf->page;
|
523 |
+
} else {
|
524 |
+
$this->mpdf->tocontents->TOCmark = $this->mpdf->page;
|
525 |
+
}
|
526 |
+
}
|
527 |
+
/* -- END TOC -- */
|
528 |
+
|
529 |
+
// mPDF 6 pagebreaktype
|
530 |
+
$this->mpdf->_postForcedPagebreak($pagebreaktype, $startpage, $save_blk, $save_blklvl);
|
531 |
+
|
532 |
+
$this->mpdf->InlineProperties = $save_ilp;
|
533 |
+
$this->mpdf->InlineBDF = $save_bflp;
|
534 |
+
$this->mpdf->InlineBDFctr = $save_bflpc; // mPDF 6
|
535 |
+
$this->mpdf->restoreInlineProperties($save_silp);
|
536 |
+
|
537 |
+
break;
|
538 |
+
|
539 |
+
|
540 |
+
/* -- TOC -- */
|
541 |
+
case 'TOCENTRY':
|
542 |
+
if (isset($attr['CONTENT']) && $attr['CONTENT']) {
|
543 |
+
$objattr = array();
|
544 |
+
$objattr['CONTENT'] = htmlspecialchars_decode($attr['CONTENT'], ENT_QUOTES);
|
545 |
+
$objattr['type'] = 'toc';
|
546 |
+
$objattr['vertical-align'] = 'T';
|
547 |
+
if (isset($attr['LEVEL']) && $attr['LEVEL']) {
|
548 |
+
$objattr['toclevel'] = $attr['LEVEL'];
|
549 |
+
} else {
|
550 |
+
$objattr['toclevel'] = 0;
|
551 |
+
}
|
552 |
+
if (isset($attr['NAME']) && $attr['NAME']) {
|
553 |
+
$objattr['toc_id'] = $attr['NAME'];
|
554 |
+
} else {
|
555 |
+
$objattr['toc_id'] = 0;
|
556 |
+
}
|
557 |
+
$e = "\xbb\xa4\xactype=toc,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
|
558 |
+
if ($this->mpdf->tableLevel) {
|
559 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['textbuffer'][] = array($e);
|
560 |
+
} // *TABLES*
|
561 |
+
else { // *TABLES*
|
562 |
+
$this->mpdf->textbuffer[] = array($e);
|
563 |
+
} // *TABLES*
|
564 |
+
}
|
565 |
+
break;
|
566 |
+
/* -- END TOC -- */
|
567 |
+
|
568 |
+
/* -- INDEX -- */
|
569 |
+
case 'INDEXENTRY':
|
570 |
+
if (isset($attr['CONTENT']) && $attr['CONTENT']) {
|
571 |
+
if (isset($attr['XREF']) && $attr['XREF']) {
|
572 |
+
$this->mpdf->IndexEntry(htmlspecialchars_decode($attr['CONTENT'], ENT_QUOTES), $attr['XREF']);
|
573 |
+
break;
|
574 |
+
}
|
575 |
+
$objattr = array();
|
576 |
+
$objattr['CONTENT'] = htmlspecialchars_decode($attr['CONTENT'], ENT_QUOTES);
|
577 |
+
$objattr['type'] = 'indexentry';
|
578 |
+
$objattr['vertical-align'] = 'T';
|
579 |
+
$e = "\xbb\xa4\xactype=indexentry,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
|
580 |
+
if ($this->mpdf->tableLevel) {
|
581 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['textbuffer'][] = array($e);
|
582 |
+
} // *TABLES*
|
583 |
+
else { // *TABLES*
|
584 |
+
$this->mpdf->textbuffer[] = array($e);
|
585 |
+
} // *TABLES*
|
586 |
+
}
|
587 |
+
break;
|
588 |
+
|
589 |
+
|
590 |
+
case 'INDEXINSERT':
|
591 |
+
if (isset($attr['COLLATION'])) {
|
592 |
+
$indexCollationLocale = $attr['COLLATION'];
|
593 |
+
} else {
|
594 |
+
$indexCollationLocale = '';
|
595 |
+
}
|
596 |
+
if (isset($attr['COLLATION-GROUP'])) {
|
597 |
+
$indexCollationGroup = $attr['COLLATION-GROUP'];
|
598 |
+
} else {
|
599 |
+
$indexCollationGroup = '';
|
600 |
+
}
|
601 |
+
if (isset($attr['USEDIVLETTERS']) && (strtoupper($attr['USEDIVLETTERS']) == 'OFF' || $attr['USEDIVLETTERS'] == -1 || $attr['USEDIVLETTERS'] === '0')) {
|
602 |
+
$usedivletters = 0;
|
603 |
+
} else {
|
604 |
+
$usedivletters = 1;
|
605 |
+
}
|
606 |
+
if (isset($attr['LINKS']) && (strtoupper($attr['LINKS']) == 'ON' || $attr['LINKS'] == 1)) {
|
607 |
+
$links = true;
|
608 |
+
} else {
|
609 |
+
$links = false;
|
610 |
+
}
|
611 |
+
$this->mpdf->InsertIndex($usedivletters, $links, $indexCollationLocale, $indexCollationGroup);
|
612 |
+
|
613 |
+
break;
|
614 |
+
/* -- END INDEX -- */
|
615 |
+
|
616 |
+
/* -- WATERMARK -- */
|
617 |
+
|
618 |
+
case 'WATERMARKTEXT':
|
619 |
+
if (isset($attr['CONTENT']) && $attr['CONTENT']) {
|
620 |
+
$txt = htmlspecialchars_decode($attr['CONTENT'], ENT_QUOTES);
|
621 |
+
} else {
|
622 |
+
$txt = '';
|
623 |
+
}
|
624 |
+
if (isset($attr['ALPHA']) && $attr['ALPHA'] > 0) {
|
625 |
+
$alpha = $attr['ALPHA'];
|
626 |
+
} else {
|
627 |
+
$alpha = -1;
|
628 |
+
}
|
629 |
+
$this->mpdf->SetWatermarkText($txt, $alpha);
|
630 |
+
break;
|
631 |
+
|
632 |
+
|
633 |
+
case 'WATERMARKIMAGE':
|
634 |
+
if (isset($attr['SRC'])) {
|
635 |
+
$src = $attr['SRC'];
|
636 |
+
} else {
|
637 |
+
$src = '';
|
638 |
+
}
|
639 |
+
if (isset($attr['ALPHA']) && $attr['ALPHA'] > 0) {
|
640 |
+
$alpha = $attr['ALPHA'];
|
641 |
+
} else {
|
642 |
+
$alpha = -1;
|
643 |
+
}
|
644 |
+
if (isset($attr['SIZE']) && $attr['SIZE']) {
|
645 |
+
$size = $attr['SIZE'];
|
646 |
+
if (strpos($size, ',')) {
|
647 |
+
$size = explode(',', $size);
|
648 |
+
}
|
649 |
+
} else {
|
650 |
+
$size = 'D';
|
651 |
+
}
|
652 |
+
if (isset($attr['POSITION']) && $attr['POSITION']) { // mPDF 5.7.2
|
653 |
+
$pos = $attr['POSITION'];
|
654 |
+
if (strpos($pos, ',')) {
|
655 |
+
$pos = explode(',', $pos);
|
656 |
+
}
|
657 |
+
} else {
|
658 |
+
$pos = 'P';
|
659 |
+
}
|
660 |
+
$this->mpdf->SetWatermarkImage($src, $alpha, $size, $pos);
|
661 |
+
break;
|
662 |
+
/* -- END WATERMARK -- */
|
663 |
+
|
664 |
+
/* -- BOOKMARKS -- */
|
665 |
+
case 'BOOKMARK':
|
666 |
+
if (isset($attr['CONTENT'])) {
|
667 |
+
$objattr = array();
|
668 |
+
$objattr['CONTENT'] = htmlspecialchars_decode($attr['CONTENT'], ENT_QUOTES);
|
669 |
+
$objattr['type'] = 'bookmark';
|
670 |
+
if (isset($attr['LEVEL']) && $attr['LEVEL']) {
|
671 |
+
$objattr['bklevel'] = $attr['LEVEL'];
|
672 |
+
} else {
|
673 |
+
$objattr['bklevel'] = 0;
|
674 |
+
}
|
675 |
+
$e = "\xbb\xa4\xactype=bookmark,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
|
676 |
+
if ($this->mpdf->tableLevel) {
|
677 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['textbuffer'][] = array($e);
|
678 |
+
} // *TABLES*
|
679 |
+
else { // *TABLES*
|
680 |
+
$this->mpdf->textbuffer[] = array($e);
|
681 |
+
} // *TABLES*
|
682 |
+
}
|
683 |
+
break;
|
684 |
+
/* -- END BOOKMARKS -- */
|
685 |
+
|
686 |
+
/* -- ANNOTATIONS -- */
|
687 |
+
case 'ANNOTATION':
|
688 |
+
|
689 |
+
//if (isset($attr['CONTENT']) && !$this->mpdf->writingHTMLheader && !$this->mpdf->writingHTMLfooter) { // Stops annotations in FixedPos
|
690 |
+
if (isset($attr['CONTENT'])) {
|
691 |
+
$objattr = array();
|
692 |
+
$objattr['margin_top'] = 0;
|
693 |
+
$objattr['margin_bottom'] = 0;
|
694 |
+
$objattr['margin_left'] = 0;
|
695 |
+
$objattr['margin_right'] = 0;
|
696 |
+
$objattr['width'] = 0;
|
697 |
+
$objattr['height'] = 0;
|
698 |
+
$objattr['border_top']['w'] = 0;
|
699 |
+
$objattr['border_bottom']['w'] = 0;
|
700 |
+
$objattr['border_left']['w'] = 0;
|
701 |
+
$objattr['border_right']['w'] = 0;
|
702 |
+
$objattr['CONTENT'] = htmlspecialchars_decode($attr['CONTENT'], ENT_QUOTES);
|
703 |
+
$objattr['type'] = 'annot';
|
704 |
+
$objattr['POPUP'] = '';
|
705 |
+
} else {
|
706 |
+
break;
|
707 |
+
}
|
708 |
+
if (isset($attr['POS-X'])) {
|
709 |
+
$objattr['POS-X'] = $attr['POS-X'];
|
710 |
+
} else {
|
711 |
+
$objattr['POS-X'] = 0;
|
712 |
+
}
|
713 |
+
if (isset($attr['POS-Y'])) {
|
714 |
+
$objattr['POS-Y'] = $attr['POS-Y'];
|
715 |
+
} else {
|
716 |
+
$objattr['POS-Y'] = 0;
|
717 |
+
}
|
718 |
+
if (isset($attr['ICON'])) {
|
719 |
+
$objattr['ICON'] = $attr['ICON'];
|
720 |
+
} else {
|
721 |
+
$objattr['ICON'] = 'Note';
|
722 |
+
}
|
723 |
+
if (isset($attr['AUTHOR'])) {
|
724 |
+
$objattr['AUTHOR'] = $attr['AUTHOR'];
|
725 |
+
} else if (isset($attr['TITLE'])) {
|
726 |
+
$objattr['AUTHOR'] = $attr['TITLE'];
|
727 |
+
} else {
|
728 |
+
$objattr['AUTHOR'] = '';
|
729 |
+
}
|
730 |
+
if (isset($attr['FILE'])) {
|
731 |
+
$objattr['FILE'] = $attr['FILE'];
|
732 |
+
} else {
|
733 |
+
$objattr['FILE'] = '';
|
734 |
+
}
|
735 |
+
if (isset($attr['SUBJECT'])) {
|
736 |
+
$objattr['SUBJECT'] = $attr['SUBJECT'];
|
737 |
+
} else {
|
738 |
+
$objattr['SUBJECT'] = '';
|
739 |
+
}
|
740 |
+
if (isset($attr['OPACITY']) && $attr['OPACITY'] > 0 && $attr['OPACITY'] <= 1) {
|
741 |
+
$objattr['OPACITY'] = $attr['OPACITY'];
|
742 |
+
} else if ($this->mpdf->annotMargin) {
|
743 |
+
$objattr['OPACITY'] = 1;
|
744 |
+
} else {
|
745 |
+
$objattr['OPACITY'] = $this->mpdf->annotOpacity;
|
746 |
+
}
|
747 |
+
if (isset($attr['COLOR'])) {
|
748 |
+
$cor = $this->mpdf->ConvertColor($attr['COLOR']);
|
749 |
+
if ($cor) {
|
750 |
+
$objattr['COLOR'] = $cor;
|
751 |
+
} else {
|
752 |
+
$objattr['COLOR'] = $this->mpdf->ConvertColor('yellow');
|
753 |
+
}
|
754 |
+
} else {
|
755 |
+
$objattr['COLOR'] = $this->mpdf->ConvertColor('yellow');
|
756 |
+
}
|
757 |
+
|
758 |
+
if (isset($attr['POPUP']) && !empty($attr['POPUP'])) {
|
759 |
+
$pop = preg_split('/\s+/', trim($attr['POPUP']));
|
760 |
+
if (count($pop) > 1) {
|
761 |
+
$objattr['POPUP'] = $pop;
|
762 |
+
} else {
|
763 |
+
$objattr['POPUP'] = true;
|
764 |
+
}
|
765 |
+
}
|
766 |
+
$e = "\xbb\xa4\xactype=annot,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
|
767 |
+
if ($this->mpdf->tableLevel) {
|
768 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['textbuffer'][] = array($e);
|
769 |
+
} // *TABLES*
|
770 |
+
else { // *TABLES*
|
771 |
+
$this->mpdf->textbuffer[] = array($e);
|
772 |
+
} // *TABLES*
|
773 |
+
break;
|
774 |
+
/* -- END ANNOTATIONS -- */
|
775 |
+
|
776 |
+
|
777 |
+
/* -- COLUMNS -- */
|
778 |
+
case 'COLUMNS': //added custom-tag
|
779 |
+
if (isset($attr['COLUMN-COUNT']) && ($attr['COLUMN-COUNT'] || $attr['COLUMN-COUNT'] === '0')) {
|
780 |
+
// Close any open block tags
|
781 |
+
for ($b = $this->mpdf->blklvl; $b > 0; $b--) {
|
782 |
+
$this->CloseTag($this->mpdf->blk[$b]['tag'], $ahtml, $ihtml);
|
783 |
+
}
|
784 |
+
if (!empty($this->mpdf->textbuffer)) { //Output previously buffered content
|
785 |
+
$this->mpdf->printbuffer($this->mpdf->textbuffer);
|
786 |
+
$this->mpdf->textbuffer = array();
|
787 |
+
}
|
788 |
+
|
789 |
+
if (isset($attr['VALIGN']) && $attr['VALIGN']) {
|
790 |
+
if ($attr['VALIGN'] == 'J') {
|
791 |
+
$valign = 'J';
|
792 |
+
} else {
|
793 |
+
$valign = $align[$attr['VALIGN']];
|
794 |
+
}
|
795 |
+
} else {
|
796 |
+
$valign = '';
|
797 |
+
}
|
798 |
+
if (isset($attr['COLUMN-GAP']) && $attr['COLUMN-GAP']) {
|
799 |
+
$this->mpdf->SetColumns($attr['COLUMN-COUNT'], $valign, $attr['COLUMN-GAP']);
|
800 |
+
} else {
|
801 |
+
$this->mpdf->SetColumns($attr['COLUMN-COUNT'], $valign);
|
802 |
+
}
|
803 |
+
}
|
804 |
+
$this->mpdf->ignorefollowingspaces = true;
|
805 |
+
break;
|
806 |
+
|
807 |
+
case 'COLUMN_BREAK': //custom-tag
|
808 |
+
case 'COLUMNBREAK': //custom-tag
|
809 |
+
case 'NEWCOLUMN': //custom-tag
|
810 |
+
$this->mpdf->ignorefollowingspaces = true;
|
811 |
+
$this->mpdf->NewColumn();
|
812 |
+
$this->mpdf->ColumnAdjust = false; // disables all column height adjustment for the page.
|
813 |
+
break;
|
814 |
+
|
815 |
+
/* -- END COLUMNS -- */
|
816 |
+
|
817 |
+
|
818 |
+
case 'TTZ':
|
819 |
+
$this->mpdf->ttz = true;
|
820 |
+
$this->mpdf->InlineProperties[$tag] = $this->mpdf->saveInlineProperties();
|
821 |
+
$this->mpdf->setCSS(array('FONT-FAMILY' => 'czapfdingbats', 'FONT-WEIGHT' => 'normal', 'FONT-STYLE' => 'normal'), 'INLINE');
|
822 |
+
break;
|
823 |
+
|
824 |
+
case 'TTS':
|
825 |
+
$this->mpdf->tts = true;
|
826 |
+
$this->mpdf->InlineProperties[$tag] = $this->mpdf->saveInlineProperties();
|
827 |
+
$this->mpdf->setCSS(array('FONT-FAMILY' => 'csymbol', 'FONT-WEIGHT' => 'normal', 'FONT-STYLE' => 'normal'), 'INLINE');
|
828 |
+
break;
|
829 |
+
|
830 |
+
case 'TTA':
|
831 |
+
$this->mpdf->tta = true;
|
832 |
+
$this->mpdf->InlineProperties[$tag] = $this->mpdf->saveInlineProperties();
|
833 |
+
|
834 |
+
if (in_array($this->mpdf->FontFamily, $this->mpdf->mono_fonts)) {
|
835 |
+
$this->mpdf->setCSS(array('FONT-FAMILY' => 'ccourier'), 'INLINE');
|
836 |
+
} else if (in_array($this->mpdf->FontFamily, $this->mpdf->serif_fonts)) {
|
837 |
+
$this->mpdf->setCSS(array('FONT-FAMILY' => 'ctimes'), 'INLINE');
|
838 |
+
} else {
|
839 |
+
$this->mpdf->setCSS(array('FONT-FAMILY' => 'chelvetica'), 'INLINE');
|
840 |
+
}
|
841 |
+
break;
|
842 |
+
|
843 |
+
|
844 |
+
|
845 |
+
// INLINE PHRASES OR STYLES
|
846 |
+
case 'SUB':
|
847 |
+
case 'SUP':
|
848 |
+
case 'ACRONYM':
|
849 |
+
case 'BIG':
|
850 |
+
case 'SMALL':
|
851 |
+
case 'INS':
|
852 |
+
case 'S':
|
853 |
+
case 'STRIKE':
|
854 |
+
case 'DEL':
|
855 |
+
case 'STRONG':
|
856 |
+
case 'CITE':
|
857 |
+
case 'Q':
|
858 |
+
case 'EM':
|
859 |
+
case 'B':
|
860 |
+
case 'I':
|
861 |
+
case 'U':
|
862 |
+
case 'SAMP':
|
863 |
+
case 'CODE':
|
864 |
+
case 'KBD':
|
865 |
+
case 'TT':
|
866 |
+
case 'VAR':
|
867 |
+
case 'FONT':
|
868 |
+
case 'MARK':
|
869 |
+
case 'TIME':
|
870 |
+
case 'BDO': // mPDF 6
|
871 |
+
case 'BDI': // mPDF 6
|
872 |
+
|
873 |
+
case 'SPAN':
|
874 |
+
/* -- ANNOTATIONS -- */
|
875 |
+
if ($this->mpdf->title2annots && isset($attr['TITLE'])) {
|
876 |
+
$objattr = array();
|
877 |
+
$objattr['margin_top'] = 0;
|
878 |
+
$objattr['margin_bottom'] = 0;
|
879 |
+
$objattr['margin_left'] = 0;
|
880 |
+
$objattr['margin_right'] = 0;
|
881 |
+
$objattr['width'] = 0;
|
882 |
+
$objattr['height'] = 0;
|
883 |
+
$objattr['border_top']['w'] = 0;
|
884 |
+
$objattr['border_bottom']['w'] = 0;
|
885 |
+
$objattr['border_left']['w'] = 0;
|
886 |
+
$objattr['border_right']['w'] = 0;
|
887 |
+
|
888 |
+
$objattr['CONTENT'] = $attr['TITLE'];
|
889 |
+
$objattr['type'] = 'annot';
|
890 |
+
$objattr['POS-X'] = 0;
|
891 |
+
$objattr['POS-Y'] = 0;
|
892 |
+
$objattr['ICON'] = 'Comment';
|
893 |
+
$objattr['AUTHOR'] = '';
|
894 |
+
$objattr['SUBJECT'] = '';
|
895 |
+
$objattr['OPACITY'] = $this->mpdf->annotOpacity;
|
896 |
+
$objattr['COLOR'] = $this->mpdf->ConvertColor('yellow');
|
897 |
+
$annot = "\xbb\xa4\xactype=annot,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
|
898 |
+
}
|
899 |
+
/* -- END ANNOTATIONS -- */
|
900 |
+
|
901 |
+
// mPDF 5.7.3 Inline tags
|
902 |
+
if (!isset($this->mpdf->InlineProperties[$tag])) {
|
903 |
+
$this->mpdf->InlineProperties[$tag] = array($this->mpdf->saveInlineProperties());
|
904 |
+
} else {
|
905 |
+
$this->mpdf->InlineProperties[$tag][] = $this->mpdf->saveInlineProperties();
|
906 |
+
}
|
907 |
+
if (isset($annot)) { // *ANNOTATIONS*
|
908 |
+
if (!isset($this->mpdf->InlineAnnots[$tag])) {
|
909 |
+
$this->mpdf->InlineAnnots[$tag] = array($annot);
|
910 |
+
} // *ANNOTATIONS*
|
911 |
+
else {
|
912 |
+
$this->mpdf->InlineAnnots[$tag][] = $annot;
|
913 |
+
} // *ANNOTATIONS*
|
914 |
+
} // *ANNOTATIONS*
|
915 |
+
|
916 |
+
$properties = $this->mpdf->cssmgr->MergeCSS('INLINE', $tag, $attr);
|
917 |
+
if (!empty($properties))
|
918 |
+
$this->mpdf->setCSS($properties, 'INLINE');
|
919 |
+
|
920 |
+
// mPDF 6 Bidirectional formatting for inline elements
|
921 |
+
$bdf = false;
|
922 |
+
$bdf2 = '';
|
923 |
+
$popd = '';
|
924 |
+
|
925 |
+
// Get current direction
|
926 |
+
if (isset($this->mpdf->blk[$this->mpdf->blklvl]['direction'])) {
|
927 |
+
$currdir = $this->mpdf->blk[$this->mpdf->blklvl]['direction'];
|
928 |
+
} else {
|
929 |
+
$currdir = 'ltr';
|
930 |
+
}
|
931 |
+
if ($this->mpdf->tableLevel && isset($this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['direction']) && $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['direction'] == 'rtl') {
|
932 |
+
$currdir = 'rtl';
|
933 |
+
}
|
934 |
+
if (isset($attr['DIR']) and $attr['DIR'] != '') {
|
935 |
+
$currdir = strtolower($attr['DIR']);
|
936 |
+
}
|
937 |
+
if (isset($properties['DIRECTION'])) {
|
938 |
+
$currdir = strtolower($properties['DIRECTION']);
|
939 |
+
}
|
940 |
+
|
941 |
+
// mPDF 6 bidi
|
942 |
+
// cf. http://www.w3.org/TR/css3-writing-modes/#unicode-bidi
|
943 |
+
if ($tag == 'BDO') {
|
944 |
+
if (isset($attr['DIR']) and strtolower($attr['DIR']) == 'rtl') {
|
945 |
+
$bdf = 0x202E;
|
946 |
+
$popd = 'RLOPDF';
|
947 |
+
} // U+202E RLO
|
948 |
+
else if (isset($attr['DIR']) and strtolower($attr['DIR']) == 'ltr') {
|
949 |
+
$bdf = 0x202D;
|
950 |
+
$popd = 'LROPDF';
|
951 |
+
} // U+202D LRO
|
952 |
+
} else if ($tag == 'BDI') {
|
953 |
+
if (isset($attr['DIR']) and strtolower($attr['DIR']) == 'rtl') {
|
954 |
+
$bdf = 0x2067;
|
955 |
+
$popd = 'RLIPDI';
|
956 |
+
} // U+2067 RLI
|
957 |
+
else if (isset($attr['DIR']) and strtolower($attr['DIR']) == 'ltr') {
|
958 |
+
$bdf = 0x2066;
|
959 |
+
$popd = 'LRIPDI';
|
960 |
+
} // U+2066 LRI
|
961 |
+
else {
|
962 |
+
$bdf = 0x2068;
|
963 |
+
$popd = 'FSIPDI';
|
964 |
+
} // U+2068 FSI
|
965 |
+
} else if (isset($properties ['UNICODE-BIDI']) && strtolower($properties ['UNICODE-BIDI']) == 'bidi-override') {
|
966 |
+
if ($currdir == 'rtl') {
|
967 |
+
$bdf = 0x202E;
|
968 |
+
$popd = 'RLOPDF';
|
969 |
+
} // U+202E RLO
|
970 |
+
else {
|
971 |
+
$bdf = 0x202D;
|
972 |
+
$popd = 'LROPDF';
|
973 |
+
} // U+202D LRO
|
974 |
+
} else if (isset($properties ['UNICODE-BIDI']) && strtolower($properties ['UNICODE-BIDI']) == 'embed') {
|
975 |
+
if ($currdir == 'rtl') {
|
976 |
+
$bdf = 0x202B;
|
977 |
+
$popd = 'RLEPDF';
|
978 |
+
} // U+202B RLE
|
979 |
+
else {
|
980 |
+
$bdf = 0x202A;
|
981 |
+
$popd = 'LREPDF';
|
982 |
+
} // U+202A LRE
|
983 |
+
} else if (isset($properties ['UNICODE-BIDI']) && strtolower($properties ['UNICODE-BIDI']) == 'isolate') {
|
984 |
+
if ($currdir == 'rtl') {
|
985 |
+
$bdf = 0x2067;
|
986 |
+
$popd = 'RLIPDI';
|
987 |
+
} // U+2067 RLI
|
988 |
+
else {
|
989 |
+
$bdf = 0x2066;
|
990 |
+
$popd = 'LRIPDI';
|
991 |
+
} // U+2066 LRI
|
992 |
+
} else if (isset($properties ['UNICODE-BIDI']) && strtolower($properties ['UNICODE-BIDI']) == 'isolate-override') {
|
993 |
+
if ($currdir == 'rtl') {
|
994 |
+
$bdf = 0x2067;
|
995 |
+
$bdf2 = 0x202E;
|
996 |
+
$popd = 'RLIRLOPDFPDI';
|
997 |
+
} // U+2067 RLI // U+202E RLO
|
998 |
+
else {
|
999 |
+
$bdf = 0x2066;
|
1000 |
+
$bdf2 = 0x202D;
|
1001 |
+
$popd = 'LRILROPDFPDI';
|
1002 |
+
} // U+2066 LRI // U+202D LRO
|
1003 |
+
} else if (isset($properties ['UNICODE-BIDI']) && strtolower($properties ['UNICODE-BIDI']) == 'plaintext') {
|
1004 |
+
$bdf = 0x2068;
|
1005 |
+
$popd = 'FSIPDI'; // U+2068 FSI
|
1006 |
+
} else {
|
1007 |
+
if (isset($attr['DIR']) and strtolower($attr['DIR']) == 'rtl') {
|
1008 |
+
$bdf = 0x202B;
|
1009 |
+
$popd = 'RLEPDF';
|
1010 |
+
} // U+202B RLE
|
1011 |
+
else if (isset($attr['DIR']) and strtolower($attr['DIR']) == 'ltr') {
|
1012 |
+
$bdf = 0x202A;
|
1013 |
+
$popd = 'LREPDF';
|
1014 |
+
} // U+202A LRE
|
1015 |
+
}
|
1016 |
+
|
1017 |
+
if ($bdf) {
|
1018 |
+
// mPDF 5.7.3 Inline tags
|
1019 |
+
if (!isset($this->mpdf->InlineBDF[$tag])) {
|
1020 |
+
$this->mpdf->InlineBDF[$tag] = array(array($popd, $this->mpdf->InlineBDFctr));
|
1021 |
+
} else {
|
1022 |
+
$this->mpdf->InlineBDF[$tag][] = array($popd, $this->mpdf->InlineBDFctr);
|
1023 |
+
}
|
1024 |
+
$this->mpdf->InlineBDFctr++;
|
1025 |
+
if ($bdf2) {
|
1026 |
+
$bdf2 = code2utf($bdf);
|
1027 |
+
}
|
1028 |
+
$this->mpdf->OTLdata = array();
|
1029 |
+
if ($this->mpdf->tableLevel) {
|
1030 |
+
$this->mpdf->_saveCellTextBuffer(code2utf($bdf) . $bdf2);
|
1031 |
+
} else {
|
1032 |
+
$this->mpdf->_saveTextBuffer(code2utf($bdf) . $bdf2);
|
1033 |
+
}
|
1034 |
+
$this->mpdf->biDirectional = true;
|
1035 |
+
}
|
1036 |
+
|
1037 |
+
break;
|
1038 |
+
|
1039 |
+
|
1040 |
+
case 'A':
|
1041 |
+
if (isset($attr['NAME']) and $attr['NAME'] != '') {
|
1042 |
+
$e = '';
|
1043 |
+
/* -- BOOKMARKS -- */
|
1044 |
+
if ($this->mpdf->anchor2Bookmark) {
|
1045 |
+
$objattr = array();
|
1046 |
+
$objattr['CONTENT'] = htmlspecialchars_decode($attr['NAME'], ENT_QUOTES);
|
1047 |
+
$objattr['type'] = 'bookmark';
|
1048 |
+
if (isset($attr['LEVEL']) && $attr['LEVEL']) {
|
1049 |
+
$objattr['bklevel'] = $attr['LEVEL'];
|
1050 |
+
} else {
|
1051 |
+
$objattr['bklevel'] = 0;
|
1052 |
+
}
|
1053 |
+
$e = "\xbb\xa4\xactype=bookmark,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
|
1054 |
+
}
|
1055 |
+
/* -- END BOOKMARKS -- */
|
1056 |
+
if ($this->mpdf->tableLevel) { // *TABLES*
|
1057 |
+
$this->mpdf->_saveCellTextBuffer($e, '', $attr['NAME']); // *TABLES*
|
1058 |
+
} // *TABLES*
|
1059 |
+
else { // *TABLES*
|
1060 |
+
$this->mpdf->_saveTextBuffer($e, '', $attr['NAME']); //an internal link (adds a space for recognition)
|
1061 |
+
} // *TABLES*
|
1062 |
+
}
|
1063 |
+
if (isset($attr['HREF'])) {
|
1064 |
+
$this->mpdf->InlineProperties['A'] = $this->mpdf->saveInlineProperties();
|
1065 |
+
$properties = $this->mpdf->cssmgr->MergeCSS('INLINE', $tag, $attr);
|
1066 |
+
if (!empty($properties))
|
1067 |
+
$this->mpdf->setCSS($properties, 'INLINE');
|
1068 |
+
$this->mpdf->HREF = $attr['HREF']; // mPDF 5.7.4 URLs
|
1069 |
+
}
|
1070 |
+
break;
|
1071 |
+
|
1072 |
+
case 'LEGEND':
|
1073 |
+
$this->mpdf->InlineProperties['LEGEND'] = $this->mpdf->saveInlineProperties();
|
1074 |
+
$properties = $this->mpdf->cssmgr->MergeCSS('INLINE', $tag, $attr);
|
1075 |
+
if (!empty($properties))
|
1076 |
+
$this->mpdf->setCSS($properties, 'INLINE');
|
1077 |
+
break;
|
1078 |
+
|
1079 |
+
|
1080 |
+
|
1081 |
+
case 'PROGRESS':
|
1082 |
+
case 'METER':
|
1083 |
+
$this->mpdf->inMeter = true;
|
1084 |
+
|
1085 |
+
if (isset($attr['MAX']) && $attr['MAX']) {
|
1086 |
+
$max = $attr['MAX'];
|
1087 |
+
} else {
|
1088 |
+
$max = 1;
|
1089 |
+
}
|
1090 |
+
if (isset($attr['MIN']) && $attr['MIN'] && $tag == 'METER') {
|
1091 |
+
$min = $attr['MIN'];
|
1092 |
+
} else {
|
1093 |
+
$min = 0;
|
1094 |
+
}
|
1095 |
+
if ($max < $min) {
|
1096 |
+
$max = $min;
|
1097 |
+
}
|
1098 |
+
|
1099 |
+
if (isset($attr['VALUE']) && ($attr['VALUE'] || $attr['VALUE'] === '0')) {
|
1100 |
+
$value = $attr['VALUE'];
|
1101 |
+
if ($value < $min) {
|
1102 |
+
$value = $min;
|
1103 |
+
} else if ($value > $max) {
|
1104 |
+
$value = $max;
|
1105 |
+
}
|
1106 |
+
} else {
|
1107 |
+
$value = '';
|
1108 |
+
}
|
1109 |
+
|
1110 |
+
if (isset($attr['LOW']) && $attr['LOW']) {
|
1111 |
+
$low = $attr['LOW'];
|
1112 |
+
} else {
|
1113 |
+
$low = $min;
|
1114 |
+
}
|
1115 |
+
if ($low < $min) {
|
1116 |
+
$low = $min;
|
1117 |
+
} else if ($low > $max) {
|
1118 |
+
$low = $max;
|
1119 |
+
}
|
1120 |
+
if (isset($attr['HIGH']) && $attr['HIGH']) {
|
1121 |
+
$high = $attr['HIGH'];
|
1122 |
+
} else {
|
1123 |
+
$high = $max;
|
1124 |
+
}
|
1125 |
+
if ($high < $low) {
|
1126 |
+
$high = $low;
|
1127 |
+
} else if ($high > $max) {
|
1128 |
+
$high = $max;
|
1129 |
+
}
|
1130 |
+
if (isset($attr['OPTIMUM']) && $attr['OPTIMUM']) {
|
1131 |
+
$optimum = $attr['OPTIMUM'];
|
1132 |
+
} else {
|
1133 |
+
$optimum = $min + (($max - $min) / 2);
|
1134 |
+
}
|
1135 |
+
if ($optimum < $min) {
|
1136 |
+
$optimum = $min;
|
1137 |
+
} else if ($optimum > $max) {
|
1138 |
+
$optimum = $max;
|
1139 |
+
}
|
1140 |
+
if (isset($attr['TYPE']) && $attr['TYPE']) {
|
1141 |
+
$type = $attr['TYPE'];
|
1142 |
+
} else {
|
1143 |
+
$type = '';
|
1144 |
+
}
|
1145 |
+
$objattr = array();
|
1146 |
+
$objattr['margin_top'] = 0;
|
1147 |
+
$objattr['margin_bottom'] = 0;
|
1148 |
+
$objattr['margin_left'] = 0;
|
1149 |
+
$objattr['margin_right'] = 0;
|
1150 |
+
$objattr['padding_top'] = 0;
|
1151 |
+
$objattr['padding_bottom'] = 0;
|
1152 |
+
$objattr['padding_left'] = 0;
|
1153 |
+
$objattr['padding_right'] = 0;
|
1154 |
+
$objattr['width'] = 0;
|
1155 |
+
$objattr['height'] = 0;
|
1156 |
+
$objattr['border_top']['w'] = 0;
|
1157 |
+
$objattr['border_bottom']['w'] = 0;
|
1158 |
+
$objattr['border_left']['w'] = 0;
|
1159 |
+
$objattr['border_right']['w'] = 0;
|
1160 |
+
|
1161 |
+
$properties = $this->mpdf->cssmgr->MergeCSS('INLINE', $tag, $attr);
|
1162 |
+
if (isset($properties ['DISPLAY']) && strtolower($properties ['DISPLAY']) == 'none') {
|
1163 |
+
return;
|
1164 |
+
}
|
1165 |
+
$objattr['visibility'] = 'visible';
|
1166 |
+
if (isset($properties['VISIBILITY'])) {
|
1167 |
+
$v = strtolower($properties['VISIBILITY']);
|
1168 |
+
if (($v == 'hidden' || $v == 'printonly' || $v == 'screenonly') && $this->mpdf->visibility == 'visible') {
|
1169 |
+
$objattr['visibility'] = $v;
|
1170 |
+
}
|
1171 |
+
}
|
1172 |
+
|
1173 |
+
if (isset($properties['MARGIN-TOP'])) {
|
1174 |
+
$objattr['margin_top'] = $this->mpdf->ConvertSize($properties['MARGIN-TOP'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
1175 |
+
}
|
1176 |
+
if (isset($properties['MARGIN-BOTTOM'])) {
|
1177 |
+
$objattr['margin_bottom'] = $this->mpdf->ConvertSize($properties['MARGIN-BOTTOM'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
1178 |
+
}
|
1179 |
+
if (isset($properties['MARGIN-LEFT'])) {
|
1180 |
+
$objattr['margin_left'] = $this->mpdf->ConvertSize($properties['MARGIN-LEFT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
1181 |
+
}
|
1182 |
+
if (isset($properties['MARGIN-RIGHT'])) {
|
1183 |
+
$objattr['margin_right'] = $this->mpdf->ConvertSize($properties['MARGIN-RIGHT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
1184 |
+
}
|
1185 |
+
|
1186 |
+
if (isset($properties['PADDING-TOP'])) {
|
1187 |
+
$objattr['padding_top'] = $this->mpdf->ConvertSize($properties['PADDING-TOP'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
1188 |
+
}
|
1189 |
+
if (isset($properties['PADDING-BOTTOM'])) {
|
1190 |
+
$objattr['padding_bottom'] = $this->mpdf->ConvertSize($properties['PADDING-BOTTOM'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
1191 |
+
}
|
1192 |
+
if (isset($properties['PADDING-LEFT'])) {
|
1193 |
+
$objattr['padding_left'] = $this->mpdf->ConvertSize($properties['PADDING-LEFT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
1194 |
+
}
|
1195 |
+
if (isset($properties['PADDING-RIGHT'])) {
|
1196 |
+
$objattr['padding_right'] = $this->mpdf->ConvertSize($properties['PADDING-RIGHT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
1197 |
+
}
|
1198 |
+
|
1199 |
+
if (isset($properties['BORDER-TOP'])) {
|
1200 |
+
$objattr['border_top'] = $this->mpdf->border_details($properties['BORDER-TOP']);
|
1201 |
+
}
|
1202 |
+
if (isset($properties['BORDER-BOTTOM'])) {
|
1203 |
+
$objattr['border_bottom'] = $this->mpdf->border_details($properties['BORDER-BOTTOM']);
|
1204 |
+
}
|
1205 |
+
if (isset($properties['BORDER-LEFT'])) {
|
1206 |
+
$objattr['border_left'] = $this->mpdf->border_details($properties['BORDER-LEFT']);
|
1207 |
+
}
|
1208 |
+
if (isset($properties['BORDER-RIGHT'])) {
|
1209 |
+
$objattr['border_right'] = $this->mpdf->border_details($properties['BORDER-RIGHT']);
|
1210 |
+
}
|
1211 |
+
|
1212 |
+
if (isset($properties['VERTICAL-ALIGN'])) {
|
1213 |
+
$objattr['vertical-align'] = $align[strtolower($properties['VERTICAL-ALIGN'])];
|
1214 |
+
}
|
1215 |
+
$w = 0;
|
1216 |
+
$h = 0;
|
1217 |
+
if (isset($properties['WIDTH']))
|
1218 |
+
$w = $this->mpdf->ConvertSize($properties['WIDTH'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
1219 |
+
else if (isset($attr['WIDTH']))
|
1220 |
+
$w = $this->mpdf->ConvertSize($attr['WIDTH'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
1221 |
+
|
1222 |
+
if (isset($properties['HEIGHT']))
|
1223 |
+
$h = $this->mpdf->ConvertSize($properties['HEIGHT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
1224 |
+
else if (isset($attr['HEIGHT']))
|
1225 |
+
$h = $this->mpdf->ConvertSize($attr['HEIGHT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
1226 |
+
|
1227 |
+
if (isset($properties['OPACITY']) && $properties['OPACITY'] > 0 && $properties['OPACITY'] <= 1) {
|
1228 |
+
$objattr['opacity'] = $properties['OPACITY'];
|
1229 |
+
}
|
1230 |
+
if ($this->mpdf->HREF) {
|
1231 |
+
if (strpos($this->mpdf->HREF, ".") === false && strpos($this->mpdf->HREF, "@") !== 0) {
|
1232 |
+
$href = $this->mpdf->HREF;
|
1233 |
+
while (array_key_exists($href, $this->mpdf->internallink))
|
1234 |
+
$href = "#" . $href;
|
1235 |
+
$this->mpdf->internallink[$href] = $this->mpdf->AddLink();
|
1236 |
+
$objattr['link'] = $this->mpdf->internallink[$href];
|
1237 |
+
} else {
|
1238 |
+
$objattr['link'] = $this->mpdf->HREF;
|
1239 |
+
}
|
1240 |
+
}
|
1241 |
+
$extraheight = $objattr['padding_top'] + $objattr['padding_bottom'] + $objattr['margin_top'] + $objattr['margin_bottom'] + $objattr['border_top']['w'] + $objattr['border_bottom']['w'];
|
1242 |
+
$extrawidth = $objattr['padding_left'] + $objattr['padding_right'] + $objattr['margin_left'] + $objattr['margin_right'] + $objattr['border_left']['w'] + $objattr['border_right']['w'];
|
1243 |
+
|
1244 |
+
// Image file
|
1245 |
+
if (!class_exists('meter', false)) {
|
1246 |
+
include(_MPDF_PATH . 'classes/meter.php');
|
1247 |
+
}
|
1248 |
+
$this->mpdf->meter = new meter();
|
1249 |
+
$svg = $this->mpdf->meter->makeSVG(strtolower($tag), $type, $value, $max, $min, $optimum, $low, $high);
|
1250 |
+
//Save to local file
|
1251 |
+
$srcpath = _MPDF_TEMP_PATH . '_tempSVG' . uniqid(rand(1, 100000), true) . '_' . strtolower($tag) . '.svg';
|
1252 |
+
file_put_contents($srcpath, $svg);
|
1253 |
+
$orig_srcpath = $srcpath;
|
1254 |
+
$this->mpdf->GetFullPath($srcpath);
|
1255 |
+
|
1256 |
+
$info = $this->mpdf->_getImage($srcpath, true, true, $orig_srcpath);
|
1257 |
+
if (!$info) {
|
1258 |
+
$info = $this->mpdf->_getImage($this->mpdf->noImageFile);
|
1259 |
+
if ($info) {
|
1260 |
+
$srcpath = $this->mpdf->noImageFile;
|
1261 |
+
$w = ($info['w'] * (25.4 / $this->mpdf->dpi));
|
1262 |
+
$h = ($info['h'] * (25.4 / $this->mpdf->dpi));
|
1263 |
+
}
|
1264 |
+
}
|
1265 |
+
if (!$info)
|
1266 |
+
break;
|
1267 |
+
|
1268 |
+
$objattr['file'] = $srcpath;
|
1269 |
+
//Default width and height calculation if needed
|
1270 |
+
if ($w == 0 and $h == 0) {
|
1271 |
+
// SVG units are pixels
|
1272 |
+
$w = $this->mpdf->FontSize / (10 / _MPDFK) * abs($info['w']) / _MPDFK;
|
1273 |
+
$h = $this->mpdf->FontSize / (10 / _MPDFK) * abs($info['h']) / _MPDFK;
|
1274 |
+
}
|
1275 |
+
// IF WIDTH OR HEIGHT SPECIFIED
|
1276 |
+
if ($w == 0)
|
1277 |
+
$w = abs($h * $info['w'] / $info['h']);
|
1278 |
+
if ($h == 0)
|
1279 |
+
$h = abs($w * $info['h'] / $info['w']);
|
1280 |
+
|
1281 |
+
// Resize to maximum dimensions of page
|
1282 |
+
$maxWidth = $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'];
|
1283 |
+
$maxHeight = $this->mpdf->h - ($this->mpdf->tMargin + $this->mpdf->bMargin + 1);
|
1284 |
+
if ($this->mpdf->fullImageHeight) {
|
1285 |
+
$maxHeight = $this->mpdf->fullImageHeight;
|
1286 |
+
}
|
1287 |
+
if (($w + $extrawidth) > ($maxWidth + 0.0001)) { // mPDF 5.7.4 0.0001 to allow for rounding errors when w==maxWidth
|
1288 |
+
$w = $maxWidth - $extrawidth;
|
1289 |
+
$h = abs($w * $info['h'] / $info['w']);
|
1290 |
+
}
|
1291 |
+
|
1292 |
+
if ($h + $extraheight > $maxHeight) {
|
1293 |
+
$h = $maxHeight - $extraheight;
|
1294 |
+
$w = abs($h * $info['w'] / $info['h']);
|
1295 |
+
}
|
1296 |
+
$objattr['type'] = 'image';
|
1297 |
+
$objattr['itype'] = $info['type'];
|
1298 |
+
|
1299 |
+
$objattr['orig_h'] = $info['h'];
|
1300 |
+
$objattr['orig_w'] = $info['w'];
|
1301 |
+
$objattr['wmf_x'] = $info['x'];
|
1302 |
+
$objattr['wmf_y'] = $info['y'];
|
1303 |
+
$objattr['height'] = $h + $extraheight;
|
1304 |
+
$objattr['width'] = $w + $extrawidth;
|
1305 |
+
$objattr['image_height'] = $h;
|
1306 |
+
$objattr['image_width'] = $w;
|
1307 |
+
$e = "\xbb\xa4\xactype=image,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
|
1308 |
+
$properties = array();
|
1309 |
+
if ($this->mpdf->tableLevel) {
|
1310 |
+
$this->mpdf->_saveCellTextBuffer($e, $this->mpdf->HREF);
|
1311 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s'] += $objattr['width'];
|
1312 |
+
} else {
|
1313 |
+
$this->mpdf->_saveTextBuffer($e, $this->mpdf->HREF);
|
1314 |
+
}
|
1315 |
+
|
1316 |
+
break;
|
1317 |
+
|
1318 |
+
|
1319 |
+
case 'BR':
|
1320 |
+
// Added mPDF 3.0 Float DIV - CLEAR
|
1321 |
+
if (isset($attr['STYLE'])) {
|
1322 |
+
$properties = $this->mpdf->cssmgr->readInlineCSS($attr['STYLE']);
|
1323 |
+
if (isset($properties['CLEAR'])) {
|
1324 |
+
$this->mpdf->ClearFloats(strtoupper($properties['CLEAR']), $this->mpdf->blklvl);
|
1325 |
+
} // *CSS-FLOAT*
|
1326 |
+
}
|
1327 |
+
|
1328 |
+
// mPDF 6 bidi
|
1329 |
+
// Inline
|
1330 |
+
// If unicode-bidi set, any embedding levels, isolates, or overrides started by the inline box are closed at the br and reopened on the other side
|
1331 |
+
$blockpre = '';
|
1332 |
+
$blockpost = '';
|
1333 |
+
if (isset($this->mpdf->blk[$this->mpdf->blklvl]['bidicode'])) {
|
1334 |
+
$blockpre = $this->mpdf->_setBidiCodes('end', $this->mpdf->blk[$this->mpdf->blklvl]['bidicode']);
|
1335 |
+
$blockpost = $this->mpdf->_setBidiCodes('start', $this->mpdf->blk[$this->mpdf->blklvl]['bidicode']);
|
1336 |
+
}
|
1337 |
+
|
1338 |
+
// Inline
|
1339 |
+
// If unicode-bidi set, any embedding levels, isolates, or overrides started by the inline box are closed at the br and reopened on the other side
|
1340 |
+
$inlinepre = '';
|
1341 |
+
$inlinepost = '';
|
1342 |
+
$iBDF = array();
|
1343 |
+
if (count($this->mpdf->InlineBDF)) {
|
1344 |
+
foreach ($this->mpdf->InlineBDF AS $k => $ib) {
|
1345 |
+
foreach ($ib AS $ib2) {
|
1346 |
+
$iBDF[$ib2[1]] = $ib2[0];
|
1347 |
+
}
|
1348 |
+
}
|
1349 |
+
if (count($iBDF)) {
|
1350 |
+
ksort($iBDF);
|
1351 |
+
for ($i = count($iBDF) - 1; $i >= 0; $i--) {
|
1352 |
+
$inlinepre .= $this->mpdf->_setBidiCodes('end', $iBDF[$i]);
|
1353 |
+
}
|
1354 |
+
for ($i = 0; $i < count($iBDF); $i++) {
|
1355 |
+
$inlinepost .= $this->mpdf->_setBidiCodes('start', $iBDF[$i]);
|
1356 |
+
}
|
1357 |
+
}
|
1358 |
+
}
|
1359 |
+
|
1360 |
+
/* -- TABLES -- */
|
1361 |
+
if ($this->mpdf->tableLevel) {
|
1362 |
+
|
1363 |
+
if ($this->mpdf->blockjustfinished) {
|
1364 |
+
$this->mpdf->_saveCellTextBuffer($blockpre . $inlinepre . "\n" . $inlinepost . $blockpost);
|
1365 |
+
}
|
1366 |
+
|
1367 |
+
$this->mpdf->_saveCellTextBuffer($blockpre . $inlinepre . "\n" . $inlinepost . $blockpost);
|
1368 |
+
if (!isset($this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['maxs'])) {
|
1369 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['maxs'] = $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s'];
|
1370 |
+
} elseif ($this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['maxs'] < $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s']) {
|
1371 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['maxs'] = $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s'];
|
1372 |
+
}
|
1373 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s'] = 0; // reset
|
1374 |
+
} else {
|
1375 |
+
/* -- END TABLES -- */
|
1376 |
+
if (count($this->mpdf->textbuffer)) {
|
1377 |
+
$this->mpdf->textbuffer[count($this->mpdf->textbuffer) - 1][0] = preg_replace('/ $/', '', $this->mpdf->textbuffer[count($this->mpdf->textbuffer) - 1][0]);
|
1378 |
+
if (!empty($this->mpdf->textbuffer[count($this->mpdf->textbuffer) - 1][18])) {
|
1379 |
+
$this->mpdf->otl->trimOTLdata($this->mpdf->textbuffer[count($this->mpdf->textbuffer) - 1][18], false, true);
|
1380 |
+
} // *OTL*
|
1381 |
+
}
|
1382 |
+
$this->mpdf->_saveTextBuffer($blockpre . $inlinepre . "\n" . $inlinepost . $blockpost);
|
1383 |
+
} // *TABLES*
|
1384 |
+
$this->mpdf->ignorefollowingspaces = true;
|
1385 |
+
$this->mpdf->blockjustfinished = false;
|
1386 |
+
|
1387 |
+
$this->mpdf->linebreakjustfinished = true;
|
1388 |
+
break;
|
1389 |
+
|
1390 |
+
|
1391 |
+
// *********** BLOCKS ********************
|
1392 |
+
|
1393 |
+
|
1394 |
+
case 'PRE':
|
1395 |
+
$this->mpdf->ispre = true; // ADDED - Prevents left trim of textbuffer in printbuffer()
|
1396 |
+
|
1397 |
+
case 'DIV':
|
1398 |
+
case 'FORM':
|
1399 |
+
case 'CENTER':
|
1400 |
+
|
1401 |
+
case 'BLOCKQUOTE':
|
1402 |
+
case 'ADDRESS':
|
1403 |
+
|
1404 |
+
case 'CAPTION':
|
1405 |
+
case 'P':
|
1406 |
+
case 'H1':
|
1407 |
+
case 'H2':
|
1408 |
+
case 'H3':
|
1409 |
+
case 'H4':
|
1410 |
+
case 'H5':
|
1411 |
+
case 'H6':
|
1412 |
+
case 'DL':
|
1413 |
+
case 'DT':
|
1414 |
+
case 'DD':
|
1415 |
+
case 'UL': // mPDF 6 Lists
|
1416 |
+
case 'OL': // mPDF 6
|
1417 |
+
case 'LI': // mPDF 6
|
1418 |
+
case 'FIELDSET':
|
1419 |
+
case 'DETAILS':
|
1420 |
+
case 'SUMMARY':
|
1421 |
+
case 'ARTICLE':
|
1422 |
+
case 'ASIDE':
|
1423 |
+
case 'FIGURE':
|
1424 |
+
case 'FIGCAPTION':
|
1425 |
+
case 'FOOTER':
|
1426 |
+
case 'HEADER':
|
1427 |
+
case 'HGROUP':
|
1428 |
+
case 'NAV':
|
1429 |
+
case 'SECTION':
|
1430 |
+
case 'MAIN':
|
1431 |
+
// mPDF 6 Lists
|
1432 |
+
$this->mpdf->lastoptionaltag = '';
|
1433 |
+
|
1434 |
+
// mPDF 6 bidi
|
1435 |
+
// Block
|
1436 |
+
// If unicode-bidi set on current clock, any embedding levels, isolates, or overrides are closed (not inherited)
|
1437 |
+
if (isset($this->mpdf->blk[$this->mpdf->blklvl]['bidicode'])) {
|
1438 |
+
$blockpost = $this->mpdf->_setBidiCodes('end', $this->mpdf->blk[$this->mpdf->blklvl]['bidicode']);
|
1439 |
+
if ($blockpost) {
|
1440 |
+
$this->mpdf->OTLdata = array();
|
1441 |
+
if ($this->mpdf->tableLevel) {
|
1442 |
+
$this->mpdf->_saveCellTextBuffer($blockpost);
|
1443 |
+
} else {
|
1444 |
+
$this->mpdf->_saveTextBuffer($blockpost);
|
1445 |
+
}
|
1446 |
+
}
|
1447 |
+
}
|
1448 |
+
|
1449 |
+
|
1450 |
+
$p = $this->mpdf->cssmgr->PreviewBlockCSS($tag, $attr);
|
1451 |
+
if (isset($p['DISPLAY']) && strtolower($p['DISPLAY']) == 'none') {
|
1452 |
+
$this->mpdf->blklvl++;
|
1453 |
+
$this->mpdf->blk[$this->mpdf->blklvl]['hide'] = true;
|
1454 |
+
$this->mpdf->blk[$this->mpdf->blklvl]['tag'] = $tag; // mPDF 6
|
1455 |
+
return;
|
1456 |
+
}
|
1457 |
+
if ($tag == 'CAPTION') {
|
1458 |
+
// position is written in AdjstHTML
|
1459 |
+
if (isset($attr['POSITION']) && strtolower($attr['POSITION']) == 'bottom') {
|
1460 |
+
$divpos = 'B';
|
1461 |
+
} else {
|
1462 |
+
$divpos = 'T';
|
1463 |
+
}
|
1464 |
+
if (isset($attr['ALIGN']) && strtolower($attr['ALIGN']) == 'bottom') {
|
1465 |
+
$cappos = 'B';
|
1466 |
+
} else if (isset($p['CAPTION-SIDE']) && strtolower($p['CAPTION-SIDE']) == 'bottom') {
|
1467 |
+
$cappos = 'B';
|
1468 |
+
} else {
|
1469 |
+
$cappos = 'T';
|
1470 |
+
}
|
1471 |
+
if (isset($attr['ALIGN'])) {
|
1472 |
+
unset($attr['ALIGN']);
|
1473 |
+
}
|
1474 |
+
if ($cappos != $divpos) {
|
1475 |
+
$this->mpdf->blklvl++;
|
1476 |
+
$this->mpdf->blk[$this->mpdf->blklvl]['hide'] = true;
|
1477 |
+
$this->mpdf->blk[$this->mpdf->blklvl]['tag'] = $tag; // mPDF 6
|
1478 |
+
return;
|
1479 |
+
}
|
1480 |
+
}
|
1481 |
+
|
1482 |
+
/* -- FORMS -- */
|
1483 |
+
if ($tag == 'FORM') {
|
1484 |
+
if (isset($attr['METHOD']) && strtolower($attr['METHOD']) == 'get') {
|
1485 |
+
$this->mpdf->mpdfform->formMethod = 'GET';
|
1486 |
+
} else {
|
1487 |
+
$this->mpdf->mpdfform->formMethod = 'POST';
|
1488 |
+
}
|
1489 |
+
if (isset($attr['ACTION'])) {
|
1490 |
+
$this->mpdf->mpdfform->formAction = $attr['ACTION'];
|
1491 |
+
} else {
|
1492 |
+
$this->mpdf->mpdfform->formAction = '';
|
1493 |
+
}
|
1494 |
+
}
|
1495 |
+
/* -- END FORMS -- */
|
1496 |
+
|
1497 |
+
|
1498 |
+
/* -- CSS-POSITION -- */
|
1499 |
+
if ((isset($p['POSITION']) && (strtolower($p['POSITION']) == 'fixed' || strtolower($p['POSITION']) == 'absolute')) && $this->mpdf->blklvl == 0) {
|
1500 |
+
if ($this->mpdf->inFixedPosBlock) {
|
1501 |
+
throw new MpdfException("Cannot nest block with position:fixed or position:absolute");
|
1502 |
+
}
|
1503 |
+
$this->mpdf->inFixedPosBlock = true;
|
1504 |
+
return;
|
1505 |
+
}
|
1506 |
+
/* -- END CSS-POSITION -- */
|
1507 |
+
// Start Block
|
1508 |
+
$this->mpdf->ignorefollowingspaces = true;
|
1509 |
+
|
1510 |
+
if ($this->mpdf->blockjustfinished && !count($this->mpdf->textbuffer) && $this->mpdf->y != $this->mpdf->tMargin && $this->mpdf->collapseBlockMargins) {
|
1511 |
+
$lastbottommargin = $this->mpdf->lastblockbottommargin;
|
1512 |
+
} else {
|
1513 |
+
$lastbottommargin = 0;
|
1514 |
+
}
|
1515 |
+
$this->mpdf->lastblockbottommargin = 0;
|
1516 |
+
$this->mpdf->blockjustfinished = false;
|
1517 |
+
|
1518 |
+
|
1519 |
+
$this->mpdf->InlineBDF = array(); // mPDF 6
|
1520 |
+
$this->mpdf->InlineBDFctr = 0; // mPDF 6
|
1521 |
+
$this->mpdf->InlineProperties = array();
|
1522 |
+
$this->mpdf->divbegin = true;
|
1523 |
+
|
1524 |
+
$this->mpdf->linebreakjustfinished = false;
|
1525 |
+
|
1526 |
+
/* -- TABLES -- */
|
1527 |
+
if ($this->mpdf->tableLevel) {
|
1528 |
+
// If already something on the line
|
1529 |
+
if ($this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s'] > 0 && !$this->mpdf->nestedtablejustfinished) {
|
1530 |
+
$this->mpdf->_saveCellTextBuffer("\n");
|
1531 |
+
if (!isset($this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['maxs'])) {
|
1532 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['maxs'] = $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s'];
|
1533 |
+
} elseif ($this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['maxs'] < $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s']) {
|
1534 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['maxs'] = $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s'];
|
1535 |
+
}
|
1536 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s'] = 0; // reset
|
1537 |
+
}
|
1538 |
+
// Cannot set block properties inside table - use Bold to indicate h1-h6
|
1539 |
+
if ($tag == 'CENTER' && $this->mpdf->tdbegin) {
|
1540 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['a'] = $align['center'];
|
1541 |
+
}
|
1542 |
+
|
1543 |
+
$this->mpdf->InlineProperties['BLOCKINTABLE'] = $this->mpdf->saveInlineProperties();
|
1544 |
+
$properties = $this->mpdf->cssmgr->MergeCSS('', $tag, $attr);
|
1545 |
+
if (!empty($properties))
|
1546 |
+
$this->mpdf->setCSS($properties, 'INLINE');
|
1547 |
+
|
1548 |
+
// mPDF 6 Lists
|
1549 |
+
if ($tag == 'UL' || $tag == 'OL') {
|
1550 |
+
$this->mpdf->listlvl++;
|
1551 |
+
if (isset($attr['START'])) {
|
1552 |
+
$this->mpdf->listcounter[$this->mpdf->listlvl] = intval($attr['START']) - 1;
|
1553 |
+
} else {
|
1554 |
+
$this->mpdf->listcounter[$this->mpdf->listlvl] = 0;
|
1555 |
+
}
|
1556 |
+
$this->mpdf->listitem = array();
|
1557 |
+
if ($tag == 'OL')
|
1558 |
+
$this->mpdf->listtype[$this->mpdf->listlvl] = 'decimal';
|
1559 |
+
else if ($tag == 'UL') {
|
1560 |
+
if ($this->mpdf->listlvl % 3 == 1)
|
1561 |
+
$this->mpdf->listtype[$this->mpdf->listlvl] = 'disc';
|
1562 |
+
elseif ($this->mpdf->listlvl % 3 == 2)
|
1563 |
+
$this->mpdf->listtype[$this->mpdf->listlvl] = 'circle';
|
1564 |
+
else
|
1565 |
+
$this->mpdf->listtype[$this->mpdf->listlvl] = 'square';
|
1566 |
+
}
|
1567 |
+
}
|
1568 |
+
|
1569 |
+
// mPDF 6 Lists - in Tables
|
1570 |
+
if ($tag == 'LI') {
|
1571 |
+
if ($this->mpdf->listlvl == 0) { //in case of malformed HTML code. Example:(...)</p><li>Content</li><p>Paragraph1</p>(...)
|
1572 |
+
$this->mpdf->listlvl++; // first depth level
|
1573 |
+
$this->mpdf->listcounter[$this->mpdf->listlvl] = 0;
|
1574 |
+
}
|
1575 |
+
$this->mpdf->listcounter[$this->mpdf->listlvl] ++;
|
1576 |
+
$this->mpdf->listitem = array();
|
1577 |
+
//if in table - output here as a tabletextbuffer
|
1578 |
+
//position:inside OR position:outside (always output in table as position:inside)
|
1579 |
+
switch ($this->mpdf->listtype[$this->mpdf->listlvl]) {
|
1580 |
+
case 'upper-alpha':
|
1581 |
+
case 'upper-latin':
|
1582 |
+
case 'A':
|
1583 |
+
$blt = $this->mpdf->dec2alpha($this->mpdf->listcounter[$this->mpdf->listlvl], true) . $this->mpdf->list_number_suffix;
|
1584 |
+
break;
|
1585 |
+
case 'lower-alpha':
|
1586 |
+
case 'lower-latin':
|
1587 |
+
case 'a':
|
1588 |
+
$blt = $this->mpdf->dec2alpha($this->mpdf->listcounter[$this->mpdf->listlvl], false) . $this->mpdf->list_number_suffix;
|
1589 |
+
break;
|
1590 |
+
case 'upper-roman':
|
1591 |
+
case 'I':
|
1592 |
+
$blt = $this->mpdf->dec2roman($this->mpdf->listcounter[$this->mpdf->listlvl], true) . $this->mpdf->list_number_suffix;
|
1593 |
+
break;
|
1594 |
+
case 'lower-roman':
|
1595 |
+
case 'i':
|
1596 |
+
$blt = $this->mpdf->dec2roman($this->mpdf->listcounter[$this->mpdf->listlvl], false) . $this->mpdf->list_number_suffix;
|
1597 |
+
break;
|
1598 |
+
case 'decimal':
|
1599 |
+
case '1':
|
1600 |
+
$blt = $this->mpdf->listcounter[$this->mpdf->listlvl] . $this->mpdf->list_number_suffix;
|
1601 |
+
break;
|
1602 |
+
default:
|
1603 |
+
if ($this->mpdf->listlvl % 3 == 1 && $this->mpdf->_charDefined($this->mpdf->CurrentFont['cw'], 8226)) {
|
1604 |
+
$blt = "\xe2\x80\xa2";
|
1605 |
+
} // •
|
1606 |
+
else if ($this->mpdf->listlvl % 3 == 2 && $this->mpdf->_charDefined($this->mpdf->CurrentFont['cw'], 9900)) {
|
1607 |
+
$blt = "\xe2\x9a\xac";
|
1608 |
+
} // ⚬
|
1609 |
+
else if ($this->mpdf->listlvl % 3 == 0 && $this->mpdf->_charDefined($this->mpdf->CurrentFont['cw'], 9642)) {
|
1610 |
+
$blt = "\xe2\x96\xaa";
|
1611 |
+
} // ▪
|
1612 |
+
else {
|
1613 |
+
$blt = '-';
|
1614 |
+
}
|
1615 |
+
break;
|
1616 |
+
}
|
1617 |
+
|
1618 |
+
// change to spaces
|
1619 |
+
if ($this->mpdf->usingCoreFont) {
|
1620 |
+
$ls = str_repeat(chr(160) . chr(160), ($this->mpdf->listlvl - 1) * 2) . $blt . ' ';
|
1621 |
+
} else {
|
1622 |
+
$ls = str_repeat("\xc2\xa0\xc2\xa0", ($this->mpdf->listlvl - 1) * 2) . $blt . ' ';
|
1623 |
+
}
|
1624 |
+
$this->mpdf->_saveCellTextBuffer($ls);
|
1625 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s'] += $this->mpdf->GetStringWidth($ls);
|
1626 |
+
}
|
1627 |
+
|
1628 |
+
break;
|
1629 |
+
}
|
1630 |
+
/* -- END TABLES -- */
|
1631 |
+
|
1632 |
+
if ($this->mpdf->lastblocklevelchange == 1) {
|
1633 |
+
$blockstate = 1;
|
1634 |
+
} // Top margins/padding only
|
1635 |
+
else if ($this->mpdf->lastblocklevelchange < 1) {
|
1636 |
+
$blockstate = 0;
|
1637 |
+
} // NO margins/padding
|
1638 |
+
$this->mpdf->printbuffer($this->mpdf->textbuffer, $blockstate);
|
1639 |
+
$this->mpdf->textbuffer = array();
|
1640 |
+
|
1641 |
+
$save_blklvl = $this->mpdf->blklvl;
|
1642 |
+
$save_blk = $this->mpdf->blk;
|
1643 |
+
|
1644 |
+
$this->mpdf->Reset();
|
1645 |
+
|
1646 |
+
$pagesel = '';
|
1647 |
+
/* -- CSS-PAGE -- */
|
1648 |
+
if (isset($p['PAGE'])) {
|
1649 |
+
$pagesel = $p['PAGE'];
|
1650 |
+
} // mPDF 6 (uses $p - preview of properties so blklvl can be incremented after page-break)
|
1651 |
+
/* -- END CSS-PAGE -- */
|
1652 |
+
|
1653 |
+
// If page-box has changed AND/OR PAGE-BREAK-BEFORE
|
1654 |
+
// mPDF 6 (uses $p - preview of properties so blklvl can be imcremented after page-break)
|
1655 |
+
if (!$this->mpdf->tableLevel && (($pagesel && (!isset($this->mpdf->page_box['current']) || $pagesel != $this->mpdf->page_box['current'])) || (isset($p['PAGE-BREAK-BEFORE']) && $p['PAGE-BREAK-BEFORE']))) {
|
1656 |
+
// mPDF 6 pagebreaktype
|
1657 |
+
$startpage = $this->mpdf->page;
|
1658 |
+
$pagebreaktype = $this->mpdf->defaultPagebreakType;
|
1659 |
+
$this->mpdf->lastblocklevelchange = -1;
|
1660 |
+
if ($this->mpdf->ColActive) {
|
1661 |
+
$pagebreaktype = 'cloneall';
|
1662 |
+
}
|
1663 |
+
if ($pagesel && (!isset($this->mpdf->page_box['current']) || $pagesel != $this->mpdf->page_box['current'])) {
|
1664 |
+
$pagebreaktype = 'cloneall';
|
1665 |
+
}
|
1666 |
+
$this->mpdf->_preForcedPagebreak($pagebreaktype);
|
1667 |
+
|
1668 |
+
if (isset($p['PAGE-BREAK-BEFORE'])) {
|
1669 |
+
if (strtoupper($p['PAGE-BREAK-BEFORE']) == 'RIGHT') {
|
1670 |
+
$this->mpdf->AddPage($this->mpdf->CurOrientation, 'NEXT-ODD', '', '', '', '', '', '', '', '', '', '', '', '', '', 0, 0, 0, 0, $pagesel);
|
1671 |
+
} else if (strtoupper($p['PAGE-BREAK-BEFORE']) == 'LEFT') {
|
1672 |
+
$this->mpdf->AddPage($this->mpdf->CurOrientation, 'NEXT-EVEN', '', '', '', '', '', '', '', '', '', '', '', '', '', 0, 0, 0, 0, $pagesel);
|
1673 |
+
} else if (strtoupper($p['PAGE-BREAK-BEFORE']) == 'ALWAYS') {
|
1674 |
+
$this->mpdf->AddPage($this->mpdf->CurOrientation, '', '', '', '', '', '', '', '', '', '', '', '', '', '', 0, 0, 0, 0, $pagesel);
|
1675 |
+
} else if ($this->mpdf->page_box['current'] != $pagesel) {
|
1676 |
+
$this->mpdf->AddPage($this->mpdf->CurOrientation, '', '', '', '', '', '', '', '', '', '', '', '', '', '', 0, 0, 0, 0, $pagesel);
|
1677 |
+
} // *CSS-PAGE*
|
1678 |
+
}
|
1679 |
+
/* -- CSS-PAGE -- */
|
1680 |
+
// Must Add new page if changed page properties
|
1681 |
+
else if (!isset($this->mpdf->page_box['current']) || $pagesel != $this->mpdf->page_box['current']) {
|
1682 |
+
$this->mpdf->AddPage($this->mpdf->CurOrientation, '', '', '', '', '', '', '', '', '', '', '', '', '', '', 0, 0, 0, 0, $pagesel);
|
1683 |
+
}
|
1684 |
+
/* -- END CSS-PAGE -- */
|
1685 |
+
|
1686 |
+
// mPDF 6 pagebreaktype
|
1687 |
+
$this->mpdf->_postForcedPagebreak($pagebreaktype, $startpage, $save_blk, $save_blklvl);
|
1688 |
+
}
|
1689 |
+
|
1690 |
+
// mPDF 6 pagebreaktype - moved after pagebreak
|
1691 |
+
$this->mpdf->blklvl++;
|
1692 |
+
$currblk = & $this->mpdf->blk[$this->mpdf->blklvl];
|
1693 |
+
$this->mpdf->initialiseBlock($currblk);
|
1694 |
+
$prevblk = & $this->mpdf->blk[$this->mpdf->blklvl - 1];
|
1695 |
+
$currblk['tag'] = $tag;
|
1696 |
+
$currblk['attr'] = $attr;
|
1697 |
+
|
1698 |
+
$properties = $this->mpdf->cssmgr->MergeCSS('BLOCK', $tag, $attr); // mPDF 6 - moved to after page-break-before
|
1699 |
+
// mPDF 6 page-break-inside:avoid
|
1700 |
+
if (isset($properties['PAGE-BREAK-INSIDE']) && strtoupper($properties['PAGE-BREAK-INSIDE']) == 'AVOID' && !$this->mpdf->ColActive && !$this->mpdf->keep_block_together && !isset($attr['PAGEBREAKAVOIDCHECKED'])) { // avoid re-iterating using PAGEBREAKAVOIDCHECKED; set in CloseTag
|
1701 |
+
$currblk['keep_block_together'] = 1;
|
1702 |
+
$currblk['array_i'] = $ihtml; // mPDF 6
|
1703 |
+
$this->mpdf->kt_y00 = $this->mpdf->y;
|
1704 |
+
$this->mpdf->kt_p00 = $this->mpdf->page;
|
1705 |
+
$this->mpdf->keep_block_together = 1;
|
1706 |
+
}
|
1707 |
+
if ($lastbottommargin && isset($properties['MARGIN-TOP']) && $properties['MARGIN-TOP'] && empty($properties['FLOAT'])) {
|
1708 |
+
$currblk['lastbottommargin'] = $lastbottommargin;
|
1709 |
+
}
|
1710 |
+
|
1711 |
+
if (isset($properties['Z-INDEX']) && $this->mpdf->current_layer == 0) {
|
1712 |
+
$v = intval($properties['Z-INDEX']);
|
1713 |
+
if ($v > 0) {
|
1714 |
+
$currblk['z-index'] = $v;
|
1715 |
+
$this->mpdf->BeginLayer($v);
|
1716 |
+
}
|
1717 |
+
}
|
1718 |
+
|
1719 |
+
|
1720 |
+
// mPDF 6 Lists
|
1721 |
+
// List-type set by attribute
|
1722 |
+
if ($tag == 'OL' || $tag == 'UL' || $tag == 'LI') {
|
1723 |
+
if (isset($attr['TYPE']) && $attr['TYPE']) {
|
1724 |
+
$listtype = $attr['TYPE'];
|
1725 |
+
switch ($listtype) {
|
1726 |
+
case 'A':
|
1727 |
+
$listtype = 'upper-latin';
|
1728 |
+
break;
|
1729 |
+
case 'a':
|
1730 |
+
$listtype = 'lower-latin';
|
1731 |
+
break;
|
1732 |
+
case 'I':
|
1733 |
+
$listtype = 'upper-roman';
|
1734 |
+
break;
|
1735 |
+
case 'i':
|
1736 |
+
$listtype = 'lower-roman';
|
1737 |
+
break;
|
1738 |
+
case '1':
|
1739 |
+
$listtype = 'decimal';
|
1740 |
+
break;
|
1741 |
+
}
|
1742 |
+
$currblk['list_style_type'] = $listtype;
|
1743 |
+
}
|
1744 |
+
}
|
1745 |
+
|
1746 |
+
$this->mpdf->setCSS($properties, 'BLOCK', $tag); //name(id/class/style) found in the CSS array!
|
1747 |
+
$currblk['InlineProperties'] = $this->mpdf->saveInlineProperties();
|
1748 |
+
|
1749 |
+
if (isset($properties['VISIBILITY'])) {
|
1750 |
+
$v = strtolower($properties['VISIBILITY']);
|
1751 |
+
if (($v == 'hidden' || $v == 'printonly' || $v == 'screenonly') && $this->mpdf->visibility == 'visible' && !$this->mpdf->tableLevel) {
|
1752 |
+
$currblk['visibility'] = $v;
|
1753 |
+
$this->mpdf->SetVisibility($v);
|
1754 |
+
}
|
1755 |
+
}
|
1756 |
+
|
1757 |
+
// mPDF 6
|
1758 |
+
if (isset($attr['ALIGN']) && $attr['ALIGN']) {
|
1759 |
+
$currblk['block-align'] = $align[strtolower($attr['ALIGN'])];
|
1760 |
+
}
|
1761 |
+
|
1762 |
+
|
1763 |
+
if (isset($properties['HEIGHT'])) {
|
1764 |
+
$currblk['css_set_height'] = $this->mpdf->ConvertSize($properties['HEIGHT'], ($this->mpdf->h - $this->mpdf->tMargin - $this->mpdf->bMargin), $this->mpdf->FontSize, false);
|
1765 |
+
if (($currblk['css_set_height'] + $this->mpdf->y) > $this->mpdf->PageBreakTrigger && $this->mpdf->y > $this->mpdf->tMargin + 5 && $currblk['css_set_height'] < ($this->mpdf->h - ($this->mpdf->tMargin + $this->mpdf->bMargin))) {
|
1766 |
+
$this->mpdf->AddPage($this->mpdf->CurOrientation);
|
1767 |
+
}
|
1768 |
+
} else {
|
1769 |
+
$currblk['css_set_height'] = false;
|
1770 |
+
}
|
1771 |
+
|
1772 |
+
|
1773 |
+
// Added mPDF 3.0 Float DIV
|
1774 |
+
if (isset($prevblk['blockContext'])) {
|
1775 |
+
$currblk['blockContext'] = $prevblk['blockContext'];
|
1776 |
+
} // *CSS-FLOAT*
|
1777 |
+
|
1778 |
+
if (isset($properties['CLEAR'])) {
|
1779 |
+
$this->mpdf->ClearFloats(strtoupper($properties['CLEAR']), $this->mpdf->blklvl - 1);
|
1780 |
+
} // *CSS-FLOAT*
|
1781 |
+
|
1782 |
+
$container_w = $prevblk['inner_width'];
|
1783 |
+
$bdr = $currblk['border_right']['w'];
|
1784 |
+
$bdl = $currblk['border_left']['w'];
|
1785 |
+
$pdr = $currblk['padding_right'];
|
1786 |
+
$pdl = $currblk['padding_left'];
|
1787 |
+
|
1788 |
+
if (isset($currblk['css_set_width'])) {
|
1789 |
+
$setwidth = $currblk['css_set_width'];
|
1790 |
+
} else {
|
1791 |
+
$setwidth = 0;
|
1792 |
+
}
|
1793 |
+
|
1794 |
+
/* -- CSS-FLOAT -- */
|
1795 |
+
if (isset($properties['FLOAT']) && strtoupper($properties['FLOAT']) == 'RIGHT' && !$this->mpdf->ColActive) {
|
1796 |
+
// Cancel Keep-Block-together
|
1797 |
+
$currblk['keep_block_together'] = false;
|
1798 |
+
$this->mpdf->kt_y00 = '';
|
1799 |
+
$this->mpdf->keep_block_together = 0;
|
1800 |
+
|
1801 |
+
$this->mpdf->blockContext++;
|
1802 |
+
$currblk['blockContext'] = $this->mpdf->blockContext;
|
1803 |
+
|
1804 |
+
list($l_exists, $r_exists, $l_max, $r_max, $l_width, $r_width) = $this->mpdf->GetFloatDivInfo($this->mpdf->blklvl - 1);
|
1805 |
+
|
1806 |
+
// DIV is too narrow for text to fit!
|
1807 |
+
$maxw = $container_w - $l_width - $r_width;
|
1808 |
+
if (($setwidth + $currblk['margin_right'] + $bdl + $pdl + $bdr + $pdr) > $maxw || ($maxw - ($currblk['margin_right'] + $bdl + $pdl + $bdr + $pdr)) < (2 * $this->mpdf->GetCharWidth('W', false))) {
|
1809 |
+
// Too narrow to fit - try to move down past L or R float
|
1810 |
+
if ($l_max < $r_max && ($setwidth + $currblk['margin_right'] + $bdl + $pdl + $bdr + $pdr) <= ($container_w - $r_width) && (($container_w - $r_width) - ($currblk['margin_right'] + $bdl + $pdl + $bdr + $pdr)) > (2 * $this->mpdf->GetCharWidth('W', false))) {
|
1811 |
+
$this->mpdf->ClearFloats('LEFT', $this->mpdf->blklvl - 1);
|
1812 |
+
} else if ($r_max < $l_max && ($setwidth + $currblk['margin_right'] + $bdl + $pdl + $bdr + $pdr) <= ($container_w - $l_width) && (($container_w - $l_width) - ($currblk['margin_right'] + $bdl + $pdl + $bdr + $pdr)) > (2 * $this->mpdf->GetCharWidth('W', false))) {
|
1813 |
+
$this->mpdf->ClearFloats('RIGHT', $this->mpdf->blklvl - 1);
|
1814 |
+
} else {
|
1815 |
+
$this->mpdf->ClearFloats('BOTH', $this->mpdf->blklvl - 1);
|
1816 |
+
}
|
1817 |
+
list($l_exists, $r_exists, $l_max, $r_max, $l_width, $r_width) = $this->mpdf->GetFloatDivInfo($this->mpdf->blklvl - 1);
|
1818 |
+
}
|
1819 |
+
|
1820 |
+
if ($r_exists) {
|
1821 |
+
$currblk['margin_right'] += $r_width;
|
1822 |
+
}
|
1823 |
+
|
1824 |
+
$currblk['float'] = 'R';
|
1825 |
+
$currblk['float_start_y'] = $this->mpdf->y;
|
1826 |
+
if ($currblk['css_set_width']) {
|
1827 |
+
$currblk['margin_left'] = $container_w - ($setwidth + $bdl + $pdl + $bdr + $pdr + $currblk['margin_right']);
|
1828 |
+
$currblk['float_width'] = ($setwidth + $bdl + $pdl + $bdr + $pdr + $currblk['margin_right']);
|
1829 |
+
} else {
|
1830 |
+
// *** If no width set - would need to buffer and keep track of max width, then Right-align if not full width
|
1831 |
+
// and do borders and backgrounds - For now - just set to maximum width left
|
1832 |
+
|
1833 |
+
if ($l_exists) {
|
1834 |
+
$currblk['margin_left'] += $l_width;
|
1835 |
+
}
|
1836 |
+
$currblk['css_set_width'] = $container_w - ($currblk['margin_left'] + $currblk['margin_right'] + $bdl + $pdl + $bdr + $pdr);
|
1837 |
+
|
1838 |
+
$currblk['float_width'] = ($currblk['css_set_width'] + $bdl + $pdl + $bdr + $pdr + $currblk['margin_right']);
|
1839 |
+
}
|
1840 |
+
} else if (isset($properties['FLOAT']) && strtoupper($properties['FLOAT']) == 'LEFT' && !$this->mpdf->ColActive) {
|
1841 |
+
// Cancel Keep-Block-together
|
1842 |
+
$currblk['keep_block_together'] = false;
|
1843 |
+
$this->mpdf->kt_y00 = '';
|
1844 |
+
$this->mpdf->keep_block_together = 0;
|
1845 |
+
|
1846 |
+
$this->mpdf->blockContext++;
|
1847 |
+
$currblk['blockContext'] = $this->mpdf->blockContext;
|
1848 |
+
|
1849 |
+
list($l_exists, $r_exists, $l_max, $r_max, $l_width, $r_width) = $this->mpdf->GetFloatDivInfo($this->mpdf->blklvl - 1);
|
1850 |
+
|
1851 |
+
// DIV is too narrow for text to fit!
|
1852 |
+
$maxw = $container_w - $l_width - $r_width;
|
1853 |
+
if (($setwidth + $currblk['margin_left'] + $bdl + $pdl + $bdr + $pdr) > $maxw || ($maxw - ($currblk['margin_left'] + $bdl + $pdl + $bdr + $pdr)) < (2 * $this->mpdf->GetCharWidth('W', false))) {
|
1854 |
+
// Too narrow to fit - try to move down past L or R float
|
1855 |
+
if ($l_max < $r_max && ($setwidth + $currblk['margin_right'] + $bdl + $pdl + $bdr + $pdr) <= ($container_w - $r_width) && (($container_w - $r_width) - ($currblk['margin_right'] + $bdl + $pdl + $bdr + $pdr)) > (2 * $this->mpdf->GetCharWidth('W', false))) {
|
1856 |
+
$this->mpdf->ClearFloats('LEFT', $this->mpdf->blklvl - 1);
|
1857 |
+
} else if ($r_max < $l_max && ($setwidth + $currblk['margin_right'] + $bdl + $pdl + $bdr + $pdr) <= ($container_w - $l_width) && (($container_w - $l_width) - ($currblk['margin_right'] + $bdl + $pdl + $bdr + $pdr)) > (2 * $this->mpdf->GetCharWidth('W', false))) {
|
1858 |
+
$this->mpdf->ClearFloats('RIGHT', $this->mpdf->blklvl - 1);
|
1859 |
+
} else {
|
1860 |
+
$this->mpdf->ClearFloats('BOTH', $this->mpdf->blklvl - 1);
|
1861 |
+
}
|
1862 |
+
list($l_exists, $r_exists, $l_max, $r_max, $l_width, $r_width) = $this->mpdf->GetFloatDivInfo($this->mpdf->blklvl - 1);
|
1863 |
+
}
|
1864 |
+
|
1865 |
+
if ($l_exists) {
|
1866 |
+
$currblk['margin_left'] += $l_width;
|
1867 |
+
}
|
1868 |
+
|
1869 |
+
$currblk['float'] = 'L';
|
1870 |
+
$currblk['float_start_y'] = $this->mpdf->y;
|
1871 |
+
if ($setwidth) {
|
1872 |
+
$currblk['margin_right'] = $container_w - ($setwidth + $bdl + $pdl + $bdr + $pdr + $currblk['margin_left']);
|
1873 |
+
$currblk['float_width'] = ($setwidth + $bdl + $pdl + $bdr + $pdr + $currblk['margin_left']);
|
1874 |
+
} else {
|
1875 |
+
// *** If no width set - would need to buffer and keep track of max width, then Right-align if not full width
|
1876 |
+
// and do borders and backgrounds - For now - just set to maximum width left
|
1877 |
+
|
1878 |
+
if ($r_exists) {
|
1879 |
+
$currblk['margin_right'] += $r_width;
|
1880 |
+
}
|
1881 |
+
$currblk['css_set_width'] = $container_w - ($currblk['margin_left'] + $currblk['margin_right'] + $bdl + $pdl + $bdr + $pdr);
|
1882 |
+
|
1883 |
+
$currblk['float_width'] = ($currblk['css_set_width'] + $bdl + $pdl + $bdr + $pdr + $currblk['margin_left']);
|
1884 |
+
}
|
1885 |
+
} else {
|
1886 |
+
// Don't allow overlap - if floats present - adjust padding to avoid overlap with Floats
|
1887 |
+
list($l_exists, $r_exists, $l_max, $r_max, $l_width, $r_width) = $this->mpdf->GetFloatDivInfo($this->mpdf->blklvl - 1);
|
1888 |
+
$maxw = $container_w - $l_width - $r_width;
|
1889 |
+
if (($setwidth + $currblk['margin_left'] + $currblk['margin_right'] + $bdl + $pdl + $bdr + $pdr) > $maxw || ($maxw - ($currblk['margin_right'] + $currblk['margin_left'] + $bdl + $pdl + $bdr + $pdr)) < (2 * $this->mpdf->GetCharWidth('W', false))) {
|
1890 |
+
// Too narrow to fit - try to move down past L or R float
|
1891 |
+
if ($l_max < $r_max && ($setwidth + $currblk['margin_left'] + $currblk['margin_right'] + $bdl + $pdl + $bdr + $pdr) <= ($container_w - $r_width) && (($container_w - $r_width) - ($currblk['margin_right'] + $currblk['margin_left'] + $bdl + $pdl + $bdr + $pdr)) > (2 * $this->mpdf->GetCharWidth('W', false))) {
|
1892 |
+
$this->mpdf->ClearFloats('LEFT', $this->mpdf->blklvl - 1);
|
1893 |
+
} else if ($r_max < $l_max && ($setwidth + $currblk['margin_left'] + $currblk['margin_right'] + $bdl + $pdl + $bdr + $pdr) <= ($container_w - $l_width) && (($container_w - $l_width) - ($currblk['margin_right'] + $currblk['margin_left'] + $bdl + $pdl + $bdr + $pdr)) > (2 * $this->mpdf->GetCharWidth('W', false))) {
|
1894 |
+
$this->mpdf->ClearFloats('RIGHT', $this->mpdf->blklvl - 1);
|
1895 |
+
} else {
|
1896 |
+
$this->mpdf->ClearFloats('BOTH', $this->mpdf->blklvl - 1);
|
1897 |
+
}
|
1898 |
+
list($l_exists, $r_exists, $l_max, $r_max, $l_width, $r_width) = $this->mpdf->GetFloatDivInfo($this->mpdf->blklvl - 1);
|
1899 |
+
}
|
1900 |
+
if ($r_exists) {
|
1901 |
+
$currblk['padding_right'] = max(($r_width - $currblk['margin_right'] - $bdr), $pdr);
|
1902 |
+
}
|
1903 |
+
if ($l_exists) {
|
1904 |
+
$currblk['padding_left'] = max(($l_width - $currblk['margin_left'] - $bdl), $pdl);
|
1905 |
+
}
|
1906 |
+
}
|
1907 |
+
/* -- END CSS-FLOAT -- */
|
1908 |
+
|
1909 |
+
|
1910 |
+
/* -- BORDER-RADIUS -- */
|
1911 |
+
// Automatically increase padding if required for border-radius
|
1912 |
+
if ($this->mpdf->autoPadding && !$this->mpdf->ColActive) {
|
1913 |
+
if ($currblk['border_radius_TL_H'] > $currblk['padding_left'] && $currblk['border_radius_TL_V'] > $currblk['padding_top']) {
|
1914 |
+
if ($currblk['border_radius_TL_H'] > $currblk['border_radius_TL_V']) {
|
1915 |
+
$this->mpdf->_borderPadding($currblk['border_radius_TL_H'], $currblk['border_radius_TL_V'], $currblk['padding_left'], $currblk['padding_top']);
|
1916 |
+
} else {
|
1917 |
+
$this->mpdf->_borderPadding($currblk['border_radius_TL_V'], $currblk['border_radius_TL_H'], $currblk['padding_top'], $currblk['padding_left']);
|
1918 |
+
}
|
1919 |
+
}
|
1920 |
+
if ($currblk['border_radius_TR_H'] > $currblk['padding_right'] && $currblk['border_radius_TR_V'] > $currblk['padding_top']) {
|
1921 |
+
if ($currblk['border_radius_TR_H'] > $currblk['border_radius_TR_V']) {
|
1922 |
+
$this->mpdf->_borderPadding($currblk['border_radius_TR_H'], $currblk['border_radius_TR_V'], $currblk['padding_right'], $currblk['padding_top']);
|
1923 |
+
} else {
|
1924 |
+
$this->mpdf->_borderPadding($currblk['border_radius_TR_V'], $currblk['border_radius_TR_H'], $currblk['padding_top'], $currblk['padding_right']);
|
1925 |
+
}
|
1926 |
+
}
|
1927 |
+
if ($currblk['border_radius_BL_H'] > $currblk['padding_left'] && $currblk['border_radius_BL_V'] > $currblk['padding_bottom']) {
|
1928 |
+
if ($currblk['border_radius_BL_H'] > $currblk['border_radius_BL_V']) {
|
1929 |
+
$this->mpdf->_borderPadding($currblk['border_radius_BL_H'], $currblk['border_radius_BL_V'], $currblk['padding_left'], $currblk['padding_bottom']);
|
1930 |
+
} else {
|
1931 |
+
$this->mpdf->_borderPadding($currblk['border_radius_BL_V'], $currblk['border_radius_BL_H'], $currblk['padding_bottom'], $currblk['padding_left']);
|
1932 |
+
}
|
1933 |
+
}
|
1934 |
+
if ($currblk['border_radius_BR_H'] > $currblk['padding_right'] && $currblk['border_radius_BR_V'] > $currblk['padding_bottom']) {
|
1935 |
+
if ($currblk['border_radius_BR_H'] > $currblk['border_radius_BR_V']) {
|
1936 |
+
$this->mpdf->_borderPadding($currblk['border_radius_BR_H'], $currblk['border_radius_BR_V'], $currblk['padding_right'], $currblk['padding_bottom']);
|
1937 |
+
} else {
|
1938 |
+
$this->mpdf->_borderPadding($currblk['border_radius_BR_V'], $currblk['border_radius_BR_H'], $currblk['padding_bottom'], $currblk['padding_right']);
|
1939 |
+
}
|
1940 |
+
}
|
1941 |
+
}
|
1942 |
+
/* -- END BORDER-RADIUS -- */
|
1943 |
+
|
1944 |
+
|
1945 |
+
// Hanging indent - if negative indent: ensure padding is >= indent
|
1946 |
+
if (!isset($currblk['text_indent'])) {
|
1947 |
+
$currblk['text_indent'] = null;
|
1948 |
+
}
|
1949 |
+
if (!isset($currblk['inner_width'])) {
|
1950 |
+
$currblk['inner_width'] = null;
|
1951 |
+
}
|
1952 |
+
$cbti = $this->mpdf->ConvertSize($currblk['text_indent'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
1953 |
+
if ($cbti < 0) {
|
1954 |
+
$hangind = -($cbti);
|
1955 |
+
if (isset($currblk['direction']) && $currblk['direction'] == 'rtl') { // *OTL*
|
1956 |
+
$currblk['padding_right'] = max($currblk['padding_right'], $hangind); // *OTL*
|
1957 |
+
} // *OTL*
|
1958 |
+
else { // *OTL*
|
1959 |
+
$currblk['padding_left'] = max($currblk['padding_left'], $hangind);
|
1960 |
+
} // *OTL*
|
1961 |
+
}
|
1962 |
+
|
1963 |
+
if (isset($currblk['css_set_width'])) {
|
1964 |
+
if (isset($properties['MARGIN-LEFT']) && isset($properties['MARGIN-RIGHT']) && strtolower($properties['MARGIN-LEFT']) == 'auto' && strtolower($properties['MARGIN-RIGHT']) == 'auto') {
|
1965 |
+
// Try to reduce margins to accomodate - if still too wide, set margin-right/left=0 (reduces width)
|
1966 |
+
$anyextra = $prevblk['inner_width'] - ($currblk['css_set_width'] + $currblk['border_left']['w'] + $currblk['padding_left'] + $currblk['border_right']['w'] + $currblk['padding_right']);
|
1967 |
+
if ($anyextra > 0) {
|
1968 |
+
$currblk['margin_left'] = $currblk['margin_right'] = $anyextra / 2;
|
1969 |
+
} else {
|
1970 |
+
$currblk['margin_left'] = $currblk['margin_right'] = 0;
|
1971 |
+
}
|
1972 |
+
} else if (isset($properties['MARGIN-LEFT']) && strtolower($properties['MARGIN-LEFT']) == 'auto') {
|
1973 |
+
// Try to reduce margin-left to accomodate - if still too wide, set margin-left=0 (reduces width)
|
1974 |
+
$currblk['margin_left'] = $prevblk['inner_width'] - ($currblk['css_set_width'] + $currblk['border_left']['w'] + $currblk['padding_left'] + $currblk['border_right']['w'] + $currblk['padding_right'] + $currblk['margin_right']);
|
1975 |
+
if ($currblk['margin_left'] < 0) {
|
1976 |
+
$currblk['margin_left'] = 0;
|
1977 |
+
}
|
1978 |
+
} else if (isset($properties['MARGIN-RIGHT']) && strtolower($properties['MARGIN-RIGHT']) == 'auto') {
|
1979 |
+
// Try to reduce margin-right to accomodate - if still too wide, set margin-right=0 (reduces width)
|
1980 |
+
$currblk['margin_right'] = $prevblk['inner_width'] - ($currblk['css_set_width'] + $currblk['border_left']['w'] + $currblk['padding_left'] + $currblk['border_right']['w'] + $currblk['padding_right'] + $currblk['margin_left']);
|
1981 |
+
if ($currblk['margin_right'] < 0) {
|
1982 |
+
$currblk['margin_right'] = 0;
|
1983 |
+
}
|
1984 |
+
} else {
|
1985 |
+
if ($currblk['direction'] == 'rtl') { // *OTL*
|
1986 |
+
// Try to reduce margin-left to accomodate - if still too wide, set margin-left=0 (reduces width)
|
1987 |
+
$currblk['margin_left'] = $prevblk['inner_width'] - ($currblk['css_set_width'] + $currblk['border_left']['w'] + $currblk['padding_left'] + $currblk['border_right']['w'] + $currblk['padding_right'] + $currblk['margin_right']); // *OTL*
|
1988 |
+
if ($currblk['margin_left'] < 0) { // *OTL*
|
1989 |
+
$currblk['margin_left'] = 0; // *OTL*
|
1990 |
+
} // *OTL*
|
1991 |
+
} // *OTL*
|
1992 |
+
else { // *OTL*
|
1993 |
+
// Try to reduce margin-right to accomodate - if still too wide, set margin-right=0 (reduces width)
|
1994 |
+
$currblk['margin_right'] = $prevblk['inner_width'] - ($currblk['css_set_width'] + $currblk['border_left']['w'] + $currblk['padding_left'] + $currblk['border_right']['w'] + $currblk['padding_right'] + $currblk['margin_left']);
|
1995 |
+
if ($currblk['margin_right'] < 0) {
|
1996 |
+
$currblk['margin_right'] = 0;
|
1997 |
+
}
|
1998 |
+
} // *OTL*
|
1999 |
+
}
|
2000 |
+
}
|
2001 |
+
|
2002 |
+
$currblk['outer_left_margin'] = $prevblk['outer_left_margin'] + $currblk['margin_left'] + $prevblk['border_left']['w'] + $prevblk['padding_left'];
|
2003 |
+
$currblk['outer_right_margin'] = $prevblk['outer_right_margin'] + $currblk['margin_right'] + $prevblk['border_right']['w'] + $prevblk['padding_right'];
|
2004 |
+
|
2005 |
+
$currblk['width'] = $this->mpdf->pgwidth - ($currblk['outer_right_margin'] + $currblk['outer_left_margin']);
|
2006 |
+
$currblk['inner_width'] = $currblk['width'] - ($currblk['border_left']['w'] + $currblk['padding_left'] + $currblk['border_right']['w'] + $currblk['padding_right']);
|
2007 |
+
|
2008 |
+
// Check DIV is not now too narrow to fit text
|
2009 |
+
$mw = 2 * $this->mpdf->GetCharWidth('W', false);
|
2010 |
+
if ($currblk['inner_width'] < $mw) {
|
2011 |
+
$currblk['padding_left'] = 0;
|
2012 |
+
$currblk['padding_right'] = 0;
|
2013 |
+
$currblk['border_left']['w'] = 0.2;
|
2014 |
+
$currblk['border_right']['w'] = 0.2;
|
2015 |
+
$currblk['margin_left'] = 0;
|
2016 |
+
$currblk['margin_right'] = 0;
|
2017 |
+
$currblk['outer_left_margin'] = $prevblk['outer_left_margin'] + $currblk['margin_left'] + $prevblk['border_left']['w'] + $prevblk['padding_left'];
|
2018 |
+
$currblk['outer_right_margin'] = $prevblk['outer_right_margin'] + $currblk['margin_right'] + $prevblk['border_right']['w'] + $prevblk['padding_right'];
|
2019 |
+
$currblk['width'] = $this->mpdf->pgwidth - ($currblk['outer_right_margin'] + $currblk['outer_left_margin']);
|
2020 |
+
$currblk['inner_width'] = $this->mpdf->pgwidth - ($currblk['outer_right_margin'] + $currblk['outer_left_margin'] + $currblk['border_left']['w'] + $currblk['padding_left'] + $currblk['border_right']['w'] + $currblk['padding_right']);
|
2021 |
+
// if ($currblk['inner_width'] < $mw) { throw new MpdfException("DIV is too narrow for text to fit!"); }
|
2022 |
+
}
|
2023 |
+
|
2024 |
+
$this->mpdf->x = $this->mpdf->lMargin + $currblk['outer_left_margin'];
|
2025 |
+
|
2026 |
+
/* -- BACKGROUNDS -- */
|
2027 |
+
if (isset($properties['BACKGROUND-IMAGE']) && $properties['BACKGROUND-IMAGE'] && !$this->mpdf->kwt && !$this->mpdf->ColActive && !$this->mpdf->keep_block_together) {
|
2028 |
+
$ret = $this->mpdf->SetBackground($properties, $currblk['inner_width']);
|
2029 |
+
if ($ret) {
|
2030 |
+
$currblk['background-image'] = $ret;
|
2031 |
+
}
|
2032 |
+
}
|
2033 |
+
/* -- END BACKGROUNDS -- */
|
2034 |
+
|
2035 |
+
/* -- TABLES -- */
|
2036 |
+
if ($this->mpdf->use_kwt && isset($attr['KEEP-WITH-TABLE']) && !$this->mpdf->ColActive && !$this->mpdf->keep_block_together) {
|
2037 |
+
$this->mpdf->kwt = true;
|
2038 |
+
$this->mpdf->kwt_y0 = $this->mpdf->y;
|
2039 |
+
//$this->mpdf->kwt_x0 = $this->mpdf->x;
|
2040 |
+
$this->mpdf->kwt_x0 = $this->mpdf->lMargin; // mPDF 6
|
2041 |
+
$this->mpdf->kwt_height = 0;
|
2042 |
+
$this->mpdf->kwt_buffer = array();
|
2043 |
+
$this->mpdf->kwt_Links = array();
|
2044 |
+
$this->mpdf->kwt_Annots = array();
|
2045 |
+
$this->mpdf->kwt_moved = false;
|
2046 |
+
$this->mpdf->kwt_saved = false;
|
2047 |
+
$this->mpdf->kwt_Reference = array();
|
2048 |
+
$this->mpdf->kwt_BMoutlines = array();
|
2049 |
+
$this->mpdf->kwt_toc = array();
|
2050 |
+
} else {
|
2051 |
+
/* -- END TABLES -- */
|
2052 |
+
$this->mpdf->kwt = false;
|
2053 |
+
} // *TABLES*
|
2054 |
+
//Save x,y coords in case we need to print borders...
|
2055 |
+
$currblk['y0'] = $this->mpdf->y;
|
2056 |
+
$currblk['initial_y0'] = $this->mpdf->y; // mPDF 6
|
2057 |
+
$currblk['x0'] = $this->mpdf->x;
|
2058 |
+
$currblk['initial_x0'] = $this->mpdf->x; // mPDF 6
|
2059 |
+
$currblk['initial_startpage'] = $this->mpdf->page;
|
2060 |
+
$currblk['startpage'] = $this->mpdf->page; // mPDF 6
|
2061 |
+
$this->mpdf->oldy = $this->mpdf->y;
|
2062 |
+
|
2063 |
+
$this->mpdf->lastblocklevelchange = 1;
|
2064 |
+
|
2065 |
+
|
2066 |
+
// mPDF 6 Lists
|
2067 |
+
if ($tag == 'OL' || $tag == 'UL') {
|
2068 |
+
$this->mpdf->listlvl++;
|
2069 |
+
if (isset($attr['START']) && $attr['START']) {
|
2070 |
+
$this->mpdf->listcounter[$this->mpdf->listlvl] = intval($attr['START']) - 1;
|
2071 |
+
} else {
|
2072 |
+
$this->mpdf->listcounter[$this->mpdf->listlvl] = 0;
|
2073 |
+
}
|
2074 |
+
$this->mpdf->listitem = array();
|
2075 |
+
|
2076 |
+
// List-type
|
2077 |
+
if (!isset($currblk['list_style_type']) || !$currblk['list_style_type']) {
|
2078 |
+
if ($tag == 'OL')
|
2079 |
+
$currblk['list_style_type'] = 'decimal';
|
2080 |
+
else if ($tag == 'UL') {
|
2081 |
+
if ($this->mpdf->listlvl % 3 == 1)
|
2082 |
+
$currblk['list_style_type'] = 'disc';
|
2083 |
+
elseif ($this->mpdf->listlvl % 3 == 2)
|
2084 |
+
$currblk['list_style_type'] = 'circle';
|
2085 |
+
else
|
2086 |
+
$currblk['list_style_type'] = 'square';
|
2087 |
+
}
|
2088 |
+
}
|
2089 |
+
|
2090 |
+
// List-image
|
2091 |
+
if (!isset($currblk['list_style_image']) || !$currblk['list_style_image']) {
|
2092 |
+
$currblk['list_style_image'] = 'none';
|
2093 |
+
}
|
2094 |
+
|
2095 |
+
// List-position
|
2096 |
+
if (!isset($currblk['list_style_position']) || !$currblk['list_style_position']) {
|
2097 |
+
$currblk['list_style_position'] = 'outside';
|
2098 |
+
}
|
2099 |
+
|
2100 |
+
// Default indentation using padding
|
2101 |
+
if (strtolower($this->mpdf->list_auto_mode) == 'mpdf' && isset($currblk['list_style_position']) && $currblk['list_style_position'] == 'outside' && isset($currblk['list_style_image']) && $currblk['list_style_image'] == 'none' && (!isset($currblk['list_style_type']) || !preg_match('/U\+([a-fA-F0-9]+)/i', $currblk['list_style_type']))) {
|
2102 |
+
$autopadding = $this->mpdf->_getListMarkerWidth($currblk, $ahtml, $ihtml);
|
2103 |
+
if ($this->mpdf->listlvl > 1 || $this->mpdf->list_indent_first_level) {
|
2104 |
+
$autopadding += $this->mpdf->ConvertSize($this->mpdf->list_indent_default_mpdf, $currblk['inner_width'], $this->mpdf->FontSize, false);
|
2105 |
+
}
|
2106 |
+
// autopadding value is applied to left or right according
|
2107 |
+
// to dir of block. Once a CSS value is set for padding it overrides this default value.
|
2108 |
+
if (isset($properties['PADDING-RIGHT']) && $properties['PADDING-RIGHT'] == 'auto' && isset($currblk['direction']) && $currblk['direction'] == 'rtl') {
|
2109 |
+
$currblk['padding_right'] = $autopadding;
|
2110 |
+
} else if (isset($properties['PADDING-LEFT']) && $properties['PADDING-LEFT'] == 'auto') {
|
2111 |
+
$currblk['padding_left'] = $autopadding;
|
2112 |
+
}
|
2113 |
+
} else {
|
2114 |
+
// Initial default value is set by $this->mpdf->list_indent_default in config.php; this value is applied to left or right according
|
2115 |
+
// to dir of block. Once a CSS value is set for padding it overrides this default value.
|
2116 |
+
if (isset($properties['PADDING-RIGHT']) && $properties['PADDING-RIGHT'] == 'auto' && isset($currblk['direction']) && $currblk['direction'] == 'rtl') {
|
2117 |
+
$currblk['padding_right'] = $this->mpdf->ConvertSize($this->mpdf->list_indent_default, $currblk['inner_width'], $this->mpdf->FontSize, false);
|
2118 |
+
} else if (isset($properties['PADDING-LEFT']) && $properties['PADDING-LEFT'] == 'auto') {
|
2119 |
+
$currblk['padding_left'] = $this->mpdf->ConvertSize($this->mpdf->list_indent_default, $currblk['inner_width'], $this->mpdf->FontSize, false);
|
2120 |
+
}
|
2121 |
+
}
|
2122 |
+
}
|
2123 |
+
|
2124 |
+
|
2125 |
+
// mPDF 6 Lists
|
2126 |
+
if ($tag == 'LI') {
|
2127 |
+
if ($this->mpdf->listlvl == 0) { //in case of malformed HTML code. Example:(...)</p><li>Content</li><p>Paragraph1</p>(...)
|
2128 |
+
$this->mpdf->listlvl++; // first depth level
|
2129 |
+
$this->mpdf->listcounter[$this->mpdf->listlvl] = 0;
|
2130 |
+
}
|
2131 |
+
$this->mpdf->listcounter[$this->mpdf->listlvl] ++;
|
2132 |
+
$this->mpdf->listitem = array();
|
2133 |
+
|
2134 |
+
// Listitem-type
|
2135 |
+
$this->mpdf->_setListMarker($currblk['list_style_type'], $currblk['list_style_image'], $currblk['list_style_position']);
|
2136 |
+
}
|
2137 |
+
|
2138 |
+
// mPDF 6 Bidirectional formatting for block elements
|
2139 |
+
$bdf = false;
|
2140 |
+
$bdf2 = '';
|
2141 |
+
$popd = '';
|
2142 |
+
|
2143 |
+
// Get current direction
|
2144 |
+
if (isset($currblk['direction'])) {
|
2145 |
+
$currdir = $currblk['direction'];
|
2146 |
+
} else {
|
2147 |
+
$currdir = 'ltr';
|
2148 |
+
}
|
2149 |
+
if (isset($attr['DIR']) and $attr['DIR'] != '') {
|
2150 |
+
$currdir = strtolower($attr['DIR']);
|
2151 |
+
}
|
2152 |
+
if (isset($properties['DIRECTION'])) {
|
2153 |
+
$currdir = strtolower($properties['DIRECTION']);
|
2154 |
+
}
|
2155 |
+
|
2156 |
+
// mPDF 6 bidi
|
2157 |
+
// cf. http://www.w3.org/TR/css3-writing-modes/#unicode-bidi
|
2158 |
+
if (isset($properties ['UNICODE-BIDI']) && (strtolower($properties ['UNICODE-BIDI']) == 'bidi-override' || strtolower($properties ['UNICODE-BIDI']) == 'isolate-override')) {
|
2159 |
+
if ($currdir == 'rtl') {
|
2160 |
+
$bdf = 0x202E;
|
2161 |
+
$popd = 'RLOPDF';
|
2162 |
+
} // U+202E RLO
|
2163 |
+
else {
|
2164 |
+
$bdf = 0x202D;
|
2165 |
+
$popd = 'LROPDF';
|
2166 |
+
} // U+202D LRO
|
2167 |
+
} else if (isset($properties ['UNICODE-BIDI']) && strtolower($properties ['UNICODE-BIDI']) == 'plaintext') {
|
2168 |
+
$bdf = 0x2068;
|
2169 |
+
$popd = 'FSIPDI'; // U+2068 FSI
|
2170 |
+
}
|
2171 |
+
if ($bdf) {
|
2172 |
+
if ($bdf2) {
|
2173 |
+
$bdf2 = code2utf($bdf);
|
2174 |
+
}
|
2175 |
+
$this->mpdf->OTLdata = array();
|
2176 |
+
if ($this->mpdf->tableLevel) {
|
2177 |
+
$this->mpdf->_saveCellTextBuffer(code2utf($bdf) . $bdf2);
|
2178 |
+
} else {
|
2179 |
+
$this->mpdf->_saveTextBuffer(code2utf($bdf) . $bdf2);
|
2180 |
+
}
|
2181 |
+
$this->mpdf->biDirectional = true;
|
2182 |
+
$currblk['bidicode'] = $popd;
|
2183 |
+
}
|
2184 |
+
|
2185 |
+
break;
|
2186 |
+
|
2187 |
+
case 'HR':
|
2188 |
+
// Added mPDF 3.0 Float DIV - CLEAR
|
2189 |
+
if (isset($attr['STYLE'])) {
|
2190 |
+
$properties = $this->mpdf->cssmgr->readInlineCSS($attr['STYLE']);
|
2191 |
+
if (isset($properties['CLEAR'])) {
|
2192 |
+
$this->mpdf->ClearFloats(strtoupper($properties['CLEAR']), $this->mpdf->blklvl);
|
2193 |
+
} // *CSS-FLOAT*
|
2194 |
+
}
|
2195 |
+
|
2196 |
+
$this->mpdf->ignorefollowingspaces = true;
|
2197 |
+
|
2198 |
+
$objattr = array();
|
2199 |
+
$objattr['margin_top'] = 0;
|
2200 |
+
$objattr['margin_bottom'] = 0;
|
2201 |
+
$objattr['margin_left'] = 0;
|
2202 |
+
$objattr['margin_right'] = 0;
|
2203 |
+
$objattr['width'] = 0;
|
2204 |
+
$objattr['height'] = 0;
|
2205 |
+
$objattr['border_top']['w'] = 0;
|
2206 |
+
$objattr['border_bottom']['w'] = 0;
|
2207 |
+
$objattr['border_left']['w'] = 0;
|
2208 |
+
$objattr['border_right']['w'] = 0;
|
2209 |
+
$properties = $this->mpdf->cssmgr->MergeCSS('', $tag, $attr);
|
2210 |
+
if (isset($properties['MARGIN-TOP'])) {
|
2211 |
+
$objattr['margin_top'] = $this->mpdf->ConvertSize($properties['MARGIN-TOP'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
2212 |
+
}
|
2213 |
+
if (isset($properties['MARGIN-BOTTOM'])) {
|
2214 |
+
$objattr['margin_bottom'] = $this->mpdf->ConvertSize($properties['MARGIN-BOTTOM'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
2215 |
+
}
|
2216 |
+
if (isset($properties['WIDTH'])) {
|
2217 |
+
$objattr['width'] = $this->mpdf->ConvertSize($properties['WIDTH'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width']);
|
2218 |
+
} else if (isset($attr['WIDTH']) && $attr['WIDTH'] != '')
|
2219 |
+
$objattr['width'] = $this->mpdf->ConvertSize($attr['WIDTH'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width']);
|
2220 |
+
if (isset($properties['TEXT-ALIGN'])) {
|
2221 |
+
$objattr['align'] = $align[strtolower($properties['TEXT-ALIGN'])];
|
2222 |
+
} else if (isset($attr['ALIGN']) && $attr['ALIGN'] != '')
|
2223 |
+
$objattr['align'] = $align[strtolower($attr['ALIGN'])];
|
2224 |
+
|
2225 |
+
if (isset($properties['MARGIN-LEFT']) && strtolower($properties['MARGIN-LEFT']) == 'auto') {
|
2226 |
+
$objattr['align'] = 'R';
|
2227 |
+
}
|
2228 |
+
if (isset($properties['MARGIN-RIGHT']) && strtolower($properties['MARGIN-RIGHT']) == 'auto') {
|
2229 |
+
$objattr['align'] = 'L';
|
2230 |
+
if (isset($properties['MARGIN-RIGHT']) && strtolower($properties['MARGIN-RIGHT']) == 'auto' && isset($properties['MARGIN-LEFT']) && strtolower($properties['MARGIN-LEFT']) == 'auto') {
|
2231 |
+
$objattr['align'] = 'C';
|
2232 |
+
}
|
2233 |
+
}
|
2234 |
+
if (isset($properties['COLOR'])) {
|
2235 |
+
$objattr['color'] = $this->mpdf->ConvertColor($properties['COLOR']);
|
2236 |
+
} else if (isset($attr['COLOR']) && $attr['COLOR'] != '')
|
2237 |
+
$objattr['color'] = $this->mpdf->ConvertColor($attr['COLOR']);
|
2238 |
+
if (isset($properties['HEIGHT'])) {
|
2239 |
+
$objattr['linewidth'] = $this->mpdf->ConvertSize($properties['HEIGHT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
2240 |
+
}
|
2241 |
+
|
2242 |
+
|
2243 |
+
/* -- TABLES -- */
|
2244 |
+
if ($this->mpdf->tableLevel) {
|
2245 |
+
$objattr['W-PERCENT'] = 100;
|
2246 |
+
if (isset($properties['WIDTH']) && stristr($properties['WIDTH'], '%')) {
|
2247 |
+
$properties['WIDTH'] += 0; //make "90%" become simply "90"
|
2248 |
+
$objattr['W-PERCENT'] = $properties['WIDTH'];
|
2249 |
+
}
|
2250 |
+
if (isset($attr['WIDTH']) && stristr($attr['WIDTH'], '%')) {
|
2251 |
+
$attr['WIDTH'] += 0; //make "90%" become simply "90"
|
2252 |
+
$objattr['W-PERCENT'] = $attr['WIDTH'];
|
2253 |
+
}
|
2254 |
+
}
|
2255 |
+
/* -- END TABLES -- */
|
2256 |
+
|
2257 |
+
$objattr['type'] = 'hr';
|
2258 |
+
$objattr['height'] = $objattr['linewidth'] + $objattr['margin_top'] + $objattr['margin_bottom'];
|
2259 |
+
$e = "\xbb\xa4\xactype=image,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
|
2260 |
+
|
2261 |
+
// Clear properties - tidy up
|
2262 |
+
$properties = array();
|
2263 |
+
|
2264 |
+
/* -- TABLES -- */
|
2265 |
+
// Output it to buffers
|
2266 |
+
if ($this->mpdf->tableLevel) {
|
2267 |
+
if (!isset($this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['maxs'])) {
|
2268 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['maxs'] = $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s'];
|
2269 |
+
} elseif ($this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['maxs'] < $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s']) {
|
2270 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['maxs'] = $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s'];
|
2271 |
+
}
|
2272 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s'] = 0; // reset
|
2273 |
+
$this->mpdf->_saveCellTextBuffer($e, $this->mpdf->HREF);
|
2274 |
+
} else {
|
2275 |
+
/* -- END TABLES -- */
|
2276 |
+
$this->mpdf->_saveTextBuffer($e, $this->mpdf->HREF);
|
2277 |
+
} // *TABLES*
|
2278 |
+
|
2279 |
+
break;
|
2280 |
+
|
2281 |
+
|
2282 |
+
/* -- BARCODES -- */
|
2283 |
+
|
2284 |
+
case 'BARCODE':
|
2285 |
+
$this->mpdf->ignorefollowingspaces = false;
|
2286 |
+
if (isset($attr['CODE']) && $attr['CODE']) {
|
2287 |
+
$objattr = array();
|
2288 |
+
$objattr['margin_top'] = 0;
|
2289 |
+
$objattr['margin_bottom'] = 0;
|
2290 |
+
$objattr['margin_left'] = 0;
|
2291 |
+
$objattr['margin_right'] = 0;
|
2292 |
+
$objattr['padding_top'] = 0;
|
2293 |
+
$objattr['padding_bottom'] = 0;
|
2294 |
+
$objattr['padding_left'] = 0;
|
2295 |
+
$objattr['padding_right'] = 0;
|
2296 |
+
$objattr['width'] = 0;
|
2297 |
+
$objattr['height'] = 0;
|
2298 |
+
$objattr['border_top']['w'] = 0;
|
2299 |
+
$objattr['border_bottom']['w'] = 0;
|
2300 |
+
$objattr['border_left']['w'] = 0;
|
2301 |
+
$objattr['border_right']['w'] = 0;
|
2302 |
+
$objattr['code'] = $attr['CODE'];
|
2303 |
+
|
2304 |
+
if (isset($attr['TYPE'])) {
|
2305 |
+
$objattr['btype'] = trim(strtoupper($attr['TYPE']));
|
2306 |
+
} else {
|
2307 |
+
$objattr['btype'] = 'EAN13';
|
2308 |
+
} // default
|
2309 |
+
if (preg_match('/^(EAN13|ISBN|ISSN|EAN8|UPCA|UPCE)P([25])$/', $objattr['btype'], $m)) {
|
2310 |
+
$objattr['btype'] = $m[1];
|
2311 |
+
$objattr['bsupp'] = $m[2];
|
2312 |
+
if (preg_match('/^(\S+)\s+(.*)$/', $objattr['code'], $mm)) {
|
2313 |
+
$objattr['code'] = $mm[1];
|
2314 |
+
$objattr['bsupp_code'] = $mm[2];
|
2315 |
+
}
|
2316 |
+
} else {
|
2317 |
+
$objattr['bsupp'] = 0;
|
2318 |
+
}
|
2319 |
+
|
2320 |
+
if (isset($attr['TEXT']) && $attr['TEXT'] == 1) {
|
2321 |
+
$objattr['showtext'] = 1;
|
2322 |
+
} else {
|
2323 |
+
$objattr['showtext'] = 0;
|
2324 |
+
}
|
2325 |
+
if (isset($attr['SIZE']) && $attr['SIZE'] > 0) {
|
2326 |
+
$objattr['bsize'] = $attr['SIZE'];
|
2327 |
+
} else {
|
2328 |
+
$objattr['bsize'] = 1;
|
2329 |
+
}
|
2330 |
+
if (isset($attr['HEIGHT']) && $attr['HEIGHT'] > 0) {
|
2331 |
+
$objattr['bheight'] = $attr['HEIGHT'];
|
2332 |
+
} else {
|
2333 |
+
$objattr['bheight'] = 1;
|
2334 |
+
}
|
2335 |
+
if (isset($attr['PR']) && $attr['PR'] > 0) {
|
2336 |
+
$objattr['pr_ratio'] = $attr['PR'];
|
2337 |
+
} else {
|
2338 |
+
$objattr['pr_ratio'] = '';
|
2339 |
+
}
|
2340 |
+
$properties = $this->mpdf->cssmgr->MergeCSS('', $tag, $attr);
|
2341 |
+
if (isset($properties ['DISPLAY']) && strtolower($properties ['DISPLAY']) == 'none') {
|
2342 |
+
return;
|
2343 |
+
}
|
2344 |
+
if (isset($properties['MARGIN-TOP'])) {
|
2345 |
+
$objattr['margin_top'] = $this->mpdf->ConvertSize($properties['MARGIN-TOP'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
2346 |
+
}
|
2347 |
+
if (isset($properties['MARGIN-BOTTOM'])) {
|
2348 |
+
$objattr['margin_bottom'] = $this->mpdf->ConvertSize($properties['MARGIN-BOTTOM'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
2349 |
+
}
|
2350 |
+
if (isset($properties['MARGIN-LEFT'])) {
|
2351 |
+
$objattr['margin_left'] = $this->mpdf->ConvertSize($properties['MARGIN-LEFT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
2352 |
+
}
|
2353 |
+
if (isset($properties['MARGIN-RIGHT'])) {
|
2354 |
+
$objattr['margin_right'] = $this->mpdf->ConvertSize($properties['MARGIN-RIGHT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
2355 |
+
}
|
2356 |
+
|
2357 |
+
if (isset($properties['PADDING-TOP'])) {
|
2358 |
+
$objattr['padding_top'] = $this->mpdf->ConvertSize($properties['PADDING-TOP'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
2359 |
+
}
|
2360 |
+
if (isset($properties['PADDING-BOTTOM'])) {
|
2361 |
+
$objattr['padding_bottom'] = $this->mpdf->ConvertSize($properties['PADDING-BOTTOM'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
2362 |
+
}
|
2363 |
+
if (isset($properties['PADDING-LEFT'])) {
|
2364 |
+
$objattr['padding_left'] = $this->mpdf->ConvertSize($properties['PADDING-LEFT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
2365 |
+
}
|
2366 |
+
if (isset($properties['PADDING-RIGHT'])) {
|
2367 |
+
$objattr['padding_right'] = $this->mpdf->ConvertSize($properties['PADDING-RIGHT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
2368 |
+
}
|
2369 |
+
|
2370 |
+
if (isset($properties['BORDER-TOP'])) {
|
2371 |
+
$objattr['border_top'] = $this->mpdf->border_details($properties['BORDER-TOP']);
|
2372 |
+
}
|
2373 |
+
if (isset($properties['BORDER-BOTTOM'])) {
|
2374 |
+
$objattr['border_bottom'] = $this->mpdf->border_details($properties['BORDER-BOTTOM']);
|
2375 |
+
}
|
2376 |
+
if (isset($properties['BORDER-LEFT'])) {
|
2377 |
+
$objattr['border_left'] = $this->mpdf->border_details($properties['BORDER-LEFT']);
|
2378 |
+
}
|
2379 |
+
if (isset($properties['BORDER-RIGHT'])) {
|
2380 |
+
$objattr['border_right'] = $this->mpdf->border_details($properties['BORDER-RIGHT']);
|
2381 |
+
}
|
2382 |
+
|
2383 |
+
if (isset($properties['VERTICAL-ALIGN'])) {
|
2384 |
+
$objattr['vertical-align'] = $align[strtolower($properties['VERTICAL-ALIGN'])];
|
2385 |
+
}
|
2386 |
+
if (isset($properties['COLOR']) && $properties['COLOR'] != '') {
|
2387 |
+
$objattr['color'] = $this->mpdf->ConvertColor($properties['COLOR']);
|
2388 |
+
} else {
|
2389 |
+
$objattr['color'] = false;
|
2390 |
+
}
|
2391 |
+
if (isset($properties['BACKGROUND-COLOR']) && $properties['BACKGROUND-COLOR'] != '') {
|
2392 |
+
$objattr['bgcolor'] = $this->mpdf->ConvertColor($properties['BACKGROUND-COLOR']);
|
2393 |
+
} else {
|
2394 |
+
$objattr['bgcolor'] = false;
|
2395 |
+
}
|
2396 |
+
|
2397 |
+
if (!class_exists('PDFBarcode', false)) {
|
2398 |
+
include(_MPDF_PATH . 'classes/barcode.php');
|
2399 |
+
}
|
2400 |
+
$this->mpdf->barcode = new PDFBarcode();
|
2401 |
+
|
2402 |
+
if ($objattr['btype'] == 'EAN13' || $objattr['btype'] == 'ISBN' || $objattr['btype'] == 'ISSN' || $objattr['btype'] == 'UPCA' || $objattr['btype'] == 'UPCE' || $objattr['btype'] == 'EAN8') {
|
2403 |
+
$code = preg_replace('/\-/', '', $objattr['code']);
|
2404 |
+
if ($objattr['btype'] == 'ISSN' || $objattr['btype'] == 'ISBN') {
|
2405 |
+
$arrcode = $this->mpdf->barcode->getBarcodeArray($code, 'EAN13');
|
2406 |
+
} else {
|
2407 |
+
$arrcode = $this->mpdf->barcode->getBarcodeArray($code, $objattr['btype']);
|
2408 |
+
}
|
2409 |
+
if ($arrcode === false) {
|
2410 |
+
throw new MpdfException('Error in barcode string.');
|
2411 |
+
}
|
2412 |
+
|
2413 |
+
if ($objattr['bsupp'] == 2 || $objattr['bsupp'] == 5) { // EAN-2 or -5 Supplement
|
2414 |
+
$supparrcode = $this->mpdf->barcode->getBarcodeArray($objattr['bsupp_code'], 'EAN' . $objattr['bsupp']);
|
2415 |
+
$w = ($arrcode["maxw"] + $arrcode['lightmL'] + $arrcode['lightmR'] + $supparrcode["maxw"] + $supparrcode['sepM']) * $arrcode['nom-X'] * $objattr['bsize'];
|
2416 |
+
} else {
|
2417 |
+
$w = ($arrcode["maxw"] + $arrcode['lightmL'] + $arrcode['lightmR']) * $arrcode['nom-X'] * $objattr['bsize'];
|
2418 |
+
}
|
2419 |
+
$h = $arrcode['nom-H'] * $objattr['bsize'] * $objattr['bheight'];
|
2420 |
+
// Add height for ISBN string + margin from top of bars
|
2421 |
+
if (($objattr['showtext'] && $objattr['btype'] == 'EAN13') || $objattr['btype'] == 'ISBN' || $objattr['btype'] == 'ISSN') {
|
2422 |
+
$tisbnm = 1.5 * $objattr['bsize']; // Top margin between TOP TEXT (isbn - if shown) & bars
|
2423 |
+
$isbn_fontsize = 2.1 * $objattr['bsize'];
|
2424 |
+
$h += $isbn_fontsize + $tisbnm;
|
2425 |
+
}
|
2426 |
+
}
|
2427 |
+
// QR-code
|
2428 |
+
else if ($objattr['btype'] == 'QR') {
|
2429 |
+
$w = $h = $objattr['bsize'] * 25; // Factor of 25mm (default)
|
2430 |
+
$objattr['errorlevel'] = 'L';
|
2431 |
+
if (isset($attr['ERROR'])) {
|
2432 |
+
$objattr['errorlevel'] = $attr['ERROR'];
|
2433 |
+
}
|
2434 |
+
} else if ($objattr['btype'] == 'IMB' || $objattr['btype'] == 'RM4SCC' || $objattr['btype'] == 'KIX' || $objattr['btype'] == 'POSTNET' || $objattr['btype'] == 'PLANET') {
|
2435 |
+
$arrcode = $this->mpdf->barcode->getBarcodeArray($objattr['code'], $objattr['btype']);
|
2436 |
+
if ($arrcode === false) {
|
2437 |
+
throw new MpdfException('Error in barcode string.');
|
2438 |
+
}
|
2439 |
+
$w = ($arrcode["maxw"] * $arrcode['nom-X'] * $objattr['bsize']) + $arrcode['quietL'] + $arrcode['quietR'];
|
2440 |
+
$h = ($arrcode['nom-H'] * $objattr['bsize']) + (2 * $arrcode['quietTB']);
|
2441 |
+
} else if (in_array($objattr['btype'], array('C128A', 'C128B', 'C128C', 'EAN128A', 'EAN128B', 'EAN128C', 'C39', 'C39+', 'C39E', 'C39E+', 'S25', 'S25+', 'I25', 'I25+', 'I25B', 'I25B+', 'C93', 'MSI', 'MSI+', 'CODABAR', 'CODE11'))) {
|
2442 |
+
$arrcode = $this->mpdf->barcode->getBarcodeArray($objattr['code'], $objattr['btype'], $objattr['pr_ratio']);
|
2443 |
+
if ($arrcode === false) {
|
2444 |
+
throw new MpdfException('Error in barcode string.');
|
2445 |
+
}
|
2446 |
+
$w = ($arrcode["maxw"] + $arrcode['lightmL'] + $arrcode['lightmR']) * $arrcode['nom-X'] * $objattr['bsize'];
|
2447 |
+
$h = ((2 * $arrcode['lightTB'] * $arrcode['nom-X']) + $arrcode['nom-H']) * $objattr['bsize'] * $objattr['bheight'];
|
2448 |
+
} else {
|
2449 |
+
break;
|
2450 |
+
}
|
2451 |
+
|
2452 |
+
$extraheight = $objattr['padding_top'] + $objattr['padding_bottom'] + $objattr['margin_top'] + $objattr['margin_bottom'] + $objattr['border_top']['w'] + $objattr['border_bottom']['w'];
|
2453 |
+
$extrawidth = $objattr['padding_left'] + $objattr['padding_right'] + $objattr['margin_left'] + $objattr['margin_right'] + $objattr['border_left']['w'] + $objattr['border_right']['w'];
|
2454 |
+
|
2455 |
+
$objattr['type'] = 'barcode';
|
2456 |
+
$objattr['height'] = $h + $extraheight;
|
2457 |
+
$objattr['width'] = $w + $extrawidth;
|
2458 |
+
$objattr['barcode_height'] = $h;
|
2459 |
+
$objattr['barcode_width'] = $w;
|
2460 |
+
/* -- CSS-IMAGE-FLOAT -- */
|
2461 |
+
if (!$this->mpdf->ColActive && !$this->mpdf->tableLevel && !$this->mpdf->listlvl && !$this->mpdf->kwt) {
|
2462 |
+
if (isset($properties['FLOAT']) && (strtoupper($properties['FLOAT']) == 'RIGHT' || strtoupper($properties['FLOAT']) == 'LEFT')) {
|
2463 |
+
$objattr['float'] = substr(strtoupper($properties['FLOAT']), 0, 1);
|
2464 |
+
}
|
2465 |
+
}
|
2466 |
+
/* -- END CSS-IMAGE-FLOAT -- */
|
2467 |
+
|
2468 |
+
$e = "\xbb\xa4\xactype=barcode,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
|
2469 |
+
|
2470 |
+
// Clear properties - tidy up
|
2471 |
+
$properties = array();
|
2472 |
+
|
2473 |
+
/* -- TABLES -- */
|
2474 |
+
// Output it to buffers
|
2475 |
+
if ($this->mpdf->tableLevel) {
|
2476 |
+
$this->mpdf->_saveCellTextBuffer($e, $this->mpdf->HREF);
|
2477 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s'] += $objattr['width'];
|
2478 |
+
} else {
|
2479 |
+
/* -- END TABLES -- */
|
2480 |
+
$this->mpdf->_saveTextBuffer($e, $this->mpdf->HREF);
|
2481 |
+
} // *TABLES*
|
2482 |
+
}
|
2483 |
+
break;
|
2484 |
+
/* -- END BARCODES -- */
|
2485 |
+
|
2486 |
+
|
2487 |
+
// *********** FORM ELEMENTS ********************
|
2488 |
+
|
2489 |
+
/* -- FORMS -- */
|
2490 |
+
case 'SELECT':
|
2491 |
+
$this->mpdf->lastoptionaltag = ''; // Save current HTML specified optional endtag
|
2492 |
+
$this->mpdf->InlineProperties[$tag] = $this->mpdf->saveInlineProperties();
|
2493 |
+
$properties = $this->mpdf->cssmgr->MergeCSS('', $tag, $attr);
|
2494 |
+
if (isset($properties['FONT-FAMILY'])) {
|
2495 |
+
$this->mpdf->SetFont($properties['FONT-FAMILY'], $this->mpdf->FontStyle, 0, false);
|
2496 |
+
}
|
2497 |
+
if (isset($properties['FONT-SIZE'])) {
|
2498 |
+
$mmsize = $this->mpdf->ConvertSize($properties['FONT-SIZE'], $this->mpdf->default_font_size / _MPDFK);
|
2499 |
+
$this->mpdf->SetFontSize($mmsize * _MPDFK, false);
|
2500 |
+
}
|
2501 |
+
if (isset($attr['SPELLCHECK']) && strtolower($attr['SPELLCHECK']) == 'true') {
|
2502 |
+
$this->mpdf->selectoption['SPELLCHECK'] = true;
|
2503 |
+
}
|
2504 |
+
|
2505 |
+
if (isset($properties['COLOR'])) {
|
2506 |
+
$this->mpdf->selectoption['COLOR'] = $this->mpdf->ConvertColor($properties['COLOR']);
|
2507 |
+
}
|
2508 |
+
$this->mpdf->specialcontent = "type=select";
|
2509 |
+
if (isset($attr['DISABLED'])) {
|
2510 |
+
$this->mpdf->selectoption['DISABLED'] = $attr['DISABLED'];
|
2511 |
+
}
|
2512 |
+
if (isset($attr['READONLY'])) {
|
2513 |
+
$this->mpdf->selectoption['READONLY'] = $attr['READONLY'];
|
2514 |
+
}
|
2515 |
+
if (isset($attr['REQUIRED'])) {
|
2516 |
+
$this->mpdf->selectoption['REQUIRED'] = $attr['REQUIRED'];
|
2517 |
+
}
|
2518 |
+
if (isset($attr['EDITABLE'])) {
|
2519 |
+
$this->mpdf->selectoption['EDITABLE'] = $attr['EDITABLE'];
|
2520 |
+
}
|
2521 |
+
if (isset($attr['TITLE'])) {
|
2522 |
+
$this->mpdf->selectoption['TITLE'] = $attr['TITLE'];
|
2523 |
+
}
|
2524 |
+
if (isset($attr['MULTIPLE'])) {
|
2525 |
+
$this->mpdf->selectoption['MULTIPLE'] = $attr['MULTIPLE'];
|
2526 |
+
}
|
2527 |
+
if (isset($attr['SIZE']) && $attr['SIZE'] > 1) {
|
2528 |
+
$this->mpdf->selectoption['SIZE'] = $attr['SIZE'];
|
2529 |
+
}
|
2530 |
+
if ($this->mpdf->useActiveForms) {
|
2531 |
+
if (isset($attr['NAME'])) {
|
2532 |
+
$this->mpdf->selectoption['NAME'] = $attr['NAME'];
|
2533 |
+
}
|
2534 |
+
if (isset($attr['ONCHANGE'])) {
|
2535 |
+
$this->mpdf->selectoption['ONCHANGE'] = $attr['ONCHANGE'];
|
2536 |
+
}
|
2537 |
+
}
|
2538 |
+
|
2539 |
+
$properties = array();
|
2540 |
+
break;
|
2541 |
+
|
2542 |
+
case 'OPTION':
|
2543 |
+
$this->mpdf->lastoptionaltag = '';
|
2544 |
+
$this->mpdf->selectoption['ACTIVE'] = true;
|
2545 |
+
$this->mpdf->selectoption['currentSEL'] = false;
|
2546 |
+
if (empty($this->mpdf->selectoption)) {
|
2547 |
+
$this->mpdf->selectoption['MAXWIDTH'] = '';
|
2548 |
+
$this->mpdf->selectoption['SELECTED'] = '';
|
2549 |
+
}
|
2550 |
+
if (isset($attr['SELECTED'])) {
|
2551 |
+
$this->mpdf->selectoption['SELECTED'] = '';
|
2552 |
+
$this->mpdf->selectoption['currentSEL'] = true;
|
2553 |
+
}
|
2554 |
+
if (isset($attr['VALUE'])) {
|
2555 |
+
$attr['VALUE'] = strcode2utf($attr['VALUE']);
|
2556 |
+
$attr['VALUE'] = $this->mpdf->lesser_entity_decode($attr['VALUE']);
|
2557 |
+
if ($this->mpdf->onlyCoreFonts)
|
2558 |
+
$attr['VALUE'] = mb_convert_encoding($attr['VALUE'], $this->mpdf->mb_enc, 'UTF-8');
|
2559 |
+
}
|
2560 |
+
$this->mpdf->selectoption['currentVAL'] = $attr['VALUE'];
|
2561 |
+
break;
|
2562 |
+
|
2563 |
+
case 'TEXTAREA':
|
2564 |
+
$objattr = array();
|
2565 |
+
$objattr['margin_top'] = 0;
|
2566 |
+
$objattr['margin_bottom'] = 0;
|
2567 |
+
$objattr['margin_left'] = 0;
|
2568 |
+
$objattr['margin_right'] = 0;
|
2569 |
+
$objattr['width'] = 0;
|
2570 |
+
$objattr['height'] = 0;
|
2571 |
+
$objattr['border_top']['w'] = 0;
|
2572 |
+
$objattr['border_bottom']['w'] = 0;
|
2573 |
+
$objattr['border_left']['w'] = 0;
|
2574 |
+
$objattr['border_right']['w'] = 0;
|
2575 |
+
if (isset($attr['DISABLED'])) {
|
2576 |
+
$objattr['disabled'] = true;
|
2577 |
+
}
|
2578 |
+
if (isset($attr['READONLY'])) {
|
2579 |
+
$objattr['readonly'] = true;
|
2580 |
+
}
|
2581 |
+
if (isset($attr['REQUIRED'])) {
|
2582 |
+
$objattr['required'] = true;
|
2583 |
+
}
|
2584 |
+
if (isset($attr['SPELLCHECK']) && strtolower($attr['SPELLCHECK']) == 'true') {
|
2585 |
+
$objattr['spellcheck'] = true;
|
2586 |
+
}
|
2587 |
+
if (isset($attr['TITLE'])) {
|
2588 |
+
$objattr['title'] = $attr['TITLE'];
|
2589 |
+
if ($this->mpdf->onlyCoreFonts)
|
2590 |
+
$objattr['title'] = mb_convert_encoding($objattr['title'], $this->mpdf->mb_enc, 'UTF-8');
|
2591 |
+
}
|
2592 |
+
if ($this->mpdf->useActiveForms) {
|
2593 |
+
if (isset($attr['NAME'])) {
|
2594 |
+
$objattr['fieldname'] = $attr['NAME'];
|
2595 |
+
}
|
2596 |
+
$this->mpdf->mpdfform->form_element_spacing['textarea']['outer']['v'] = 0;
|
2597 |
+
$this->mpdf->mpdfform->form_element_spacing['textarea']['inner']['v'] = 0;
|
2598 |
+
if (isset($attr['ONCALCULATE'])) {
|
2599 |
+
$objattr['onCalculate'] = $attr['ONCALCULATE'];
|
2600 |
+
} else if (isset($attr['ONCHANGE'])) {
|
2601 |
+
$objattr['onCalculate'] = $attr['ONCHANGE'];
|
2602 |
+
}
|
2603 |
+
if (isset($attr['ONVALIDATE'])) {
|
2604 |
+
$objattr['onValidate'] = $attr['ONVALIDATE'];
|
2605 |
+
}
|
2606 |
+
if (isset($attr['ONKEYSTROKE'])) {
|
2607 |
+
$objattr['onKeystroke'] = $attr['ONKEYSTROKE'];
|
2608 |
+
}
|
2609 |
+
if (isset($attr['ONFORMAT'])) {
|
2610 |
+
$objattr['onFormat'] = $attr['ONFORMAT'];
|
2611 |
+
}
|
2612 |
+
}
|
2613 |
+
$this->mpdf->InlineProperties[$tag] = $this->mpdf->saveInlineProperties();
|
2614 |
+
$properties = $this->mpdf->cssmgr->MergeCSS('', $tag, $attr);
|
2615 |
+
if (isset($properties['FONT-FAMILY'])) {
|
2616 |
+
$this->mpdf->SetFont($properties['FONT-FAMILY'], '', 0, false);
|
2617 |
+
}
|
2618 |
+
if (isset($properties['FONT-SIZE'])) {
|
2619 |
+
$mmsize = $this->mpdf->ConvertSize($properties['FONT-SIZE'], $this->mpdf->default_font_size / _MPDFK);
|
2620 |
+
$this->mpdf->SetFontSize($mmsize * _MPDFK, false);
|
2621 |
+
}
|
2622 |
+
if (isset($properties['COLOR'])) {
|
2623 |
+
$objattr['color'] = $this->mpdf->ConvertColor($properties['COLOR']);
|
2624 |
+
}
|
2625 |
+
$objattr['fontfamily'] = $this->mpdf->FontFamily;
|
2626 |
+
$objattr['fontsize'] = $this->mpdf->FontSizePt;
|
2627 |
+
if ($this->mpdf->useActiveForms) {
|
2628 |
+
if (isset($properties['TEXT-ALIGN'])) {
|
2629 |
+
$objattr['text_align'] = $align[strtolower($properties['TEXT-ALIGN'])];
|
2630 |
+
} else if (isset($attr['ALIGN'])) {
|
2631 |
+
$objattr['text_align'] = $align[strtolower($attr['ALIGN'])];
|
2632 |
+
}
|
2633 |
+
if (isset($properties['OVERFLOW']) && strtolower($properties['OVERFLOW']) == 'hidden') {
|
2634 |
+
$objattr['donotscroll'] = true;
|
2635 |
+
}
|
2636 |
+
if (isset($properties['BORDER-TOP-COLOR'])) {
|
2637 |
+
$objattr['border-col'] = $this->mpdf->ConvertColor($properties['BORDER-TOP-COLOR']);
|
2638 |
+
}
|
2639 |
+
if (isset($properties['BACKGROUND-COLOR'])) {
|
2640 |
+
$objattr['background-col'] = $this->mpdf->ConvertColor($properties['BACKGROUND-COLOR']);
|
2641 |
+
}
|
2642 |
+
}
|
2643 |
+
$this->mpdf->SetLineHeight('', $this->mpdf->mpdfform->textarea_lineheight);
|
2644 |
+
|
2645 |
+
$w = 0;
|
2646 |
+
$h = 0;
|
2647 |
+
if (isset($properties['WIDTH']))
|
2648 |
+
$w = $this->mpdf->ConvertSize($properties['WIDTH'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
2649 |
+
if (isset($properties['HEIGHT']))
|
2650 |
+
$h = $this->mpdf->ConvertSize($properties['HEIGHT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
2651 |
+
if (isset($properties['VERTICAL-ALIGN'])) {
|
2652 |
+
$objattr['vertical-align'] = $align[strtolower($properties['VERTICAL-ALIGN'])];
|
2653 |
+
}
|
2654 |
+
|
2655 |
+
$colsize = 20; //HTML default value
|
2656 |
+
$rowsize = 2; //HTML default value
|
2657 |
+
if (isset($attr['COLS']))
|
2658 |
+
$colsize = intval($attr['COLS']);
|
2659 |
+
if (isset($attr['ROWS']))
|
2660 |
+
$rowsize = intval($attr['ROWS']);
|
2661 |
+
|
2662 |
+
$charsize = $this->mpdf->GetCharWidth('w', false);
|
2663 |
+
if ($w) {
|
2664 |
+
$colsize = round(($w - ($this->mpdf->mpdfform->form_element_spacing['textarea']['outer']['h'] * 2) - ($this->mpdf->mpdfform->form_element_spacing['textarea']['inner']['h'] * 2)) / $charsize);
|
2665 |
+
}
|
2666 |
+
if ($h) {
|
2667 |
+
$rowsize = round(($h - ($this->mpdf->mpdfform->form_element_spacing['textarea']['outer']['v'] * 2) - ($this->mpdf->mpdfform->form_element_spacing['textarea']['inner']['v'] * 2)) / $this->mpdf->lineheight);
|
2668 |
+
}
|
2669 |
+
|
2670 |
+
$objattr['type'] = 'textarea';
|
2671 |
+
$objattr['width'] = ($colsize * $charsize) + ($this->mpdf->mpdfform->form_element_spacing['textarea']['outer']['h'] * 2) + ($this->mpdf->mpdfform->form_element_spacing['textarea']['inner']['h'] * 2);
|
2672 |
+
$objattr['height'] = ($rowsize * $this->mpdf->lineheight) + ($this->mpdf->mpdfform->form_element_spacing['textarea']['outer']['v'] * 2) + ($this->mpdf->mpdfform->form_element_spacing['textarea']['inner']['v'] * 2);
|
2673 |
+
$objattr['rows'] = $rowsize;
|
2674 |
+
$objattr['cols'] = $colsize;
|
2675 |
+
|
2676 |
+
$this->mpdf->specialcontent = serialize($objattr);
|
2677 |
+
|
2678 |
+
if ($this->mpdf->tableLevel) { // *TABLES*
|
2679 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s'] += $objattr['width']; // *TABLES*
|
2680 |
+
} // *TABLES*
|
2681 |
+
// Clear properties - tidy up
|
2682 |
+
$properties = array();
|
2683 |
+
break;
|
2684 |
+
|
2685 |
+
|
2686 |
+
|
2687 |
+
// *********** FORM - INPUT ********************
|
2688 |
+
|
2689 |
+
case 'INPUT':
|
2690 |
+
$this->mpdf->ignorefollowingspaces = false;
|
2691 |
+
if (!isset($attr['TYPE']))
|
2692 |
+
$attr['TYPE'] == 'TEXT';
|
2693 |
+
$objattr = array();
|
2694 |
+
$objattr['margin_top'] = 0;
|
2695 |
+
$objattr['margin_bottom'] = 0;
|
2696 |
+
$objattr['margin_left'] = 0;
|
2697 |
+
$objattr['margin_right'] = 0;
|
2698 |
+
$objattr['width'] = 0;
|
2699 |
+
$objattr['height'] = 0;
|
2700 |
+
$objattr['border_top']['w'] = 0;
|
2701 |
+
$objattr['border_bottom']['w'] = 0;
|
2702 |
+
$objattr['border_left']['w'] = 0;
|
2703 |
+
$objattr['border_right']['w'] = 0;
|
2704 |
+
$objattr['type'] = 'input';
|
2705 |
+
if (isset($attr['DISABLED'])) {
|
2706 |
+
$objattr['disabled'] = true;
|
2707 |
+
}
|
2708 |
+
if (isset($attr['READONLY'])) {
|
2709 |
+
$objattr['readonly'] = true;
|
2710 |
+
}
|
2711 |
+
if (isset($attr['REQUIRED'])) {
|
2712 |
+
$objattr['required'] = true;
|
2713 |
+
}
|
2714 |
+
if (isset($attr['SPELLCHECK']) && strtolower($attr['SPELLCHECK']) == 'true') {
|
2715 |
+
$objattr['spellcheck'] = true;
|
2716 |
+
}
|
2717 |
+
if (isset($attr['TITLE'])) {
|
2718 |
+
$objattr['title'] = $attr['TITLE'];
|
2719 |
+
} else if (isset($attr['ALT'])) {
|
2720 |
+
$objattr['title'] = $attr['ALT'];
|
2721 |
+
} else
|
2722 |
+
$objattr['title'] = '';
|
2723 |
+
$objattr['title'] = strcode2utf($objattr['title']);
|
2724 |
+
$objattr['title'] = $this->mpdf->lesser_entity_decode($objattr['title']);
|
2725 |
+
if ($this->mpdf->onlyCoreFonts)
|
2726 |
+
$objattr['title'] = mb_convert_encoding($objattr['title'], $this->mpdf->mb_enc, 'UTF-8');
|
2727 |
+
if ($this->mpdf->useActiveForms) {
|
2728 |
+
if (isset($attr['NAME'])) {
|
2729 |
+
$objattr['fieldname'] = $attr['NAME'];
|
2730 |
+
}
|
2731 |
+
}
|
2732 |
+
if (isset($attr['VALUE'])) {
|
2733 |
+
$attr['VALUE'] = strcode2utf($attr['VALUE']);
|
2734 |
+
$attr['VALUE'] = $this->mpdf->lesser_entity_decode($attr['VALUE']);
|
2735 |
+
if ($this->mpdf->onlyCoreFonts)
|
2736 |
+
$attr['VALUE'] = mb_convert_encoding($attr['VALUE'], $this->mpdf->mb_enc, 'UTF-8');
|
2737 |
+
$objattr['value'] = $attr['VALUE'];
|
2738 |
+
}
|
2739 |
+
|
2740 |
+
$this->mpdf->InlineProperties[$tag] = $this->mpdf->saveInlineProperties();
|
2741 |
+
$properties = $this->mpdf->cssmgr->MergeCSS('', $tag, $attr);
|
2742 |
+
$objattr['vertical-align'] = '';
|
2743 |
+
|
2744 |
+
if (isset($properties['FONT-FAMILY'])) {
|
2745 |
+
$this->mpdf->SetFont($properties['FONT-FAMILY'], $this->mpdf->FontStyle, 0, false);
|
2746 |
+
}
|
2747 |
+
if (isset($properties['FONT-SIZE'])) {
|
2748 |
+
$mmsize = $this->mpdf->ConvertSize($properties['FONT-SIZE'], ($this->mpdf->default_font_size / _MPDFK));
|
2749 |
+
$this->mpdf->SetFontSize($mmsize * _MPDFK, false);
|
2750 |
+
}
|
2751 |
+
if (isset($properties['COLOR'])) {
|
2752 |
+
$objattr['color'] = $this->mpdf->ConvertColor($properties['COLOR']);
|
2753 |
+
}
|
2754 |
+
$objattr['fontfamily'] = $this->mpdf->FontFamily;
|
2755 |
+
$objattr['fontsize'] = $this->mpdf->FontSizePt;
|
2756 |
+
if ($this->mpdf->useActiveForms) {
|
2757 |
+
if (isset($attr['ALIGN'])) {
|
2758 |
+
$objattr['text_align'] = $align[strtolower($attr['ALIGN'])];
|
2759 |
+
} else if (isset($properties['TEXT-ALIGN'])) {
|
2760 |
+
$objattr['text_align'] = $align[strtolower($properties['TEXT-ALIGN'])];
|
2761 |
+
}
|
2762 |
+
if (isset($properties['BORDER-TOP-COLOR'])) {
|
2763 |
+
$objattr['border-col'] = $this->mpdf->ConvertColor($properties['BORDER-TOP-COLOR']);
|
2764 |
+
}
|
2765 |
+
if (isset($properties['BACKGROUND-COLOR'])) {
|
2766 |
+
$objattr['background-col'] = $this->mpdf->ConvertColor($properties['BACKGROUND-COLOR']);
|
2767 |
+
}
|
2768 |
+
}
|
2769 |
+
|
2770 |
+
$type = '';
|
2771 |
+
$texto = '';
|
2772 |
+
$height = $this->mpdf->FontSize;
|
2773 |
+
$width = 0;
|
2774 |
+
$spacesize = $this->mpdf->GetCharWidth(' ', false);
|
2775 |
+
|
2776 |
+
$w = 0;
|
2777 |
+
if (isset($properties['WIDTH']))
|
2778 |
+
$w = $this->mpdf->ConvertSize($properties['WIDTH'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width']);
|
2779 |
+
|
2780 |
+
if ($properties['VERTICAL-ALIGN']) {
|
2781 |
+
$objattr['vertical-align'] = $align[strtolower($properties['VERTICAL-ALIGN'])];
|
2782 |
+
}
|
2783 |
+
|
2784 |
+
switch (strtoupper($attr['TYPE'])) {
|
2785 |
+
case 'HIDDEN':
|
2786 |
+
$this->mpdf->ignorefollowingspaces = true; //Eliminate exceeding left-side spaces
|
2787 |
+
if ($this->mpdf->useActiveForms) {
|
2788 |
+
$this->mpdf->mpdfform->SetFormText(0, 0, $objattr['fieldname'], $objattr['value'], $objattr['value'], '', 0, '', true);
|
2789 |
+
}
|
2790 |
+
if ($this->mpdf->InlineProperties[$tag]) {
|
2791 |
+
$this->mpdf->restoreInlineProperties($this->mpdf->InlineProperties[$tag]);
|
2792 |
+
}
|
2793 |
+
unset($this->mpdf->InlineProperties[$tag]);
|
2794 |
+
break 2;
|
2795 |
+
case 'CHECKBOX': //Draw Checkbox
|
2796 |
+
$type = 'CHECKBOX';
|
2797 |
+
if (isset($attr['CHECKED'])) {
|
2798 |
+
$objattr['checked'] = true;
|
2799 |
+
} else {
|
2800 |
+
$objattr['checked'] = false;
|
2801 |
+
}
|
2802 |
+
$width = $this->mpdf->FontSize;
|
2803 |
+
$height = $this->mpdf->FontSize;
|
2804 |
+
break;
|
2805 |
+
|
2806 |
+
case 'RADIO': //Draw Radio button
|
2807 |
+
$type = 'RADIO';
|
2808 |
+
if (isset($attr['CHECKED']))
|
2809 |
+
$objattr['checked'] = true;
|
2810 |
+
$width = $this->mpdf->FontSize;
|
2811 |
+
$height = $this->mpdf->FontSize;
|
2812 |
+
break;
|
2813 |
+
|
2814 |
+
/* -- IMAGES-CORE -- */
|
2815 |
+
case 'IMAGE': // Draw an Image button
|
2816 |
+
if (isset($attr['SRC'])) {
|
2817 |
+
$type = 'IMAGE';
|
2818 |
+
$srcpath = $attr['SRC'];
|
2819 |
+
$orig_srcpath = $attr['ORIG_SRC'];
|
2820 |
+
// VSPACE and HSPACE converted to margins in MergeCSS
|
2821 |
+
if (isset($properties['MARGIN-TOP'])) {
|
2822 |
+
$objattr['margin_top'] = $this->mpdf->ConvertSize($properties['MARGIN-TOP'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
2823 |
+
}
|
2824 |
+
if (isset($properties['MARGIN-BOTTOM'])) {
|
2825 |
+
$objattr['margin_bottom'] = $this->mpdf->ConvertSize($properties['MARGIN-BOTTOM'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
2826 |
+
}
|
2827 |
+
if (isset($properties['MARGIN-LEFT'])) {
|
2828 |
+
$objattr['margin_left'] = $this->mpdf->ConvertSize($properties['MARGIN-LEFT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
2829 |
+
}
|
2830 |
+
if (isset($properties['MARGIN-RIGHT'])) {
|
2831 |
+
$objattr['margin_right'] = $this->mpdf->ConvertSize($properties['MARGIN-RIGHT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
2832 |
+
}
|
2833 |
+
|
2834 |
+
|
2835 |
+
if (isset($properties['BORDER-TOP'])) {
|
2836 |
+
$objattr['border_top'] = $this->mpdf->border_details($properties['BORDER-TOP']);
|
2837 |
+
}
|
2838 |
+
if (isset($properties['BORDER-BOTTOM'])) {
|
2839 |
+
$objattr['border_bottom'] = $this->mpdf->border_details($properties['BORDER-BOTTOM']);
|
2840 |
+
}
|
2841 |
+
if (isset($properties['BORDER-LEFT'])) {
|
2842 |
+
$objattr['border_left'] = $this->mpdf->border_details($properties['BORDER-LEFT']);
|
2843 |
+
}
|
2844 |
+
if (isset($properties['BORDER-RIGHT'])) {
|
2845 |
+
$objattr['border_right'] = $this->mpdf->border_details($properties['BORDER-RIGHT']);
|
2846 |
+
}
|
2847 |
+
|
2848 |
+
$objattr['padding_top'] = 0;
|
2849 |
+
$objattr['padding_bottom'] = 0;
|
2850 |
+
$objattr['padding_left'] = 0;
|
2851 |
+
$objattr['padding_right'] = 0;
|
2852 |
+
|
2853 |
+
if (isset($properties['VERTICAL-ALIGN'])) {
|
2854 |
+
$objattr['vertical-align'] = $align[strtolower($properties['VERTICAL-ALIGN'])];
|
2855 |
+
}
|
2856 |
+
|
2857 |
+
$w = 0;
|
2858 |
+
$h = 0;
|
2859 |
+
if (isset($properties['WIDTH']))
|
2860 |
+
$w = $this->mpdf->ConvertSize($properties['WIDTH'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width']);
|
2861 |
+
if (isset($properties['HEIGHT']))
|
2862 |
+
$h = $this->mpdf->ConvertSize($properties['HEIGHT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width']);
|
2863 |
+
|
2864 |
+
$extraheight = $objattr['margin_top'] + $objattr['margin_bottom'] + $objattr['border_top']['w'] + $objattr['border_bottom']['w'];
|
2865 |
+
$extrawidth = $objattr['margin_left'] + $objattr['margin_right'] + $objattr['border_left']['w'] + $objattr['border_right']['w'];
|
2866 |
+
|
2867 |
+
// Image file
|
2868 |
+
$info = $this->mpdf->_getImage($srcpath, true, true, $orig_srcpath);
|
2869 |
+
if (!$info) {
|
2870 |
+
$info = $this->mpdf->_getImage($this->mpdf->noImageFile);
|
2871 |
+
if ($info) {
|
2872 |
+
$srcpath = $this->mpdf->noImageFile;
|
2873 |
+
$w = ($info['w'] * (25.4 / $this->mpdf->dpi));
|
2874 |
+
$h = ($info['h'] * (25.4 / $this->mpdf->dpi));
|
2875 |
+
}
|
2876 |
+
}
|
2877 |
+
if (!$info)
|
2878 |
+
break;
|
2879 |
+
if ($info['cs'] == 'Indexed') {
|
2880 |
+
$objattr['Indexed'] = true;
|
2881 |
+
}
|
2882 |
+
$objattr['file'] = $srcpath;
|
2883 |
+
//Default width and height calculation if needed
|
2884 |
+
if ($w == 0 and $h == 0) {
|
2885 |
+
/* -- IMAGES-WMF -- */
|
2886 |
+
if ($info['type'] == 'wmf') {
|
2887 |
+
// WMF units are twips (1/20pt)
|
2888 |
+
// divide by 20 to get points
|
2889 |
+
// divide by k to get user units
|
2890 |
+
$w = abs($info['w']) / (20 * _MPDFK);
|
2891 |
+
$h = abs($info['h']) / (20 * _MPDFK);
|
2892 |
+
} else
|
2893 |
+
/* -- END IMAGES-WMF -- */
|
2894 |
+
if ($info['type'] == 'svg') {
|
2895 |
+
// SVG units are pixels
|
2896 |
+
$w = abs($info['w']) / _MPDFK;
|
2897 |
+
$h = abs($info['h']) / _MPDFK;
|
2898 |
+
} else {
|
2899 |
+
//Put image at default image dpi
|
2900 |
+
$w = ($info['w'] / _MPDFK) * (72 / $this->mpdf->img_dpi);
|
2901 |
+
$h = ($info['h'] / _MPDFK) * (72 / $this->mpdf->img_dpi);
|
2902 |
+
}
|
2903 |
+
if (isset($properties['IMAGE-RESOLUTION'])) {
|
2904 |
+
if (preg_match('/from-image/i', $properties['IMAGE-RESOLUTION']) && isset($info['set-dpi']) && $info['set-dpi'] > 0) {
|
2905 |
+
$w *= $this->mpdf->img_dpi / $info['set-dpi'];
|
2906 |
+
$h *= $this->mpdf->img_dpi / $info['set-dpi'];
|
2907 |
+
} else if (preg_match('/(\d+)dpi/i', $properties['IMAGE-RESOLUTION'], $m)) {
|
2908 |
+
$dpi = $m[1];
|
2909 |
+
if ($dpi > 0) {
|
2910 |
+
$w *= $this->mpdf->img_dpi / $dpi;
|
2911 |
+
$h *= $this->mpdf->img_dpi / $dpi;
|
2912 |
+
}
|
2913 |
+
}
|
2914 |
+
}
|
2915 |
+
}
|
2916 |
+
// IF WIDTH OR HEIGHT SPECIFIED
|
2917 |
+
if ($w == 0)
|
2918 |
+
$w = $h * $info['w'] / $info['h'];
|
2919 |
+
if ($h == 0)
|
2920 |
+
$h = $w * $info['h'] / $info['w'];
|
2921 |
+
// Resize to maximum dimensions of page
|
2922 |
+
$maxWidth = $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'];
|
2923 |
+
$maxHeight = $this->mpdf->h - ($this->mpdf->tMargin + $this->mpdf->bMargin + 10);
|
2924 |
+
if ($this->mpdf->fullImageHeight) {
|
2925 |
+
$maxHeight = $this->mpdf->fullImageHeight;
|
2926 |
+
}
|
2927 |
+
if (($w + $extrawidth) > ($maxWidth + 0.0001)) { // mPDF 5.7.4 0.0001 to allow for rounding errors when w==maxWidth
|
2928 |
+
$w = $maxWidth - $extrawidth;
|
2929 |
+
$h = $w * $info['h'] / $info['w'];
|
2930 |
+
}
|
2931 |
+
if ($h + $extraheight > $maxHeight) {
|
2932 |
+
$h = $maxHeight - $extraheight;
|
2933 |
+
$w = $h * $info['w'] / $info['h'];
|
2934 |
+
}
|
2935 |
+
$height = $h + $extraheight;
|
2936 |
+
$width = $w + $extrawidth;
|
2937 |
+
$objattr['type'] = 'image';
|
2938 |
+
$objattr['itype'] = $info['type'];
|
2939 |
+
$objattr['orig_h'] = $info['h'];
|
2940 |
+
$objattr['orig_w'] = $info['w'];
|
2941 |
+
/* -- IMAGES-WMF -- */
|
2942 |
+
if ($info['type'] == 'wmf') {
|
2943 |
+
$objattr['wmf_x'] = $info['x'];
|
2944 |
+
$objattr['wmf_y'] = $info['y'];
|
2945 |
+
} else
|
2946 |
+
/* -- END IMAGES-WMF -- */
|
2947 |
+
if ($info['type'] == 'svg') {
|
2948 |
+
$objattr['wmf_x'] = $info['x'];
|
2949 |
+
$objattr['wmf_y'] = $info['y'];
|
2950 |
+
}
|
2951 |
+
$objattr['height'] = $h + $extraheight;
|
2952 |
+
$objattr['width'] = $w + $extrawidth;
|
2953 |
+
|
2954 |
+
$objattr['image_height'] = $h;
|
2955 |
+
$objattr['image_width'] = $w;
|
2956 |
+
$objattr['ID'] = $info['i'];
|
2957 |
+
$texto = 'X';
|
2958 |
+
if ($this->mpdf->useActiveForms) {
|
2959 |
+
if (isset($attr['ONCLICK'])) {
|
2960 |
+
$objattr['onClick'] = $attr['ONCLICK'];
|
2961 |
+
}
|
2962 |
+
$objattr['type'] = 'input';
|
2963 |
+
$type = 'IMAGE';
|
2964 |
+
}
|
2965 |
+
break;
|
2966 |
+
}
|
2967 |
+
/* -- END IMAGES-CORE -- */
|
2968 |
+
|
2969 |
+
case 'BUTTON': // Draw a button
|
2970 |
+
case 'SUBMIT':
|
2971 |
+
case 'RESET':
|
2972 |
+
$type = strtoupper($attr['TYPE']);
|
2973 |
+
if ($type == 'IMAGE') {
|
2974 |
+
$type = 'BUTTON';
|
2975 |
+
} // src path not found
|
2976 |
+
if (isset($attr['NOPRINT'])) {
|
2977 |
+
$objattr['noprint'] = true;
|
2978 |
+
}
|
2979 |
+
if (!isset($attr['VALUE'])) {
|
2980 |
+
$objattr['value'] = ucfirst(strtolower($type));
|
2981 |
+
}
|
2982 |
+
|
2983 |
+
$texto = " " . $objattr['value'] . " ";
|
2984 |
+
$width = $this->mpdf->GetStringWidth($texto) + ($this->mpdf->mpdfform->form_element_spacing['button']['outer']['h'] * 2) + ($this->mpdf->mpdfform->form_element_spacing['button']['inner']['h'] * 2);
|
2985 |
+
$height = $this->mpdf->FontSize + ($this->mpdf->mpdfform->form_element_spacing['button']['outer']['v'] * 2) + ($this->mpdf->mpdfform->form_element_spacing['button']['inner']['v'] * 2);
|
2986 |
+
if ($this->mpdf->useActiveForms) {
|
2987 |
+
if (isset($attr['ONCLICK'])) {
|
2988 |
+
$objattr['onClick'] = $attr['ONCLICK'];
|
2989 |
+
}
|
2990 |
+
}
|
2991 |
+
break;
|
2992 |
+
|
2993 |
+
case 'PASSWORD':
|
2994 |
+
case 'TEXT':
|
2995 |
+
default:
|
2996 |
+
if ($type == '') {
|
2997 |
+
$type = 'TEXT';
|
2998 |
+
}
|
2999 |
+
if (strtoupper($attr['TYPE']) == 'PASSWORD') {
|
3000 |
+
$type = 'PASSWORD';
|
3001 |
+
}
|
3002 |
+
if (isset($attr['VALUE'])) {
|
3003 |
+
if ($type == 'PASSWORD') {
|
3004 |
+
$num_stars = mb_strlen($attr['VALUE'], $this->mpdf->mb_enc);
|
3005 |
+
$texto = str_repeat('*', $num_stars);
|
3006 |
+
} else {
|
3007 |
+
$texto = $attr['VALUE'];
|
3008 |
+
}
|
3009 |
+
}
|
3010 |
+
$xw = ($this->mpdf->mpdfform->form_element_spacing['input']['outer']['h'] * 2) + ($this->mpdf->mpdfform->form_element_spacing['input']['inner']['h'] * 2);
|
3011 |
+
$xh = ($this->mpdf->mpdfform->form_element_spacing['input']['outer']['v'] * 2) + ($this->mpdf->mpdfform->form_element_spacing['input']['inner']['v'] * 2);
|
3012 |
+
if ($w) {
|
3013 |
+
$width = $w + $xw;
|
3014 |
+
} else {
|
3015 |
+
$width = (20 * $spacesize) + $xw;
|
3016 |
+
} // Default width in chars
|
3017 |
+
if (isset($attr['SIZE']) and ctype_digit($attr['SIZE']))
|
3018 |
+
$width = ($attr['SIZE'] * $spacesize) + $xw;
|
3019 |
+
$height = $this->mpdf->FontSize + $xh;
|
3020 |
+
if (isset($attr['MAXLENGTH']) and ctype_digit($attr['MAXLENGTH']))
|
3021 |
+
$objattr['maxlength'] = $attr['MAXLENGTH'];
|
3022 |
+
if ($this->mpdf->useActiveForms) {
|
3023 |
+
if (isset($attr['ONCALCULATE'])) {
|
3024 |
+
$objattr['onCalculate'] = $attr['ONCALCULATE'];
|
3025 |
+
} else if (isset($attr['ONCHANGE'])) {
|
3026 |
+
$objattr['onCalculate'] = $attr['ONCHANGE'];
|
3027 |
+
}
|
3028 |
+
if (isset($attr['ONVALIDATE'])) {
|
3029 |
+
$objattr['onValidate'] = $attr['ONVALIDATE'];
|
3030 |
+
}
|
3031 |
+
if (isset($attr['ONKEYSTROKE'])) {
|
3032 |
+
$objattr['onKeystroke'] = $attr['ONKEYSTROKE'];
|
3033 |
+
}
|
3034 |
+
if (isset($attr['ONFORMAT'])) {
|
3035 |
+
$objattr['onFormat'] = $attr['ONFORMAT'];
|
3036 |
+
}
|
3037 |
+
}
|
3038 |
+
break;
|
3039 |
+
}
|
3040 |
+
|
3041 |
+
$objattr['subtype'] = $type;
|
3042 |
+
$objattr['text'] = $texto;
|
3043 |
+
$objattr['width'] = $width;
|
3044 |
+
$objattr['height'] = $height;
|
3045 |
+
$e = "\xbb\xa4\xactype=input,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
|
3046 |
+
|
3047 |
+
// Clear properties - tidy up
|
3048 |
+
$properties = array();
|
3049 |
+
|
3050 |
+
/* -- TABLES -- */
|
3051 |
+
// Output it to buffers
|
3052 |
+
if ($this->mpdf->tableLevel) {
|
3053 |
+
$this->mpdf->_saveCellTextBuffer($e, $this->mpdf->HREF);
|
3054 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s'] += $objattr['width'];
|
3055 |
+
} else {
|
3056 |
+
/* -- END TABLES -- */
|
3057 |
+
$this->mpdf->_saveTextBuffer($e, $this->mpdf->HREF);
|
3058 |
+
} // *TABLES*
|
3059 |
+
|
3060 |
+
if ($this->mpdf->InlineProperties[$tag]) {
|
3061 |
+
$this->mpdf->restoreInlineProperties($this->mpdf->InlineProperties[$tag]);
|
3062 |
+
}
|
3063 |
+
unset($this->mpdf->InlineProperties[$tag]);
|
3064 |
+
|
3065 |
+
break; // END of INPUT
|
3066 |
+
/* -- END FORMS -- */
|
3067 |
+
|
3068 |
+
|
3069 |
+
// *********** GRAPH ********************
|
3070 |
+
case 'JPGRAPH':
|
3071 |
+
if (!$this->mpdf->useGraphs) {
|
3072 |
+
break;
|
3073 |
+
}
|
3074 |
+
if ($attr['TABLE']) {
|
3075 |
+
$gid = strtoupper($attr['TABLE']);
|
3076 |
+
} else {
|
3077 |
+
$gid = '0';
|
3078 |
+
}
|
3079 |
+
if (!is_array($this->mpdf->graphs[$gid]) || count($this->mpdf->graphs[$gid]) == 0) {
|
3080 |
+
break;
|
3081 |
+
}
|
3082 |
+
$this->mpdf->ignorefollowingspaces = false;
|
3083 |
+
include_once(_MPDF_PATH . 'graph.php');
|
3084 |
+
$this->mpdf->graphs[$gid]['attr'] = $attr;
|
3085 |
+
|
3086 |
+
|
3087 |
+
if (isset($this->mpdf->graphs[$gid]['attr']['WIDTH']) && $this->mpdf->graphs[$gid]['attr']['WIDTH']) {
|
3088 |
+
$this->mpdf->graphs[$gid]['attr']['cWIDTH'] = $this->mpdf->ConvertSize($this->mpdf->graphs[$gid]['attr']['WIDTH'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width']);
|
3089 |
+
} // mm
|
3090 |
+
if (isset($this->mpdf->graphs[$gid]['attr']['HEIGHT']) && $this->mpdf->graphs[$gid]['attr']['HEIGHT']) {
|
3091 |
+
$this->mpdf->graphs[$gid]['attr']['cHEIGHT'] = $this->mpdf->ConvertSize($this->mpdf->graphs[$gid]['attr']['HEIGHT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width']);
|
3092 |
+
}
|
3093 |
+
|
3094 |
+
$graph_img = print_graph($this->mpdf->graphs[$gid], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width']);
|
3095 |
+
if ($graph_img) {
|
3096 |
+
if (isset($attr['ROTATE'])) {
|
3097 |
+
if ($attr['ROTATE'] == 90 || $attr['ROTATE'] == -90) {
|
3098 |
+
$tmpw = $graph_img['w'];
|
3099 |
+
$graph_img['w'] = $graph_img['h'];
|
3100 |
+
$graph_img['h'] = $tmpw;
|
3101 |
+
}
|
3102 |
+
}
|
3103 |
+
$attr['SRC'] = $graph_img['file'];
|
3104 |
+
$attr['WIDTH'] = $graph_img['w'];
|
3105 |
+
$attr['HEIGHT'] = $graph_img['h'];
|
3106 |
+
} else {
|
3107 |
+
break;
|
3108 |
+
}
|
3109 |
+
|
3110 |
+
// *********** IMAGE ********************
|
3111 |
+
/* -- IMAGES-CORE -- */
|
3112 |
+
case 'IMG':
|
3113 |
+
$this->mpdf->ignorefollowingspaces = false;
|
3114 |
+
if ($this->mpdf->progressBar) {
|
3115 |
+
$this->mpdf->UpdateProgressBar(1, '', 'IMG');
|
3116 |
+
} // *PROGRESS-BAR*
|
3117 |
+
$objattr = array();
|
3118 |
+
$objattr['margin_top'] = 0;
|
3119 |
+
$objattr['margin_bottom'] = 0;
|
3120 |
+
$objattr['margin_left'] = 0;
|
3121 |
+
$objattr['margin_right'] = 0;
|
3122 |
+
$objattr['padding_top'] = 0;
|
3123 |
+
$objattr['padding_bottom'] = 0;
|
3124 |
+
$objattr['padding_left'] = 0;
|
3125 |
+
$objattr['padding_right'] = 0;
|
3126 |
+
$objattr['width'] = 0;
|
3127 |
+
$objattr['height'] = 0;
|
3128 |
+
$objattr['border_top']['w'] = 0;
|
3129 |
+
$objattr['border_bottom']['w'] = 0;
|
3130 |
+
$objattr['border_left']['w'] = 0;
|
3131 |
+
$objattr['border_right']['w'] = 0;
|
3132 |
+
if (isset($attr['SRC'])) {
|
3133 |
+
$srcpath = $attr['SRC'];
|
3134 |
+
$orig_srcpath = (isset($attr['ORIG_SRC']) ? $attr['ORIG_SRC'] : '');
|
3135 |
+
$properties = $this->mpdf->cssmgr->MergeCSS('', $tag, $attr);
|
3136 |
+
if (isset($properties ['DISPLAY']) && strtolower($properties ['DISPLAY']) == 'none') {
|
3137 |
+
return;
|
3138 |
+
}
|
3139 |
+
if (isset($properties['Z-INDEX']) && $this->mpdf->current_layer == 0) {
|
3140 |
+
$v = intval($properties['Z-INDEX']);
|
3141 |
+
if ($v > 0) {
|
3142 |
+
$objattr['z-index'] = $v;
|
3143 |
+
}
|
3144 |
+
}
|
3145 |
+
|
3146 |
+
$objattr['visibility'] = 'visible';
|
3147 |
+
if (isset($properties['VISIBILITY'])) {
|
3148 |
+
$v = strtolower($properties['VISIBILITY']);
|
3149 |
+
if (($v == 'hidden' || $v == 'printonly' || $v == 'screenonly') && $this->mpdf->visibility == 'visible') {
|
3150 |
+
$objattr['visibility'] = $v;
|
3151 |
+
}
|
3152 |
+
}
|
3153 |
+
|
3154 |
+
// VSPACE and HSPACE converted to margins in MergeCSS
|
3155 |
+
if (isset($properties['MARGIN-TOP'])) {
|
3156 |
+
$objattr['margin_top'] = $this->mpdf->ConvertSize($properties['MARGIN-TOP'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3157 |
+
}
|
3158 |
+
if (isset($properties['MARGIN-BOTTOM'])) {
|
3159 |
+
$objattr['margin_bottom'] = $this->mpdf->ConvertSize($properties['MARGIN-BOTTOM'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3160 |
+
}
|
3161 |
+
if (isset($properties['MARGIN-LEFT'])) {
|
3162 |
+
$objattr['margin_left'] = $this->mpdf->ConvertSize($properties['MARGIN-LEFT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3163 |
+
}
|
3164 |
+
if (isset($properties['MARGIN-RIGHT'])) {
|
3165 |
+
$objattr['margin_right'] = $this->mpdf->ConvertSize($properties['MARGIN-RIGHT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3166 |
+
}
|
3167 |
+
|
3168 |
+
if (isset($properties['PADDING-TOP'])) {
|
3169 |
+
$objattr['padding_top'] = $this->mpdf->ConvertSize($properties['PADDING-TOP'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3170 |
+
}
|
3171 |
+
if (isset($properties['PADDING-BOTTOM'])) {
|
3172 |
+
$objattr['padding_bottom'] = $this->mpdf->ConvertSize($properties['PADDING-BOTTOM'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3173 |
+
}
|
3174 |
+
if (isset($properties['PADDING-LEFT'])) {
|
3175 |
+
$objattr['padding_left'] = $this->mpdf->ConvertSize($properties['PADDING-LEFT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3176 |
+
}
|
3177 |
+
if (isset($properties['PADDING-RIGHT'])) {
|
3178 |
+
$objattr['padding_right'] = $this->mpdf->ConvertSize($properties['PADDING-RIGHT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3179 |
+
}
|
3180 |
+
|
3181 |
+
if (isset($properties['BORDER-TOP'])) {
|
3182 |
+
$objattr['border_top'] = $this->mpdf->border_details($properties['BORDER-TOP']);
|
3183 |
+
}
|
3184 |
+
if (isset($properties['BORDER-BOTTOM'])) {
|
3185 |
+
$objattr['border_bottom'] = $this->mpdf->border_details($properties['BORDER-BOTTOM']);
|
3186 |
+
}
|
3187 |
+
if (isset($properties['BORDER-LEFT'])) {
|
3188 |
+
$objattr['border_left'] = $this->mpdf->border_details($properties['BORDER-LEFT']);
|
3189 |
+
}
|
3190 |
+
if (isset($properties['BORDER-RIGHT'])) {
|
3191 |
+
$objattr['border_right'] = $this->mpdf->border_details($properties['BORDER-RIGHT']);
|
3192 |
+
}
|
3193 |
+
|
3194 |
+
if (isset($properties['VERTICAL-ALIGN'])) {
|
3195 |
+
$objattr['vertical-align'] = $align[strtolower($properties['VERTICAL-ALIGN'])];
|
3196 |
+
}
|
3197 |
+
$w = 0;
|
3198 |
+
$h = 0;
|
3199 |
+
if (isset($properties['WIDTH']))
|
3200 |
+
$w = $this->mpdf->ConvertSize($properties['WIDTH'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3201 |
+
else if (isset($attr['WIDTH']))
|
3202 |
+
$w = $this->mpdf->ConvertSize($attr['WIDTH'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3203 |
+
if (isset($properties['HEIGHT']))
|
3204 |
+
$h = $this->mpdf->ConvertSize($properties['HEIGHT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3205 |
+
else if (isset($attr['HEIGHT']))
|
3206 |
+
$h = $this->mpdf->ConvertSize($attr['HEIGHT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3207 |
+
$maxw = $maxh = $minw = $minh = false;
|
3208 |
+
if (isset($properties['MAX-WIDTH']))
|
3209 |
+
$maxw = $this->mpdf->ConvertSize($properties['MAX-WIDTH'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3210 |
+
else if (isset($attr['MAX-WIDTH']))
|
3211 |
+
$maxw = $this->mpdf->ConvertSize($attr['MAX-WIDTH'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3212 |
+
if (isset($properties['MAX-HEIGHT']))
|
3213 |
+
$maxh = $this->mpdf->ConvertSize($properties['MAX-HEIGHT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3214 |
+
else if (isset($attr['MAX-HEIGHT']))
|
3215 |
+
$maxh = $this->mpdf->ConvertSize($attr['MAX-HEIGHT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3216 |
+
if (isset($properties['MIN-WIDTH']))
|
3217 |
+
$minw = $this->mpdf->ConvertSize($properties['MIN-WIDTH'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3218 |
+
else if (isset($attr['MIN-WIDTH']))
|
3219 |
+
$minw = $this->mpdf->ConvertSize($attr['MIN-WIDTH'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3220 |
+
if (isset($properties['MIN-HEIGHT']))
|
3221 |
+
$minh = $this->mpdf->ConvertSize($properties['MIN-HEIGHT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3222 |
+
else if (isset($attr['MIN-HEIGHT']))
|
3223 |
+
$minh = $this->mpdf->ConvertSize($attr['MIN-HEIGHT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3224 |
+
|
3225 |
+
if (isset($properties['OPACITY']) && $properties['OPACITY'] > 0 && $properties['OPACITY'] <= 1) {
|
3226 |
+
$objattr['opacity'] = $properties['OPACITY'];
|
3227 |
+
}
|
3228 |
+
if ($this->mpdf->HREF) {
|
3229 |
+
if (strpos($this->mpdf->HREF, ".") === false && strpos($this->mpdf->HREF, "@") !== 0) {
|
3230 |
+
$href = $this->mpdf->HREF;
|
3231 |
+
while (array_key_exists($href, $this->mpdf->internallink))
|
3232 |
+
$href = "#" . $href;
|
3233 |
+
$this->mpdf->internallink[$href] = $this->mpdf->AddLink();
|
3234 |
+
$objattr['link'] = $this->mpdf->internallink[$href];
|
3235 |
+
} else {
|
3236 |
+
$objattr['link'] = $this->mpdf->HREF;
|
3237 |
+
}
|
3238 |
+
}
|
3239 |
+
$extraheight = $objattr['padding_top'] + $objattr['padding_bottom'] + $objattr['margin_top'] + $objattr['margin_bottom'] + $objattr['border_top']['w'] + $objattr['border_bottom']['w'];
|
3240 |
+
$extrawidth = $objattr['padding_left'] + $objattr['padding_right'] + $objattr['margin_left'] + $objattr['margin_right'] + $objattr['border_left']['w'] + $objattr['border_right']['w'];
|
3241 |
+
|
3242 |
+
// mPDF 5.7.3 TRANSFORMS
|
3243 |
+
if (isset($properties['BACKGROUND-COLOR']) && $properties['BACKGROUND-COLOR'] != '') {
|
3244 |
+
$objattr['bgcolor'] = $this->mpdf->ConvertColor($properties['BACKGROUND-COLOR']);
|
3245 |
+
}
|
3246 |
+
|
3247 |
+
/* -- BACKGROUNDS -- */
|
3248 |
+
if (isset($properties['GRADIENT-MASK']) && preg_match('/(-moz-)*(repeating-)*(linear|radial)-gradient/', $properties['GRADIENT-MASK'])) {
|
3249 |
+
$objattr['GRADIENT-MASK'] = $properties['GRADIENT-MASK'];
|
3250 |
+
}
|
3251 |
+
/* -- END BACKGROUNDS -- */
|
3252 |
+
|
3253 |
+
// mPDF 6
|
3254 |
+
$interpolation = false;
|
3255 |
+
if (isset($properties['IMAGE-RENDERING']) && $properties['IMAGE-RENDERING']) {
|
3256 |
+
if (strtolower($properties['IMAGE-RENDERING']) == 'crisp-edges') {
|
3257 |
+
$interpolation = false;
|
3258 |
+
} else if (strtolower($properties['IMAGE-RENDERING']) == 'optimizequality') {
|
3259 |
+
$interpolation = true;
|
3260 |
+
} else if (strtolower($properties['IMAGE-RENDERING']) == 'smooth') {
|
3261 |
+
$interpolation = true;
|
3262 |
+
} else if (strtolower($properties['IMAGE-RENDERING']) == 'auto') {
|
3263 |
+
$interpolation = $this->mpdf->interpolateImages;
|
3264 |
+
} else {
|
3265 |
+
$interpolation = false;
|
3266 |
+
}
|
3267 |
+
$info['interpolation'] = $interpolation;
|
3268 |
+
}
|
3269 |
+
|
3270 |
+
// Image file
|
3271 |
+
$info = $this->mpdf->_getImage($srcpath, true, true, $orig_srcpath, $interpolation); // mPDF 6
|
3272 |
+
if (!$info) {
|
3273 |
+
$info = $this->mpdf->_getImage($this->mpdf->noImageFile);
|
3274 |
+
if ($info) {
|
3275 |
+
$srcpath = $this->mpdf->noImageFile;
|
3276 |
+
$w = ($info['w'] * (25.4 / $this->mpdf->dpi));
|
3277 |
+
$h = ($info['h'] * (25.4 / $this->mpdf->dpi));
|
3278 |
+
}
|
3279 |
+
}
|
3280 |
+
if (!$info)
|
3281 |
+
break;
|
3282 |
+
|
3283 |
+
if (isset($attr['ROTATE'])) {
|
3284 |
+
$image_orientation = $attr['ROTATE'];
|
3285 |
+
} else if (isset($properties['IMAGE-ORIENTATION'])) {
|
3286 |
+
$image_orientation = $properties['IMAGE-ORIENTATION'];
|
3287 |
+
} else {
|
3288 |
+
$image_orientation = 0;
|
3289 |
+
}
|
3290 |
+
if ($image_orientation) {
|
3291 |
+
if ($image_orientation == 90 || $image_orientation == -90 || $image_orientation == 270) {
|
3292 |
+
$tmpw = $info['w'];
|
3293 |
+
$info['w'] = $info['h'];
|
3294 |
+
$info['h'] = $tmpw;
|
3295 |
+
}
|
3296 |
+
$objattr['ROTATE'] = $image_orientation;
|
3297 |
+
}
|
3298 |
+
|
3299 |
+
$objattr['file'] = $srcpath;
|
3300 |
+
//Default width and height calculation if needed
|
3301 |
+
if ($w == 0 and $h == 0) {
|
3302 |
+
/* -- IMAGES-WMF -- */
|
3303 |
+
if ($info['type'] == 'wmf') {
|
3304 |
+
// WMF units are twips (1/20pt)
|
3305 |
+
// divide by 20 to get points
|
3306 |
+
// divide by k to get user units
|
3307 |
+
$w = abs($info['w']) / (20 * _MPDFK);
|
3308 |
+
$h = abs($info['h']) / (20 * _MPDFK);
|
3309 |
+
} else
|
3310 |
+
/* -- END IMAGES-WMF -- */
|
3311 |
+
if ($info['type'] == 'svg') {
|
3312 |
+
// SVG units are pixels
|
3313 |
+
$w = abs($info['w']) / _MPDFK;
|
3314 |
+
$h = abs($info['h']) / _MPDFK;
|
3315 |
+
} else {
|
3316 |
+
//Put image at default image dpi
|
3317 |
+
$w = ($info['w'] / _MPDFK) * (72 / $this->mpdf->img_dpi);
|
3318 |
+
$h = ($info['h'] / _MPDFK) * (72 / $this->mpdf->img_dpi);
|
3319 |
+
}
|
3320 |
+
if (isset($properties['IMAGE-RESOLUTION'])) {
|
3321 |
+
if (preg_match('/from-image/i', $properties['IMAGE-RESOLUTION']) && isset($info['set-dpi']) && $info['set-dpi'] > 0) {
|
3322 |
+
$w *= $this->mpdf->img_dpi / $info['set-dpi'];
|
3323 |
+
$h *= $this->mpdf->img_dpi / $info['set-dpi'];
|
3324 |
+
} else if (preg_match('/(\d+)dpi/i', $properties['IMAGE-RESOLUTION'], $m)) {
|
3325 |
+
$dpi = $m[1];
|
3326 |
+
if ($dpi > 0) {
|
3327 |
+
$w *= $this->mpdf->img_dpi / $dpi;
|
3328 |
+
$h *= $this->mpdf->img_dpi / $dpi;
|
3329 |
+
}
|
3330 |
+
}
|
3331 |
+
}
|
3332 |
+
}
|
3333 |
+
// IF WIDTH OR HEIGHT SPECIFIED
|
3334 |
+
if ($w == 0)
|
3335 |
+
$w = abs($h * $info['w'] / $info['h']);
|
3336 |
+
if ($h == 0)
|
3337 |
+
$h = abs($w * $info['h'] / $info['w']);
|
3338 |
+
|
3339 |
+
if ($minw && $w < $minw) {
|
3340 |
+
$w = $minw;
|
3341 |
+
$h = abs($w * $info['h'] / $info['w']);
|
3342 |
+
}
|
3343 |
+
if ($maxw && $w > $maxw) {
|
3344 |
+
$w = $maxw;
|
3345 |
+
$h = abs($w * $info['h'] / $info['w']);
|
3346 |
+
}
|
3347 |
+
if ($minh && $h < $minh) {
|
3348 |
+
$h = $minh;
|
3349 |
+
$w = abs($h * $info['w'] / $info['h']);
|
3350 |
+
}
|
3351 |
+
if ($maxh && $h > $maxh) {
|
3352 |
+
$h = $maxh;
|
3353 |
+
$w = abs($h * $info['w'] / $info['h']);
|
3354 |
+
}
|
3355 |
+
|
3356 |
+
// Resize to maximum dimensions of page
|
3357 |
+
$maxWidth = $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'];
|
3358 |
+
$maxHeight = $this->mpdf->h - ($this->mpdf->tMargin + $this->mpdf->bMargin + 1);
|
3359 |
+
if ($this->mpdf->fullImageHeight) {
|
3360 |
+
$maxHeight = $this->mpdf->fullImageHeight;
|
3361 |
+
}
|
3362 |
+
if (($w + $extrawidth) > ($maxWidth + 0.0001)) { // mPDF 5.7.4 0.0001 to allow for rounding errors when w==maxWidth
|
3363 |
+
$w = $maxWidth - $extrawidth;
|
3364 |
+
$h = abs($w * $info['h'] / $info['w']);
|
3365 |
+
}
|
3366 |
+
|
3367 |
+
if ($h + $extraheight > $maxHeight) {
|
3368 |
+
$h = $maxHeight - $extraheight;
|
3369 |
+
$w = abs($h * $info['w'] / $info['h']);
|
3370 |
+
}
|
3371 |
+
$objattr['type'] = 'image';
|
3372 |
+
$objattr['itype'] = $info['type'];
|
3373 |
+
|
3374 |
+
$objattr['orig_h'] = $info['h'];
|
3375 |
+
$objattr['orig_w'] = $info['w'];
|
3376 |
+
/* -- IMAGES-WMF -- */
|
3377 |
+
if ($info['type'] == 'wmf') {
|
3378 |
+
$objattr['wmf_x'] = $info['x'];
|
3379 |
+
$objattr['wmf_y'] = $info['y'];
|
3380 |
+
} else
|
3381 |
+
/* -- END IMAGES-WMF -- */
|
3382 |
+
if ($info['type'] == 'svg') {
|
3383 |
+
$objattr['wmf_x'] = $info['x'];
|
3384 |
+
$objattr['wmf_y'] = $info['y'];
|
3385 |
+
}
|
3386 |
+
$objattr['height'] = $h + $extraheight;
|
3387 |
+
$objattr['width'] = $w + $extrawidth;
|
3388 |
+
$objattr['image_height'] = $h;
|
3389 |
+
$objattr['image_width'] = $w;
|
3390 |
+
/* -- CSS-IMAGE-FLOAT -- */
|
3391 |
+
if (!$this->mpdf->ColActive && !$this->mpdf->tableLevel && !$this->mpdf->listlvl && !$this->mpdf->kwt) {
|
3392 |
+
if (isset($properties['FLOAT']) && (strtoupper($properties['FLOAT']) == 'RIGHT' || strtoupper($properties['FLOAT']) == 'LEFT')) {
|
3393 |
+
$objattr['float'] = substr(strtoupper($properties['FLOAT']), 0, 1);
|
3394 |
+
}
|
3395 |
+
}
|
3396 |
+
/* -- END CSS-IMAGE-FLOAT -- */
|
3397 |
+
// mPDF 5.7.3 TRANSFORMS
|
3398 |
+
if (isset($properties['TRANSFORM']) && !$this->mpdf->ColActive && !$this->mpdf->kwt) {
|
3399 |
+
$objattr['transform'] = $properties['TRANSFORM'];
|
3400 |
+
}
|
3401 |
+
|
3402 |
+
$e = "\xbb\xa4\xactype=image,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
|
3403 |
+
|
3404 |
+
// Clear properties - tidy up
|
3405 |
+
$properties = array();
|
3406 |
+
|
3407 |
+
/* -- TABLES -- */
|
3408 |
+
// Output it to buffers
|
3409 |
+
if ($this->mpdf->tableLevel) {
|
3410 |
+
$this->mpdf->_saveCellTextBuffer($e, $this->mpdf->HREF);
|
3411 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s'] += $objattr['width'];
|
3412 |
+
} else {
|
3413 |
+
/* -- END TABLES -- */
|
3414 |
+
$this->mpdf->_saveTextBuffer($e, $this->mpdf->HREF);
|
3415 |
+
} // *TABLES*
|
3416 |
+
/* -- ANNOTATIONS -- */
|
3417 |
+
if ($this->mpdf->title2annots && isset($attr['TITLE'])) {
|
3418 |
+
$objattr = array();
|
3419 |
+
$objattr['margin_top'] = 0;
|
3420 |
+
$objattr['margin_bottom'] = 0;
|
3421 |
+
$objattr['margin_left'] = 0;
|
3422 |
+
$objattr['margin_right'] = 0;
|
3423 |
+
$objattr['width'] = 0;
|
3424 |
+
$objattr['height'] = 0;
|
3425 |
+
$objattr['border_top']['w'] = 0;
|
3426 |
+
$objattr['border_bottom']['w'] = 0;
|
3427 |
+
$objattr['border_left']['w'] = 0;
|
3428 |
+
$objattr['border_right']['w'] = 0;
|
3429 |
+
$objattr['CONTENT'] = $attr['TITLE'];
|
3430 |
+
$objattr['type'] = 'annot';
|
3431 |
+
$objattr['POS-X'] = 0;
|
3432 |
+
$objattr['POS-Y'] = 0;
|
3433 |
+
$objattr['ICON'] = 'Comment';
|
3434 |
+
$objattr['AUTHOR'] = '';
|
3435 |
+
$objattr['SUBJECT'] = '';
|
3436 |
+
$objattr['OPACITY'] = $this->mpdf->annotOpacity;
|
3437 |
+
$objattr['COLOR'] = $this->mpdf->ConvertColor('yellow');
|
3438 |
+
$e = "\xbb\xa4\xactype=annot,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
|
3439 |
+
if ($this->mpdf->tableLevel) { // *TABLES*
|
3440 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['textbuffer'][] = array($e); // *TABLES*
|
3441 |
+
} // *TABLES*
|
3442 |
+
else { // *TABLES*
|
3443 |
+
$this->mpdf->textbuffer[] = array($e);
|
3444 |
+
} // *TABLES*
|
3445 |
+
}
|
3446 |
+
/* -- END ANNOTATIONS -- */
|
3447 |
+
}
|
3448 |
+
break;
|
3449 |
+
/* -- END IMAGES-CORE -- */
|
3450 |
+
|
3451 |
+
|
3452 |
+
// *********** CIRCULAR TEXT = TEXTCIRCLE ********************
|
3453 |
+
case 'TEXTCIRCLE':
|
3454 |
+
$objattr = array();
|
3455 |
+
$objattr['margin_top'] = 0;
|
3456 |
+
$objattr['margin_bottom'] = 0;
|
3457 |
+
$objattr['margin_left'] = 0;
|
3458 |
+
$objattr['margin_right'] = 0;
|
3459 |
+
$objattr['padding_top'] = 0;
|
3460 |
+
$objattr['padding_bottom'] = 0;
|
3461 |
+
$objattr['padding_left'] = 0;
|
3462 |
+
$objattr['padding_right'] = 0;
|
3463 |
+
$objattr['width'] = 0;
|
3464 |
+
$objattr['height'] = 0;
|
3465 |
+
$objattr['border_top']['w'] = 0;
|
3466 |
+
$objattr['border_bottom']['w'] = 0;
|
3467 |
+
$objattr['border_left']['w'] = 0;
|
3468 |
+
$objattr['border_right']['w'] = 0;
|
3469 |
+
$objattr['top-text'] = '';
|
3470 |
+
$objattr['bottom-text'] = '';
|
3471 |
+
$objattr['r'] = 20; // radius (default value here for safety)
|
3472 |
+
$objattr['space-width'] = 120;
|
3473 |
+
$objattr['char-width'] = 100;
|
3474 |
+
|
3475 |
+
$this->mpdf->InlineProperties[$tag] = $this->mpdf->saveInlineProperties();
|
3476 |
+
$properties = $this->mpdf->cssmgr->MergeCSS('INLINE', $tag, $attr);
|
3477 |
+
|
3478 |
+
if (isset($properties ['DISPLAY']) && strtolower($properties ['DISPLAY']) == 'none') {
|
3479 |
+
return;
|
3480 |
+
}
|
3481 |
+
if (isset($attr['R'])) {
|
3482 |
+
$objattr['r'] = $this->mpdf->ConvertSize($attr['R'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3483 |
+
}
|
3484 |
+
if (isset($attr['TOP-TEXT'])) {
|
3485 |
+
$objattr['top-text'] = strcode2utf($attr['TOP-TEXT']);
|
3486 |
+
$objattr['top-text'] = $this->mpdf->lesser_entity_decode($objattr['top-text']);
|
3487 |
+
if ($this->mpdf->onlyCoreFonts)
|
3488 |
+
$objattr['top-text'] = mb_convert_encoding($objattr['top-text'], $this->mpdf->mb_enc, 'UTF-8');
|
3489 |
+
}
|
3490 |
+
if (isset($attr['BOTTOM-TEXT'])) {
|
3491 |
+
$objattr['bottom-text'] = strcode2utf($attr['BOTTOM-TEXT']);
|
3492 |
+
$objattr['bottom-text'] = $this->mpdf->lesser_entity_decode($objattr['bottom-text']);
|
3493 |
+
if ($this->mpdf->onlyCoreFonts)
|
3494 |
+
$objattr['bottom-text'] = mb_convert_encoding($objattr['bottom-text'], $this->mpdf->mb_enc, 'UTF-8');
|
3495 |
+
}
|
3496 |
+
if (isset($attr['SPACE-WIDTH']) && $attr['SPACE-WIDTH']) {
|
3497 |
+
$objattr['space-width'] = $attr['SPACE-WIDTH'];
|
3498 |
+
}
|
3499 |
+
if (isset($attr['CHAR-WIDTH']) && $attr['CHAR-WIDTH']) {
|
3500 |
+
$objattr['char-width'] = $attr['CHAR-WIDTH'];
|
3501 |
+
}
|
3502 |
+
|
3503 |
+
// VISIBILITY
|
3504 |
+
$objattr['visibility'] = 'visible';
|
3505 |
+
if (isset($properties['VISIBILITY'])) {
|
3506 |
+
$v = strtolower($properties['VISIBILITY']);
|
3507 |
+
if (($v == 'hidden' || $v == 'printonly' || $v == 'screenonly') && $this->mpdf->visibility == 'visible') {
|
3508 |
+
$objattr['visibility'] = $v;
|
3509 |
+
}
|
3510 |
+
}
|
3511 |
+
if (isset($properties['FONT-SIZE'])) {
|
3512 |
+
if (strtolower($properties['FONT-SIZE']) == 'auto') {
|
3513 |
+
if ($objattr['top-text'] && $objattr['bottom-text']) {
|
3514 |
+
$objattr['fontsize'] = -2;
|
3515 |
+
} else {
|
3516 |
+
$objattr['fontsize'] = -1;
|
3517 |
+
}
|
3518 |
+
} else {
|
3519 |
+
$mmsize = $this->mpdf->ConvertSize($properties['FONT-SIZE'], ($this->mpdf->default_font_size / _MPDFK));
|
3520 |
+
$this->mpdf->SetFontSize($mmsize * _MPDFK, false);
|
3521 |
+
$objattr['fontsize'] = $this->mpdf->FontSizePt;
|
3522 |
+
}
|
3523 |
+
}
|
3524 |
+
if (isset($attr['DIVIDER'])) {
|
3525 |
+
$objattr['divider'] = strcode2utf($attr['DIVIDER']);
|
3526 |
+
$objattr['divider'] = $this->mpdf->lesser_entity_decode($objattr['divider']);
|
3527 |
+
if ($this->mpdf->onlyCoreFonts)
|
3528 |
+
$objattr['divider'] = mb_convert_encoding($objattr['divider'], $this->mpdf->mb_enc, 'UTF-8');
|
3529 |
+
}
|
3530 |
+
|
3531 |
+
if (isset($properties['COLOR'])) {
|
3532 |
+
$objattr['color'] = $this->mpdf->ConvertColor($properties['COLOR']);
|
3533 |
+
}
|
3534 |
+
|
3535 |
+
$objattr['fontstyle'] = '';
|
3536 |
+
if (isset($properties['FONT-WEIGHT'])) {
|
3537 |
+
if (strtoupper($properties['FONT-WEIGHT']) == 'BOLD') {
|
3538 |
+
$objattr['fontstyle'] .= 'B';
|
3539 |
+
}
|
3540 |
+
}
|
3541 |
+
if (isset($properties['FONT-STYLE'])) {
|
3542 |
+
if (strtoupper($properties['FONT-STYLE']) == 'ITALIC') {
|
3543 |
+
$objattr['fontstyle'] .= 'I';
|
3544 |
+
}
|
3545 |
+
}
|
3546 |
+
|
3547 |
+
if (isset($properties['FONT-FAMILY'])) {
|
3548 |
+
$this->mpdf->SetFont($properties['FONT-FAMILY'], $this->mpdf->FontStyle, 0, false);
|
3549 |
+
}
|
3550 |
+
$objattr['fontfamily'] = $this->mpdf->FontFamily;
|
3551 |
+
|
3552 |
+
// VSPACE and HSPACE converted to margins in MergeCSS
|
3553 |
+
if (isset($properties['MARGIN-TOP'])) {
|
3554 |
+
$objattr['margin_top'] = $this->mpdf->ConvertSize($properties['MARGIN-TOP'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3555 |
+
}
|
3556 |
+
if (isset($properties['MARGIN-BOTTOM'])) {
|
3557 |
+
$objattr['margin_bottom'] = $this->mpdf->ConvertSize($properties['MARGIN-BOTTOM'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3558 |
+
}
|
3559 |
+
if (isset($properties['MARGIN-LEFT'])) {
|
3560 |
+
$objattr['margin_left'] = $this->mpdf->ConvertSize($properties['MARGIN-LEFT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3561 |
+
}
|
3562 |
+
if (isset($properties['MARGIN-RIGHT'])) {
|
3563 |
+
$objattr['margin_right'] = $this->mpdf->ConvertSize($properties['MARGIN-RIGHT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3564 |
+
}
|
3565 |
+
|
3566 |
+
if (isset($properties['PADDING-TOP'])) {
|
3567 |
+
$objattr['padding_top'] = $this->mpdf->ConvertSize($properties['PADDING-TOP'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3568 |
+
}
|
3569 |
+
if (isset($properties['PADDING-BOTTOM'])) {
|
3570 |
+
$objattr['padding_bottom'] = $this->mpdf->ConvertSize($properties['PADDING-BOTTOM'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3571 |
+
}
|
3572 |
+
if (isset($properties['PADDING-LEFT'])) {
|
3573 |
+
$objattr['padding_left'] = $this->mpdf->ConvertSize($properties['PADDING-LEFT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3574 |
+
}
|
3575 |
+
if (isset($properties['PADDING-RIGHT'])) {
|
3576 |
+
$objattr['padding_right'] = $this->mpdf->ConvertSize($properties['PADDING-RIGHT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3577 |
+
}
|
3578 |
+
|
3579 |
+
if (isset($properties['BORDER-TOP'])) {
|
3580 |
+
$objattr['border_top'] = $this->mpdf->border_details($properties['BORDER-TOP']);
|
3581 |
+
}
|
3582 |
+
if (isset($properties['BORDER-BOTTOM'])) {
|
3583 |
+
$objattr['border_bottom'] = $this->mpdf->border_details($properties['BORDER-BOTTOM']);
|
3584 |
+
}
|
3585 |
+
if (isset($properties['BORDER-LEFT'])) {
|
3586 |
+
$objattr['border_left'] = $this->mpdf->border_details($properties['BORDER-LEFT']);
|
3587 |
+
}
|
3588 |
+
if (isset($properties['BORDER-RIGHT'])) {
|
3589 |
+
$objattr['border_right'] = $this->mpdf->border_details($properties['BORDER-RIGHT']);
|
3590 |
+
}
|
3591 |
+
|
3592 |
+
if (isset($properties['OPACITY']) && $properties['OPACITY'] > 0 && $properties['OPACITY'] <= 1) {
|
3593 |
+
$objattr['opacity'] = $properties['OPACITY'];
|
3594 |
+
}
|
3595 |
+
if (isset($properties['BACKGROUND-COLOR']) && $properties['BACKGROUND-COLOR'] != '') {
|
3596 |
+
$objattr['bgcolor'] = $this->mpdf->ConvertColor($properties['BACKGROUND-COLOR']);
|
3597 |
+
} else {
|
3598 |
+
$objattr['bgcolor'] = false;
|
3599 |
+
}
|
3600 |
+
if ($this->mpdf->HREF) {
|
3601 |
+
if (strpos($this->mpdf->HREF, ".") === false && strpos($this->mpdf->HREF, "@") !== 0) {
|
3602 |
+
$href = $this->mpdf->HREF;
|
3603 |
+
while (array_key_exists($href, $this->mpdf->internallink))
|
3604 |
+
$href = "#" . $href;
|
3605 |
+
$this->mpdf->internallink[$href] = $this->mpdf->AddLink();
|
3606 |
+
$objattr['link'] = $this->mpdf->internallink[$href];
|
3607 |
+
} else {
|
3608 |
+
$objattr['link'] = $this->mpdf->HREF;
|
3609 |
+
}
|
3610 |
+
}
|
3611 |
+
$extraheight = $objattr['padding_top'] + $objattr['padding_bottom'] + $objattr['margin_top'] + $objattr['margin_bottom'] + $objattr['border_top']['w'] + $objattr['border_bottom']['w'];
|
3612 |
+
$extrawidth = $objattr['padding_left'] + $objattr['padding_right'] + $objattr['margin_left'] + $objattr['margin_right'] + $objattr['border_left']['w'] + $objattr['border_right']['w'];
|
3613 |
+
|
3614 |
+
|
3615 |
+
$w = $objattr['r'] * 2;
|
3616 |
+
$h = $w;
|
3617 |
+
$objattr['height'] = $h + $extraheight;
|
3618 |
+
$objattr['width'] = $w + $extrawidth;
|
3619 |
+
$objattr['type'] = 'textcircle';
|
3620 |
+
|
3621 |
+
$e = "\xbb\xa4\xactype=image,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
|
3622 |
+
|
3623 |
+
// Clear properties - tidy up
|
3624 |
+
$properties = array();
|
3625 |
+
|
3626 |
+
/* -- TABLES -- */
|
3627 |
+
// Output it to buffers
|
3628 |
+
if ($this->mpdf->tableLevel) {
|
3629 |
+
$this->mpdf->_saveCellTextBuffer($e, $this->mpdf->HREF);
|
3630 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s'] += $objattr['width'];
|
3631 |
+
} else {
|
3632 |
+
/* -- END TABLES -- */
|
3633 |
+
$this->mpdf->_saveTextBuffer($e, $this->mpdf->HREF);
|
3634 |
+
} // *TABLES*
|
3635 |
+
|
3636 |
+
if ($this->mpdf->InlineProperties[$tag]) {
|
3637 |
+
$this->mpdf->restoreInlineProperties($this->mpdf->InlineProperties[$tag]);
|
3638 |
+
}
|
3639 |
+
unset($this->mpdf->InlineProperties[$tag]);
|
3640 |
+
|
3641 |
+
break;
|
3642 |
+
|
3643 |
+
|
3644 |
+
/* -- TABLES -- */
|
3645 |
+
|
3646 |
+
case 'TABLE': // TABLE-BEGIN
|
3647 |
+
$this->mpdf->tdbegin = false;
|
3648 |
+
$this->mpdf->lastoptionaltag = '';
|
3649 |
+
// Disable vertical justification in columns
|
3650 |
+
if ($this->mpdf->ColActive) {
|
3651 |
+
$this->mpdf->colvAlign = '';
|
3652 |
+
} // *COLUMNS*
|
3653 |
+
if ($this->mpdf->lastblocklevelchange == 1) {
|
3654 |
+
$blockstate = 1;
|
3655 |
+
} // Top margins/padding only
|
3656 |
+
else if ($this->mpdf->lastblocklevelchange < 1) {
|
3657 |
+
$blockstate = 0;
|
3658 |
+
} // NO margins/padding
|
3659 |
+
// called from block after new div e.g. <div> ... <table> ... Outputs block top margin/border and padding
|
3660 |
+
if (count($this->mpdf->textbuffer) == 0 && $this->mpdf->lastblocklevelchange == 1 && !$this->mpdf->tableLevel && !$this->mpdf->kwt) {
|
3661 |
+
$this->mpdf->newFlowingBlock($this->mpdf->blk[$this->mpdf->blklvl]['width'], $this->mpdf->lineheight, '', false, 1, true, $this->mpdf->blk[$this->mpdf->blklvl]['direction']);
|
3662 |
+
$this->mpdf->finishFlowingBlock(true); // true = END of flowing block
|
3663 |
+
} else if (!$this->mpdf->tableLevel && count($this->mpdf->textbuffer)) {
|
3664 |
+
$this->mpdf->printbuffer($this->mpdf->textbuffer, $blockstate);
|
3665 |
+
}
|
3666 |
+
|
3667 |
+
$this->mpdf->textbuffer = array();
|
3668 |
+
$this->mpdf->lastblocklevelchange = -1;
|
3669 |
+
|
3670 |
+
|
3671 |
+
|
3672 |
+
if ($this->mpdf->tableLevel) { // i.e. now a nested table coming...
|
3673 |
+
// Save current level table
|
3674 |
+
$this->mpdf->cell['PARENTCELL'] = $this->mpdf->saveInlineProperties();
|
3675 |
+
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['baseProperties'] = $this->mpdf->base_table_properties;
|
3676 |
+
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['cells'] = $this->mpdf->cell;
|
3677 |
+
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['currrow'] = $this->mpdf->row;
|
3678 |
+
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['currcol'] = $this->mpdf->col;
|
3679 |
+
}
|
3680 |
+
$this->mpdf->tableLevel++;
|
3681 |
+
$this->mpdf->cssmgr->tbCSSlvl++;
|
3682 |
+
|
3683 |
+
if ($this->mpdf->tableLevel > 1) { // inherit table properties from cell in which nested
|
3684 |
+
//$this->mpdf->base_table_properties['FONT-KERNING'] = ($this->mpdf->textvar & FC_KERNING); // mPDF 6
|
3685 |
+
$this->mpdf->base_table_properties['LETTER-SPACING'] = $this->mpdf->lSpacingCSS;
|
3686 |
+
$this->mpdf->base_table_properties['WORD-SPACING'] = $this->mpdf->wSpacingCSS;
|
3687 |
+
// mPDF 6
|
3688 |
+
$direction = $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['direction'];
|
3689 |
+
$txta = $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['a'];
|
3690 |
+
$cellLineHeight = $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['cellLineHeight'];
|
3691 |
+
$cellLineStackingStrategy = $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['cellLineStackingStrategy'];
|
3692 |
+
$cellLineStackingShift = $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['cellLineStackingShift'];
|
3693 |
+
}
|
3694 |
+
|
3695 |
+
if (isset($this->mpdf->tbctr[$this->mpdf->tableLevel])) {
|
3696 |
+
$this->mpdf->tbctr[$this->mpdf->tableLevel] ++;
|
3697 |
+
} else {
|
3698 |
+
$this->mpdf->tbctr[$this->mpdf->tableLevel] = 1;
|
3699 |
+
}
|
3700 |
+
|
3701 |
+
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['level'] = $this->mpdf->tableLevel;
|
3702 |
+
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['levelid'] = $this->mpdf->tbctr[$this->mpdf->tableLevel];
|
3703 |
+
|
3704 |
+
if ($this->mpdf->tableLevel > $this->mpdf->innermostTableLevel) {
|
3705 |
+
$this->mpdf->innermostTableLevel = $this->mpdf->tableLevel;
|
3706 |
+
}
|
3707 |
+
if ($this->mpdf->tableLevel > 1) {
|
3708 |
+
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['nestedpos'] = array($this->mpdf->row, $this->mpdf->col, $this->mpdf->tbctr[($this->mpdf->tableLevel - 1)]);
|
3709 |
+
}
|
3710 |
+
//++++++++++++++++++++++++++++
|
3711 |
+
|
3712 |
+
$this->mpdf->cell = array();
|
3713 |
+
$this->mpdf->col = -1; //int
|
3714 |
+
$this->mpdf->row = -1; //int
|
3715 |
+
$table = &$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]];
|
3716 |
+
|
3717 |
+
// New table - any level
|
3718 |
+
$table['direction'] = $this->mpdf->directionality;
|
3719 |
+
$table['bgcolor'] = false;
|
3720 |
+
$table['va'] = false;
|
3721 |
+
$table['txta'] = false;
|
3722 |
+
$table['topntail'] = false;
|
3723 |
+
$table['thead-underline'] = false;
|
3724 |
+
$table['border'] = false;
|
3725 |
+
$table['border_details']['R']['w'] = 0;
|
3726 |
+
$table['border_details']['L']['w'] = 0;
|
3727 |
+
$table['border_details']['T']['w'] = 0;
|
3728 |
+
$table['border_details']['B']['w'] = 0;
|
3729 |
+
$table['border_details']['R']['style'] = '';
|
3730 |
+
$table['border_details']['L']['style'] = '';
|
3731 |
+
$table['border_details']['T']['style'] = '';
|
3732 |
+
$table['border_details']['B']['style'] = '';
|
3733 |
+
$table['max_cell_border_width']['R'] = 0;
|
3734 |
+
$table['max_cell_border_width']['L'] = 0;
|
3735 |
+
$table['max_cell_border_width']['T'] = 0;
|
3736 |
+
$table['max_cell_border_width']['B'] = 0;
|
3737 |
+
$table['padding']['L'] = false;
|
3738 |
+
$table['padding']['R'] = false;
|
3739 |
+
$table['padding']['T'] = false;
|
3740 |
+
$table['padding']['B'] = false;
|
3741 |
+
$table['margin']['L'] = false;
|
3742 |
+
$table['margin']['R'] = false;
|
3743 |
+
$table['margin']['T'] = false;
|
3744 |
+
$table['margin']['B'] = false;
|
3745 |
+
$table['a'] = false;
|
3746 |
+
$table['border_spacing_H'] = false;
|
3747 |
+
$table['border_spacing_V'] = false;
|
3748 |
+
$table['decimal_align'] = false;
|
3749 |
+
$this->mpdf->Reset();
|
3750 |
+
$this->mpdf->InlineProperties = array();
|
3751 |
+
$this->mpdf->InlineBDF = array(); // mPDF 6
|
3752 |
+
$this->mpdf->InlineBDFctr = 0; // mPDF 6
|
3753 |
+
$table['nc'] = $table['nr'] = 0;
|
3754 |
+
$this->mpdf->tablethead = 0;
|
3755 |
+
$this->mpdf->tabletfoot = 0;
|
3756 |
+
$this->mpdf->tabletheadjustfinished = false;
|
3757 |
+
|
3758 |
+
// mPDF 6
|
3759 |
+
if ($this->mpdf->tableLevel > 1) { // inherit table properties from cell in which nested
|
3760 |
+
$table['direction'] = $direction;
|
3761 |
+
$table['txta'] = $txta;
|
3762 |
+
$table['cellLineHeight'] = $cellLineHeight;
|
3763 |
+
$table['cellLineStackingStrategy'] = $cellLineStackingStrategy;
|
3764 |
+
$table['cellLineStackingShift'] = $cellLineStackingShift;
|
3765 |
+
}
|
3766 |
+
|
3767 |
+
|
3768 |
+
if ($this->mpdf->blockjustfinished && !count($this->mpdf->textbuffer) && $this->mpdf->y != $this->mpdf->tMargin && $this->mpdf->collapseBlockMargins && $this->mpdf->tableLevel == 1) {
|
3769 |
+
$lastbottommargin = $this->mpdf->lastblockbottommargin;
|
3770 |
+
} else {
|
3771 |
+
$lastbottommargin = 0;
|
3772 |
+
}
|
3773 |
+
$this->mpdf->lastblockbottommargin = 0;
|
3774 |
+
$this->mpdf->blockjustfinished = false;
|
3775 |
+
|
3776 |
+
if ($this->mpdf->tableLevel == 1) {
|
3777 |
+
$table['headernrows'] = 0;
|
3778 |
+
$table['footernrows'] = 0;
|
3779 |
+
$this->mpdf->base_table_properties = array();
|
3780 |
+
}
|
3781 |
+
|
3782 |
+
// ADDED CSS FUNCIONS FOR TABLE
|
3783 |
+
if ($this->mpdf->cssmgr->tbCSSlvl == 1) {
|
3784 |
+
$properties = $this->mpdf->cssmgr->MergeCSS('TOPTABLE', $tag, $attr);
|
3785 |
+
} else {
|
3786 |
+
$properties = $this->mpdf->cssmgr->MergeCSS('TABLE', $tag, $attr);
|
3787 |
+
}
|
3788 |
+
|
3789 |
+
$w = '';
|
3790 |
+
if (isset($properties['WIDTH'])) {
|
3791 |
+
$w = $properties['WIDTH'];
|
3792 |
+
} else if (isset($attr['WIDTH']) && $attr['WIDTH']) {
|
3793 |
+
$w = $attr['WIDTH'];
|
3794 |
+
}
|
3795 |
+
|
3796 |
+
if (isset($attr['ALIGN']) && isset($align[strtolower($attr['ALIGN'])])) {
|
3797 |
+
$table['a'] = $align[strtolower($attr['ALIGN'])];
|
3798 |
+
}
|
3799 |
+
if (!$table['a']) {
|
3800 |
+
if ($table['direction'] == 'rtl') {
|
3801 |
+
$table['a'] = 'R';
|
3802 |
+
} else {
|
3803 |
+
$table['a'] = 'L';
|
3804 |
+
}
|
3805 |
+
}
|
3806 |
+
|
3807 |
+
if (isset($properties['DIRECTION']) && $properties['DIRECTION']) {
|
3808 |
+
$table['direction'] = strtolower($properties['DIRECTION']);
|
3809 |
+
} else if (isset($attr['DIR']) && $attr['DIR']) {
|
3810 |
+
$table['direction'] = strtolower($attr['DIR']);
|
3811 |
+
} else if ($this->mpdf->tableLevel == 1) {
|
3812 |
+
$table['direction'] = $this->mpdf->blk[$this->mpdf->blklvl]['direction'];
|
3813 |
+
}
|
3814 |
+
|
3815 |
+
if (isset($properties['BACKGROUND-COLOR'])) {
|
3816 |
+
$table['bgcolor'][-1] = $properties['BACKGROUND-COLOR'];
|
3817 |
+
} else if (isset($properties['BACKGROUND'])) {
|
3818 |
+
$table['bgcolor'][-1] = $properties['BACKGROUND'];
|
3819 |
+
} else if (isset($attr['BGCOLOR'])) {
|
3820 |
+
$table['bgcolor'][-1] = $attr['BGCOLOR'];
|
3821 |
+
}
|
3822 |
+
|
3823 |
+
if (isset($properties['VERTICAL-ALIGN']) && isset($align[strtolower($properties['VERTICAL-ALIGN'])])) {
|
3824 |
+
$table['va'] = $align[strtolower($properties['VERTICAL-ALIGN'])];
|
3825 |
+
}
|
3826 |
+
if (isset($properties['TEXT-ALIGN']) && isset($align[strtolower($properties['TEXT-ALIGN'])])) {
|
3827 |
+
$table['txta'] = $align[strtolower($properties['TEXT-ALIGN'])];
|
3828 |
+
}
|
3829 |
+
|
3830 |
+
if (isset($properties['AUTOSIZE']) && $properties['AUTOSIZE'] && $this->mpdf->tableLevel == 1) {
|
3831 |
+
$this->mpdf->shrink_this_table_to_fit = $properties['AUTOSIZE'];
|
3832 |
+
if ($this->mpdf->shrink_this_table_to_fit < 1) {
|
3833 |
+
$this->mpdf->shrink_this_table_to_fit = 0;
|
3834 |
+
}
|
3835 |
+
}
|
3836 |
+
if (isset($properties['ROTATE']) && $properties['ROTATE'] && $this->mpdf->tableLevel == 1) {
|
3837 |
+
$this->mpdf->table_rotate = $properties['ROTATE'];
|
3838 |
+
}
|
3839 |
+
if (isset($properties['TOPNTAIL'])) {
|
3840 |
+
$table['topntail'] = $properties['TOPNTAIL'];
|
3841 |
+
}
|
3842 |
+
if (isset($properties['THEAD-UNDERLINE'])) {
|
3843 |
+
$table['thead-underline'] = $properties['THEAD-UNDERLINE'];
|
3844 |
+
}
|
3845 |
+
|
3846 |
+
if (isset($properties['BORDER'])) {
|
3847 |
+
$bord = $this->mpdf->border_details($properties['BORDER']);
|
3848 |
+
if ($bord['s']) {
|
3849 |
+
$table['border'] = _BORDER_ALL;
|
3850 |
+
$table['border_details']['R'] = $bord;
|
3851 |
+
$table['border_details']['L'] = $bord;
|
3852 |
+
$table['border_details']['T'] = $bord;
|
3853 |
+
$table['border_details']['B'] = $bord;
|
3854 |
+
}
|
3855 |
+
}
|
3856 |
+
if (isset($properties['BORDER-RIGHT'])) {
|
3857 |
+
if ($table['direction'] == 'rtl') { // *OTL*
|
3858 |
+
$table['border_details']['R'] = $this->mpdf->border_details($properties['BORDER-LEFT']); // *OTL*
|
3859 |
+
} // *OTL*
|
3860 |
+
else { // *OTL*
|
3861 |
+
$table['border_details']['R'] = $this->mpdf->border_details($properties['BORDER-RIGHT']);
|
3862 |
+
} // *OTL*
|
3863 |
+
$this->mpdf->setBorder($table['border'], _BORDER_RIGHT, $table['border_details']['R']['s']);
|
3864 |
+
}
|
3865 |
+
if (isset($properties['BORDER-LEFT'])) {
|
3866 |
+
if ($table['direction'] == 'rtl') { // *OTL*
|
3867 |
+
$table['border_details']['L'] = $this->mpdf->border_details($properties['BORDER-RIGHT']); // *OTL*
|
3868 |
+
} // *OTL*
|
3869 |
+
else { // *OTL*
|
3870 |
+
$table['border_details']['L'] = $this->mpdf->border_details($properties['BORDER-LEFT']);
|
3871 |
+
} // *OTL*
|
3872 |
+
$this->mpdf->setBorder($table['border'], _BORDER_LEFT, $table['border_details']['L']['s']);
|
3873 |
+
}
|
3874 |
+
if (isset($properties['BORDER-BOTTOM'])) {
|
3875 |
+
$table['border_details']['B'] = $this->mpdf->border_details($properties['BORDER-BOTTOM']);
|
3876 |
+
$this->mpdf->setBorder($table['border'], _BORDER_BOTTOM, $table['border_details']['B']['s']);
|
3877 |
+
}
|
3878 |
+
if (isset($properties['BORDER-TOP'])) {
|
3879 |
+
$table['border_details']['T'] = $this->mpdf->border_details($properties['BORDER-TOP']);
|
3880 |
+
$this->mpdf->setBorder($table['border'], _BORDER_TOP, $table['border_details']['T']['s']);
|
3881 |
+
}
|
3882 |
+
if ($table['border']) {
|
3883 |
+
$this->mpdf->table_border_css_set = 1;
|
3884 |
+
} else {
|
3885 |
+
$this->mpdf->table_border_css_set = 0;
|
3886 |
+
}
|
3887 |
+
|
3888 |
+
// mPDF 6
|
3889 |
+
if (isset($properties['LANG']) && $properties['LANG']) {
|
3890 |
+
if ($this->mpdf->autoLangToFont && !$this->mpdf->usingCoreFont) {
|
3891 |
+
if ($properties['LANG'] != $this->mpdf->default_lang && $properties['LANG'] != 'UTF-8') {
|
3892 |
+
list ($coreSuitable, $mpdf_pdf_unifont) = GetLangOpts($properties['LANG'], $this->mpdf->useAdobeCJK, $this->mpdf->fontdata);
|
3893 |
+
if ($mpdf_pdf_unifont) {
|
3894 |
+
$properties['FONT-FAMILY'] = $mpdf_pdf_unifont;
|
3895 |
+
}
|
3896 |
+
}
|
3897 |
+
}
|
3898 |
+
$this->mpdf->currentLang = $properties['LANG'];
|
3899 |
+
}
|
3900 |
+
|
3901 |
+
|
3902 |
+
if (isset($properties['FONT-FAMILY'])) {
|
3903 |
+
$this->mpdf->default_font = $properties['FONT-FAMILY'];
|
3904 |
+
$this->mpdf->SetFont($this->mpdf->default_font, '', 0, false);
|
3905 |
+
}
|
3906 |
+
$this->mpdf->base_table_properties['FONT-FAMILY'] = $this->mpdf->FontFamily;
|
3907 |
+
|
3908 |
+
if (isset($properties['FONT-SIZE'])) {
|
3909 |
+
if ($this->mpdf->tableLevel > 1) {
|
3910 |
+
$mmsize = $this->mpdf->ConvertSize($properties['FONT-SIZE'], $this->mpdf->base_table_properties['FONT-SIZE']);
|
3911 |
+
} else {
|
3912 |
+
$mmsize = $this->mpdf->ConvertSize($properties['FONT-SIZE'], $this->mpdf->default_font_size / _MPDFK);
|
3913 |
+
}
|
3914 |
+
if ($mmsize) {
|
3915 |
+
$this->mpdf->default_font_size = $mmsize * (_MPDFK);
|
3916 |
+
$this->mpdf->SetFontSize($this->mpdf->default_font_size, false);
|
3917 |
+
}
|
3918 |
+
}
|
3919 |
+
$this->mpdf->base_table_properties['FONT-SIZE'] = $this->mpdf->FontSize . 'mm';
|
3920 |
+
|
3921 |
+
if (isset($properties['FONT-WEIGHT'])) {
|
3922 |
+
if (strtoupper($properties['FONT-WEIGHT']) == 'BOLD') {
|
3923 |
+
$this->mpdf->base_table_properties['FONT-WEIGHT'] = 'BOLD';
|
3924 |
+
}
|
3925 |
+
}
|
3926 |
+
if (isset($properties['FONT-STYLE'])) {
|
3927 |
+
if (strtoupper($properties['FONT-STYLE']) == 'ITALIC') {
|
3928 |
+
$this->mpdf->base_table_properties['FONT-STYLE'] = 'ITALIC';
|
3929 |
+
}
|
3930 |
+
}
|
3931 |
+
if (isset($properties['COLOR'])) {
|
3932 |
+
$this->mpdf->base_table_properties['COLOR'] = $properties['COLOR'];
|
3933 |
+
}
|
3934 |
+
if (isset($properties['FONT-KERNING'])) {
|
3935 |
+
$this->mpdf->base_table_properties['FONT-KERNING'] = $properties['FONT-KERNING'];
|
3936 |
+
}
|
3937 |
+
if (isset($properties['LETTER-SPACING'])) {
|
3938 |
+
$this->mpdf->base_table_properties['LETTER-SPACING'] = $properties['LETTER-SPACING'];
|
3939 |
+
}
|
3940 |
+
if (isset($properties['WORD-SPACING'])) {
|
3941 |
+
$this->mpdf->base_table_properties['WORD-SPACING'] = $properties['WORD-SPACING'];
|
3942 |
+
}
|
3943 |
+
// mPDF 6
|
3944 |
+
if (isset($properties['HYPHENS'])) {
|
3945 |
+
$this->mpdf->base_table_properties['HYPHENS'] = $properties['HYPHENS'];
|
3946 |
+
}
|
3947 |
+
if (isset($properties['LINE-HEIGHT']) && $properties['LINE-HEIGHT']) {
|
3948 |
+
$table['cellLineHeight'] = $this->mpdf->fixLineheight($properties['LINE-HEIGHT']);
|
3949 |
+
} else if ($this->mpdf->tableLevel == 1) {
|
3950 |
+
$table['cellLineHeight'] = $this->mpdf->blk[$this->mpdf->blklvl]['line_height'];
|
3951 |
+
}
|
3952 |
+
|
3953 |
+
if (isset($properties['LINE-STACKING-STRATEGY']) && $properties['LINE-STACKING-STRATEGY']) {
|
3954 |
+
$table['cellLineStackingStrategy'] = strtolower($properties['LINE-STACKING-STRATEGY']);
|
3955 |
+
} else if ($this->mpdf->tableLevel == 1 && isset($this->mpdf->blk[$this->mpdf->blklvl]['line_stacking_strategy'])) {
|
3956 |
+
$table['cellLineStackingStrategy'] = $this->mpdf->blk[$this->mpdf->blklvl]['line_stacking_strategy'];
|
3957 |
+
} else {
|
3958 |
+
$table['cellLineStackingStrategy'] = 'inline-line-height';
|
3959 |
+
}
|
3960 |
+
|
3961 |
+
if (isset($properties['LINE-STACKING-SHIFT']) && $properties['LINE-STACKING-SHIFT']) {
|
3962 |
+
$table['cellLineStackingShift'] = strtolower($properties['LINE-STACKING-SHIFT']);
|
3963 |
+
} else if ($this->mpdf->tableLevel == 1 && isset($this->mpdf->blk[$this->mpdf->blklvl]['line_stacking_shift'])) {
|
3964 |
+
$table['cellLineStackingShift'] = $this->mpdf->blk[$this->mpdf->blklvl]['line_stacking_shift'];
|
3965 |
+
} else {
|
3966 |
+
$table['cellLineStackingShift'] = 'consider-shifts';
|
3967 |
+
}
|
3968 |
+
|
3969 |
+
if (isset($properties['PADDING-LEFT'])) {
|
3970 |
+
$table['padding']['L'] = $this->mpdf->ConvertSize($properties['PADDING-LEFT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3971 |
+
}
|
3972 |
+
if (isset($properties['PADDING-RIGHT'])) {
|
3973 |
+
$table['padding']['R'] = $this->mpdf->ConvertSize($properties['PADDING-RIGHT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3974 |
+
}
|
3975 |
+
if (isset($properties['PADDING-TOP'])) {
|
3976 |
+
$table['padding']['T'] = $this->mpdf->ConvertSize($properties['PADDING-TOP'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3977 |
+
}
|
3978 |
+
if (isset($properties['PADDING-BOTTOM'])) {
|
3979 |
+
$table['padding']['B'] = $this->mpdf->ConvertSize($properties['PADDING-BOTTOM'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3980 |
+
}
|
3981 |
+
|
3982 |
+
if (isset($properties['MARGIN-TOP'])) {
|
3983 |
+
if ($lastbottommargin) {
|
3984 |
+
$tmp = $this->mpdf->ConvertSize($properties['MARGIN-TOP'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3985 |
+
if ($tmp > $lastbottommargin) {
|
3986 |
+
$properties['MARGIN-TOP'] -= $lastbottommargin;
|
3987 |
+
} else {
|
3988 |
+
$properties['MARGIN-TOP'] = 0;
|
3989 |
+
}
|
3990 |
+
}
|
3991 |
+
$table['margin']['T'] = $this->mpdf->ConvertSize($properties['MARGIN-TOP'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3992 |
+
}
|
3993 |
+
|
3994 |
+
if (isset($properties['MARGIN-BOTTOM'])) {
|
3995 |
+
$table['margin']['B'] = $this->mpdf->ConvertSize($properties['MARGIN-BOTTOM'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3996 |
+
}
|
3997 |
+
if (isset($properties['MARGIN-LEFT'])) {
|
3998 |
+
$table['margin']['L'] = $this->mpdf->ConvertSize($properties['MARGIN-LEFT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
3999 |
+
}
|
4000 |
+
|
4001 |
+
if (isset($properties['MARGIN-RIGHT'])) {
|
4002 |
+
$table['margin']['R'] = $this->mpdf->ConvertSize($properties['MARGIN-RIGHT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
4003 |
+
}
|
4004 |
+
if (isset($properties['MARGIN-LEFT']) && isset($properties['MARGIN-RIGHT']) && strtolower($properties['MARGIN-LEFT']) == 'auto' && strtolower($properties['MARGIN-RIGHT']) == 'auto') {
|
4005 |
+
$table['a'] = 'C';
|
4006 |
+
} else if (isset($properties['MARGIN-LEFT']) && strtolower($properties['MARGIN-LEFT']) == 'auto') {
|
4007 |
+
$table['a'] = 'R';
|
4008 |
+
} else if (isset($properties['MARGIN-RIGHT']) && strtolower($properties['MARGIN-RIGHT']) == 'auto') {
|
4009 |
+
$table['a'] = 'L';
|
4010 |
+
}
|
4011 |
+
|
4012 |
+
if (isset($properties['BORDER-COLLAPSE']) && strtoupper($properties['BORDER-COLLAPSE']) == 'SEPARATE') {
|
4013 |
+
$table['borders_separate'] = true;
|
4014 |
+
} else {
|
4015 |
+
$table['borders_separate'] = false;
|
4016 |
+
}
|
4017 |
+
|
4018 |
+
// mPDF 5.7.3
|
4019 |
+
|
4020 |
+
if (isset($properties['BORDER-SPACING-H'])) {
|
4021 |
+
$table['border_spacing_H'] = $this->mpdf->ConvertSize($properties['BORDER-SPACING-H'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
4022 |
+
}
|
4023 |
+
if (isset($properties['BORDER-SPACING-V'])) {
|
4024 |
+
$table['border_spacing_V'] = $this->mpdf->ConvertSize($properties['BORDER-SPACING-V'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
4025 |
+
}
|
4026 |
+
// mPDF 5.7.3
|
4027 |
+
if (!$table['borders_separate']) {
|
4028 |
+
$table['border_spacing_H'] = $table['border_spacing_V'] = 0;
|
4029 |
+
}
|
4030 |
+
|
4031 |
+
if (isset($properties['EMPTY-CELLS'])) {
|
4032 |
+
$table['empty_cells'] = strtolower($properties['EMPTY-CELLS']); // 'hide' or 'show'
|
4033 |
+
} else {
|
4034 |
+
$table['empty_cells'] = '';
|
4035 |
+
}
|
4036 |
+
|
4037 |
+
if (isset($properties['PAGE-BREAK-INSIDE']) && strtoupper($properties['PAGE-BREAK-INSIDE']) == 'AVOID' && $this->mpdf->tableLevel == 1 && !$this->mpdf->writingHTMLfooter) {
|
4038 |
+
$this->mpdf->table_keep_together = true;
|
4039 |
+
} else if ($this->mpdf->tableLevel == 1) {
|
4040 |
+
$this->mpdf->table_keep_together = false;
|
4041 |
+
}
|
4042 |
+
if (isset($properties['PAGE-BREAK-AFTER']) && $this->mpdf->tableLevel == 1) {
|
4043 |
+
$table['page_break_after'] = strtoupper($properties['PAGE-BREAK-AFTER']);
|
4044 |
+
}
|
4045 |
+
|
4046 |
+
/* -- BACKGROUNDS -- */
|
4047 |
+
if (isset($properties['BACKGROUND-GRADIENT']) && !$this->mpdf->kwt && !$this->mpdf->ColActive) {
|
4048 |
+
$table['gradient'] = $properties['BACKGROUND-GRADIENT'];
|
4049 |
+
}
|
4050 |
+
|
4051 |
+
if (isset($properties['BACKGROUND-IMAGE']) && $properties['BACKGROUND-IMAGE'] && !$this->mpdf->kwt && !$this->mpdf->ColActive) {
|
4052 |
+
$ret = $this->mpdf->SetBackground($properties, $currblk['inner_width']);
|
4053 |
+
if ($ret) {
|
4054 |
+
$table['background-image'] = $ret;
|
4055 |
+
}
|
4056 |
+
}
|
4057 |
+
/* -- END BACKGROUNDS -- */
|
4058 |
+
|
4059 |
+
if (isset($properties['OVERFLOW'])) {
|
4060 |
+
$table['overflow'] = strtolower($properties['OVERFLOW']); // 'hidden' 'wrap' or 'visible' or 'auto'
|
4061 |
+
if (($this->mpdf->ColActive || $this->mpdf->tableLevel > 1) && $table['overflow'] == 'visible') {
|
4062 |
+
unset($table['overflow']);
|
4063 |
+
}
|
4064 |
+
}
|
4065 |
+
|
4066 |
+
$properties = array();
|
4067 |
+
|
4068 |
+
|
4069 |
+
if (isset($attr['CELLPADDING'])) {
|
4070 |
+
$table['cell_padding'] = $attr['CELLPADDING'];
|
4071 |
+
} else {
|
4072 |
+
$table['cell_padding'] = false;
|
4073 |
+
}
|
4074 |
+
|
4075 |
+
if (isset($attr['BORDER']) && $attr['BORDER'] == '1') {
|
4076 |
+
$this->mpdf->table_border_attr_set = 1;
|
4077 |
+
$bord = $this->mpdf->border_details('#000000 1px solid');
|
4078 |
+
if ($bord['s']) {
|
4079 |
+
$table['border'] = _BORDER_ALL;
|
4080 |
+
$table['border_details']['R'] = $bord;
|
4081 |
+
$table['border_details']['L'] = $bord;
|
4082 |
+
$table['border_details']['T'] = $bord;
|
4083 |
+
$table['border_details']['B'] = $bord;
|
4084 |
+
}
|
4085 |
+
} else {
|
4086 |
+
$this->mpdf->table_border_attr_set = 0;
|
4087 |
+
}
|
4088 |
+
|
4089 |
+
if ($w) {
|
4090 |
+
$maxwidth = $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'];
|
4091 |
+
if ($table['borders_separate']) {
|
4092 |
+
$tblblw = $table['margin']['L'] + $table['margin']['R'] + $table['border_details']['L']['w'] / 2 + $table['border_details']['R']['w'] / 2;
|
4093 |
+
} else {
|
4094 |
+
$tblblw = $table['margin']['L'] + $table['margin']['R'] + $table['max_cell_border_width']['L'] / 2 + $table['max_cell_border_width']['R'] / 2;
|
4095 |
+
}
|
4096 |
+
if (strpos($w, '%') && $this->mpdf->tableLevel == 1 && !$this->mpdf->ignore_table_percents) {
|
4097 |
+
// % needs to be of inner box without table margins etc.
|
4098 |
+
$maxwidth -= $tblblw;
|
4099 |
+
$wmm = $this->mpdf->ConvertSize($w, $maxwidth, $this->mpdf->FontSize, false);
|
4100 |
+
$table['w'] = $wmm + $tblblw;
|
4101 |
+
}
|
4102 |
+
if (strpos($w, '%') && $this->mpdf->tableLevel > 1 && !$this->mpdf->ignore_table_percents && $this->mpdf->keep_table_proportions) {
|
4103 |
+
$table['wpercent'] = $w + 0; // makes 80% -> 80
|
4104 |
+
}
|
4105 |
+
if (!strpos($w, '%') && !$this->mpdf->ignore_table_widths) {
|
4106 |
+
$wmm = $this->mpdf->ConvertSize($w, $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
4107 |
+
$table['w'] = $wmm + $tblblw;
|
4108 |
+
}
|
4109 |
+
if (!$this->mpdf->keep_table_proportions) {
|
4110 |
+
if (isset($table['w']) && $table['w'] > $this->mpdf->blk[$this->mpdf->blklvl]['inner_width']) {
|
4111 |
+
$table['w'] = $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'];
|
4112 |
+
}
|
4113 |
+
}
|
4114 |
+
}
|
4115 |
+
|
4116 |
+
if (isset($attr['AUTOSIZE']) && $this->mpdf->tableLevel == 1) {
|
4117 |
+
$this->mpdf->shrink_this_table_to_fit = $attr['AUTOSIZE'];
|
4118 |
+
if ($this->mpdf->shrink_this_table_to_fit < 1) {
|
4119 |
+
$this->mpdf->shrink_this_table_to_fit = 1;
|
4120 |
+
}
|
4121 |
+
}
|
4122 |
+
if (isset($attr['ROTATE']) && $this->mpdf->tableLevel == 1) {
|
4123 |
+
$this->mpdf->table_rotate = $attr['ROTATE'];
|
4124 |
+
}
|
4125 |
+
|
4126 |
+
//++++++++++++++++++++++++++++
|
4127 |
+
if ($this->mpdf->table_rotate) {
|
4128 |
+
$this->mpdf->tbrot_Links = array();
|
4129 |
+
$this->mpdf->tbrot_Annots = array();
|
4130 |
+
$this->mpdf->tbrotForms = array();
|
4131 |
+
$this->mpdf->tbrot_BMoutlines = array();
|
4132 |
+
$this->mpdf->tbrot_toc = array();
|
4133 |
+
}
|
4134 |
+
|
4135 |
+
if ($this->mpdf->kwt) {
|
4136 |
+
if ($this->mpdf->table_rotate) {
|
4137 |
+
$this->mpdf->table_keep_together = true;
|
4138 |
+
}
|
4139 |
+
$this->mpdf->kwt = false;
|
4140 |
+
$this->mpdf->kwt_saved = true;
|
4141 |
+
}
|
4142 |
+
|
4143 |
+
if ($this->mpdf->tableLevel == 1 && $this->mpdf->useGraphs) {
|
4144 |
+
if (isset($attr['ID']) && $attr['ID']) {
|
4145 |
+
$this->mpdf->currentGraphId = strtoupper($attr['ID']);
|
4146 |
+
} else {
|
4147 |
+
$this->mpdf->currentGraphId = '0';
|
4148 |
+
}
|
4149 |
+
$this->mpdf->graphs[$this->mpdf->currentGraphId] = array();
|
4150 |
+
}
|
4151 |
+
//++++++++++++++++++++++++++++
|
4152 |
+
$this->mpdf->plainCell_properties = array();
|
4153 |
+
unset($table);
|
4154 |
+
break;
|
4155 |
+
|
4156 |
+
case 'THEAD':
|
4157 |
+
$this->mpdf->lastoptionaltag = $tag; // Save current HTML specified optional endtag
|
4158 |
+
$this->mpdf->cssmgr->tbCSSlvl++;
|
4159 |
+
$this->mpdf->tablethead = 1;
|
4160 |
+
$this->mpdf->tabletfoot = 0;
|
4161 |
+
$properties = $this->mpdf->cssmgr->MergeCSS('TABLE', $tag, $attr);
|
4162 |
+
if (isset($properties['FONT-WEIGHT'])) {
|
4163 |
+
if (strtoupper($properties['FONT-WEIGHT']) == 'BOLD') {
|
4164 |
+
$this->mpdf->thead_font_weight = 'B';
|
4165 |
+
} else {
|
4166 |
+
$this->mpdf->thead_font_weight = '';
|
4167 |
+
}
|
4168 |
+
}
|
4169 |
+
|
4170 |
+
if (isset($properties['FONT-STYLE'])) {
|
4171 |
+
if (strtoupper($properties['FONT-STYLE']) == 'ITALIC') {
|
4172 |
+
$this->mpdf->thead_font_style = 'I';
|
4173 |
+
} else {
|
4174 |
+
$this->mpdf->thead_font_style = '';
|
4175 |
+
}
|
4176 |
+
}
|
4177 |
+
if (isset($properties['FONT-VARIANT'])) {
|
4178 |
+
if (strtoupper($properties['FONT-VARIANT']) == 'SMALL-CAPS') {
|
4179 |
+
$this->mpdf->thead_font_smCaps = 'S';
|
4180 |
+
} else {
|
4181 |
+
$this->mpdf->thead_font_smCaps = '';
|
4182 |
+
}
|
4183 |
+
}
|
4184 |
+
|
4185 |
+
if (isset($properties['VERTICAL-ALIGN'])) {
|
4186 |
+
$this->mpdf->thead_valign_default = $properties['VERTICAL-ALIGN'];
|
4187 |
+
}
|
4188 |
+
if (isset($properties['TEXT-ALIGN'])) {
|
4189 |
+
$this->mpdf->thead_textalign_default = $properties['TEXT-ALIGN'];
|
4190 |
+
}
|
4191 |
+
$properties = array();
|
4192 |
+
break;
|
4193 |
+
|
4194 |
+
case 'TFOOT':
|
4195 |
+
$this->mpdf->lastoptionaltag = $tag; // Save current HTML specified optional endtag
|
4196 |
+
$this->mpdf->cssmgr->tbCSSlvl++;
|
4197 |
+
$this->mpdf->tabletfoot = 1;
|
4198 |
+
$this->mpdf->tablethead = 0;
|
4199 |
+
$properties = $this->mpdf->cssmgr->MergeCSS('TABLE', $tag, $attr);
|
4200 |
+
if (isset($properties['FONT-WEIGHT'])) {
|
4201 |
+
if (strtoupper($properties['FONT-WEIGHT']) == 'BOLD') {
|
4202 |
+
$this->mpdf->tfoot_font_weight = 'B';
|
4203 |
+
} else {
|
4204 |
+
$this->mpdf->tfoot_font_weight = '';
|
4205 |
+
}
|
4206 |
+
}
|
4207 |
+
|
4208 |
+
if (isset($properties['FONT-STYLE'])) {
|
4209 |
+
if (strtoupper($properties['FONT-STYLE']) == 'ITALIC') {
|
4210 |
+
$this->mpdf->tfoot_font_style = 'I';
|
4211 |
+
} else {
|
4212 |
+
$this->mpdf->tfoot_font_style = '';
|
4213 |
+
}
|
4214 |
+
}
|
4215 |
+
if (isset($properties['FONT-VARIANT'])) {
|
4216 |
+
if (strtoupper($properties['FONT-VARIANT']) == 'SMALL-CAPS') {
|
4217 |
+
$this->mpdf->tfoot_font_smCaps = 'S';
|
4218 |
+
} else {
|
4219 |
+
$this->mpdf->tfoot_font_smCaps = '';
|
4220 |
+
}
|
4221 |
+
}
|
4222 |
+
|
4223 |
+
if (isset($properties['VERTICAL-ALIGN'])) {
|
4224 |
+
$this->mpdf->tfoot_valign_default = $properties['VERTICAL-ALIGN'];
|
4225 |
+
}
|
4226 |
+
if (isset($properties['TEXT-ALIGN'])) {
|
4227 |
+
$this->mpdf->tfoot_textalign_default = $properties['TEXT-ALIGN'];
|
4228 |
+
}
|
4229 |
+
$properties = array();
|
4230 |
+
break;
|
4231 |
+
|
4232 |
+
|
4233 |
+
case 'TBODY':
|
4234 |
+
$this->mpdf->tablethead = 0;
|
4235 |
+
$this->mpdf->tabletfoot = 0;
|
4236 |
+
$this->mpdf->lastoptionaltag = $tag; // Save current HTML specified optional endtag
|
4237 |
+
$this->mpdf->cssmgr->tbCSSlvl++;
|
4238 |
+
$this->mpdf->cssmgr->MergeCSS('TABLE', $tag, $attr);
|
4239 |
+
break;
|
4240 |
+
|
4241 |
+
|
4242 |
+
case 'TR':
|
4243 |
+
$this->mpdf->lastoptionaltag = $tag; // Save current HTML specified optional endtag
|
4244 |
+
$this->mpdf->cssmgr->tbCSSlvl++;
|
4245 |
+
$this->mpdf->row++;
|
4246 |
+
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['nr'] ++;
|
4247 |
+
$this->mpdf->col = -1;
|
4248 |
+
$properties = $this->mpdf->cssmgr->MergeCSS('TABLE', $tag, $attr);
|
4249 |
+
|
4250 |
+
if (!$this->mpdf->simpleTables && (!isset($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['borders_separate']) || !$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['borders_separate'])) {
|
4251 |
+
if (isset($properties['BORDER-LEFT']) && $properties['BORDER-LEFT']) {
|
4252 |
+
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['trborder-left'][$this->mpdf->row] = $properties['BORDER-LEFT'];
|
4253 |
+
}
|
4254 |
+
if (isset($properties['BORDER-RIGHT']) && $properties['BORDER-RIGHT']) {
|
4255 |
+
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['trborder-right'][$this->mpdf->row] = $properties['BORDER-RIGHT'];
|
4256 |
+
}
|
4257 |
+
if (isset($properties['BORDER-TOP']) && $properties['BORDER-TOP']) {
|
4258 |
+
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['trborder-top'][$this->mpdf->row] = $properties['BORDER-TOP'];
|
4259 |
+
}
|
4260 |
+
if (isset($properties['BORDER-BOTTOM']) && $properties['BORDER-BOTTOM']) {
|
4261 |
+
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['trborder-bottom'][$this->mpdf->row] = $properties['BORDER-BOTTOM'];
|
4262 |
+
}
|
4263 |
+
}
|
4264 |
+
|
4265 |
+
if (isset($properties['BACKGROUND-COLOR'])) {
|
4266 |
+
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['bgcolor'][$this->mpdf->row] = $properties['BACKGROUND-COLOR'];
|
4267 |
+
} else if (isset($attr['BGCOLOR']))
|
4268 |
+
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['bgcolor'][$this->mpdf->row] = $attr['BGCOLOR'];
|
4269 |
+
|
4270 |
+
/* -- BACKGROUNDS -- */
|
4271 |
+
if (isset($properties['BACKGROUND-GRADIENT']) && !$this->mpdf->kwt && !$this->mpdf->ColActive) {
|
4272 |
+
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['trgradients'][$this->mpdf->row] = $properties['BACKGROUND-GRADIENT'];
|
4273 |
+
}
|
4274 |
+
|
4275 |
+
if (isset($properties['BACKGROUND-IMAGE']) && $properties['BACKGROUND-IMAGE'] && !$this->mpdf->kwt && !$this->mpdf->ColActive) {
|
4276 |
+
$ret = $this->mpdf->SetBackground($properties, $currblk['inner_width']);
|
4277 |
+
if ($ret) {
|
4278 |
+
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['trbackground-images'][$this->mpdf->row] = $ret;
|
4279 |
+
}
|
4280 |
+
}
|
4281 |
+
/* -- END BACKGROUNDS -- */
|
4282 |
+
|
4283 |
+
|
4284 |
+
|
4285 |
+
|
4286 |
+
if (isset($properties['TEXT-ROTATE'])) {
|
4287 |
+
$this->mpdf->trow_text_rotate = $properties['TEXT-ROTATE'];
|
4288 |
+
}
|
4289 |
+
if (isset($attr['TEXT-ROTATE']))
|
4290 |
+
$this->mpdf->trow_text_rotate = $attr['TEXT-ROTATE'];
|
4291 |
+
|
4292 |
+
if ($this->mpdf->tablethead) {
|
4293 |
+
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_thead'][$this->mpdf->row] = true;
|
4294 |
+
}
|
4295 |
+
if ($this->mpdf->tabletfoot) {
|
4296 |
+
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_tfoot'][$this->mpdf->row] = true;
|
4297 |
+
}
|
4298 |
+
$properties = array();
|
4299 |
+
break;
|
4300 |
+
|
4301 |
+
|
4302 |
+
case 'TH':
|
4303 |
+
case 'TD':
|
4304 |
+
$this->mpdf->ignorefollowingspaces = true;
|
4305 |
+
$this->mpdf->lastoptionaltag = $tag; // Save current HTML specified optional endtag
|
4306 |
+
$this->mpdf->cssmgr->tbCSSlvl++;
|
4307 |
+
$this->mpdf->InlineProperties = array();
|
4308 |
+
$this->mpdf->InlineBDF = array(); // mPDF 6
|
4309 |
+
$this->mpdf->InlineBDFctr = 0; // mPDF 6
|
4310 |
+
$this->mpdf->tdbegin = true;
|
4311 |
+
$this->mpdf->col++;
|
4312 |
+
while (isset($this->mpdf->cell[$this->mpdf->row][$this->mpdf->col])) {
|
4313 |
+
$this->mpdf->col++;
|
4314 |
+
}
|
4315 |
+
|
4316 |
+
//Update number column
|
4317 |
+
if ($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['nc'] < $this->mpdf->col + 1) {
|
4318 |
+
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['nc'] = $this->mpdf->col + 1;
|
4319 |
+
}
|
4320 |
+
|
4321 |
+
$table = &$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]];
|
4322 |
+
|
4323 |
+
$c = array('a' => false,
|
4324 |
+
'R' => false,
|
4325 |
+
'nowrap' => false,
|
4326 |
+
'bgcolor' => false,
|
4327 |
+
'padding' => array('L' => false,
|
4328 |
+
'R' => false,
|
4329 |
+
'T' => false,
|
4330 |
+
'B' => false
|
4331 |
+
)
|
4332 |
+
);
|
4333 |
+
|
4334 |
+
if ($this->mpdf->simpleTables && $this->mpdf->row == 0 && $this->mpdf->col == 0) {
|
4335 |
+
$table['simple']['border'] = false;
|
4336 |
+
$table['simple']['border_details']['R']['w'] = 0;
|
4337 |
+
$table['simple']['border_details']['L']['w'] = 0;
|
4338 |
+
$table['simple']['border_details']['T']['w'] = 0;
|
4339 |
+
$table['simple']['border_details']['B']['w'] = 0;
|
4340 |
+
$table['simple']['border_details']['R']['style'] = '';
|
4341 |
+
$table['simple']['border_details']['L']['style'] = '';
|
4342 |
+
$table['simple']['border_details']['T']['style'] = '';
|
4343 |
+
$table['simple']['border_details']['B']['style'] = '';
|
4344 |
+
} else if (!$this->mpdf->simpleTables) {
|
4345 |
+
$c['border'] = false;
|
4346 |
+
$c['border_details']['R']['w'] = 0;
|
4347 |
+
$c['border_details']['L']['w'] = 0;
|
4348 |
+
$c['border_details']['T']['w'] = 0;
|
4349 |
+
$c['border_details']['B']['w'] = 0;
|
4350 |
+
$c['border_details']['mbw']['BL'] = 0;
|
4351 |
+
$c['border_details']['mbw']['BR'] = 0;
|
4352 |
+
$c['border_details']['mbw']['RT'] = 0;
|
4353 |
+
$c['border_details']['mbw']['RB'] = 0;
|
4354 |
+
$c['border_details']['mbw']['TL'] = 0;
|
4355 |
+
$c['border_details']['mbw']['TR'] = 0;
|
4356 |
+
$c['border_details']['mbw']['LT'] = 0;
|
4357 |
+
$c['border_details']['mbw']['LB'] = 0;
|
4358 |
+
$c['border_details']['R']['style'] = '';
|
4359 |
+
$c['border_details']['L']['style'] = '';
|
4360 |
+
$c['border_details']['T']['style'] = '';
|
4361 |
+
$c['border_details']['B']['style'] = '';
|
4362 |
+
$c['border_details']['R']['s'] = 0;
|
4363 |
+
$c['border_details']['L']['s'] = 0;
|
4364 |
+
$c['border_details']['T']['s'] = 0;
|
4365 |
+
$c['border_details']['B']['s'] = 0;
|
4366 |
+
$c['border_details']['R']['c'] = $this->mpdf->ConvertColor(0);
|
4367 |
+
$c['border_details']['L']['c'] = $this->mpdf->ConvertColor(0);
|
4368 |
+
$c['border_details']['T']['c'] = $this->mpdf->ConvertColor(0);
|
4369 |
+
$c['border_details']['B']['c'] = $this->mpdf->ConvertColor(0);
|
4370 |
+
$c['border_details']['R']['dom'] = 0;
|
4371 |
+
$c['border_details']['L']['dom'] = 0;
|
4372 |
+
$c['border_details']['T']['dom'] = 0;
|
4373 |
+
$c['border_details']['B']['dom'] = 0;
|
4374 |
+
$c['border_details']['cellposdom'] = 0;
|
4375 |
+
}
|
4376 |
+
|
4377 |
+
|
4378 |
+
if ($table['va']) {
|
4379 |
+
$c['va'] = $table['va'];
|
4380 |
+
}
|
4381 |
+
if ($table['txta']) {
|
4382 |
+
$c['a'] = $table['txta'];
|
4383 |
+
}
|
4384 |
+
if ($this->mpdf->table_border_attr_set) {
|
4385 |
+
if ($table['border_details']) {
|
4386 |
+
if (!$this->mpdf->simpleTables) {
|
4387 |
+
$c['border_details']['R'] = $table['border_details']['R'];
|
4388 |
+
$c['border_details']['L'] = $table['border_details']['L'];
|
4389 |
+
$c['border_details']['T'] = $table['border_details']['T'];
|
4390 |
+
$c['border_details']['B'] = $table['border_details']['B'];
|
4391 |
+
$c['border'] = $table['border'];
|
4392 |
+
$c['border_details']['L']['dom'] = 1;
|
4393 |
+
$c['border_details']['R']['dom'] = 1;
|
4394 |
+
$c['border_details']['T']['dom'] = 1;
|
4395 |
+
$c['border_details']['B']['dom'] = 1;
|
4396 |
+
} else if ($this->mpdf->simpleTables && $this->mpdf->row == 0 && $this->mpdf->col == 0) {
|
4397 |
+
$table['simple']['border_details']['R'] = $table['border_details']['R'];
|
4398 |
+
$table['simple']['border_details']['L'] = $table['border_details']['L'];
|
4399 |
+
$table['simple']['border_details']['T'] = $table['border_details']['T'];
|
4400 |
+
$table['simple']['border_details']['B'] = $table['border_details']['B'];
|
4401 |
+
$table['simple']['border'] = $table['border'];
|
4402 |
+
}
|
4403 |
+
}
|
4404 |
+
}
|
4405 |
+
// INHERITED THEAD CSS Properties
|
4406 |
+
if ($this->mpdf->tablethead) {
|
4407 |
+
if ($this->mpdf->thead_valign_default)
|
4408 |
+
$c['va'] = $align[strtolower($this->mpdf->thead_valign_default)];
|
4409 |
+
if ($this->mpdf->thead_textalign_default)
|
4410 |
+
$c['a'] = $align[strtolower($this->mpdf->thead_textalign_default)];
|
4411 |
+
if ($this->mpdf->thead_font_weight == 'B') {
|
4412 |
+
$this->mpdf->SetStyle('B', true);
|
4413 |
+
}
|
4414 |
+
if ($this->mpdf->thead_font_style == 'I') {
|
4415 |
+
$this->mpdf->SetStyle('I', true);
|
4416 |
+
}
|
4417 |
+
if ($this->mpdf->thead_font_smCaps == 'S') {
|
4418 |
+
$this->mpdf->textvar = ($this->mpdf->textvar | FC_SMALLCAPS);
|
4419 |
+
} // mPDF 5.7.1
|
4420 |
+
}
|
4421 |
+
|
4422 |
+
// INHERITED TFOOT CSS Properties
|
4423 |
+
if ($this->mpdf->tabletfoot) {
|
4424 |
+
if ($this->mpdf->tfoot_valign_default)
|
4425 |
+
$c['va'] = $align[strtolower($this->mpdf->tfoot_valign_default)];
|
4426 |
+
if ($this->mpdf->tfoot_textalign_default)
|
4427 |
+
$c['a'] = $align[strtolower($this->mpdf->tfoot_textalign_default)];
|
4428 |
+
if ($this->mpdf->tfoot_font_weight == 'B') {
|
4429 |
+
$this->mpdf->SetStyle('B', true);
|
4430 |
+
}
|
4431 |
+
if ($this->mpdf->tfoot_font_style == 'I') {
|
4432 |
+
$this->mpdf->SetStyle('I', true);
|
4433 |
+
}
|
4434 |
+
if ($this->mpdf->tfoot_font_style == 'S') {
|
4435 |
+
$this->mpdf->textvar = ($this->mpdf->textvar | FC_SMALLCAPS);
|
4436 |
+
} // mPDF 5.7.1
|
4437 |
+
}
|
4438 |
+
|
4439 |
+
|
4440 |
+
if ($this->mpdf->trow_text_rotate) {
|
4441 |
+
$c['R'] = $this->mpdf->trow_text_rotate;
|
4442 |
+
}
|
4443 |
+
|
4444 |
+
$this->mpdf->cell_border_dominance_L = 0;
|
4445 |
+
$this->mpdf->cell_border_dominance_R = 0;
|
4446 |
+
$this->mpdf->cell_border_dominance_T = 0;
|
4447 |
+
$this->mpdf->cell_border_dominance_B = 0;
|
4448 |
+
|
4449 |
+
$properties = $this->mpdf->cssmgr->MergeCSS('TABLE', $tag, $attr);
|
4450 |
+
|
4451 |
+
$properties = $this->mpdf->cssmgr->array_merge_recursive_unique($this->mpdf->base_table_properties, $properties);
|
4452 |
+
|
4453 |
+
$this->mpdf->Reset(); // mPDF 6 ?????????????????????
|
4454 |
+
|
4455 |
+
$this->mpdf->setCSS($properties, 'TABLECELL', $tag);
|
4456 |
+
|
4457 |
+
$c['dfs'] = $this->mpdf->FontSize; // Default Font size
|
4458 |
+
|
4459 |
+
|
4460 |
+
if (isset($properties['BACKGROUND-COLOR'])) {
|
4461 |
+
$c['bgcolor'] = $properties['BACKGROUND-COLOR'];
|
4462 |
+
} else if (isset($properties['BACKGROUND'])) {
|
4463 |
+
$c['bgcolor'] = $properties['BACKGROUND'];
|
4464 |
+
} else if (isset($attr['BGCOLOR']))
|
4465 |
+
$c['bgcolor'] = $attr['BGCOLOR'];
|
4466 |
+
|
4467 |
+
|
4468 |
+
|
4469 |
+
/* -- BACKGROUNDS -- */
|
4470 |
+
if (isset($properties['BACKGROUND-GRADIENT'])) {
|
4471 |
+
$c['gradient'] = $properties['BACKGROUND-GRADIENT'];
|
4472 |
+
} else {
|
4473 |
+
$c['gradient'] = false;
|
4474 |
+
}
|
4475 |
+
|
4476 |
+
if (isset($properties['BACKGROUND-IMAGE']) && $properties['BACKGROUND-IMAGE'] && !$this->mpdf->keep_block_together) {
|
4477 |
+
$ret = $this->mpdf->SetBackground($properties, $this->mpdf->blk[$this->mpdf->blklvl]['inner_width']);
|
4478 |
+
if ($ret) {
|
4479 |
+
$c['background-image'] = $ret;
|
4480 |
+
}
|
4481 |
+
}
|
4482 |
+
/* -- END BACKGROUNDS -- */
|
4483 |
+
if (isset($properties['VERTICAL-ALIGN'])) {
|
4484 |
+
$c['va'] = $align[strtolower($properties['VERTICAL-ALIGN'])];
|
4485 |
+
} else if (isset($attr['VALIGN']))
|
4486 |
+
$c['va'] = $align[strtolower($attr['VALIGN'])];
|
4487 |
+
|
4488 |
+
|
4489 |
+
if (isset($properties['TEXT-ALIGN']) && $properties['TEXT-ALIGN']) {
|
4490 |
+
if (substr($properties['TEXT-ALIGN'], 0, 1) == 'D') {
|
4491 |
+
$c['a'] = $properties['TEXT-ALIGN'];
|
4492 |
+
} else {
|
4493 |
+
$c['a'] = $align[strtolower($properties['TEXT-ALIGN'])];
|
4494 |
+
}
|
4495 |
+
}
|
4496 |
+
if (isset($attr['ALIGN']) && $attr['ALIGN']) {
|
4497 |
+
if (strtolower($attr['ALIGN']) == 'char') {
|
4498 |
+
if (isset($attr['CHAR']) && $attr['CHAR']) {
|
4499 |
+
$char = html_entity_decode($attr['CHAR']);
|
4500 |
+
$char = strcode2utf($char);
|
4501 |
+
$d = array_search($char, $this->mpdf->decimal_align);
|
4502 |
+
if ($d !== false) {
|
4503 |
+
$c['a'] = $d . 'R';
|
4504 |
+
}
|
4505 |
+
} else {
|
4506 |
+
$c['a'] = 'DPR';
|
4507 |
+
}
|
4508 |
+
} else {
|
4509 |
+
$c['a'] = $align[strtolower($attr['ALIGN'])];
|
4510 |
+
}
|
4511 |
+
}
|
4512 |
+
|
4513 |
+
// mPDF 6
|
4514 |
+
$c['direction'] = $table['direction'];
|
4515 |
+
if (isset($attr['DIR']) and $attr['DIR'] != '') {
|
4516 |
+
$c['direction'] = strtolower($attr['DIR']);
|
4517 |
+
}
|
4518 |
+
if (isset($properties['DIRECTION'])) {
|
4519 |
+
$c['direction'] = strtolower($properties['DIRECTION']);
|
4520 |
+
}
|
4521 |
+
|
4522 |
+
if (!$c['a']) {
|
4523 |
+
if (isset($c['direction']) && $c['direction'] == 'rtl') {
|
4524 |
+
$c['a'] = 'R';
|
4525 |
+
} else {
|
4526 |
+
$c['a'] = 'L';
|
4527 |
+
}
|
4528 |
+
}
|
4529 |
+
|
4530 |
+
$c['cellLineHeight'] = $table['cellLineHeight'];
|
4531 |
+
if (isset($properties['LINE-HEIGHT'])) {
|
4532 |
+
$c['cellLineHeight'] = $this->mpdf->fixLineheight($properties['LINE-HEIGHT']);
|
4533 |
+
}
|
4534 |
+
|
4535 |
+
$c['cellLineStackingStrategy'] = $table['cellLineStackingStrategy'];
|
4536 |
+
if (isset($properties['LINE-STACKING-STRATEGY'])) {
|
4537 |
+
$c['cellLineStackingStrategy'] = strtolower($properties['LINE-STACKING-STRATEGY']);
|
4538 |
+
}
|
4539 |
+
|
4540 |
+
$c['cellLineStackingShift'] = $table['cellLineStackingShift'];
|
4541 |
+
if (isset($properties['LINE-STACKING-SHIFT'])) {
|
4542 |
+
$c['cellLineStackingShift'] = strtolower($properties['LINE-STACKING-SHIFT']);
|
4543 |
+
}
|
4544 |
+
|
4545 |
+
if (isset($properties['TEXT-ROTATE']) && ($properties['TEXT-ROTATE'] || $properties['TEXT-ROTATE'] === "0")) {
|
4546 |
+
$c['R'] = $properties['TEXT-ROTATE'];
|
4547 |
+
}
|
4548 |
+
if (isset($properties['BORDER'])) {
|
4549 |
+
$bord = $this->mpdf->border_details($properties['BORDER']);
|
4550 |
+
if ($bord['s']) {
|
4551 |
+
if (!$this->mpdf->simpleTables) {
|
4552 |
+
$c['border'] = _BORDER_ALL;
|
4553 |
+
$c['border_details']['R'] = $bord;
|
4554 |
+
$c['border_details']['L'] = $bord;
|
4555 |
+
$c['border_details']['T'] = $bord;
|
4556 |
+
$c['border_details']['B'] = $bord;
|
4557 |
+
$c['border_details']['L']['dom'] = $this->mpdf->cell_border_dominance_L;
|
4558 |
+
$c['border_details']['R']['dom'] = $this->mpdf->cell_border_dominance_R;
|
4559 |
+
$c['border_details']['T']['dom'] = $this->mpdf->cell_border_dominance_T;
|
4560 |
+
$c['border_details']['B']['dom'] = $this->mpdf->cell_border_dominance_B;
|
4561 |
+
} else if ($this->mpdf->simpleTables && $this->mpdf->row == 0 && $this->mpdf->col == 0) {
|
4562 |
+
$table['simple']['border'] = _BORDER_ALL;
|
4563 |
+
$table['simple']['border_details']['R'] = $bord;
|
4564 |
+
$table['simple']['border_details']['L'] = $bord;
|
4565 |
+
$table['simple']['border_details']['T'] = $bord;
|
4566 |
+
$table['simple']['border_details']['B'] = $bord;
|
4567 |
+
}
|
4568 |
+
}
|
4569 |
+
}
|
4570 |
+
if (!$this->mpdf->simpleTables) {
|
4571 |
+
if (isset($properties['BORDER-RIGHT']) && $properties['BORDER-RIGHT']) {
|
4572 |
+
$c['border_details']['R'] = $this->mpdf->border_details($properties['BORDER-RIGHT']);
|
4573 |
+
$this->mpdf->setBorder($c['border'], _BORDER_RIGHT, $c['border_details']['R']['s']);
|
4574 |
+
$c['border_details']['R']['dom'] = $this->mpdf->cell_border_dominance_R;
|
4575 |
+
}
|
4576 |
+
if (isset($properties['BORDER-LEFT']) && $properties['BORDER-LEFT']) {
|
4577 |
+
$c['border_details']['L'] = $this->mpdf->border_details($properties['BORDER-LEFT']);
|
4578 |
+
$this->mpdf->setBorder($c['border'], _BORDER_LEFT, $c['border_details']['L']['s']);
|
4579 |
+
$c['border_details']['L']['dom'] = $this->mpdf->cell_border_dominance_L;
|
4580 |
+
}
|
4581 |
+
if (isset($properties['BORDER-BOTTOM']) && $properties['BORDER-BOTTOM']) {
|
4582 |
+
$c['border_details']['B'] = $this->mpdf->border_details($properties['BORDER-BOTTOM']);
|
4583 |
+
$this->mpdf->setBorder($c['border'], _BORDER_BOTTOM, $c['border_details']['B']['s']);
|
4584 |
+
$c['border_details']['B']['dom'] = $this->mpdf->cell_border_dominance_B;
|
4585 |
+
}
|
4586 |
+
if (isset($properties['BORDER-TOP']) && $properties['BORDER-TOP']) {
|
4587 |
+
$c['border_details']['T'] = $this->mpdf->border_details($properties['BORDER-TOP']);
|
4588 |
+
$this->mpdf->setBorder($c['border'], _BORDER_TOP, $c['border_details']['T']['s']);
|
4589 |
+
$c['border_details']['T']['dom'] = $this->mpdf->cell_border_dominance_T;
|
4590 |
+
}
|
4591 |
+
} else if ($this->mpdf->simpleTables && $this->mpdf->row == 0 && $this->mpdf->col == 0) {
|
4592 |
+
if (isset($properties['BORDER-LEFT']) && $properties['BORDER-LEFT']) {
|
4593 |
+
$bord = $this->mpdf->border_details($properties['BORDER-LEFT']);
|
4594 |
+
if ($bord['s']) {
|
4595 |
+
$table['simple']['border'] = _BORDER_ALL;
|
4596 |
+
} else {
|
4597 |
+
$table['simple']['border'] = 0;
|
4598 |
+
}
|
4599 |
+
$table['simple']['border_details']['R'] = $bord;
|
4600 |
+
$table['simple']['border_details']['L'] = $bord;
|
4601 |
+
$table['simple']['border_details']['T'] = $bord;
|
4602 |
+
$table['simple']['border_details']['B'] = $bord;
|
4603 |
+
}
|
4604 |
+
}
|
4605 |
+
|
4606 |
+
if ($this->mpdf->simpleTables && $this->mpdf->row == 0 && $this->mpdf->col == 0 && !$table['borders_separate'] && $table['simple']['border']) {
|
4607 |
+
$table['border_details'] = $table['simple']['border_details'];
|
4608 |
+
$table['border'] = $table['simple']['border'];
|
4609 |
+
}
|
4610 |
+
|
4611 |
+
// Border set on TR (if collapsed only)
|
4612 |
+
if (!$table['borders_separate'] && !$this->mpdf->simpleTables && isset($table['trborder-left'][$this->mpdf->row])) {
|
4613 |
+
if ($this->mpdf->col == 0) {
|
4614 |
+
$left = $this->mpdf->border_details($table['trborder-left'][$this->mpdf->row]);
|
4615 |
+
$c['border_details']['L'] = $left;
|
4616 |
+
$this->mpdf->setBorder($c['border'], _BORDER_LEFT, $c['border_details']['L']['s']);
|
4617 |
+
}
|
4618 |
+
$c['border_details']['B'] = $this->mpdf->border_details($table['trborder-bottom'][$this->mpdf->row]);
|
4619 |
+
$this->mpdf->setBorder($c['border'], _BORDER_BOTTOM, $c['border_details']['B']['s']);
|
4620 |
+
$c['border_details']['T'] = $this->mpdf->border_details($table['trborder-top'][$this->mpdf->row]);
|
4621 |
+
$this->mpdf->setBorder($c['border'], _BORDER_TOP, $c['border_details']['T']['s']);
|
4622 |
+
}
|
4623 |
+
|
4624 |
+
if ($this->mpdf->packTableData && !$this->mpdf->simpleTables) {
|
4625 |
+
$c['borderbin'] = $this->mpdf->_packCellBorder($c);
|
4626 |
+
unset($c['border']);
|
4627 |
+
unset($c['border_details']);
|
4628 |
+
}
|
4629 |
+
|
4630 |
+
if (isset($properties['PADDING-LEFT'])) {
|
4631 |
+
$c['padding']['L'] = $this->mpdf->ConvertSize($properties['PADDING-LEFT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
4632 |
+
}
|
4633 |
+
if (isset($properties['PADDING-RIGHT'])) {
|
4634 |
+
$c['padding']['R'] = $this->mpdf->ConvertSize($properties['PADDING-RIGHT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
4635 |
+
}
|
4636 |
+
if (isset($properties['PADDING-BOTTOM'])) {
|
4637 |
+
$c['padding']['B'] = $this->mpdf->ConvertSize($properties['PADDING-BOTTOM'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
4638 |
+
}
|
4639 |
+
if (isset($properties['PADDING-TOP'])) {
|
4640 |
+
$c['padding']['T'] = $this->mpdf->ConvertSize($properties['PADDING-TOP'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
4641 |
+
}
|
4642 |
+
|
4643 |
+
$w = '';
|
4644 |
+
if (isset($properties['WIDTH'])) {
|
4645 |
+
$w = $properties['WIDTH'];
|
4646 |
+
} else if (isset($attr['WIDTH'])) {
|
4647 |
+
$w = $attr['WIDTH'];
|
4648 |
+
}
|
4649 |
+
if ($w) {
|
4650 |
+
if (strpos($w, '%') && !$this->mpdf->ignore_table_percents) {
|
4651 |
+
$c['wpercent'] = $w + 0;
|
4652 |
+
} // makes 80% -> 80
|
4653 |
+
else if (!strpos($w, '%') && !$this->mpdf->ignore_table_widths) {
|
4654 |
+
$c['w'] = $this->mpdf->ConvertSize($w, $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
4655 |
+
}
|
4656 |
+
}
|
4657 |
+
|
4658 |
+
if (isset($properties['HEIGHT']) && !strpos($properties['HEIGHT'], '%')) {
|
4659 |
+
$c['h'] = $this->mpdf->ConvertSize($properties['HEIGHT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
4660 |
+
} else if (isset($attr['HEIGHT']) && !strpos($attr['HEIGHT'], '%'))
|
4661 |
+
$c['h'] = $this->mpdf->ConvertSize($attr['HEIGHT'], $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
4662 |
+
|
4663 |
+
if (isset($properties['WHITE-SPACE'])) {
|
4664 |
+
if (strtoupper($properties['WHITE-SPACE']) == 'NOWRAP') {
|
4665 |
+
$c['nowrap'] = 1;
|
4666 |
+
}
|
4667 |
+
}
|
4668 |
+
$properties = array();
|
4669 |
+
|
4670 |
+
|
4671 |
+
if (isset($attr['TEXT-ROTATE'])) {
|
4672 |
+
$c['R'] = $attr['TEXT-ROTATE'];
|
4673 |
+
}
|
4674 |
+
if (isset($attr['NOWRAP']) && $attr['NOWRAP'])
|
4675 |
+
$c['nowrap'] = 1;
|
4676 |
+
|
4677 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col] = $c;
|
4678 |
+
unset($c);
|
4679 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s'] = 0;
|
4680 |
+
|
4681 |
+
$cs = $rs = 1;
|
4682 |
+
if (isset($attr['COLSPAN']) && $attr['COLSPAN'] > 1)
|
4683 |
+
$cs = $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['colspan'] = $attr['COLSPAN'];
|
4684 |
+
if ($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['nc'] < $this->mpdf->col + $cs) {
|
4685 |
+
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['nc'] = $this->mpdf->col + $cs;
|
4686 |
+
} // following code moved outside if...
|
4687 |
+
for ($l = $this->mpdf->col; $l < $this->mpdf->col + $cs; $l++) {
|
4688 |
+
if ($l - $this->mpdf->col)
|
4689 |
+
$this->mpdf->cell[$this->mpdf->row][$l] = 0;
|
4690 |
+
}
|
4691 |
+
if (isset($attr['ROWSPAN']) && $attr['ROWSPAN'] > 1)
|
4692 |
+
$rs = $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['rowspan'] = $attr['ROWSPAN'];
|
4693 |
+
for ($k = $this->mpdf->row; $k < $this->mpdf->row + $rs; $k++) {
|
4694 |
+
for ($l = $this->mpdf->col; $l < $this->mpdf->col + $cs; $l++) {
|
4695 |
+
if ($k - $this->mpdf->row || $l - $this->mpdf->col)
|
4696 |
+
$this->mpdf->cell[$k][$l] = 0;
|
4697 |
+
}
|
4698 |
+
}
|
4699 |
+
unset($table);
|
4700 |
+
break;
|
4701 |
+
/* -- END TABLES -- */
|
4702 |
+
}//end of switch
|
4703 |
+
}
|
4704 |
+
|
4705 |
+
function CloseTag($tag, &$ahtml, &$ihtml)
|
4706 |
+
{ // mPDF 6
|
4707 |
+
//Closing tag
|
4708 |
+
if ($tag == 'OPTION') {
|
4709 |
+
$this->mpdf->selectoption['ACTIVE'] = false;
|
4710 |
+
$this->mpdf->lastoptionaltag = '';
|
4711 |
+
}
|
4712 |
+
|
4713 |
+
if ($tag == 'TTS' or $tag == 'TTA' or $tag == 'TTZ') {
|
4714 |
+
if ($this->mpdf->InlineProperties[$tag]) {
|
4715 |
+
$this->mpdf->restoreInlineProperties($this->mpdf->InlineProperties[$tag]);
|
4716 |
+
}
|
4717 |
+
unset($this->mpdf->InlineProperties[$tag]);
|
4718 |
+
$ltag = strtolower($tag);
|
4719 |
+
$this->mpdf->$ltag = false;
|
4720 |
+
}
|
4721 |
+
|
4722 |
+
|
4723 |
+
if ($tag == 'FONT' || $tag == 'SPAN' || $tag == 'CODE' || $tag == 'KBD' || $tag == 'SAMP' || $tag == 'TT' || $tag == 'VAR' || $tag == 'INS' || $tag == 'STRONG' || $tag == 'CITE' || $tag == 'SUB' || $tag == 'SUP' || $tag == 'S' || $tag == 'STRIKE' || $tag == 'DEL' || $tag == 'Q' || $tag == 'EM' || $tag == 'B' || $tag == 'I' || $tag == 'U' | $tag == 'SMALL' || $tag == 'BIG' || $tag == 'ACRONYM' || $tag == 'MARK' || $tag == 'TIME' || $tag == 'PROGRESS' || $tag == 'METER' || $tag == 'BDO' || $tag == 'BDI'
|
4724 |
+
) {
|
4725 |
+
|
4726 |
+
$annot = false; // mPDF 6
|
4727 |
+
$bdf = false; // mPDF 6
|
4728 |
+
// mPDF 5.7.3 Inline tags
|
4729 |
+
if ($tag == 'PROGRESS' || $tag == 'METER') {
|
4730 |
+
if (isset($this->mpdf->InlineProperties[$tag]) && $this->mpdf->InlineProperties[$tag]) {
|
4731 |
+
$this->mpdf->restoreInlineProperties($this->mpdf->InlineProperties[$tag]);
|
4732 |
+
}
|
4733 |
+
unset($this->mpdf->InlineProperties[$tag]);
|
4734 |
+
if (isset($this->mpdf->InlineAnnots[$tag]) && $this->mpdf->InlineAnnots[$tag]) {
|
4735 |
+
$annot = $this->mpdf->InlineAnnots[$tag];
|
4736 |
+
} // *ANNOTATIONS*
|
4737 |
+
unset($this->mpdf->InlineAnnots[$tag]); // *ANNOTATIONS*
|
4738 |
+
} else {
|
4739 |
+
if (isset($this->mpdf->InlineProperties[$tag]) && count($this->mpdf->InlineProperties[$tag])) {
|
4740 |
+
$tmpProps = array_pop($this->mpdf->InlineProperties[$tag]); // mPDF 5.7.4
|
4741 |
+
$this->mpdf->restoreInlineProperties($tmpProps);
|
4742 |
+
}
|
4743 |
+
if (isset($this->mpdf->InlineAnnots[$tag]) && count($this->mpdf->InlineAnnots[$tag])) { // *ANNOTATIONS*
|
4744 |
+
$annot = array_pop($this->mpdf->InlineAnnots[$tag]); // *ANNOTATIONS*
|
4745 |
+
} // *ANNOTATIONS*
|
4746 |
+
if (isset($this->mpdf->InlineBDF[$tag]) && count($this->mpdf->InlineBDF[$tag])) { // mPDF 6
|
4747 |
+
$bdfarr = array_pop($this->mpdf->InlineBDF[$tag]);
|
4748 |
+
$bdf = $bdfarr[0];
|
4749 |
+
}
|
4750 |
+
}
|
4751 |
+
|
4752 |
+
/* -- ANNOTATIONS -- */
|
4753 |
+
if ($annot) { // mPDF 6
|
4754 |
+
if ($this->mpdf->tableLevel) { // *TABLES*
|
4755 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['textbuffer'][] = array($annot); // *TABLES*
|
4756 |
+
} // *TABLES*
|
4757 |
+
else { // *TABLES*
|
4758 |
+
$this->mpdf->textbuffer[] = array($annot);
|
4759 |
+
} // *TABLES*
|
4760 |
+
}
|
4761 |
+
/* -- END ANNOTATIONS -- */
|
4762 |
+
|
4763 |
+
// mPDF 6 bidi
|
4764 |
+
// mPDF 6 Bidirectional formatting for inline elements
|
4765 |
+
if ($bdf) {
|
4766 |
+
$popf = $this->mpdf->_setBidiCodes('end', $bdf);
|
4767 |
+
$this->mpdf->OTLdata = array();
|
4768 |
+
if ($this->mpdf->tableLevel) {
|
4769 |
+
$this->mpdf->_saveCellTextBuffer($popf);
|
4770 |
+
} else {
|
4771 |
+
$this->mpdf->_saveTextBuffer($popf);
|
4772 |
+
}
|
4773 |
+
}
|
4774 |
+
} // End of (most) Inline elements eg SPAN
|
4775 |
+
|
4776 |
+
|
4777 |
+
if ($tag == 'METER' || $tag == 'PROGRESS') {
|
4778 |
+
$this->mpdf->ignorefollowingspaces = false;
|
4779 |
+
$this->mpdf->inMeter = false;
|
4780 |
+
}
|
4781 |
+
|
4782 |
+
|
4783 |
+
if ($tag == 'A') {
|
4784 |
+
$this->mpdf->HREF = '';
|
4785 |
+
if (isset($this->mpdf->InlineProperties['A'])) {
|
4786 |
+
$this->mpdf->restoreInlineProperties($this->mpdf->InlineProperties['A']);
|
4787 |
+
}
|
4788 |
+
unset($this->mpdf->InlineProperties['A']);
|
4789 |
+
}
|
4790 |
+
|
4791 |
+
if ($tag == 'LEGEND') {
|
4792 |
+
if (count($this->mpdf->textbuffer) && !$this->mpdf->tableLevel) {
|
4793 |
+
$leg = $this->mpdf->textbuffer[(count($this->mpdf->textbuffer) - 1)];
|
4794 |
+
unset($this->mpdf->textbuffer[(count($this->mpdf->textbuffer) - 1)]);
|
4795 |
+
$this->mpdf->textbuffer = array_values($this->mpdf->textbuffer);
|
4796 |
+
$this->mpdf->blk[$this->mpdf->blklvl]['border_legend'] = $leg;
|
4797 |
+
$this->mpdf->blk[$this->mpdf->blklvl]['margin_top'] += ($leg[11] / 2) / _MPDFK;
|
4798 |
+
$this->mpdf->blk[$this->mpdf->blklvl]['padding_top'] += ($leg[11] / 2) / _MPDFK;
|
4799 |
+
}
|
4800 |
+
if (isset($this->mpdf->InlineProperties['LEGEND'])) {
|
4801 |
+
$this->mpdf->restoreInlineProperties($this->mpdf->InlineProperties['LEGEND']);
|
4802 |
+
}
|
4803 |
+
unset($this->mpdf->InlineProperties['LEGEND']);
|
4804 |
+
$this->mpdf->ignorefollowingspaces = true; //Eliminate exceeding left-side spaces
|
4805 |
+
}
|
4806 |
+
|
4807 |
+
/* -- FORMS -- */
|
4808 |
+
// *********** FORM ELEMENTS ********************
|
4809 |
+
|
4810 |
+
if ($tag == 'TEXTAREA') {
|
4811 |
+
$this->mpdf->ignorefollowingspaces = false;
|
4812 |
+
$this->mpdf->specialcontent = '';
|
4813 |
+
if ($this->mpdf->InlineProperties[$tag]) {
|
4814 |
+
$this->mpdf->restoreInlineProperties($this->mpdf->InlineProperties[$tag]);
|
4815 |
+
}
|
4816 |
+
unset($this->mpdf->InlineProperties[$tag]);
|
4817 |
+
}
|
4818 |
+
|
4819 |
+
|
4820 |
+
if ($tag == 'SELECT') {
|
4821 |
+
$this->mpdf->ignorefollowingspaces = false;
|
4822 |
+
$this->mpdf->lastoptionaltag = '';
|
4823 |
+
$texto = '';
|
4824 |
+
$OTLdata = false;
|
4825 |
+
if (isset($this->mpdf->selectoption['SELECTED'])) {
|
4826 |
+
$texto = $this->mpdf->selectoption['SELECTED'];
|
4827 |
+
}
|
4828 |
+
if (isset($this->mpdf->selectoption['SELECTED-OTLDATA'])) {
|
4829 |
+
$OTLdata = $this->mpdf->selectoption['SELECTED-OTLDATA'];
|
4830 |
+
}
|
4831 |
+
|
4832 |
+
if ($this->mpdf->useActiveForms) {
|
4833 |
+
$w = $this->mpdf->selectoption['MAXWIDTH'];
|
4834 |
+
} else {
|
4835 |
+
$w = $this->mpdf->GetStringWidth($texto, true, $OTLdata);
|
4836 |
+
}
|
4837 |
+
if ($w == 0) {
|
4838 |
+
$w = 5;
|
4839 |
+
}
|
4840 |
+
$objattr['type'] = 'select';
|
4841 |
+
$objattr['text'] = $texto;
|
4842 |
+
$objattr['OTLdata'] = $OTLdata;
|
4843 |
+
if (isset($this->mpdf->selectoption['NAME'])) {
|
4844 |
+
$objattr['fieldname'] = $this->mpdf->selectoption['NAME'];
|
4845 |
+
}
|
4846 |
+
if (isset($this->mpdf->selectoption['READONLY'])) {
|
4847 |
+
$objattr['readonly'] = true;
|
4848 |
+
}
|
4849 |
+
if (isset($this->mpdf->selectoption['REQUIRED'])) {
|
4850 |
+
$objattr['required'] = true;
|
4851 |
+
}
|
4852 |
+
if (isset($this->mpdf->selectoption['SPELLCHECK'])) {
|
4853 |
+
$objattr['spellcheck'] = true;
|
4854 |
+
}
|
4855 |
+
if (isset($this->mpdf->selectoption['EDITABLE'])) {
|
4856 |
+
$objattr['editable'] = true;
|
4857 |
+
}
|
4858 |
+
if (isset($this->mpdf->selectoption['ONCHANGE'])) {
|
4859 |
+
$objattr['onChange'] = $this->mpdf->selectoption['ONCHANGE'];
|
4860 |
+
}
|
4861 |
+
if (isset($this->mpdf->selectoption['ITEMS'])) {
|
4862 |
+
$objattr['items'] = $this->mpdf->selectoption['ITEMS'];
|
4863 |
+
}
|
4864 |
+
if (isset($this->mpdf->selectoption['MULTIPLE'])) {
|
4865 |
+
$objattr['multiple'] = $this->mpdf->selectoption['MULTIPLE'];
|
4866 |
+
}
|
4867 |
+
if (isset($this->mpdf->selectoption['DISABLED'])) {
|
4868 |
+
$objattr['disabled'] = $this->mpdf->selectoption['DISABLED'];
|
4869 |
+
}
|
4870 |
+
if (isset($this->mpdf->selectoption['TITLE'])) {
|
4871 |
+
$objattr['title'] = $this->mpdf->selectoption['TITLE'];
|
4872 |
+
}
|
4873 |
+
if (isset($this->mpdf->selectoption['COLOR'])) {
|
4874 |
+
$objattr['color'] = $this->mpdf->selectoption['COLOR'];
|
4875 |
+
}
|
4876 |
+
if (isset($this->mpdf->selectoption['SIZE'])) {
|
4877 |
+
$objattr['size'] = $this->mpdf->selectoption['SIZE'];
|
4878 |
+
}
|
4879 |
+
if (isset($objattr['size']) && $objattr['size'] > 1) {
|
4880 |
+
$rows = $objattr['size'];
|
4881 |
+
} else {
|
4882 |
+
$rows = 1;
|
4883 |
+
}
|
4884 |
+
|
4885 |
+
$objattr['fontfamily'] = $this->mpdf->FontFamily;
|
4886 |
+
$objattr['fontsize'] = $this->mpdf->FontSizePt;
|
4887 |
+
|
4888 |
+
$objattr['width'] = $w + ($this->mpdf->mpdfform->form_element_spacing['select']['outer']['h'] * 2) + ($this->mpdf->mpdfform->form_element_spacing['select']['inner']['h'] * 2) + ($this->mpdf->FontSize * 1.4);
|
4889 |
+
$objattr['height'] = ($this->mpdf->FontSize * $rows) + ($this->mpdf->mpdfform->form_element_spacing['select']['outer']['v'] * 2) + ($this->mpdf->mpdfform->form_element_spacing['select']['inner']['v'] * 2);
|
4890 |
+
$e = "\xbb\xa4\xactype=select,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
|
4891 |
+
|
4892 |
+
// Clear properties - tidy up
|
4893 |
+
$properties = array();
|
4894 |
+
|
4895 |
+
// Output it to buffers
|
4896 |
+
if ($this->mpdf->tableLevel) { // *TABLES*
|
4897 |
+
$this->mpdf->_saveCellTextBuffer($e, $this->mpdf->HREF);
|
4898 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s'] += $objattr['width']; // *TABLES*
|
4899 |
+
} // *TABLES*
|
4900 |
+
else { // *TABLES*
|
4901 |
+
$this->mpdf->_saveTextBuffer($e, $this->mpdf->HREF);
|
4902 |
+
} // *TABLES*
|
4903 |
+
|
4904 |
+
$this->mpdf->selectoption = array();
|
4905 |
+
$this->mpdf->specialcontent = '';
|
4906 |
+
|
4907 |
+
if ($this->mpdf->InlineProperties[$tag]) {
|
4908 |
+
$this->mpdf->restoreInlineProperties($this->mpdf->InlineProperties[$tag]);
|
4909 |
+
}
|
4910 |
+
unset($this->mpdf->InlineProperties[$tag]);
|
4911 |
+
}
|
4912 |
+
/* -- END FORMS -- */
|
4913 |
+
|
4914 |
+
|
4915 |
+
// *********** BLOCKS ********************
|
4916 |
+
// mPDF 6 Lists
|
4917 |
+
if ($tag == 'P' || $tag == 'DIV' || $tag == 'H1' || $tag == 'H2' || $tag == 'H3' || $tag == 'H4' || $tag == 'H5' || $tag == 'H6' || $tag == 'PRE' || $tag == 'FORM' || $tag == 'ADDRESS' || $tag == 'BLOCKQUOTE' || $tag == 'CENTER' || $tag == 'DT' || $tag == 'DD' || $tag == 'DL' || $tag == 'CAPTION' || $tag == 'FIELDSET' || $tag == 'UL' || $tag == 'OL' || $tag == 'LI' || $tag == 'ARTICLE' || $tag == 'ASIDE' || $tag == 'FIGURE' || $tag == 'FIGCAPTION' || $tag == 'FOOTER' || $tag == 'HEADER' || $tag == 'HGROUP' || $tag == 'MAIN' || $tag == 'NAV' || $tag == 'SECTION' || $tag == 'DETAILS' || $tag == 'SUMMARY'
|
4918 |
+
) {
|
4919 |
+
|
4920 |
+
// mPDF 6 bidi
|
4921 |
+
// Block
|
4922 |
+
// If unicode-bidi set, any embedding levels, isolates, or overrides started by this box are closed
|
4923 |
+
if (isset($this->mpdf->blk[$this->mpdf->blklvl]['bidicode'])) {
|
4924 |
+
$blockpost = $this->mpdf->_setBidiCodes('end', $this->mpdf->blk[$this->mpdf->blklvl]['bidicode']);
|
4925 |
+
if ($blockpost) {
|
4926 |
+
$this->mpdf->OTLdata = array();
|
4927 |
+
if ($this->mpdf->tableLevel) {
|
4928 |
+
$this->mpdf->_saveCellTextBuffer($blockpost);
|
4929 |
+
} else {
|
4930 |
+
$this->mpdf->_saveTextBuffer($blockpost);
|
4931 |
+
}
|
4932 |
+
}
|
4933 |
+
}
|
4934 |
+
|
4935 |
+
$this->mpdf->ignorefollowingspaces = true; //Eliminate exceeding left-side spaces
|
4936 |
+
$this->mpdf->blockjustfinished = true;
|
4937 |
+
|
4938 |
+
$this->mpdf->lastblockbottommargin = $this->mpdf->blk[$this->mpdf->blklvl]['margin_bottom'];
|
4939 |
+
// mPDF 6 Lists
|
4940 |
+
if ($tag == 'UL' || $tag == 'OL') {
|
4941 |
+
if ($this->mpdf->listlvl > 0 && $this->mpdf->tableLevel) {
|
4942 |
+
if (isset($this->mpdf->listtype[$this->mpdf->listlvl]))
|
4943 |
+
unset($this->mpdf->listtype[$this->mpdf->listlvl]);
|
4944 |
+
}
|
4945 |
+
$this->mpdf->listlvl--;
|
4946 |
+
$this->mpdf->listitem = array();
|
4947 |
+
}
|
4948 |
+
if ($tag == 'LI') {
|
4949 |
+
$this->mpdf->listitem = array();
|
4950 |
+
}
|
4951 |
+
|
4952 |
+
if (preg_match('/^H\d/', $tag) && !$this->mpdf->tableLevel && !$this->mpdf->writingToC) {
|
4953 |
+
if (isset($this->mpdf->h2toc[$tag]) || isset($this->mpdf->h2bookmarks[$tag])) {
|
4954 |
+
$content = '';
|
4955 |
+
if (count($this->mpdf->textbuffer) == 1) {
|
4956 |
+
$content = $this->mpdf->textbuffer[0][0];
|
4957 |
+
} else {
|
4958 |
+
for ($i = 0; $i < count($this->mpdf->textbuffer); $i++) {
|
4959 |
+
if (substr($this->mpdf->textbuffer[$i][0], 0, 3) != "\xbb\xa4\xac") { //inline object
|
4960 |
+
$content .= $this->mpdf->textbuffer[$i][0];
|
4961 |
+
}
|
4962 |
+
}
|
4963 |
+
}
|
4964 |
+
/* -- TOC -- */
|
4965 |
+
if (isset($this->mpdf->h2toc[$tag])) {
|
4966 |
+
$objattr = array();
|
4967 |
+
$objattr['type'] = 'toc';
|
4968 |
+
$objattr['toclevel'] = $this->mpdf->h2toc[$tag];
|
4969 |
+
$objattr['CONTENT'] = htmlspecialchars($content);
|
4970 |
+
$e = "\xbb\xa4\xactype=toc,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
|
4971 |
+
array_unshift($this->mpdf->textbuffer, array($e));
|
4972 |
+
}
|
4973 |
+
/* -- END TOC -- */
|
4974 |
+
/* -- BOOKMARKS -- */
|
4975 |
+
if (isset($this->mpdf->h2bookmarks[$tag])) {
|
4976 |
+
$objattr = array();
|
4977 |
+
$objattr['type'] = 'bookmark';
|
4978 |
+
$objattr['bklevel'] = $this->mpdf->h2bookmarks[$tag];
|
4979 |
+
$objattr['CONTENT'] = $content;
|
4980 |
+
$e = "\xbb\xa4\xactype=toc,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
|
4981 |
+
array_unshift($this->mpdf->textbuffer, array($e));
|
4982 |
+
}
|
4983 |
+
/* -- END BOOKMARKS -- */
|
4984 |
+
}
|
4985 |
+
}
|
4986 |
+
|
4987 |
+
/* -- TABLES -- */
|
4988 |
+
if ($this->mpdf->tableLevel) {
|
4989 |
+
if ($this->mpdf->linebreakjustfinished) {
|
4990 |
+
$this->mpdf->blockjustfinished = false;
|
4991 |
+
}
|
4992 |
+
if (isset($this->mpdf->InlineProperties['BLOCKINTABLE'])) {
|
4993 |
+
if ($this->mpdf->InlineProperties['BLOCKINTABLE']) {
|
4994 |
+
$this->mpdf->restoreInlineProperties($this->mpdf->InlineProperties['BLOCKINTABLE']);
|
4995 |
+
}
|
4996 |
+
unset($this->mpdf->InlineProperties['BLOCKINTABLE']);
|
4997 |
+
}
|
4998 |
+
if ($tag == 'PRE') {
|
4999 |
+
$this->mpdf->ispre = false;
|
5000 |
+
}
|
5001 |
+
return;
|
5002 |
+
}
|
5003 |
+
/* -- END TABLES -- */
|
5004 |
+
$this->mpdf->lastoptionaltag = '';
|
5005 |
+
$this->mpdf->divbegin = false;
|
5006 |
+
|
5007 |
+
$this->mpdf->linebreakjustfinished = false;
|
5008 |
+
|
5009 |
+
$this->mpdf->x = $this->mpdf->lMargin + $this->mpdf->blk[$this->mpdf->blklvl]['outer_left_margin'];
|
5010 |
+
|
5011 |
+
/* -- CSS-FLOAT -- */
|
5012 |
+
// If float contained in a float, need to extend bottom to allow for it
|
5013 |
+
$currpos = $this->mpdf->page * 1000 + $this->mpdf->y;
|
5014 |
+
if (isset($this->mpdf->blk[$this->mpdf->blklvl]['float_endpos']) && $this->mpdf->blk[$this->mpdf->blklvl]['float_endpos'] > $currpos) {
|
5015 |
+
$old_page = $this->mpdf->page;
|
5016 |
+
$new_page = intval($this->mpdf->blk[$this->mpdf->blklvl]['float_endpos'] / 1000);
|
5017 |
+
if ($old_page != $new_page) {
|
5018 |
+
$s = $this->mpdf->PrintPageBackgrounds();
|
5019 |
+
// Writes after the marker so not overwritten later by page background etc.
|
5020 |
+
$this->mpdf->pages[$this->mpdf->page] = preg_replace('/(___BACKGROUND___PATTERNS' . $this->mpdf->uniqstr . ')/', '\\1' . "\n" . $s . "\n", $this->mpdf->pages[$this->mpdf->page]);
|
5021 |
+
$this->mpdf->pageBackgrounds = array();
|
5022 |
+
$this->mpdf->page = $new_page;
|
5023 |
+
$this->mpdf->ResetMargins();
|
5024 |
+
$this->mpdf->Reset();
|
5025 |
+
$this->mpdf->pageoutput[$this->mpdf->page] = array();
|
5026 |
+
}
|
5027 |
+
$this->mpdf->y = (($this->mpdf->blk[$this->mpdf->blklvl]['float_endpos'] * 1000) % 1000000) / 1000; // mod changes operands to integers before processing
|
5028 |
+
}
|
5029 |
+
/* -- END CSS-FLOAT -- */
|
5030 |
+
|
5031 |
+
|
5032 |
+
//Print content
|
5033 |
+
if ($this->mpdf->lastblocklevelchange == 1) {
|
5034 |
+
$blockstate = 3;
|
5035 |
+
} // Top & bottom margins/padding
|
5036 |
+
else if ($this->mpdf->lastblocklevelchange == -1) {
|
5037 |
+
$blockstate = 2;
|
5038 |
+
} // Bottom margins/padding only
|
5039 |
+
else {
|
5040 |
+
$blockstate = 0;
|
5041 |
+
}
|
5042 |
+
// called from after e.g. </table> </div> </div> ... Outputs block margin/border and padding
|
5043 |
+
if (count($this->mpdf->textbuffer) && $this->mpdf->textbuffer[count($this->mpdf->textbuffer) - 1]) {
|
5044 |
+
if (substr($this->mpdf->textbuffer[count($this->mpdf->textbuffer) - 1][0], 0, 3) != "\xbb\xa4\xac") { // not special content
|
5045 |
+
// Right trim last content and adjust OTLdata
|
5046 |
+
if (preg_match('/[ ]+$/', $this->mpdf->textbuffer[count($this->mpdf->textbuffer) - 1][0], $m)) {
|
5047 |
+
$strip = strlen($m[0]);
|
5048 |
+
$this->mpdf->textbuffer[count($this->mpdf->textbuffer) - 1][0] = substr($this->mpdf->textbuffer[count($this->mpdf->textbuffer) - 1][0], 0, (strlen($this->mpdf->textbuffer[count($this->mpdf->textbuffer) - 1][0]) - $strip));
|
5049 |
+
/* -- OTL -- */
|
5050 |
+
if (isset($this->mpdf->CurrentFont['useOTL']) && $this->mpdf->CurrentFont['useOTL']) {
|
5051 |
+
$this->mpdf->otl->trimOTLdata($this->mpdf->textbuffer[count($this->mpdf->textbuffer) - 1][18], false, true); // mPDF 6 ZZZ99K
|
5052 |
+
}
|
5053 |
+
/* -- END OTL -- */
|
5054 |
+
}
|
5055 |
+
}
|
5056 |
+
}
|
5057 |
+
|
5058 |
+
if (count($this->mpdf->textbuffer) == 0 && $this->mpdf->lastblocklevelchange != 0) {
|
5059 |
+
//$this->mpdf->newFlowingBlock( $this->mpdf->blk[$this->mpdf->blklvl]['width'],$this->mpdf->lineheight,'',false,2,true, (isset($this->mpdf->blk[$this->mpdf->blklvl]['direction']) ? $this->mpdf->blk[$this->mpdf->blklvl]['direction'] : 'ltr'));
|
5060 |
+
$this->mpdf->newFlowingBlock($this->mpdf->blk[$this->mpdf->blklvl]['width'], $this->mpdf->lineheight, '', false, $blockstate, true, (isset($this->mpdf->blk[$this->mpdf->blklvl]['direction']) ? $this->mpdf->blk[$this->mpdf->blklvl]['direction'] : 'ltr'));
|
5061 |
+
$this->mpdf->finishFlowingBlock(true); // true = END of flowing block
|
5062 |
+
$this->mpdf->PaintDivBB('', $blockstate);
|
5063 |
+
} else {
|
5064 |
+
$this->mpdf->printbuffer($this->mpdf->textbuffer, $blockstate);
|
5065 |
+
}
|
5066 |
+
|
5067 |
+
|
5068 |
+
$this->mpdf->textbuffer = array();
|
5069 |
+
|
5070 |
+
if ($this->mpdf->kwt) {
|
5071 |
+
$this->mpdf->kwt_height = $this->mpdf->y - $this->mpdf->kwt_y0;
|
5072 |
+
}
|
5073 |
+
|
5074 |
+
/* -- CSS-IMAGE-FLOAT -- */
|
5075 |
+
$this->mpdf->printfloatbuffer();
|
5076 |
+
/* -- END CSS-IMAGE-FLOAT -- */
|
5077 |
+
|
5078 |
+
if ($tag == 'PRE') {
|
5079 |
+
$this->mpdf->ispre = false;
|
5080 |
+
}
|
5081 |
+
|
5082 |
+
/* -- CSS-FLOAT -- */
|
5083 |
+
if ($this->mpdf->blk[$this->mpdf->blklvl]['float'] == 'R') {
|
5084 |
+
// If width not set, here would need to adjust and output buffer
|
5085 |
+
$s = $this->mpdf->PrintPageBackgrounds();
|
5086 |
+
// Writes after the marker so not overwritten later by page background etc.
|
5087 |
+
$this->mpdf->pages[$this->mpdf->page] = preg_replace('/(___BACKGROUND___PATTERNS' . $this->mpdf->uniqstr . ')/', '\\1' . "\n" . $s . "\n", $this->mpdf->pages[$this->mpdf->page]);
|
5088 |
+
$this->mpdf->pageBackgrounds = array();
|
5089 |
+
$this->mpdf->Reset();
|
5090 |
+
$this->mpdf->pageoutput[$this->mpdf->page] = array();
|
5091 |
+
|
5092 |
+
for ($i = ($this->mpdf->blklvl - 1); $i >= 0; $i--) {
|
5093 |
+
if (isset($this->mpdf->blk[$i]['float_endpos'])) {
|
5094 |
+
$this->mpdf->blk[$i]['float_endpos'] = max($this->mpdf->blk[$i]['float_endpos'], ($this->mpdf->page * 1000 + $this->mpdf->y));
|
5095 |
+
} else {
|
5096 |
+
$this->mpdf->blk[$i]['float_endpos'] = $this->mpdf->page * 1000 + $this->mpdf->y;
|
5097 |
+
}
|
5098 |
+
}
|
5099 |
+
|
5100 |
+
$this->mpdf->floatDivs[] = array(
|
5101 |
+
'side' => 'R',
|
5102 |
+
'startpage' => $this->mpdf->blk[$this->mpdf->blklvl]['startpage'],
|
5103 |
+
'y0' => $this->mpdf->blk[$this->mpdf->blklvl]['float_start_y'],
|
5104 |
+
'startpos' => ($this->mpdf->blk[$this->mpdf->blklvl]['startpage'] * 1000 + $this->mpdf->blk[$this->mpdf->blklvl]['float_start_y']),
|
5105 |
+
'endpage' => $this->mpdf->page,
|
5106 |
+
'y1' => $this->mpdf->y,
|
5107 |
+
'endpos' => ($this->mpdf->page * 1000 + $this->mpdf->y),
|
5108 |
+
'w' => $this->mpdf->blk[$this->mpdf->blklvl]['float_width'],
|
5109 |
+
'blklvl' => $this->mpdf->blklvl,
|
5110 |
+
'blockContext' => $this->mpdf->blk[$this->mpdf->blklvl - 1]['blockContext']
|
5111 |
+
);
|
5112 |
+
|
5113 |
+
$this->mpdf->y = $this->mpdf->blk[$this->mpdf->blklvl]['float_start_y'];
|
5114 |
+
$this->mpdf->page = $this->mpdf->blk[$this->mpdf->blklvl]['startpage'];
|
5115 |
+
$this->mpdf->ResetMargins();
|
5116 |
+
$this->mpdf->pageoutput[$this->mpdf->page] = array();
|
5117 |
+
}
|
5118 |
+
if ($this->mpdf->blk[$this->mpdf->blklvl]['float'] == 'L') {
|
5119 |
+
// If width not set, here would need to adjust and output buffer
|
5120 |
+
$s = $this->mpdf->PrintPageBackgrounds();
|
5121 |
+
// Writes after the marker so not overwritten later by page background etc.
|
5122 |
+
$this->mpdf->pages[$this->mpdf->page] = preg_replace('/(___BACKGROUND___PATTERNS' . $this->mpdf->uniqstr . ')/', '\\1' . "\n" . $s . "\n", $this->mpdf->pages[$this->mpdf->page]);
|
5123 |
+
$this->mpdf->pageBackgrounds = array();
|
5124 |
+
$this->mpdf->Reset();
|
5125 |
+
$this->mpdf->pageoutput[$this->mpdf->page] = array();
|
5126 |
+
|
5127 |
+
for ($i = ($this->mpdf->blklvl - 1); $i >= 0; $i--) {
|
5128 |
+
if (isset($this->mpdf->blk[$i]['float_endpos'])) {
|
5129 |
+
$this->mpdf->blk[$i]['float_endpos'] = max($this->mpdf->blk[$i]['float_endpos'], ($this->mpdf->page * 1000 + $this->mpdf->y));
|
5130 |
+
} else {
|
5131 |
+
$this->mpdf->blk[$i]['float_endpos'] = $this->mpdf->page * 1000 + $this->mpdf->y;
|
5132 |
+
}
|
5133 |
+
}
|
5134 |
+
|
5135 |
+
$this->mpdf->floatDivs[] = array(
|
5136 |
+
'side' => 'L',
|
5137 |
+
'startpage' => $this->mpdf->blk[$this->mpdf->blklvl]['startpage'],
|
5138 |
+
'y0' => $this->mpdf->blk[$this->mpdf->blklvl]['float_start_y'],
|
5139 |
+
'startpos' => ($this->mpdf->blk[$this->mpdf->blklvl]['startpage'] * 1000 + $this->mpdf->blk[$this->mpdf->blklvl]['float_start_y']),
|
5140 |
+
'endpage' => $this->mpdf->page,
|
5141 |
+
'y1' => $this->mpdf->y,
|
5142 |
+
'endpos' => ($this->mpdf->page * 1000 + $this->mpdf->y),
|
5143 |
+
'w' => $this->mpdf->blk[$this->mpdf->blklvl]['float_width'],
|
5144 |
+
'blklvl' => $this->mpdf->blklvl,
|
5145 |
+
'blockContext' => $this->mpdf->blk[$this->mpdf->blklvl - 1]['blockContext']
|
5146 |
+
);
|
5147 |
+
|
5148 |
+
$this->mpdf->y = $this->mpdf->blk[$this->mpdf->blklvl]['float_start_y'];
|
5149 |
+
$this->mpdf->page = $this->mpdf->blk[$this->mpdf->blklvl]['startpage'];
|
5150 |
+
$this->mpdf->ResetMargins();
|
5151 |
+
$this->mpdf->pageoutput[$this->mpdf->page] = array();
|
5152 |
+
}
|
5153 |
+
/* -- END CSS-FLOAT -- */
|
5154 |
+
|
5155 |
+
if (isset($this->mpdf->blk[$this->mpdf->blklvl]['visibility']) && $this->mpdf->blk[$this->mpdf->blklvl]['visibility'] != 'visible') {
|
5156 |
+
$this->mpdf->SetVisibility('visible');
|
5157 |
+
}
|
5158 |
+
|
5159 |
+
if (isset($this->mpdf->blk[$this->mpdf->blklvl]['page_break_after'])) {
|
5160 |
+
$page_break_after = $this->mpdf->blk[$this->mpdf->blklvl]['page_break_after'];
|
5161 |
+
} else {
|
5162 |
+
$page_break_after = '';
|
5163 |
+
}
|
5164 |
+
|
5165 |
+
//Reset values
|
5166 |
+
$this->mpdf->Reset();
|
5167 |
+
|
5168 |
+
if (isset($this->mpdf->blk[$this->mpdf->blklvl]['z-index']) && $this->mpdf->blk[$this->mpdf->blklvl]['z-index'] > 0) {
|
5169 |
+
$this->mpdf->EndLayer();
|
5170 |
+
}
|
5171 |
+
|
5172 |
+
// mPDF 6 page-break-inside:avoid
|
5173 |
+
if ($this->mpdf->blk[$this->mpdf->blklvl]['keep_block_together']) {
|
5174 |
+
$movepage = false;
|
5175 |
+
// If page-break-inside:avoid section has broken to new page but fits on one side - then move:
|
5176 |
+
if (($this->mpdf->page - $this->mpdf->kt_p00) == 1 && $this->mpdf->y < $this->mpdf->kt_y00) {
|
5177 |
+
$movepage = true;
|
5178 |
+
}
|
5179 |
+
if (($this->mpdf->page - $this->mpdf->kt_p00) > 0) {
|
5180 |
+
for ($i = $this->mpdf->page; $i > $this->mpdf->kt_p00; $i--) {
|
5181 |
+
unset($this->mpdf->pages[$i]);
|
5182 |
+
if (isset($this->mpdf->blk[$this->mpdf->blklvl]['bb_painted'][$i])) {
|
5183 |
+
unset($this->mpdf->blk[$this->mpdf->blklvl]['bb_painted'][$i]);
|
5184 |
+
}
|
5185 |
+
if (isset($this->mpdf->blk[$this->mpdf->blklvl]['marginCorrected'][$i])) {
|
5186 |
+
unset($this->mpdf->blk[$this->mpdf->blklvl]['marginCorrected'][$i]);
|
5187 |
+
}
|
5188 |
+
if (isset($this->mpdf->pageoutput[$i])) {
|
5189 |
+
unset($this->mpdf->pageoutput[$i]);
|
5190 |
+
}
|
5191 |
+
}
|
5192 |
+
$this->mpdf->page = $this->mpdf->kt_p00;
|
5193 |
+
}
|
5194 |
+
$this->mpdf->keep_block_together = 0;
|
5195 |
+
$this->mpdf->pageoutput[$this->mpdf->page] = array();
|
5196 |
+
|
5197 |
+
$this->mpdf->y = $this->mpdf->kt_y00;
|
5198 |
+
$ihtml = $this->mpdf->blk[$this->mpdf->blklvl]['array_i'] - 1;
|
5199 |
+
|
5200 |
+
$ahtml[$ihtml + 1] .= ' pagebreakavoidchecked="true";'; // avoid re-iterating; read in OpenTag()
|
5201 |
+
|
5202 |
+
unset($this->mpdf->blk[$this->mpdf->blklvl]);
|
5203 |
+
$this->mpdf->blklvl--;
|
5204 |
+
|
5205 |
+
for ($blklvl = 1; $blklvl <= $this->mpdf->blklvl; $blklvl++) {
|
5206 |
+
$this->mpdf->blk[$blklvl]['y0'] = $this->mpdf->blk[$blklvl]['initial_y0'];
|
5207 |
+
$this->mpdf->blk[$blklvl]['x0'] = $this->mpdf->blk[$blklvl]['initial_x0'];
|
5208 |
+
$this->mpdf->blk[$blklvl]['startpage'] = $this->mpdf->blk[$blklvl]['initial_startpage'];
|
5209 |
+
}
|
5210 |
+
|
5211 |
+
if (isset($this->mpdf->blk[$this->mpdf->blklvl]['x0'])) {
|
5212 |
+
$this->mpdf->x = $this->mpdf->blk[$this->mpdf->blklvl]['x0'];
|
5213 |
+
} else {
|
5214 |
+
$this->mpdf->x = $this->mpdf->lMargin;
|
5215 |
+
}
|
5216 |
+
|
5217 |
+
$this->mpdf->lastblocklevelchange = 0;
|
5218 |
+
$this->mpdf->ResetMargins();
|
5219 |
+
if ($movepage) {
|
5220 |
+
$this->mpdf->AddPage();
|
5221 |
+
}
|
5222 |
+
return;
|
5223 |
+
}
|
5224 |
+
|
5225 |
+
if ($this->mpdf->blklvl > 0) { // ==0 SHOULDN'T HAPPEN - NOT XHTML
|
5226 |
+
if ($this->mpdf->blk[$this->mpdf->blklvl]['tag'] == $tag) {
|
5227 |
+
unset($this->mpdf->blk[$this->mpdf->blklvl]);
|
5228 |
+
$this->mpdf->blklvl--;
|
5229 |
+
}
|
5230 |
+
//else { echo $tag; exit; } // debug - forces error if incorrectly nested html tags
|
5231 |
+
}
|
5232 |
+
|
5233 |
+
$this->mpdf->lastblocklevelchange = -1;
|
5234 |
+
// Reset Inline-type properties
|
5235 |
+
if (isset($this->mpdf->blk[$this->mpdf->blklvl]['InlineProperties'])) {
|
5236 |
+
$this->mpdf->restoreInlineProperties($this->mpdf->blk[$this->mpdf->blklvl]['InlineProperties']);
|
5237 |
+
}
|
5238 |
+
|
5239 |
+
$this->mpdf->x = $this->mpdf->lMargin + $this->mpdf->blk[$this->mpdf->blklvl]['outer_left_margin'];
|
5240 |
+
|
5241 |
+
if (!$this->mpdf->tableLevel && $page_break_after) {
|
5242 |
+
$save_blklvl = $this->mpdf->blklvl;
|
5243 |
+
$save_blk = $this->mpdf->blk;
|
5244 |
+
$save_silp = $this->mpdf->saveInlineProperties();
|
5245 |
+
$save_ilp = $this->mpdf->InlineProperties;
|
5246 |
+
$save_bflp = $this->mpdf->InlineBDF;
|
5247 |
+
$save_bflpc = $this->mpdf->InlineBDFctr; // mPDF 6
|
5248 |
+
// mPDF 6 pagebreaktype
|
5249 |
+
$startpage = $this->mpdf->page;
|
5250 |
+
$pagebreaktype = $this->mpdf->defaultPagebreakType;
|
5251 |
+
if ($this->mpdf->ColActive) {
|
5252 |
+
$pagebreaktype = 'cloneall';
|
5253 |
+
}
|
5254 |
+
|
5255 |
+
// mPDF 6 pagebreaktype
|
5256 |
+
$this->mpdf->_preForcedPagebreak($pagebreaktype);
|
5257 |
+
|
5258 |
+
if ($page_break_after == 'RIGHT') {
|
5259 |
+
$this->mpdf->AddPage($this->mpdf->CurOrientation, 'NEXT-ODD', '', '', '', '', '', '', '', '', '', '', '', '', '', 0, 0, 0, 0);
|
5260 |
+
} else if ($page_break_after == 'LEFT') {
|
5261 |
+
$this->mpdf->AddPage($this->mpdf->CurOrientation, 'NEXT-EVEN', '', '', '', '', '', '', '', '', '', '', '', '', '', 0, 0, 0, 0);
|
5262 |
+
} else {
|
5263 |
+
$this->mpdf->AddPage($this->mpdf->CurOrientation, '', '', '', '', '', '', '', '', '', '', '', '', '', '', 0, 0, 0, 0);
|
5264 |
+
}
|
5265 |
+
|
5266 |
+
// mPDF 6 pagebreaktype
|
5267 |
+
$this->mpdf->_postForcedPagebreak($pagebreaktype, $startpage, $save_blk, $save_blklvl);
|
5268 |
+
|
5269 |
+
$this->mpdf->InlineProperties = $save_ilp;
|
5270 |
+
$this->mpdf->InlineBDF = $save_bflp;
|
5271 |
+
$this->mpdf->InlineBDFctr = $save_bflpc; // mPDF 6
|
5272 |
+
$this->mpdf->restoreInlineProperties($save_silp);
|
5273 |
+
}
|
5274 |
+
// mPDF 6 bidi
|
5275 |
+
// Block
|
5276 |
+
// If unicode-bidi set, any embedding levels, isolates, or overrides reopened in the continuing block
|
5277 |
+
if (isset($this->mpdf->blk[$this->mpdf->blklvl]['bidicode'])) {
|
5278 |
+
$blockpre = $this->mpdf->_setBidiCodes('start', $this->mpdf->blk[$this->mpdf->blklvl]['bidicode']);
|
5279 |
+
if ($blockpre) {
|
5280 |
+
$this->mpdf->OTLdata = array();
|
5281 |
+
if ($this->mpdf->tableLevel) {
|
5282 |
+
$this->mpdf->_saveCellTextBuffer($blockpre);
|
5283 |
+
} else {
|
5284 |
+
$this->mpdf->_saveTextBuffer($blockpre);
|
5285 |
+
}
|
5286 |
+
}
|
5287 |
+
}
|
5288 |
+
}
|
5289 |
+
|
5290 |
+
|
5291 |
+
/* -- TABLES -- */
|
5292 |
+
|
5293 |
+
if ($tag == 'TH')
|
5294 |
+
$this->mpdf->SetStyle('B', false);
|
5295 |
+
|
5296 |
+
if (($tag == 'TH' or $tag == 'TD') && $this->mpdf->tableLevel) {
|
5297 |
+
$this->mpdf->lastoptionaltag = 'TR';
|
5298 |
+
unset($this->mpdf->cssmgr->tablecascadeCSS[$this->mpdf->cssmgr->tbCSSlvl]);
|
5299 |
+
$this->mpdf->cssmgr->tbCSSlvl--;
|
5300 |
+
if (!$this->mpdf->tdbegin) {
|
5301 |
+
return;
|
5302 |
+
}
|
5303 |
+
$this->mpdf->tdbegin = false;
|
5304 |
+
// Added for correct calculation of cell column width - otherwise misses the last line if not end </p> etc.
|
5305 |
+
if (!isset($this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['maxs'])) {
|
5306 |
+
if (!is_array($this->mpdf->cell[$this->mpdf->row][$this->mpdf->col])) {
|
5307 |
+
throw new MpdfException("You may have an error in your HTML code e.g. </td></td>");
|
5308 |
+
}
|
5309 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['maxs'] = $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s'];
|
5310 |
+
} elseif ($this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['maxs'] < $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s']) {
|
5311 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['maxs'] = $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s'];
|
5312 |
+
}
|
5313 |
+
|
5314 |
+
// Remove last <br> if at end of cell
|
5315 |
+
if (isset($this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['textbuffer'])) {
|
5316 |
+
$ntb = count($this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['textbuffer']);
|
5317 |
+
} else {
|
5318 |
+
$ntb = 0;
|
5319 |
+
}
|
5320 |
+
if ($ntb > 1 && $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['textbuffer'][$ntb - 1][0] == "\n") {
|
5321 |
+
unset($this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['textbuffer'][$ntb - 1]);
|
5322 |
+
}
|
5323 |
+
|
5324 |
+
if ($this->mpdf->tablethead) {
|
5325 |
+
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_thead'][$this->mpdf->row] = true;
|
5326 |
+
if ($this->mpdf->tableLevel == 1) {
|
5327 |
+
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['headernrows'] = max($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['headernrows'], ($this->mpdf->row + 1));
|
5328 |
+
}
|
5329 |
+
}
|
5330 |
+
if ($this->mpdf->tabletfoot) {
|
5331 |
+
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_tfoot'][$this->mpdf->row] = true;
|
5332 |
+
if ($this->mpdf->tableLevel == 1) {
|
5333 |
+
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['footernrows'] = max($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['footernrows'], ($this->mpdf->row + 1 - $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['headernrows']));
|
5334 |
+
}
|
5335 |
+
}
|
5336 |
+
$this->mpdf->Reset();
|
5337 |
+
}
|
5338 |
+
|
5339 |
+
if ($tag == 'TR' && $this->mpdf->tableLevel) {
|
5340 |
+
// If Border set on TR - Update right border
|
5341 |
+
if (isset($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['trborder-left'][$this->mpdf->row])) {
|
5342 |
+
$c = & $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col];
|
5343 |
+
if ($c) {
|
5344 |
+
if ($this->mpdf->packTableData) {
|
5345 |
+
$cell = $this->mpdf->_unpackCellBorder($c['borderbin']);
|
5346 |
+
} else {
|
5347 |
+
$cell = $c;
|
5348 |
+
}
|
5349 |
+
$cell['border_details']['R'] = $this->mpdf->border_details($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['trborder-right'][$this->mpdf->row]);
|
5350 |
+
$this->mpdf->setBorder($cell['border'], _BORDER_RIGHT, $cell['border_details']['R']['s']);
|
5351 |
+
if ($this->mpdf->packTableData) {
|
5352 |
+
$c['borderbin'] = $this->mpdf->_packCellBorder($cell);
|
5353 |
+
unset($c['border']);
|
5354 |
+
unset($c['border_details']);
|
5355 |
+
} else {
|
5356 |
+
$c = $cell;
|
5357 |
+
}
|
5358 |
+
}
|
5359 |
+
}
|
5360 |
+
$this->mpdf->lastoptionaltag = '';
|
5361 |
+
unset($this->mpdf->cssmgr->tablecascadeCSS[$this->mpdf->cssmgr->tbCSSlvl]);
|
5362 |
+
$this->mpdf->cssmgr->tbCSSlvl--;
|
5363 |
+
$this->mpdf->trow_text_rotate = '';
|
5364 |
+
$this->mpdf->tabletheadjustfinished = false;
|
5365 |
+
}
|
5366 |
+
|
5367 |
+
if ($tag == 'TBODY') {
|
5368 |
+
$this->mpdf->lastoptionaltag = '';
|
5369 |
+
unset($this->mpdf->cssmgr->tablecascadeCSS[$this->mpdf->cssmgr->tbCSSlvl]);
|
5370 |
+
$this->mpdf->cssmgr->tbCSSlvl--;
|
5371 |
+
}
|
5372 |
+
|
5373 |
+
if ($tag == 'THEAD') {
|
5374 |
+
$this->mpdf->lastoptionaltag = '';
|
5375 |
+
unset($this->mpdf->cssmgr->tablecascadeCSS[$this->mpdf->cssmgr->tbCSSlvl]);
|
5376 |
+
$this->mpdf->cssmgr->tbCSSlvl--;
|
5377 |
+
$this->mpdf->tablethead = 0;
|
5378 |
+
$this->mpdf->tabletheadjustfinished = true;
|
5379 |
+
$this->mpdf->ResetStyles();
|
5380 |
+
$this->mpdf->thead_font_weight = '';
|
5381 |
+
$this->mpdf->thead_font_style = '';
|
5382 |
+
$this->mpdf->thead_font_smCaps = '';
|
5383 |
+
|
5384 |
+
$this->mpdf->thead_valign_default = '';
|
5385 |
+
$this->mpdf->thead_textalign_default = '';
|
5386 |
+
}
|
5387 |
+
|
5388 |
+
if ($tag == 'TFOOT') {
|
5389 |
+
$this->mpdf->lastoptionaltag = '';
|
5390 |
+
unset($this->mpdf->cssmgr->tablecascadeCSS[$this->mpdf->cssmgr->tbCSSlvl]);
|
5391 |
+
$this->mpdf->cssmgr->tbCSSlvl--;
|
5392 |
+
$this->mpdf->tabletfoot = 0;
|
5393 |
+
$this->mpdf->ResetStyles();
|
5394 |
+
$this->mpdf->tfoot_font_weight = '';
|
5395 |
+
$this->mpdf->tfoot_font_style = '';
|
5396 |
+
$this->mpdf->tfoot_font_smCaps = '';
|
5397 |
+
|
5398 |
+
$this->mpdf->tfoot_valign_default = '';
|
5399 |
+
$this->mpdf->tfoot_textalign_default = '';
|
5400 |
+
}
|
5401 |
+
|
5402 |
+
if ($tag == 'TABLE') { // TABLE-END (
|
5403 |
+
if ($this->mpdf->progressBar) {
|
5404 |
+
$this->mpdf->UpdateProgressBar(1, '', 'TABLE');
|
5405 |
+
} // *PROGRESS-BAR*
|
5406 |
+
if ($this->mpdf->progressBar) {
|
5407 |
+
$this->mpdf->UpdateProgressBar(7, 0, '');
|
5408 |
+
} // *PROGRESS-BAR*
|
5409 |
+
$this->mpdf->lastoptionaltag = '';
|
5410 |
+
unset($this->mpdf->cssmgr->tablecascadeCSS[$this->mpdf->cssmgr->tbCSSlvl]);
|
5411 |
+
$this->mpdf->cssmgr->tbCSSlvl--;
|
5412 |
+
$this->mpdf->ignorefollowingspaces = true; //Eliminate exceeding left-side spaces
|
5413 |
+
// mPDF 5.7.3
|
5414 |
+
// In case a colspan (on a row after first row) exceeded number of columns in table
|
5415 |
+
for ($k = 0; $k < $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['nr']; $k++) {
|
5416 |
+
for ($l = 0; $l < $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['nc']; $l++) {
|
5417 |
+
if (!isset($this->mpdf->cell[$k][$l])) {
|
5418 |
+
for ($n = $l - 1; $n >= 0; $n--) {
|
5419 |
+
if (isset($this->mpdf->cell[$k][$n]) && $this->mpdf->cell[$k][$n] != 0) {
|
5420 |
+
break;
|
5421 |
+
}
|
5422 |
+
}
|
5423 |
+
$this->mpdf->cell[$k][$l] = array(
|
5424 |
+
'a' => 'C',
|
5425 |
+
'va' => 'M',
|
5426 |
+
'R' => false,
|
5427 |
+
'nowrap' => false,
|
5428 |
+
'bgcolor' => false,
|
5429 |
+
'padding' => array('L' => false, 'R' => false, 'T' => false, 'B' => false),
|
5430 |
+
'gradient' => false,
|
5431 |
+
's' => 0,
|
5432 |
+
'maxs' => 0,
|
5433 |
+
'textbuffer' => array(),
|
5434 |
+
'dfs' => $this->mpdf->FontSize,
|
5435 |
+
);
|
5436 |
+
|
5437 |
+
if (!$this->mpdf->simpleTables) {
|
5438 |
+
$this->mpdf->cell[$k][$l]['border'] = 0;
|
5439 |
+
$this->mpdf->cell[$k][$l]['border_details']['R'] = array('s' => 0, 'w' => 0, 'c' => false, 'style' => 'none', 'dom' => 0);
|
5440 |
+
$this->mpdf->cell[$k][$l]['border_details']['L'] = array('s' => 0, 'w' => 0, 'c' => false, 'style' => 'none', 'dom' => 0);
|
5441 |
+
$this->mpdf->cell[$k][$l]['border_details']['T'] = array('s' => 0, 'w' => 0, 'c' => false, 'style' => 'none', 'dom' => 0);
|
5442 |
+
$this->mpdf->cell[$k][$l]['border_details']['B'] = array('s' => 0, 'w' => 0, 'c' => false, 'style' => 'none', 'dom' => 0);
|
5443 |
+
$this->mpdf->cell[$k][$l]['border_details']['mbw'] = array('BL' => 0, 'BR' => 0, 'RT' => 0, 'RB' => 0, 'TL' => 0, 'TR' => 0, 'LT' => 0, 'LB' => 0);
|
5444 |
+
if ($this->mpdf->packTableData) {
|
5445 |
+
$this->mpdf->cell[$k][$l]['borderbin'] = $this->mpdf->_packCellBorder($this->mpdf->cell[$k][$l]);
|
5446 |
+
unset($this->mpdf->cell[$k][$l]['border']);
|
5447 |
+
unset($this->mpdf->cell[$k][$l]['border_details']);
|
5448 |
+
}
|
5449 |
+
}
|
5450 |
+
}
|
5451 |
+
}
|
5452 |
+
}
|
5453 |
+
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['cells'] = $this->mpdf->cell;
|
5454 |
+
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['wc'] = array_pad(array(), $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['nc'], array('miw' => 0, 'maw' => 0));
|
5455 |
+
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['hr'] = array_pad(array(), $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['nr'], 0);
|
5456 |
+
|
5457 |
+
// Move table footer <tfoot> row to end of table
|
5458 |
+
if (isset($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_tfoot']) && count($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_tfoot'])) {
|
5459 |
+
$tfrows = array();
|
5460 |
+
foreach ($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_tfoot'] AS $r => $val) {
|
5461 |
+
if ($val) {
|
5462 |
+
$tfrows[] = $r;
|
5463 |
+
}
|
5464 |
+
}
|
5465 |
+
$temp = array();
|
5466 |
+
$temptf = array();
|
5467 |
+
foreach ($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['cells'] AS $k => $row) {
|
5468 |
+
if (in_array($k, $tfrows)) {
|
5469 |
+
$temptf[] = $row;
|
5470 |
+
} else {
|
5471 |
+
$temp[] = $row;
|
5472 |
+
}
|
5473 |
+
}
|
5474 |
+
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_tfoot'] = array();
|
5475 |
+
for ($i = count($temp); $i < (count($temp) + count($temptf)); $i++) {
|
5476 |
+
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_tfoot'][$i] = true;
|
5477 |
+
}
|
5478 |
+
// Update nestedpos row references
|
5479 |
+
if (isset($this->mpdf->table[($this->mpdf->tableLevel + 1)]) && count($this->mpdf->table[($this->mpdf->tableLevel + 1)])) {
|
5480 |
+
foreach ($this->mpdf->table[($this->mpdf->tableLevel + 1)] AS $nid => $nested) {
|
5481 |
+
$this->mpdf->table[($this->mpdf->tableLevel + 1)][$nid]['nestedpos'][0] -= count($temptf);
|
5482 |
+
}
|
5483 |
+
}
|
5484 |
+
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['cells'] = array_merge($temp, $temptf);
|
5485 |
+
|
5486 |
+
// Update other arays set on row number
|
5487 |
+
// [trbackground-images] [trgradients]
|
5488 |
+
$temptrbgi = array();
|
5489 |
+
$temptrbgg = array();
|
5490 |
+
$temptrbgc = array();
|
5491 |
+
if (isset($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['bgcolor'][-1])) {
|
5492 |
+
$temptrbgc[-1] = $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['bgcolor'][-1];
|
5493 |
+
}
|
5494 |
+
for ($k = 0; $k < $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['nr']; $k++) {
|
5495 |
+
if (!in_array($k, $tfrows)) {
|
5496 |
+
$temptrbgi[] = (isset($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['trbackground-images'][$k]) ? $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['trbackground-images'][$k] : null);
|
5497 |
+
$temptrbgg[] = (isset($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['trgradients'][$k]) ? $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['trgradients'][$k] : null);
|
5498 |
+
$temptrbgc[] = (isset($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['bgcolor'][$k]) ? $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['bgcolor'][$k] : null);
|
5499 |
+
}
|
5500 |
+
}
|
5501 |
+
for ($k = 0; $k < $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['nr']; $k++) {
|
5502 |
+
if (in_array($k, $tfrows)) {
|
5503 |
+
$temptrbgi[] = (isset($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['trbackground-images'][$k]) ? $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['trbackground-images'][$k] : null);
|
5504 |
+
$temptrbgg[] = (isset($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['trgradients'][$k]) ? $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['trgradients'][$k] : null);
|
5505 |
+
$temptrbgc[] = (isset($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['bgcolor'][$k]) ? $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['bgcolor'][$k] : null);
|
5506 |
+
}
|
5507 |
+
}
|
5508 |
+
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['trbackground-images'] = $temptrbgi;
|
5509 |
+
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['trgradients'] = $temptrbgg;
|
5510 |
+
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['bgcolor'] = $temptrbgc;
|
5511 |
+
// Should Update all other arays set on row number, but cell properties have been set so not needed
|
5512 |
+
// [bgcolor] [trborder-left] [trborder-right] [trborder-top] [trborder-bottom]
|
5513 |
+
}
|
5514 |
+
|
5515 |
+
if ($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['direction'] == 'rtl') {
|
5516 |
+
$this->mpdf->_reverseTableDir($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]);
|
5517 |
+
}
|
5518 |
+
|
5519 |
+
// Fix Borders *********************************************
|
5520 |
+
$this->mpdf->_fixTableBorders($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]);
|
5521 |
+
|
5522 |
+
if ($this->mpdf->progressBar) {
|
5523 |
+
$this->mpdf->UpdateProgressBar(7, 10, ' ');
|
5524 |
+
} // *PROGRESS-BAR*
|
5525 |
+
|
5526 |
+
if ($this->mpdf->ColActive) {
|
5527 |
+
$this->mpdf->table_rotate = 0;
|
5528 |
+
} // *COLUMNS*
|
5529 |
+
if ($this->mpdf->table_rotate <> 0) {
|
5530 |
+
$this->mpdf->tablebuffer = '';
|
5531 |
+
// Max width for rotated table
|
5532 |
+
$this->mpdf->tbrot_maxw = $this->mpdf->h - ($this->mpdf->y + $this->mpdf->bMargin + 1);
|
5533 |
+
$this->mpdf->tbrot_maxh = $this->mpdf->blk[$this->mpdf->blklvl]['inner_width']; // Max width for rotated table
|
5534 |
+
$this->mpdf->tbrot_align = $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['a'];
|
5535 |
+
}
|
5536 |
+
$this->mpdf->shrin_k = 1;
|
5537 |
+
|
5538 |
+
if ($this->mpdf->shrink_tables_to_fit < 1) {
|
5539 |
+
$this->mpdf->shrink_tables_to_fit = 1;
|
5540 |
+
}
|
5541 |
+
if (!$this->mpdf->shrink_this_table_to_fit) {
|
5542 |
+
$this->mpdf->shrink_this_table_to_fit = $this->mpdf->shrink_tables_to_fit;
|
5543 |
+
}
|
5544 |
+
|
5545 |
+
if ($this->mpdf->tableLevel > 1) {
|
5546 |
+
// deal with nested table
|
5547 |
+
|
5548 |
+
$this->mpdf->_tableColumnWidth($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]], true);
|
5549 |
+
|
5550 |
+
$tmiw = $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['miw'];
|
5551 |
+
$tmaw = $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['maw'];
|
5552 |
+
$tl = $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['tl'];
|
5553 |
+
|
5554 |
+
// Go down to lower table level
|
5555 |
+
$this->mpdf->tableLevel--;
|
5556 |
+
|
5557 |
+
// Reset lower level table
|
5558 |
+
$this->mpdf->base_table_properties = $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['baseProperties'];
|
5559 |
+
// mPDF 5.7.3
|
5560 |
+
$this->mpdf->default_font = $this->mpdf->base_table_properties['FONT-FAMILY'];
|
5561 |
+
$this->mpdf->SetFont($this->mpdf->default_font, '', 0, false);
|
5562 |
+
$this->mpdf->default_font_size = $this->mpdf->ConvertSize($this->mpdf->base_table_properties['FONT-SIZE']) * (_MPDFK);
|
5563 |
+
$this->mpdf->SetFontSize($this->mpdf->default_font_size, false);
|
5564 |
+
|
5565 |
+
$this->mpdf->cell = $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['cells'];
|
5566 |
+
if (isset($this->mpdf->cell['PARENTCELL'])) {
|
5567 |
+
if ($this->mpdf->cell['PARENTCELL']) {
|
5568 |
+
$this->mpdf->restoreInlineProperties($this->mpdf->cell['PARENTCELL']);
|
5569 |
+
}
|
5570 |
+
unset($this->mpdf->cell['PARENTCELL']);
|
5571 |
+
}
|
5572 |
+
$this->mpdf->row = $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['currrow'];
|
5573 |
+
$this->mpdf->col = $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['currcol'];
|
5574 |
+
$objattr = array();
|
5575 |
+
$objattr['type'] = 'nestedtable';
|
5576 |
+
$objattr['nestedcontent'] = $this->mpdf->tbctr[($this->mpdf->tableLevel + 1)];
|
5577 |
+
$objattr['table'] = $this->mpdf->tbctr[$this->mpdf->tableLevel];
|
5578 |
+
$objattr['row'] = $this->mpdf->row;
|
5579 |
+
$objattr['col'] = $this->mpdf->col;
|
5580 |
+
$objattr['level'] = $this->mpdf->tableLevel;
|
5581 |
+
$e = "\xbb\xa4\xactype=nestedtable,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
|
5582 |
+
$this->mpdf->_saveCellTextBuffer($e);
|
5583 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s'] += $tl;
|
5584 |
+
if (!isset($this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['maxs'])) {
|
5585 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['maxs'] = $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s'];
|
5586 |
+
} elseif ($this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['maxs'] < $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s']) {
|
5587 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['maxs'] = $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s'];
|
5588 |
+
}
|
5589 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s'] = 0; // reset
|
5590 |
+
if ((isset($this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['nestedmaw']) && $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['nestedmaw'] < $tmaw) || !isset($this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['nestedmaw'])) {
|
5591 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['nestedmaw'] = $tmaw;
|
5592 |
+
}
|
5593 |
+
if ((isset($this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['nestedmiw']) && $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['nestedmiw'] < $tmiw) || !isset($this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['nestedmiw'])) {
|
5594 |
+
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['nestedmiw'] = $tmiw;
|
5595 |
+
}
|
5596 |
+
$this->mpdf->tdbegin = true;
|
5597 |
+
$this->mpdf->nestedtablejustfinished = true;
|
5598 |
+
$this->mpdf->ignorefollowingspaces = true;
|
5599 |
+
return;
|
5600 |
+
}
|
5601 |
+
$this->mpdf->cMarginL = 0;
|
5602 |
+
$this->mpdf->cMarginR = 0;
|
5603 |
+
$this->mpdf->cMarginT = 0;
|
5604 |
+
$this->mpdf->cMarginB = 0;
|
5605 |
+
$this->mpdf->cellPaddingL = 0;
|
5606 |
+
$this->mpdf->cellPaddingR = 0;
|
5607 |
+
$this->mpdf->cellPaddingT = 0;
|
5608 |
+
$this->mpdf->cellPaddingB = 0;
|
5609 |
+
|
5610 |
+
if (isset($this->mpdf->table[1][1]['overflow']) && $this->mpdf->table[1][1]['overflow'] == 'visible') {
|
5611 |
+
if ($this->mpdf->kwt || $this->mpdf->table_rotate || $this->mpdf->table_keep_together || $this->mpdf->ColActive) {
|
5612 |
+
$this->mpdf->kwt = false;
|
5613 |
+
$this->mpdf->table_rotate = 0;
|
5614 |
+
$this->mpdf->table_keep_together = false;
|
5615 |
+
//throw new MpdfException("mPDF Warning: You cannot use CSS overflow:visible together with any of these functions: 'Keep-with-table', rotated tables, page-break-inside:avoid, or columns");
|
5616 |
+
}
|
5617 |
+
$this->mpdf->_tableColumnWidth($this->mpdf->table[1][1], true);
|
5618 |
+
$this->mpdf->_tableWidth($this->mpdf->table[1][1]);
|
5619 |
+
} else {
|
5620 |
+
if (!$this->mpdf->kwt_saved) {
|
5621 |
+
$this->mpdf->kwt_height = 0;
|
5622 |
+
}
|
5623 |
+
|
5624 |
+
list($check, $tablemiw) = $this->mpdf->_tableColumnWidth($this->mpdf->table[1][1], true);
|
5625 |
+
$save_table = $this->mpdf->table;
|
5626 |
+
$reset_to_minimum_width = false;
|
5627 |
+
$added_page = false;
|
5628 |
+
|
5629 |
+
if ($check > 1) {
|
5630 |
+
if ($check > $this->mpdf->shrink_this_table_to_fit && $this->mpdf->table_rotate) {
|
5631 |
+
if ($this->mpdf->y != $this->mpdf->tMargin) {
|
5632 |
+
$this->mpdf->AddPage($this->mpdf->CurOrientation);
|
5633 |
+
$this->mpdf->kwt_moved = true;
|
5634 |
+
}
|
5635 |
+
$added_page = true;
|
5636 |
+
$this->mpdf->tbrot_maxw = $this->mpdf->h - ($this->mpdf->y + $this->mpdf->bMargin + 5) - $this->mpdf->kwt_height;
|
5637 |
+
//$check = $tablemiw/$this->mpdf->tbrot_maxw; // undo any shrink
|
5638 |
+
$check = 1; // undo any shrink
|
5639 |
+
}
|
5640 |
+
$reset_to_minimum_width = true;
|
5641 |
+
}
|
5642 |
+
|
5643 |
+
if ($reset_to_minimum_width) {
|
5644 |
+
$this->mpdf->shrin_k = $check;
|
5645 |
+
|
5646 |
+
$this->mpdf->default_font_size /= $this->mpdf->shrin_k;
|
5647 |
+
$this->mpdf->SetFontSize($this->mpdf->default_font_size, false);
|
5648 |
+
|
5649 |
+
$this->mpdf->shrinkTable($this->mpdf->table[1][1], $this->mpdf->shrin_k);
|
5650 |
+
|
5651 |
+
$this->mpdf->_tableColumnWidth($this->mpdf->table[1][1], false); // repeat
|
5652 |
+
// Starting at $this->mpdf->innermostTableLevel
|
5653 |
+
// Shrink table values - and redo columnWidth
|
5654 |
+
for ($lvl = 2; $lvl <= $this->mpdf->innermostTableLevel; $lvl++) {
|
5655 |
+
for ($nid = 1; $nid <= $this->mpdf->tbctr[$lvl]; $nid++) {
|
5656 |
+
$this->mpdf->shrinkTable($this->mpdf->table[$lvl][$nid], $this->mpdf->shrin_k);
|
5657 |
+
$this->mpdf->_tableColumnWidth($this->mpdf->table[$lvl][$nid], false);
|
5658 |
+
}
|
5659 |
+
}
|
5660 |
+
}
|
5661 |
+
|
5662 |
+
// Set table cell widths for top level table
|
5663 |
+
// Use $shrin_k to resize but don't change again
|
5664 |
+
$this->mpdf->SetLineHeight('', $this->mpdf->table[1][1]['cellLineHeight']);
|
5665 |
+
|
5666 |
+
// Top level table
|
5667 |
+
$this->mpdf->_tableWidth($this->mpdf->table[1][1]);
|
5668 |
+
}
|
5669 |
+
|
5670 |
+
// Now work through any nested tables setting child table[w'] = parent cell['w']
|
5671 |
+
// Now do nested tables _tableWidth
|
5672 |
+
for ($lvl = 2; $lvl <= $this->mpdf->innermostTableLevel; $lvl++) {
|
5673 |
+
for ($nid = 1; $nid <= $this->mpdf->tbctr[$lvl]; $nid++) {
|
5674 |
+
// HERE set child table width = cell width
|
5675 |
+
|
5676 |
+
list($parentrow, $parentcol, $parentnid) = $this->mpdf->table[$lvl][$nid]['nestedpos'];
|
5677 |
+
|
5678 |
+
$c = & $this->mpdf->table[($lvl - 1)][$parentnid]['cells'][$parentrow][$parentcol];
|
5679 |
+
|
5680 |
+
if (isset($c['colspan']) && $c['colspan'] > 1) {
|
5681 |
+
$parentwidth = 0;
|
5682 |
+
for ($cs = 0; $cs < $c['colspan']; $cs++) {
|
5683 |
+
$parentwidth += $this->mpdf->table[($lvl - 1)][$parentnid]['wc'][$parentcol + $cs];
|
5684 |
+
}
|
5685 |
+
} else {
|
5686 |
+
$parentwidth = $this->mpdf->table[($lvl - 1)][$parentnid]['wc'][$parentcol];
|
5687 |
+
}
|
5688 |
+
|
5689 |
+
|
5690 |
+
//$parentwidth -= ALLOW FOR PADDING ETC.in parent cell
|
5691 |
+
if (!$this->mpdf->simpleTables) {
|
5692 |
+
if ($this->mpdf->packTableData) {
|
5693 |
+
list($bt, $br, $bb, $bl) = $this->mpdf->_getBorderWidths($c['borderbin']);
|
5694 |
+
} else {
|
5695 |
+
$br = $c['border_details']['R']['w'];
|
5696 |
+
$bl = $c['border_details']['L']['w'];
|
5697 |
+
}
|
5698 |
+
if ($this->mpdf->table[$lvl - 1][$parentnid]['borders_separate']) {
|
5699 |
+
$parentwidth -= $br + $bl + $c['padding']['L'] + $c['padding']['R'] + $this->mpdf->table[($lvl - 1)][$parentnid]['border_spacing_H'];
|
5700 |
+
} else {
|
5701 |
+
$parentwidth -= $br / 2 + $bl / 2 + $c['padding']['L'] + $c['padding']['R'];
|
5702 |
+
}
|
5703 |
+
} else if ($this->mpdf->simpleTables) {
|
5704 |
+
if ($this->mpdf->table[$lvl - 1][$parentnid]['borders_separate']) {
|
5705 |
+
$parentwidth -= $this->mpdf->table[($lvl - 1)][$parentnid]['simple']['border_details']['L']['w'] + $this->mpdf->table[($lvl - 1)][$parentnid]['simple']['border_details']['R']['w'] + $c['padding']['L'] + $c['padding']['R'] + $this->mpdf->table[($lvl - 1)][$parentnid]['border_spacing_H'];
|
5706 |
+
} else {
|
5707 |
+
$parentwidth -= $this->mpdf->table[($lvl - 1)][$parentnid]['simple']['border_details']['L']['w'] / 2 + $this->mpdf->table[($lvl - 1)][$parentnid]['simple']['border_details']['R']['w'] / 2 + $c['padding']['L'] + $c['padding']['R'];
|
5708 |
+
}
|
5709 |
+
}
|
5710 |
+
if (isset($this->mpdf->table[$lvl][$nid]['wpercent']) && $this->mpdf->table[$lvl][$nid]['wpercent'] && $lvl > 1) {
|
5711 |
+
$this->mpdf->table[$lvl][$nid]['w'] = $parentwidth;
|
5712 |
+
} else if ($parentwidth > $this->mpdf->table[$lvl][$nid]['maw']) {
|
5713 |
+
$this->mpdf->table[$lvl][$nid]['w'] = $this->mpdf->table[$lvl][$nid]['maw'];
|
5714 |
+
} else {
|
5715 |
+
$this->mpdf->table[$lvl][$nid]['w'] = $parentwidth;
|
5716 |
+
}
|
5717 |
+
unset($c);
|
5718 |
+
$this->mpdf->_tableWidth($this->mpdf->table[$lvl][$nid]);
|
5719 |
+
}
|
5720 |
+
}
|
5721 |
+
|
5722 |
+
// Starting at $this->mpdf->innermostTableLevel
|
5723 |
+
// Cascade back up nested tables: setting heights back up the tree
|
5724 |
+
for ($lvl = $this->mpdf->innermostTableLevel; $lvl > 0; $lvl--) {
|
5725 |
+
for ($nid = 1; $nid <= $this->mpdf->tbctr[$lvl]; $nid++) {
|
5726 |
+
list($tableheight, $maxrowheight, $fullpage, $remainingpage, $maxfirstrowheight) = $this->mpdf->_tableHeight($this->mpdf->table[$lvl][$nid]);
|
5727 |
+
}
|
5728 |
+
}
|
5729 |
+
if ($this->mpdf->progressBar) {
|
5730 |
+
$this->mpdf->UpdateProgressBar(7, 20, ' ');
|
5731 |
+
} // *PROGRESS-BAR*
|
5732 |
+
if ($this->mpdf->table[1][1]['overflow'] == 'visible') {
|
5733 |
+
if ($maxrowheight > $fullpage) {
|
5734 |
+
throw new MpdfException("mPDF Warning: A Table row is greater than available height. You cannot use CSS overflow:visible");
|
5735 |
+
}
|
5736 |
+
if ($maxfirstrowheight > $remainingpage) {
|
5737 |
+
$this->mpdf->AddPage($this->mpdf->CurOrientation);
|
5738 |
+
}
|
5739 |
+
$r = 0;
|
5740 |
+
$c = 0;
|
5741 |
+
$p = 0;
|
5742 |
+
$y = 0;
|
5743 |
+
$finished = false;
|
5744 |
+
while (!$finished) {
|
5745 |
+
list($finished, $r, $c, $p, $y, $y0) = $this->mpdf->_tableWrite($this->mpdf->table[1][1], true, $r, $c, $p, $y);
|
5746 |
+
if (!$finished) {
|
5747 |
+
$this->mpdf->AddPage($this->mpdf->CurOrientation);
|
5748 |
+
// If printed something on first spread, set same y
|
5749 |
+
if ($r == 0 && $y0 > -1) {
|
5750 |
+
$this->mpdf->y = $y0;
|
5751 |
+
}
|
5752 |
+
}
|
5753 |
+
}
|
5754 |
+
} else {
|
5755 |
+
$recalculate = 1;
|
5756 |
+
$forcerecalc = false;
|
5757 |
+
// RESIZING ALGORITHM
|
5758 |
+
if ($maxrowheight > $fullpage) {
|
5759 |
+
$recalculate = $this->mpdf->tbsqrt($maxrowheight / $fullpage, 1);
|
5760 |
+
$forcerecalc = true;
|
5761 |
+
} else if ($this->mpdf->table_rotate) { // NB $remainingpage == $fullpage == the width of the page
|
5762 |
+
if ($tableheight > $remainingpage) {
|
5763 |
+
// If can fit on remainder of page whilst respecting autsize value..
|
5764 |
+
if (($this->mpdf->shrin_k * $this->mpdf->tbsqrt($tableheight / $remainingpage, 1)) <= $this->mpdf->shrink_this_table_to_fit) {
|
5765 |
+
$recalculate = $this->mpdf->tbsqrt($tableheight / $remainingpage, 1);
|
5766 |
+
} else if (!$added_page) {
|
5767 |
+
if ($this->mpdf->y != $this->mpdf->tMargin) {
|
5768 |
+
$this->mpdf->AddPage($this->mpdf->CurOrientation);
|
5769 |
+
$this->mpdf->kwt_moved = true;
|
5770 |
+
}
|
5771 |
+
$added_page = true;
|
5772 |
+
$this->mpdf->tbrot_maxw = $this->mpdf->h - ($this->mpdf->y + $this->mpdf->bMargin + 5) - $this->mpdf->kwt_height;
|
5773 |
+
// 0.001 to force it to recalculate
|
5774 |
+
$recalculate = (1 / $this->mpdf->shrin_k) + 0.001; // undo any shrink
|
5775 |
+
}
|
5776 |
+
} else {
|
5777 |
+
$recalculate = 1;
|
5778 |
+
}
|
5779 |
+
} else if ($this->mpdf->table_keep_together || ($this->mpdf->table[1][1]['nr'] == 1 && !$this->mpdf->writingHTMLfooter)) {
|
5780 |
+
if ($tableheight > $fullpage) {
|
5781 |
+
if (($this->mpdf->shrin_k * $this->mpdf->tbsqrt($tableheight / $fullpage, 1)) <= $this->mpdf->shrink_this_table_to_fit) {
|
5782 |
+
$recalculate = $this->mpdf->tbsqrt($tableheight / $fullpage, 1);
|
5783 |
+
} else if ($this->mpdf->tableMinSizePriority) {
|
5784 |
+
$this->mpdf->table_keep_together = false;
|
5785 |
+
$recalculate = 1.001;
|
5786 |
+
} else {
|
5787 |
+
if ($this->mpdf->y != $this->mpdf->tMargin) {
|
5788 |
+
$this->mpdf->AddPage($this->mpdf->CurOrientation);
|
5789 |
+
$this->mpdf->kwt_moved = true;
|
5790 |
+
}
|
5791 |
+
$added_page = true;
|
5792 |
+
$this->mpdf->tbrot_maxw = $this->mpdf->h - ($this->mpdf->y + $this->mpdf->bMargin + 5) - $this->mpdf->kwt_height;
|
5793 |
+
$recalculate = $this->mpdf->tbsqrt($tableheight / $fullpage, 1);
|
5794 |
+
}
|
5795 |
+
} else if ($tableheight > $remainingpage) {
|
5796 |
+
// If can fit on remainder of page whilst respecting autsize value..
|
5797 |
+
if (($this->mpdf->shrin_k * $this->mpdf->tbsqrt($tableheight / $remainingpage, 1)) <= $this->mpdf->shrink_this_table_to_fit) {
|
5798 |
+
$recalculate = $this->mpdf->tbsqrt($tableheight / $remainingpage, 1);
|
5799 |
+
} else {
|
5800 |
+
if ($this->mpdf->y != $this->mpdf->tMargin) {
|
5801 |
+
// mPDF 6
|
5802 |
+
if ($this->mpdf->AcceptPageBreak()) {
|
5803 |
+
$this->mpdf->AddPage($this->mpdf->CurOrientation);
|
5804 |
+
} else if ($this->mpdf->ColActive && $tableheight > (($this->mpdf->h - $this->mpdf->bMargin) - $this->mpdf->y0)) {
|
5805 |
+
$this->mpdf->AddPage($this->mpdf->CurOrientation);
|
5806 |
+
}
|
5807 |
+
$this->mpdf->kwt_moved = true;
|
5808 |
+
}
|
5809 |
+
$added_page = true;
|
5810 |
+
$this->mpdf->tbrot_maxw = $this->mpdf->h - ($this->mpdf->y + $this->mpdf->bMargin + 5) - $this->mpdf->kwt_height;
|
5811 |
+
$recalculate = 1.001;
|
5812 |
+
}
|
5813 |
+
} else {
|
5814 |
+
$recalculate = 1;
|
5815 |
+
}
|
5816 |
+
} else {
|
5817 |
+
$recalculate = 1;
|
5818 |
+
}
|
5819 |
+
|
5820 |
+
if ($recalculate > $this->mpdf->shrink_this_table_to_fit && !$forcerecalc) {
|
5821 |
+
$recalculate = $this->mpdf->shrink_this_table_to_fit;
|
5822 |
+
}
|
5823 |
+
|
5824 |
+
$iteration = 1;
|
5825 |
+
|
5826 |
+
// RECALCULATE
|
5827 |
+
while ($recalculate <> 1) {
|
5828 |
+
$this->mpdf->shrin_k1 = $recalculate;
|
5829 |
+
$this->mpdf->shrin_k *= $recalculate;
|
5830 |
+
$this->mpdf->default_font_size /= ($this->mpdf->shrin_k1);
|
5831 |
+
$this->mpdf->SetFontSize($this->mpdf->default_font_size, false);
|
5832 |
+
$this->mpdf->SetLineHeight('', $this->mpdf->table[1][1]['cellLineHeight']);
|
5833 |
+
$this->mpdf->table = $save_table;
|
5834 |
+
if ($this->mpdf->shrin_k <> 1) {
|
5835 |
+
$this->mpdf->shrinkTable($this->mpdf->table[1][1], $this->mpdf->shrin_k);
|
5836 |
+
}
|
5837 |
+
$this->mpdf->_tableColumnWidth($this->mpdf->table[1][1], false); // repeat
|
5838 |
+
// Starting at $this->mpdf->innermostTableLevel
|
5839 |
+
// Shrink table values - and redo columnWidth
|
5840 |
+
for ($lvl = 2; $lvl <= $this->mpdf->innermostTableLevel; $lvl++) {
|
5841 |
+
for ($nid = 1; $nid <= $this->mpdf->tbctr[$lvl]; $nid++) {
|
5842 |
+
if ($this->mpdf->shrin_k <> 1) {
|
5843 |
+
$this->mpdf->shrinkTable($this->mpdf->table[$lvl][$nid], $this->mpdf->shrin_k);
|
5844 |
+
}
|
5845 |
+
$this->mpdf->_tableColumnWidth($this->mpdf->table[$lvl][$nid], false);
|
5846 |
+
}
|
5847 |
+
}
|
5848 |
+
// Set table cell widths for top level table
|
5849 |
+
// Top level table
|
5850 |
+
$this->mpdf->_tableWidth($this->mpdf->table[1][1]);
|
5851 |
+
|
5852 |
+
// Now work through any nested tables setting child table[w'] = parent cell['w']
|
5853 |
+
// Now do nested tables _tableWidth
|
5854 |
+
for ($lvl = 2; $lvl <= $this->mpdf->innermostTableLevel; $lvl++) {
|
5855 |
+
for ($nid = 1; $nid <= $this->mpdf->tbctr[$lvl]; $nid++) {
|
5856 |
+
// HERE set child table width = cell width
|
5857 |
+
|
5858 |
+
list($parentrow, $parentcol, $parentnid) = $this->mpdf->table[$lvl][$nid]['nestedpos'];
|
5859 |
+
$c = & $this->mpdf->table[($lvl - 1)][$parentnid]['cells'][$parentrow][$parentcol];
|
5860 |
+
|
5861 |
+
if (isset($c['colspan']) && $c['colspan'] > 1) {
|
5862 |
+
$parentwidth = 0;
|
5863 |
+
for ($cs = 0; $cs < $c['colspan']; $cs++) {
|
5864 |
+
$parentwidth += $this->mpdf->table[($lvl - 1)][$parentnid]['wc'][$parentcol + $cs];
|
5865 |
+
}
|
5866 |
+
} else {
|
5867 |
+
$parentwidth = $this->mpdf->table[($lvl - 1)][$parentnid]['wc'][$parentcol];
|
5868 |
+
}
|
5869 |
+
|
5870 |
+
//$parentwidth -= ALLOW FOR PADDING ETC.in parent cell
|
5871 |
+
if (!$this->mpdf->simpleTables) {
|
5872 |
+
if ($this->mpdf->packTableData) {
|
5873 |
+
list($bt, $br, $bb, $bl) = $this->mpdf->_getBorderWidths($c['borderbin']);
|
5874 |
+
} else {
|
5875 |
+
$br = $c['border_details']['R']['w'];
|
5876 |
+
$bl = $c['border_details']['L']['w'];
|
5877 |
+
}
|
5878 |
+
if ($this->mpdf->table[$lvl - 1][$parentnid]['borders_separate']) {
|
5879 |
+
$parentwidth -= $br + $bl + $c['padding']['L'] + $c['padding']['R'] + $this->mpdf->table[($lvl - 1)][$parentnid]['border_spacing_H'];
|
5880 |
+
} else {
|
5881 |
+
$parentwidth -= $br / 2 + $bl / 2 + $c['padding']['L'] + $c['padding']['R'];
|
5882 |
+
}
|
5883 |
+
} else if ($this->mpdf->simpleTables) {
|
5884 |
+
if ($this->mpdf->table[$lvl - 1][$parentnid]['borders_separate']) {
|
5885 |
+
$parentwidth -= $this->mpdf->table[($lvl - 1)][$parentnid]['simple']['border_details']['L']['w'] + $this->mpdf->table[($lvl - 1)][$parentnid]['simple']['border_details']['R']['w'] + $c['padding']['L'] + $c['padding']['R'] + $this->mpdf->table[($lvl - 1)][$parentnid]['border_spacing_H'];
|
5886 |
+
} else {
|
5887 |
+
$parentwidth -= ($this->mpdf->table[($lvl - 1)][$parentnid]['simple']['border_details']['L']['w'] + $this->mpdf->table[($lvl - 1)][$parentnid]['simple']['border_details']['R']['w']) / 2 + $c['padding']['L'] + $c['padding']['R'];
|
5888 |
+
}
|
5889 |
+
}
|
5890 |
+
if (isset($this->mpdf->table[$lvl][$nid]['wpercent']) && $this->mpdf->table[$lvl][$nid]['wpercent'] && $lvl > 1) {
|
5891 |
+
$this->mpdf->table[$lvl][$nid]['w'] = $parentwidth;
|
5892 |
+
} else if ($parentwidth > $this->mpdf->table[$lvl][$nid]['maw']) {
|
5893 |
+
$this->mpdf->table[$lvl][$nid]['w'] = $this->mpdf->table[$lvl][$nid]['maw'];
|
5894 |
+
} else {
|
5895 |
+
$this->mpdf->table[$lvl][$nid]['w'] = $parentwidth;
|
5896 |
+
}
|
5897 |
+
unset($c);
|
5898 |
+
$this->mpdf->_tableWidth($this->mpdf->table[$lvl][$nid]);
|
5899 |
+
}
|
5900 |
+
}
|
5901 |
+
|
5902 |
+
// Starting at $this->mpdf->innermostTableLevel
|
5903 |
+
// Cascade back up nested tables: setting heights back up the tree
|
5904 |
+
for ($lvl = $this->mpdf->innermostTableLevel; $lvl > 0; $lvl--) {
|
5905 |
+
for ($nid = 1; $nid <= $this->mpdf->tbctr[$lvl]; $nid++) {
|
5906 |
+
list($tableheight, $maxrowheight, $fullpage, $remainingpage, $maxfirstrowheight) = $this->mpdf->_tableHeight($this->mpdf->table[$lvl][$nid]);
|
5907 |
+
}
|
5908 |
+
}
|
5909 |
+
|
5910 |
+
// RESIZING ALGORITHM
|
5911 |
+
|
5912 |
+
if ($maxrowheight > $fullpage) {
|
5913 |
+
$recalculate = $this->mpdf->tbsqrt($maxrowheight / $fullpage, $iteration);
|
5914 |
+
$iteration++;
|
5915 |
+
} else if ($this->mpdf->table_rotate && $tableheight > $remainingpage && !$added_page) {
|
5916 |
+
// If can fit on remainder of page whilst respecting autosize value..
|
5917 |
+
if (($this->mpdf->shrin_k * $this->mpdf->tbsqrt($tableheight / $remainingpage, $iteration)) <= $this->mpdf->shrink_this_table_to_fit) {
|
5918 |
+
$recalculate = $this->mpdf->tbsqrt($tableheight / $remainingpage, $iteration);
|
5919 |
+
$iteration++;
|
5920 |
+
} else {
|
5921 |
+
if (!$added_page) {
|
5922 |
+
$this->mpdf->AddPage($this->mpdf->CurOrientation);
|
5923 |
+
$added_page = true;
|
5924 |
+
$this->mpdf->kwt_moved = true;
|
5925 |
+
$this->mpdf->tbrot_maxw = $this->mpdf->h - ($this->mpdf->y + $this->mpdf->bMargin + 5) - $this->mpdf->kwt_height;
|
5926 |
+
}
|
5927 |
+
// 0.001 to force it to recalculate
|
5928 |
+
$recalculate = (1 / $this->mpdf->shrin_k) + 0.001; // undo any shrink
|
5929 |
+
}
|
5930 |
+
} else if ($this->mpdf->table_keep_together || ($this->mpdf->table[1][1]['nr'] == 1 && !$this->mpdf->writingHTMLfooter)) {
|
5931 |
+
if ($tableheight > $fullpage) {
|
5932 |
+
if (($this->mpdf->shrin_k * $this->mpdf->tbsqrt($tableheight / $fullpage, $iteration)) <= $this->mpdf->shrink_this_table_to_fit) {
|
5933 |
+
$recalculate = $this->mpdf->tbsqrt($tableheight / $fullpage, $iteration);
|
5934 |
+
$iteration++;
|
5935 |
+
} else if ($this->mpdf->tableMinSizePriority) {
|
5936 |
+
$this->mpdf->table_keep_together = false;
|
5937 |
+
$recalculate = (1 / $this->mpdf->shrin_k) + 0.001;
|
5938 |
+
} else {
|
5939 |
+
if (!$added_page && $this->mpdf->y != $this->mpdf->tMargin) {
|
5940 |
+
$this->mpdf->AddPage($this->mpdf->CurOrientation);
|
5941 |
+
$added_page = true;
|
5942 |
+
$this->mpdf->kwt_moved = true;
|
5943 |
+
$this->mpdf->tbrot_maxw = $this->mpdf->h - ($this->mpdf->y + $this->mpdf->bMargin + 5) - $this->mpdf->kwt_height;
|
5944 |
+
}
|
5945 |
+
$recalculate = $this->mpdf->tbsqrt($tableheight / $fullpage, $iteration);
|
5946 |
+
$iteration++;
|
5947 |
+
}
|
5948 |
+
} else if ($tableheight > $remainingpage) {
|
5949 |
+
// If can fit on remainder of page whilst respecting autosize value..
|
5950 |
+
if (($this->mpdf->shrin_k * $this->mpdf->tbsqrt($tableheight / $remainingpage, $iteration)) <= $this->mpdf->shrink_this_table_to_fit) {
|
5951 |
+
$recalculate = $this->mpdf->tbsqrt($tableheight / $remainingpage, $iteration);
|
5952 |
+
$iteration++;
|
5953 |
+
} else {
|
5954 |
+
if (!$added_page) {
|
5955 |
+
// mPDF 6
|
5956 |
+
if ($this->mpdf->AcceptPageBreak()) {
|
5957 |
+
$this->mpdf->AddPage($this->mpdf->CurOrientation);
|
5958 |
+
} else if ($this->mpdf->ColActive && $tableheight > (($this->mpdf->h - $this->mpdf->bMargin) - $this->mpdf->y0)) {
|
5959 |
+
$this->mpdf->AddPage($this->mpdf->CurOrientation);
|
5960 |
+
}
|
5961 |
+
$added_page = true;
|
5962 |
+
$this->mpdf->kwt_moved = true;
|
5963 |
+
$this->mpdf->tbrot_maxw = $this->mpdf->h - ($this->mpdf->y + $this->mpdf->bMargin + 5) - $this->mpdf->kwt_height;
|
5964 |
+
}
|
5965 |
+
|
5966 |
+
//$recalculate = $this->mpdf->tbsqrt($tableheight / $fullpage, $iteration); $iteration++;
|
5967 |
+
$recalculate = (1 / $this->mpdf->shrin_k) + 0.001; // undo any shrink
|
5968 |
+
}
|
5969 |
+
} else {
|
5970 |
+
$recalculate = 1;
|
5971 |
+
}
|
5972 |
+
} else {
|
5973 |
+
$recalculate = 1;
|
5974 |
+
}
|
5975 |
+
}
|
5976 |
+
|
5977 |
+
|
5978 |
+
if ($maxfirstrowheight > $remainingpage && !$added_page && !$this->mpdf->table_rotate && !$this->mpdf->ColActive && !$this->mpdf->table_keep_together && !$this->mpdf->writingHTMLheader && !$this->mpdf->writingHTMLfooter) {
|
5979 |
+
$this->mpdf->AddPage($this->mpdf->CurOrientation);
|
5980 |
+
$this->mpdf->kwt_moved = true;
|
5981 |
+
}
|
5982 |
+
|
5983 |
+
// keep-with-table: if page has advanced, print out buffer now, else done in fn. _Tablewrite()
|
5984 |
+
if ($this->mpdf->kwt_saved && $this->mpdf->kwt_moved) {
|
5985 |
+
$this->mpdf->printkwtbuffer();
|
5986 |
+
$this->mpdf->kwt_moved = false;
|
5987 |
+
$this->mpdf->kwt_saved = false;
|
5988 |
+
}
|
5989 |
+
|
5990 |
+
if ($this->mpdf->progressBar) {
|
5991 |
+
$this->mpdf->UpdateProgressBar(7, 30, ' ');
|
5992 |
+
} // *PROGRESS-BAR*
|
5993 |
+
// Recursively writes all tables starting at top level
|
5994 |
+
$this->mpdf->_tableWrite($this->mpdf->table[1][1]);
|
5995 |
+
|
5996 |
+
if ($this->mpdf->table_rotate && $this->mpdf->tablebuffer) {
|
5997 |
+
$this->mpdf->PageBreakTrigger = $this->mpdf->h - $this->mpdf->bMargin;
|
5998 |
+
$save_tr = $this->mpdf->table_rotate;
|
5999 |
+
$save_y = $this->mpdf->y;
|
6000 |
+
$this->mpdf->table_rotate = 0;
|
6001 |
+
$this->mpdf->y = $this->mpdf->tbrot_y0;
|
6002 |
+
$h = $this->mpdf->tbrot_w;
|
6003 |
+
$this->mpdf->DivLn($h, $this->mpdf->blklvl, true);
|
6004 |
+
|
6005 |
+
$this->mpdf->table_rotate = $save_tr;
|
6006 |
+
$this->mpdf->y = $save_y;
|
6007 |
+
|
6008 |
+
$this->mpdf->printtablebuffer();
|
6009 |
+
}
|
6010 |
+
$this->mpdf->table_rotate = 0;
|
6011 |
+
}
|
6012 |
+
|
6013 |
+
|
6014 |
+
$this->mpdf->x = $this->mpdf->lMargin + $this->mpdf->blk[$this->mpdf->blklvl]['outer_left_margin'];
|
6015 |
+
|
6016 |
+
$this->mpdf->maxPosR = max($this->mpdf->maxPosR, ($this->mpdf->x + $this->mpdf->table[1][1]['w']));
|
6017 |
+
|
6018 |
+
$this->mpdf->blockjustfinished = true;
|
6019 |
+
$this->mpdf->lastblockbottommargin = $this->mpdf->table[1][1]['margin']['B'];
|
6020 |
+
//Reset values
|
6021 |
+
|
6022 |
+
if (isset($this->mpdf->table[1][1]['page_break_after'])) {
|
6023 |
+
$page_break_after = $this->mpdf->table[1][1]['page_break_after'];
|
6024 |
+
} else {
|
6025 |
+
$page_break_after = '';
|
6026 |
+
}
|
6027 |
+
|
6028 |
+
// Keep-with-table
|
6029 |
+
$this->mpdf->kwt = false;
|
6030 |
+
$this->mpdf->kwt_y0 = 0;
|
6031 |
+
$this->mpdf->kwt_x0 = 0;
|
6032 |
+
$this->mpdf->kwt_height = 0;
|
6033 |
+
$this->mpdf->kwt_buffer = array();
|
6034 |
+
$this->mpdf->kwt_Links = array();
|
6035 |
+
$this->mpdf->kwt_Annots = array();
|
6036 |
+
$this->mpdf->kwt_moved = false;
|
6037 |
+
$this->mpdf->kwt_saved = false;
|
6038 |
+
|
6039 |
+
$this->mpdf->kwt_Reference = array();
|
6040 |
+
$this->mpdf->kwt_BMoutlines = array();
|
6041 |
+
$this->mpdf->kwt_toc = array();
|
6042 |
+
|
6043 |
+
$this->mpdf->shrin_k = 1;
|
6044 |
+
$this->mpdf->shrink_this_table_to_fit = 0;
|
6045 |
+
|
6046 |
+
unset($this->mpdf->table);
|
6047 |
+
$this->mpdf->table = array(); //array
|
6048 |
+
$this->mpdf->tableLevel = 0;
|
6049 |
+
$this->mpdf->tbctr = array();
|
6050 |
+
$this->mpdf->innermostTableLevel = 0;
|
6051 |
+
$this->mpdf->cssmgr->tbCSSlvl = 0;
|
6052 |
+
$this->mpdf->cssmgr->tablecascadeCSS = array();
|
6053 |
+
|
6054 |
+
unset($this->mpdf->cell);
|
6055 |
+
$this->mpdf->cell = array(); //array
|
6056 |
+
|
6057 |
+
$this->mpdf->col = -1; //int
|
6058 |
+
$this->mpdf->row = -1; //int
|
6059 |
+
$this->mpdf->Reset();
|
6060 |
+
|
6061 |
+
$this->mpdf->cellPaddingL = 0;
|
6062 |
+
$this->mpdf->cellPaddingT = 0;
|
6063 |
+
$this->mpdf->cellPaddingR = 0;
|
6064 |
+
$this->mpdf->cellPaddingB = 0;
|
6065 |
+
$this->mpdf->cMarginL = 0;
|
6066 |
+
$this->mpdf->cMarginT = 0;
|
6067 |
+
$this->mpdf->cMarginR = 0;
|
6068 |
+
$this->mpdf->cMarginB = 0;
|
6069 |
+
$this->mpdf->default_font_size = $this->mpdf->original_default_font_size;
|
6070 |
+
$this->mpdf->default_font = $this->mpdf->original_default_font;
|
6071 |
+
$this->mpdf->SetFontSize($this->mpdf->default_font_size, false);
|
6072 |
+
$this->mpdf->SetFont($this->mpdf->default_font, '', 0, false);
|
6073 |
+
$this->mpdf->SetLineHeight();
|
6074 |
+
if (isset($this->mpdf->blk[$this->mpdf->blklvl]['InlineProperties'])) {
|
6075 |
+
$this->mpdf->restoreInlineProperties($this->mpdf->blk[$this->mpdf->blklvl]['InlineProperties']);
|
6076 |
+
}
|
6077 |
+
if ($this->mpdf->progressBar) {
|
6078 |
+
$this->mpdf->UpdateProgressBar(7, 100, ' ');
|
6079 |
+
} // *PROGRESS-BAR*
|
6080 |
+
|
6081 |
+
if ($page_break_after) {
|
6082 |
+
$save_blklvl = $this->mpdf->blklvl;
|
6083 |
+
$save_blk = $this->mpdf->blk;
|
6084 |
+
$save_silp = $this->mpdf->saveInlineProperties();
|
6085 |
+
$save_ilp = $this->mpdf->InlineProperties;
|
6086 |
+
$save_bflp = $this->mpdf->InlineBDF;
|
6087 |
+
$save_bflpc = $this->mpdf->InlineBDFctr; // mPDF 6
|
6088 |
+
// mPDF 6 pagebreaktype
|
6089 |
+
$startpage = $this->mpdf->page;
|
6090 |
+
$pagebreaktype = $this->mpdf->defaultPagebreakType;
|
6091 |
+
if ($this->mpdf->ColActive) {
|
6092 |
+
$pagebreaktype = 'cloneall';
|
6093 |
+
}
|
6094 |
+
|
6095 |
+
// mPDF 6 pagebreaktype
|
6096 |
+
$this->mpdf->_preForcedPagebreak($pagebreaktype);
|
6097 |
+
|
6098 |
+
if ($page_break_after == 'RIGHT') {
|
6099 |
+
$this->mpdf->AddPage($this->mpdf->CurOrientation, 'NEXT-ODD', '', '', '', '', '', '', '', '', '', '', '', '', '', 0, 0, 0, 0);
|
6100 |
+
} else if ($page_break_after == 'LEFT') {
|
6101 |
+
$this->mpdf->AddPage($this->mpdf->CurOrientation, 'NEXT-EVEN', '', '', '', '', '', '', '', '', '', '', '', '', '', 0, 0, 0, 0);
|
6102 |
+
} else {
|
6103 |
+
$this->mpdf->AddPage($this->mpdf->CurOrientation, '', '', '', '', '', '', '', '', '', '', '', '', '', '', 0, 0, 0, 0);
|
6104 |
+
}
|
6105 |
+
|
6106 |
+
// mPDF 6 pagebreaktype
|
6107 |
+
$this->mpdf->_postForcedPagebreak($pagebreaktype, $startpage, $save_blk, $save_blklvl);
|
6108 |
+
|
6109 |
+
$this->mpdf->InlineProperties = $save_ilp;
|
6110 |
+
$this->mpdf->InlineBDF = $save_bflp;
|
6111 |
+
$this->mpdf->InlineBDFctr = $save_bflpc; // mPDF 6
|
6112 |
+
$this->mpdf->restoreInlineProperties($save_silp);
|
6113 |
+
}
|
6114 |
+
}
|
6115 |
+
/* -- END TABLES -- */
|
6116 |
+
}
|
6117 |
+
|
6118 |
+
}
|
lib/mpdf/classes/barcode.php
CHANGED
@@ -1,1972 +1,2102 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// Adapted for mPDF from TCPDF barcode. Original Details left below.
|
4 |
-
|
5 |
-
|
6 |
-
//
|
7 |
-
//
|
8 |
-
//
|
9 |
-
//
|
10 |
-
//
|
11 |
-
//
|
12 |
-
//
|
13 |
-
//
|
14 |
-
//
|
15 |
-
//
|
16 |
-
//
|
17 |
-
//
|
18 |
-
//
|
19 |
-
//
|
20 |
-
//
|
21 |
-
//
|
22 |
-
//
|
23 |
-
//
|
24 |
-
//
|
25 |
-
//
|
26 |
-
//
|
27 |
-
//
|
28 |
-
//
|
29 |
-
//
|
30 |
-
//
|
31 |
-
//
|
32 |
-
//
|
33 |
-
//
|
34 |
-
//
|
35 |
-
//
|
36 |
-
//
|
37 |
-
//
|
38 |
-
//
|
39 |
-
//
|
40 |
-
//
|
41 |
-
//
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
protected $
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
case '
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
case '
|
308 |
-
case '
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
$
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
$
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
$
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
$
|
463 |
-
$
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
$
|
483 |
-
$
|
484 |
-
|
485 |
-
|
486 |
-
$
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
$
|
513 |
-
$
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
$
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
chr(
|
548 |
-
chr(
|
549 |
-
chr(
|
550 |
-
chr(
|
551 |
-
chr(
|
552 |
-
chr(
|
553 |
-
chr(
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
$
|
592 |
-
$
|
593 |
-
$
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
$
|
613 |
-
$
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
$
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
$
|
630 |
-
$
|
631 |
-
|
632 |
-
$
|
633 |
-
$
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
$
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
$
|
680 |
-
}
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
$
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
$
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
$
|
738 |
-
$
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
$
|
752 |
-
$
|
753 |
-
$
|
754 |
-
|
755 |
-
$
|
756 |
-
$
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
$
|
770 |
-
for ($i =
|
771 |
-
$
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
$
|
789 |
-
$
|
790 |
-
$
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
$
|
824 |
-
$
|
825 |
-
$
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
'
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
'
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
'
|
987 |
-
'
|
988 |
-
'
|
989 |
-
'
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
$
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
$
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
'
|
1172 |
-
'
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
);
|
1198 |
-
|
1199 |
-
$
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
1210 |
-
)
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
if ($
|
1226 |
-
|
1227 |
-
$
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
$
|
1234 |
-
$
|
1235 |
-
if ($
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
}
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
'
|
1292 |
-
'
|
1293 |
-
'
|
1294 |
-
|
1295 |
-
'
|
1296 |
-
'
|
1297 |
-
'
|
1298 |
-
'
|
1299 |
-
'
|
1300 |
-
'
|
1301 |
-
|
1302 |
-
'
|
1303 |
-
'
|
1304 |
-
'
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
'
|
1316 |
-
'
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
'
|
1322 |
-
'
|
1323 |
-
'
|
1324 |
-
'
|
1325 |
-
'
|
1326 |
-
'
|
1327 |
-
'
|
1328 |
-
'
|
1329 |
-
'
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
'
|
1437 |
-
'
|
1438 |
-
'
|
1439 |
-
'
|
1440 |
-
|
1441 |
-
|
1442 |
-
'
|
1443 |
-
'
|
1444 |
-
'
|
1445 |
-
'
|
1446 |
-
'
|
1447 |
-
'
|
1448 |
-
'
|
1449 |
-
'
|
1450 |
-
'
|
1451 |
-
'
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
'
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
-
|
1475 |
-
|
1476 |
-
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
|
1481 |
-
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
|
1486 |
-
|
1487 |
-
|
1488 |
-
|
1489 |
-
|
1490 |
-
|
1491 |
-
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
-
|
1496 |
-
|
1497 |
-
|
1498 |
-
|
1499 |
-
|
1500 |
-
|
1501 |
-
|
1502 |
-
|
1503 |
-
|
1504 |
-
|
1505 |
-
|
1506 |
-
|
1507 |
-
|
1508 |
-
|
1509 |
-
|
1510 |
-
|
1511 |
-
|
1512 |
-
|
1513 |
-
|
1514 |
-
|
1515 |
-
|
1516 |
-
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
$
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
1530 |
-
|
1531 |
-
|
1532 |
-
|
1533 |
-
|
1534 |
-
|
1535 |
-
|
1536 |
-
|
1537 |
-
|
1538 |
-
|
1539 |
-
|
1540 |
-
|
1541 |
-
|
1542 |
-
|
1543 |
-
|
1544 |
-
|
1545 |
-
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
-
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
1553 |
-
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
1560 |
-
|
1561 |
-
|
1562 |
-
|
1563 |
-
|
1564 |
-
|
1565 |
-
|
1566 |
-
|
1567 |
-
|
1568 |
-
|
1569 |
-
|
1570 |
-
|
1571 |
-
|
1572 |
-
|
1573 |
-
|
1574 |
-
|
1575 |
-
|
1576 |
-
|
1577 |
-
|
1578 |
-
|
1579 |
-
|
1580 |
-
|
1581 |
-
'
|
1582 |
-
'
|
1583 |
-
'
|
1584 |
-
'
|
1585 |
-
'
|
1586 |
-
'
|
1587 |
-
'
|
1588 |
-
'
|
1589 |
-
'
|
1590 |
-
'
|
1591 |
-
|
1592 |
-
|
1593 |
-
|
1594 |
-
|
1595 |
-
|
1596 |
-
|
1597 |
-
|
1598 |
-
|
1599 |
-
|
1600 |
-
|
1601 |
-
|
1602 |
-
|
1603 |
-
|
1604 |
-
|
1605 |
-
|
1606 |
-
|
1607 |
-
|
1608 |
-
|
1609 |
-
|
1610 |
-
|
1611 |
-
|
1612 |
-
|
1613 |
-
|
1614 |
-
|
1615 |
-
|
1616 |
-
|
1617 |
-
|
1618 |
-
|
1619 |
-
|
1620 |
-
|
1621 |
-
|
1622 |
-
|
1623 |
-
|
1624 |
-
|
1625 |
-
|
1626 |
-
|
1627 |
-
|
1628 |
-
|
1629 |
-
|
1630 |
-
|
1631 |
-
|
1632 |
-
|
1633 |
-
|
1634 |
-
|
1635 |
-
|
1636 |
-
|
1637 |
-
|
1638 |
-
|
1639 |
-
|
1640 |
-
|
1641 |
-
|
1642 |
-
|
1643 |
-
|
1644 |
-
|
1645 |
-
'
|
1646 |
-
|
1647 |
-
|
1648 |
-
|
1649 |
-
|
1650 |
-
|
1651 |
-
|
1652 |
-
|
1653 |
-
|
1654 |
-
|
1655 |
-
|
1656 |
-
|
1657 |
-
|
1658 |
-
|
1659 |
-
|
1660 |
-
|
1661 |
-
|
1662 |
-
|
1663 |
-
|
1664 |
-
|
1665 |
-
|
1666 |
-
|
1667 |
-
|
1668 |
-
|
1669 |
-
|
1670 |
-
|
1671 |
-
|
1672 |
-
|
1673 |
-
|
1674 |
-
|
1675 |
-
|
1676 |
-
|
1677 |
-
|
1678 |
-
|
1679 |
-
|
1680 |
-
|
1681 |
-
|
1682 |
-
|
1683 |
-
|
1684 |
-
|
1685 |
-
|
1686 |
-
|
1687 |
-
|
1688 |
-
|
1689 |
-
|
1690 |
-
|
1691 |
-
|
1692 |
-
|
1693 |
-
|
1694 |
-
|
1695 |
-
|
1696 |
-
|
1697 |
-
|
1698 |
-
|
1699 |
-
|
1700 |
-
|
1701 |
-
|
1702 |
-
|
1703 |
-
|
1704 |
-
|
1705 |
-
|
1706 |
-
|
1707 |
-
|
1708 |
-
|
1709 |
-
|
1710 |
-
|
1711 |
-
|
1712 |
-
|
1713 |
-
|
1714 |
-
|
1715 |
-
|
1716 |
-
|
1717 |
-
|
1718 |
-
|
1719 |
-
|
1720 |
-
|
1721 |
-
|
1722 |
-
|
1723 |
-
|
1724 |
-
|
1725 |
-
|
1726 |
-
|
1727 |
-
|
1728 |
-
|
1729 |
-
|
1730 |
-
|
1731 |
-
|
1732 |
-
|
1733 |
-
|
1734 |
-
|
1735 |
-
|
1736 |
-
|
1737 |
-
|
1738 |
-
|
1739 |
-
|
1740 |
-
|
1741 |
-
|
1742 |
-
|
1743 |
-
|
1744 |
-
|
1745 |
-
|
1746 |
-
|
1747 |
-
|
1748 |
-
|
1749 |
-
|
1750 |
-
|
1751 |
-
|
1752 |
-
|
1753 |
-
|
1754 |
-
|
1755 |
-
|
1756 |
-
|
1757 |
-
|
1758 |
-
|
1759 |
-
|
1760 |
-
|
1761 |
-
|
1762 |
-
|
1763 |
-
|
1764 |
-
|
1765 |
-
|
1766 |
-
|
1767 |
-
|
1768 |
-
|
1769 |
-
|
1770 |
-
|
1771 |
-
|
1772 |
-
|
1773 |
-
|
1774 |
-
|
1775 |
-
|
1776 |
-
|
1777 |
-
$
|
1778 |
-
$
|
1779 |
-
|
1780 |
-
$
|
1781 |
-
|
1782 |
-
|
1783 |
-
$
|
1784 |
-
|
1785 |
-
$
|
1786 |
-
|
1787 |
-
|
1788 |
-
|
1789 |
-
|
1790 |
-
|
1791 |
-
|
1792 |
-
|
1793 |
-
|
1794 |
-
|
1795 |
-
|
1796 |
-
|
1797 |
-
|
1798 |
-
$
|
1799 |
-
$
|
1800 |
-
|
1801 |
-
|
1802 |
-
$
|
1803 |
-
|
1804 |
-
|
1805 |
-
|
1806 |
-
|
1807 |
-
|
1808 |
-
|
1809 |
-
|
1810 |
-
|
1811 |
-
|
1812 |
-
|
1813 |
-
|
1814 |
-
|
1815 |
-
|
1816 |
-
|
1817 |
-
|
1818 |
-
|
1819 |
-
|
1820 |
-
|
1821 |
-
$
|
1822 |
-
$
|
1823 |
-
|
1824 |
-
|
1825 |
-
|
1826 |
-
|
1827 |
-
|
1828 |
-
|
1829 |
-
|
1830 |
-
|
1831 |
-
}
|
1832 |
-
|
1833 |
-
|
1834 |
-
$
|
1835 |
-
|
1836 |
-
|
1837 |
-
|
1838 |
-
|
1839 |
-
|
1840 |
-
|
1841 |
-
|
1842 |
-
|
1843 |
-
|
1844 |
-
|
1845 |
-
|
1846 |
-
|
1847 |
-
|
1848 |
-
|
1849 |
-
|
1850 |
-
|
1851 |
-
|
1852 |
-
|
1853 |
-
|
1854 |
-
|
1855 |
-
|
1856 |
-
|
1857 |
-
|
1858 |
-
|
1859 |
-
|
1860 |
-
|
1861 |
-
|
1862 |
-
|
1863 |
-
|
1864 |
-
|
1865 |
-
|
1866 |
-
|
1867 |
-
|
1868 |
-
|
1869 |
-
|
1870 |
-
|
1871 |
-
|
1872 |
-
|
1873 |
-
|
1874 |
-
|
1875 |
-
|
1876 |
-
|
1877 |
-
|
1878 |
-
|
1879 |
-
|
1880 |
-
|
1881 |
-
|
1882 |
-
|
1883 |
-
|
1884 |
-
|
1885 |
-
|
1886 |
-
|
1887 |
-
|
1888 |
-
|
1889 |
-
|
1890 |
-
|
1891 |
-
|
1892 |
-
|
1893 |
-
|
1894 |
-
|
1895 |
-
|
1896 |
-
|
1897 |
-
|
1898 |
-
|
1899 |
-
|
1900 |
-
|
1901 |
-
|
1902 |
-
|
1903 |
-
|
1904 |
-
|
1905 |
-
|
1906 |
-
|
1907 |
-
|
1908 |
-
|
1909 |
-
|
1910 |
-
|
1911 |
-
|
1912 |
-
|
1913 |
-
|
1914 |
-
|
1915 |
-
|
1916 |
-
|
1917 |
-
|
1918 |
-
|
1919 |
-
|
1920 |
-
|
1921 |
-
|
1922 |
-
|
1923 |
-
|
1924 |
-
$
|
1925 |
-
|
1926 |
-
|
1927 |
-
|
1928 |
-
|
1929 |
-
|
1930 |
-
|
1931 |
-
|
1932 |
-
|
1933 |
-
|
1934 |
-
|
1935 |
-
|
1936 |
-
|
1937 |
-
|
1938 |
-
|
1939 |
-
|
1940 |
-
|
1941 |
-
|
1942 |
-
|
1943 |
-
|
1944 |
-
|
1945 |
-
|
1946 |
-
|
1947 |
-
|
1948 |
-
|
1949 |
-
|
1950 |
-
|
1951 |
-
|
1952 |
-
|
1953 |
-
|
1954 |
-
|
1955 |
-
|
1956 |
-
|
1957 |
-
|
1958 |
-
|
1959 |
-
|
1960 |
-
|
1961 |
-
|
1962 |
-
|
1963 |
-
|
1964 |
-
|
1965 |
-
|
1966 |
-
|
1967 |
-
|
1968 |
-
|
1969 |
-
|
1970 |
-
|
1971 |
-
|
1972 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// Adapted for mPDF from TCPDF barcode. Original Details left below.
|
4 |
+
//============================================================+
|
5 |
+
// File name : barcodes.php
|
6 |
+
// Begin : 2008-06-09
|
7 |
+
// Last Update : 2009-04-15
|
8 |
+
// Version : 1.0.008
|
9 |
+
// License : GNU LGPL (http://www.gnu.org/copyleft/lesser.html)
|
10 |
+
// ----------------------------------------------------------------------------
|
11 |
+
// Copyright (C) 2008-2009 Nicola Asuni - Tecnick.com S.r.l.
|
12 |
+
//
|
13 |
+
// This program is free software: you can redistribute it and/or modify
|
14 |
+
// it under the terms of the GNU Lesser General Public License as published by
|
15 |
+
// the Free Software Foundation, either version 2.1 of the License, or
|
16 |
+
// (at your option) any later version.
|
17 |
+
//
|
18 |
+
// This program is distributed in the hope that it will be useful,
|
19 |
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
+
// GNU Lesser General Public License for more details.
|
22 |
+
//
|
23 |
+
// You should have received a copy of the GNU Lesser General Public License
|
24 |
+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
25 |
+
//
|
26 |
+
// See LICENSE.TXT file for more information.
|
27 |
+
// ----------------------------------------------------------------------------
|
28 |
+
//
|
29 |
+
// Description : PHP class to creates array representations for
|
30 |
+
// common 1D barcodes to be used with TCPDF.
|
31 |
+
//
|
32 |
+
// Author: Nicola Asuni
|
33 |
+
//
|
34 |
+
// (c) Copyright:
|
35 |
+
// Nicola Asuni
|
36 |
+
// Tecnick.com S.r.l.
|
37 |
+
// Via della Pace, 11
|
38 |
+
// 09044 Quartucciu (CA)
|
39 |
+
// ITALY
|
40 |
+
// www.tecnick.com
|
41 |
+
// info@tecnick.com
|
42 |
+
//============================================================+
|
43 |
+
|
44 |
+
require_once __DIR__ . '/../MpdfException.php';
|
45 |
+
|
46 |
+
class PDFBarcode
|
47 |
+
{
|
48 |
+
|
49 |
+
protected $barcode_array;
|
50 |
+
|
51 |
+
protected $gapwidth;
|
52 |
+
|
53 |
+
protected $print_ratio;
|
54 |
+
|
55 |
+
protected $daft;
|
56 |
+
|
57 |
+
public function __construct()
|
58 |
+
{
|
59 |
+
|
60 |
+
}
|
61 |
+
|
62 |
+
public function getBarcodeArray($code, $type, $pr = '')
|
63 |
+
{
|
64 |
+
$this->setBarcode($code, $type, $pr);
|
65 |
+
return $this->barcode_array;
|
66 |
+
}
|
67 |
+
|
68 |
+
public function getChecksum($code, $type)
|
69 |
+
{
|
70 |
+
$this->setBarcode($code, $type);
|
71 |
+
if (!$this->barcode_array) {
|
72 |
+
return '';
|
73 |
+
} else {
|
74 |
+
return $this->barcode_array['checkdigit'];
|
75 |
+
}
|
76 |
+
}
|
77 |
+
|
78 |
+
public function setBarcode($code, $type, $pr = '')
|
79 |
+
{
|
80 |
+
$this->print_ratio = 1;
|
81 |
+
switch (strtoupper($type)) {
|
82 |
+
case 'ISBN':
|
83 |
+
case 'ISSN':
|
84 |
+
case 'EAN13': { // EAN 13
|
85 |
+
$arrcode = $this->barcode_eanupc($code, 13);
|
86 |
+
$arrcode['lightmL'] = 11; // LEFT light margin = x X-dim (http://www.gs1uk.org)
|
87 |
+
$arrcode['lightmR'] = 7; // RIGHT light margin = x X-dim (http://www.gs1uk.org)
|
88 |
+
$arrcode['nom-X'] = 0.33; // Nominal value for X-dim in mm (http://www.gs1uk.org)
|
89 |
+
$arrcode['nom-H'] = 25.93; // Nominal bar height in mm incl. numerals (http://www.gs1uk.org)
|
90 |
+
break;
|
91 |
+
}
|
92 |
+
case 'UPCA': { // UPC-A
|
93 |
+
$arrcode = $this->barcode_eanupc($code, 12);
|
94 |
+
$arrcode['lightmL'] = 9; // LEFT light margin = x X-dim (http://www.gs1uk.org)
|
95 |
+
$arrcode['lightmR'] = 9; // RIGHT light margin = x X-dim (http://www.gs1uk.org)
|
96 |
+
$arrcode['nom-X'] = 0.33; // Nominal value for X-dim in mm (http://www.gs1uk.org)
|
97 |
+
$arrcode['nom-H'] = 25.91; // Nominal bar height in mm incl. numerals (http://www.gs1uk.org)
|
98 |
+
break;
|
99 |
+
}
|
100 |
+
case 'UPCE': { // UPC-E
|
101 |
+
$arrcode = $this->barcode_eanupc($code, 6);
|
102 |
+
$arrcode['lightmL'] = 9; // LEFT light margin = x X-dim (http://www.gs1uk.org)
|
103 |
+
$arrcode['lightmR'] = 7; // RIGHT light margin = x X-dim (http://www.gs1uk.org)
|
104 |
+
$arrcode['nom-X'] = 0.33; // Nominal value for X-dim in mm (http://www.gs1uk.org)
|
105 |
+
$arrcode['nom-H'] = 25.93; // Nominal bar height in mm incl. numerals (http://www.gs1uk.org)
|
106 |
+
break;
|
107 |
+
}
|
108 |
+
case 'EAN8': { // EAN 8
|
109 |
+
$arrcode = $this->barcode_eanupc($code, 8);
|
110 |
+
$arrcode['lightmL'] = 7; // LEFT light margin = x X-dim (http://www.gs1uk.org)
|
111 |
+
$arrcode['lightmR'] = 7; // RIGHT light margin = x X-dim (http://www.gs1uk.org)
|
112 |
+
$arrcode['nom-X'] = 0.33; // Nominal value for X-dim in mm (http://www.gs1uk.org)
|
113 |
+
$arrcode['nom-H'] = 21.64; // Nominal bar height in mm incl. numerals (http://www.gs1uk.org)
|
114 |
+
break;
|
115 |
+
}
|
116 |
+
case 'EAN2': { // 2-Digits UPC-Based Extention
|
117 |
+
$arrcode = $this->barcode_eanext($code, 2);
|
118 |
+
$arrcode['lightmL'] = 7; // LEFT light margin = x X-dim (estimated)
|
119 |
+
$arrcode['lightmR'] = 7; // RIGHT light margin = x X-dim (estimated)
|
120 |
+
$arrcode['sepM'] = 9; // SEPARATION margin = x X-dim (http://web.archive.org/web/19990501035133/http://www.uc-council.org/d36-d.htm)
|
121 |
+
$arrcode['nom-X'] = 0.33; // Nominal value for X-dim in mm (http://www.gs1uk.org)
|
122 |
+
$arrcode['nom-H'] = 20; // Nominal bar height in mm incl. numerals (estimated) not used when combined
|
123 |
+
break;
|
124 |
+
}
|
125 |
+
case 'EAN5': { // 5-Digits UPC-Based Extention
|
126 |
+
$arrcode = $this->barcode_eanext($code, 5);
|
127 |
+
$arrcode['lightmL'] = 7; // LEFT light margin = x X-dim (estimated)
|
128 |
+
$arrcode['lightmR'] = 7; // RIGHT light margin = x X-dim (estimated)
|
129 |
+
$arrcode['sepM'] = 9; // SEPARATION margin = x X-dim (http://web.archive.org/web/19990501035133/http://www.uc-council.org/d36-d.htm)
|
130 |
+
$arrcode['nom-X'] = 0.33; // Nominal value for X-dim in mm (http://www.gs1uk.org)
|
131 |
+
$arrcode['nom-H'] = 20; // Nominal bar height in mm incl. numerals (estimated) not used when combined
|
132 |
+
break;
|
133 |
+
}
|
134 |
+
|
135 |
+
case 'IMB': { // IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200
|
136 |
+
$xdim = 0.508; // Nominal value for X-dim (bar width) in mm (spec.)
|
137 |
+
$bpi = 22; // Bars per inch
|
138 |
+
// Ratio of Nominal value for width of spaces in mm / Nominal value for X-dim (bar width) in mm based on bars per inch
|
139 |
+
$this->gapwidth = ((25.4 / $bpi) - $xdim) / $xdim;
|
140 |
+
$this->daft = array('D' => 2, 'A' => 2, 'F' => 3, 'T' => 1); // Descender; Ascender; Full; Tracker bar heights
|
141 |
+
$arrcode = $this->barcode_imb($code);
|
142 |
+
$arrcode['nom-X'] = $xdim;
|
143 |
+
$arrcode['nom-H'] = 3.68; // Nominal value for Height of Full bar in mm (spec.)
|
144 |
+
// USPS-B-3200 Revision C = 4.623
|
145 |
+
// USPS-B-3200 Revision E = 3.68
|
146 |
+
$arrcode['quietL'] = 3.175; // LEFT Quiet margin = mm (spec.)
|
147 |
+
$arrcode['quietR'] = 3.175; // RIGHT Quiet margin = mm (spec.)
|
148 |
+
$arrcode['quietTB'] = 0.711; // TOP/BOTTOM Quiet margin = mm (spec.)
|
149 |
+
break;
|
150 |
+
}
|
151 |
+
case 'RM4SCC': { // RM4SCC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)
|
152 |
+
$xdim = 0.508; // Nominal value for X-dim (bar width) in mm (spec.)
|
153 |
+
$bpi = 22; // Bars per inch
|
154 |
+
// Ratio of Nominal value for width of spaces in mm / Nominal value for X-dim (bar width) in mm based on bars per inch
|
155 |
+
$this->gapwidth = ((25.4 / $bpi) - $xdim) / $xdim;
|
156 |
+
$this->daft = array('D' => 5, 'A' => 5, 'F' => 8, 'T' => 2); // Descender; Ascender; Full; Tracker bar heights
|
157 |
+
$arrcode = $this->barcode_rm4scc($code, false);
|
158 |
+
$arrcode['nom-X'] = $xdim;
|
159 |
+
$arrcode['nom-H'] = 5.0; // Nominal value for Height of Full bar in mm (spec.)
|
160 |
+
$arrcode['quietL'] = 2; // LEFT Quiet margin = mm (spec.)
|
161 |
+
$arrcode['quietR'] = 2; // RIGHT Quiet margin = mm (spec.)
|
162 |
+
$arrcode['quietTB'] = 2; // TOP/BOTTOM Quiet margin = mm (spec?)
|
163 |
+
break;
|
164 |
+
}
|
165 |
+
case 'KIX': { // KIX (Klant index - Customer index)
|
166 |
+
$xdim = 0.508; // Nominal value for X-dim (bar width) in mm (spec.)
|
167 |
+
$bpi = 22; // Bars per inch
|
168 |
+
// Ratio of Nominal value for width of spaces in mm / Nominal value for X-dim (bar width) in mm based on bars per inch
|
169 |
+
$this->gapwidth = ((25.4 / $bpi) - $xdim) / $xdim;
|
170 |
+
$this->daft = array('D' => 5, 'A' => 5, 'F' => 8, 'T' => 2); // Descender; Ascender; Full; Tracker bar heights
|
171 |
+
$arrcode = $this->barcode_rm4scc($code, true);
|
172 |
+
$arrcode['nom-X'] = $xdim;
|
173 |
+
$arrcode['nom-H'] = 5.0; // Nominal value for Height of Full bar in mm (? spec.)
|
174 |
+
$arrcode['quietL'] = 2; // LEFT Quiet margin = mm (spec.)
|
175 |
+
$arrcode['quietR'] = 2; // RIGHT Quiet margin = mm (spec.)
|
176 |
+
$arrcode['quietTB'] = 2; // TOP/BOTTOM Quiet margin = mm (spec.)
|
177 |
+
break;
|
178 |
+
}
|
179 |
+
case 'POSTNET': { // POSTNET
|
180 |
+
$xdim = 0.508; // Nominal value for X-dim (bar width) in mm (spec.)
|
181 |
+
$bpi = 22; // Bars per inch
|
182 |
+
// Ratio of Nominal value for width of spaces in mm / Nominal value for X-dim (bar width) in mm based on bars per inch
|
183 |
+
$this->gapwidth = ((25.4 / $bpi) - $xdim) / $xdim;
|
184 |
+
$arrcode = $this->barcode_postnet($code, false);
|
185 |
+
$arrcode['nom-X'] = $xdim;
|
186 |
+
$arrcode['nom-H'] = 3.175; // Nominal value for Height of Full bar in mm (spec.)
|
187 |
+
$arrcode['quietL'] = 3.175; // LEFT Quiet margin = mm (?spec.)
|
188 |
+
$arrcode['quietR'] = 3.175; // RIGHT Quiet margin = mm (?spec.)
|
189 |
+
$arrcode['quietTB'] = 1.016; // TOP/BOTTOM Quiet margin = mm (?spec.)
|
190 |
+
break;
|
191 |
+
}
|
192 |
+
case 'PLANET': { // PLANET
|
193 |
+
$xdim = 0.508; // Nominal value for X-dim (bar width) in mm (spec.)
|
194 |
+
$bpi = 22; // Bars per inch
|
195 |
+
// Ratio of Nominal value for width of spaces in mm / Nominal value for X-dim (bar width) in mm based on bars per inch
|
196 |
+
$this->gapwidth = ((25.4 / $bpi) - $xdim) / $xdim;
|
197 |
+
$arrcode = $this->barcode_postnet($code, true);
|
198 |
+
$arrcode['nom-X'] = $xdim;
|
199 |
+
$arrcode['nom-H'] = 3.175; // Nominal value for Height of Full bar in mm (spec.)
|
200 |
+
$arrcode['quietL'] = 3.175; // LEFT Quiet margin = mm (?spec.)
|
201 |
+
$arrcode['quietR'] = 3.175; // RIGHT Quiet margin = mm (?spec.)
|
202 |
+
$arrcode['quietTB'] = 1.016; // TOP/BOTTOM Quiet margin = mm (?spec.)
|
203 |
+
break;
|
204 |
+
}
|
205 |
+
|
206 |
+
case 'C93': { // CODE 93 - USS-93
|
207 |
+
$arrcode = $this->barcode_code93($code);
|
208 |
+
if ($arrcode == false) {
|
209 |
+
break;
|
210 |
+
}
|
211 |
+
$arrcode['nom-X'] = 0.381; // Nominal value for X-dim (bar width) in mm (2 X min. spec.)
|
212 |
+
$arrcode['nom-H'] = 10; // Nominal value for Height of Full bar in mm (non-spec.)
|
213 |
+
$arrcode['lightmL'] = 10; // LEFT light margin = x X-dim (spec.)
|
214 |
+
$arrcode['lightmR'] = 10; // RIGHT light margin = x X-dim (spec.)
|
215 |
+
$arrcode['lightTB'] = 0; // TOP/BOTTOM light margin = x X-dim (non-spec.)
|
216 |
+
break;
|
217 |
+
}
|
218 |
+
case 'CODE11': { // CODE 11
|
219 |
+
if ($pr > 0) {
|
220 |
+
$this->print_ratio = $pr;
|
221 |
+
} else {
|
222 |
+
$this->print_ratio = 3;
|
223 |
+
} // spec: Pr= 1:2.24 - 1:3.5
|
224 |
+
$arrcode = $this->barcode_code11($code);
|
225 |
+
if ($arrcode == false) {
|
226 |
+
break;
|
227 |
+
}
|
228 |
+
$arrcode['nom-X'] = 0.381; // Nominal value for X-dim (bar width) in mm (2 X min. spec.)
|
229 |
+
$arrcode['nom-H'] = 10; // Nominal value for Height of Full bar in mm (non-spec.)
|
230 |
+
$arrcode['lightmL'] = 10; // LEFT light margin = x X-dim (spec.)
|
231 |
+
$arrcode['lightmR'] = 10; // RIGHT light margin = x X-dim (spec.)
|
232 |
+
$arrcode['lightTB'] = 0; // TOP/BOTTOM light margin = x X-dim (non-spec.)
|
233 |
+
break;
|
234 |
+
}
|
235 |
+
case 'MSI': // MSI (Variation of Plessey code)
|
236 |
+
case 'MSI+': { // MSI + CHECKSUM (modulo 11)
|
237 |
+
if (strtoupper($type) == 'MSI') {
|
238 |
+
$arrcode = $this->barcode_msi($code, false);
|
239 |
+
}
|
240 |
+
if (strtoupper($type) == 'MSI+') {
|
241 |
+
$arrcode = $this->barcode_msi($code, true);
|
242 |
+
}
|
243 |
+
if ($arrcode == false) {
|
244 |
+
break;
|
245 |
+
}
|
246 |
+
$arrcode['nom-X'] = 0.381; // Nominal value for X-dim (bar width) in mm (2 X min. spec.)
|
247 |
+
$arrcode['nom-H'] = 10; // Nominal value for Height of Full bar in mm (non-spec.)
|
248 |
+
$arrcode['lightmL'] = 12; // LEFT light margin = x X-dim (spec.)
|
249 |
+
$arrcode['lightmR'] = 12; // RIGHT light margin = x X-dim (spec.)
|
250 |
+
$arrcode['lightTB'] = 0; // TOP/BOTTOM light margin = x X-dim (non-spec.)
|
251 |
+
break;
|
252 |
+
}
|
253 |
+
case 'CODABAR': { // CODABAR
|
254 |
+
if ($pr > 0) {
|
255 |
+
$this->print_ratio = $pr;
|
256 |
+
} else {
|
257 |
+
$this->print_ratio = 2.5;
|
258 |
+
} // spec: Pr= 1:2 - 1:3 (>2.2 if X<0.50)
|
259 |
+
if (strtoupper($type) == 'CODABAR') {
|
260 |
+
$arrcode = $this->barcode_codabar($code);
|
261 |
+
}
|
262 |
+
if ($arrcode == false) {
|
263 |
+
break;
|
264 |
+
}
|
265 |
+
$arrcode['nom-X'] = 0.381; // Nominal value for X-dim (bar width) in mm (2 X min. spec.)
|
266 |
+
$arrcode['nom-H'] = 10; // Nominal value for Height of Full bar in mm (non-spec.)
|
267 |
+
$arrcode['lightmL'] = 10; // LEFT light margin = x X-dim (spec.)
|
268 |
+
$arrcode['lightmR'] = 10; // RIGHT light margin = x X-dim (spec.)
|
269 |
+
$arrcode['lightTB'] = 0; // TOP/BOTTOM light margin = x X-dim (non-spec.)
|
270 |
+
break;
|
271 |
+
}
|
272 |
+
case 'C128A': // CODE 128 A
|
273 |
+
case 'C128B': // CODE 128 B
|
274 |
+
case 'C128C': // CODE 128 C
|
275 |
+
case 'EAN128A': // EAN 128 A
|
276 |
+
case 'EAN128B': // EAN 128 B
|
277 |
+
case 'EAN128C': { // EAN 128 C
|
278 |
+
if (strtoupper($type) == 'C128A') {
|
279 |
+
$arrcode = $this->barcode_c128($code, 'A');
|
280 |
+
}
|
281 |
+
if (strtoupper($type) == 'C128B') {
|
282 |
+
$arrcode = $this->barcode_c128($code, 'B');
|
283 |
+
}
|
284 |
+
if (strtoupper($type) == 'C128C') {
|
285 |
+
$arrcode = $this->barcode_c128($code, 'C');
|
286 |
+
}
|
287 |
+
if (strtoupper($type) == 'EAN128A') {
|
288 |
+
$arrcode = $this->barcode_c128($code, 'A', true);
|
289 |
+
}
|
290 |
+
if (strtoupper($type) == 'EAN128B') {
|
291 |
+
$arrcode = $this->barcode_c128($code, 'B', true);
|
292 |
+
}
|
293 |
+
if (strtoupper($type) == 'EAN128C') {
|
294 |
+
$arrcode = $this->barcode_c128($code, 'C', true);
|
295 |
+
}
|
296 |
+
if ($arrcode == false) {
|
297 |
+
break;
|
298 |
+
}
|
299 |
+
$arrcode['nom-X'] = 0.381; // Nominal value for X-dim (bar width) in mm (2 X min. spec.)
|
300 |
+
$arrcode['nom-H'] = 10; // Nominal value for Height of Full bar in mm (non-spec.)
|
301 |
+
$arrcode['lightmL'] = 10; // LEFT light margin = x X-dim (spec.)
|
302 |
+
$arrcode['lightmR'] = 10; // RIGHT light margin = x X-dim (spec.)
|
303 |
+
$arrcode['lightTB'] = 0; // TOP/BOTTOM light margin = x X-dim (non-spec.)
|
304 |
+
break;
|
305 |
+
}
|
306 |
+
case 'C39': // CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.
|
307 |
+
case 'C39+': // CODE 39 with checksum
|
308 |
+
case 'C39E': // CODE 39 EXTENDED
|
309 |
+
case 'C39E+': { // CODE 39 EXTENDED + CHECKSUM
|
310 |
+
if ($pr > 0) {
|
311 |
+
$this->print_ratio = $pr;
|
312 |
+
} else {
|
313 |
+
$this->print_ratio = 2.5;
|
314 |
+
} // spec: Pr= 1:2 - 1:3 (>2.2 if X<0.50)
|
315 |
+
$code = str_replace(chr(194) . chr(160), ' ', $code); // mPDF 5.3.95 (for utf-8 encoded)
|
316 |
+
$code = str_replace(chr(160), ' ', $code); // mPDF 5.3.95 (for win-1252)
|
317 |
+
if (strtoupper($type) == 'C39') {
|
318 |
+
$arrcode = $this->barcode_code39($code, false, false);
|
319 |
+
}
|
320 |
+
if (strtoupper($type) == 'C39+') {
|
321 |
+
$arrcode = $this->barcode_code39($code, false, true);
|
322 |
+
}
|
323 |
+
if (strtoupper($type) == 'C39E') {
|
324 |
+
$arrcode = $this->barcode_code39($code, true, false);
|
325 |
+
}
|
326 |
+
if (strtoupper($type) == 'C39E+') {
|
327 |
+
$arrcode = $this->barcode_code39($code, true, true);
|
328 |
+
}
|
329 |
+
if ($arrcode == false) {
|
330 |
+
break;
|
331 |
+
}
|
332 |
+
$arrcode['nom-X'] = 0.381; // Nominal value for X-dim (bar width) in mm (2 X min. spec.)
|
333 |
+
$arrcode['nom-H'] = 10; // Nominal value for Height of Full bar in mm (non-spec.)
|
334 |
+
$arrcode['lightmL'] = 10; // LEFT light margin = x X-dim (spec.)
|
335 |
+
$arrcode['lightmR'] = 10; // RIGHT light margin = x X-dim (spec.)
|
336 |
+
$arrcode['lightTB'] = 0; // TOP/BOTTOM light margin = x X-dim (non-spec.)
|
337 |
+
break;
|
338 |
+
}
|
339 |
+
case 'S25': // Standard 2 of 5
|
340 |
+
case 'S25+': { // Standard 2 of 5 + CHECKSUM
|
341 |
+
if ($pr > 0) {
|
342 |
+
$this->print_ratio = $pr;
|
343 |
+
} else {
|
344 |
+
$this->print_ratio = 3;
|
345 |
+
} // spec: Pr=1:3/1:4.5
|
346 |
+
if (strtoupper($type) == 'S25') {
|
347 |
+
$arrcode = $this->barcode_s25($code, false);
|
348 |
+
}
|
349 |
+
if (strtoupper($type) == 'S25+') {
|
350 |
+
$arrcode = $this->barcode_s25($code, true);
|
351 |
+
}
|
352 |
+
if ($arrcode == false) {
|
353 |
+
break;
|
354 |
+
}
|
355 |
+
$arrcode['nom-X'] = 0.381; // Nominal value for X-dim (bar width) in mm (2 X min. spec.)
|
356 |
+
$arrcode['nom-H'] = 10; // Nominal value for Height of Full bar in mm (non-spec.)
|
357 |
+
$arrcode['lightmL'] = 10; // LEFT light margin = x X-dim (spec.)
|
358 |
+
$arrcode['lightmR'] = 10; // RIGHT light margin = x X-dim (spec.)
|
359 |
+
$arrcode['lightTB'] = 0; // TOP/BOTTOM light margin = x X-dim (non-spec.)
|
360 |
+
break;
|
361 |
+
}
|
362 |
+
case 'I25': // Interleaved 2 of 5
|
363 |
+
case 'I25+': { // Interleaved 2 of 5 + CHECKSUM
|
364 |
+
if ($pr > 0) {
|
365 |
+
$this->print_ratio = $pr;
|
366 |
+
} else {
|
367 |
+
$this->print_ratio = 2.5;
|
368 |
+
} // spec: Pr= 1:2 - 1:3 (>2.2 if X<0.50)
|
369 |
+
if (strtoupper($type) == 'I25') {
|
370 |
+
$arrcode = $this->barcode_i25($code, false);
|
371 |
+
}
|
372 |
+
if (strtoupper($type) == 'I25+') {
|
373 |
+
$arrcode = $this->barcode_i25($code, true);
|
374 |
+
}
|
375 |
+
if ($arrcode == false) {
|
376 |
+
break;
|
377 |
+
}
|
378 |
+
$arrcode['nom-X'] = 0.381; // Nominal value for X-dim (bar width) in mm (2 X min. spec.)
|
379 |
+
$arrcode['nom-H'] = 10; // Nominal value for Height of Full bar in mm (non-spec.)
|
380 |
+
$arrcode['lightmL'] = 10; // LEFT light margin = x X-dim (spec.)
|
381 |
+
$arrcode['lightmR'] = 10; // RIGHT light margin = x X-dim (spec.)
|
382 |
+
$arrcode['lightTB'] = 0; // TOP/BOTTOM light margin = x X-dim (non-spec.)
|
383 |
+
break;
|
384 |
+
}
|
385 |
+
case 'I25B': // Interleaved 2 of 5 + Bearer bars
|
386 |
+
case 'I25B+': { // Interleaved 2 of 5 + CHECKSUM + Bearer bars
|
387 |
+
if ($pr > 0) {
|
388 |
+
$this->print_ratio = $pr;
|
389 |
+
} else {
|
390 |
+
$this->print_ratio = 2.5;
|
391 |
+
} // spec: Pr= 1:2 - 1:3 (>2.2 if X<0.50)
|
392 |
+
if (strtoupper($type) == 'I25B') {
|
393 |
+
$arrcode = $this->barcode_i25($code, false);
|
394 |
+
}
|
395 |
+
if (strtoupper($type) == 'I25B+') {
|
396 |
+
$arrcode = $this->barcode_i25($code, true);
|
397 |
+
}
|
398 |
+
if ($arrcode == false) {
|
399 |
+
break;
|
400 |
+
}
|
401 |
+
$arrcode['nom-X'] = 0.381; // Nominal value for X-dim (bar width) in mm (2 X min. spec.)
|
402 |
+
$arrcode['nom-H'] = 10; // Nominal value for Height of Full bar in mm (non-spec.)
|
403 |
+
$arrcode['lightmL'] = 10; // LEFT light margin = x X-dim (spec.)
|
404 |
+
$arrcode['lightmR'] = 10; // RIGHT light margin = x X-dim (spec.)
|
405 |
+
$arrcode['lightTB'] = 2; // TOP/BOTTOM light margin = x X-dim (non-spec.) - used for bearer bars
|
406 |
+
break;
|
407 |
+
}
|
408 |
+
default: {
|
409 |
+
$this->barcode_array = false;
|
410 |
+
}
|
411 |
+
}
|
412 |
+
$this->barcode_array = $arrcode;
|
413 |
+
}
|
414 |
+
|
415 |
+
/**
|
416 |
+
* CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.
|
417 |
+
*/
|
418 |
+
protected function barcode_code39($code, $extended = false, $checksum = false)
|
419 |
+
{
|
420 |
+
$chr['0'] = '111221211';
|
421 |
+
$chr['1'] = '211211112';
|
422 |
+
$chr['2'] = '112211112';
|
423 |
+
$chr['3'] = '212211111';
|
424 |
+
$chr['4'] = '111221112';
|
425 |
+
$chr['5'] = '211221111';
|
426 |
+
$chr['6'] = '112221111';
|
427 |
+
$chr['7'] = '111211212';
|
428 |
+
$chr['8'] = '211211211';
|
429 |
+
$chr['9'] = '112211211';
|
430 |
+
$chr['A'] = '211112112';
|
431 |
+
$chr['B'] = '112112112';
|
432 |
+
$chr['C'] = '212112111';
|
433 |
+
$chr['D'] = '111122112';
|
434 |
+
$chr['E'] = '211122111';
|
435 |
+
$chr['F'] = '112122111';
|
436 |
+
$chr['G'] = '111112212';
|
437 |
+
$chr['H'] = '211112211';
|
438 |
+
$chr['I'] = '112112211';
|
439 |
+
$chr['J'] = '111122211';
|
440 |
+
$chr['K'] = '211111122';
|
441 |
+
$chr['L'] = '112111122';
|
442 |
+
$chr['M'] = '212111121';
|
443 |
+
$chr['N'] = '111121122';
|
444 |
+
$chr['O'] = '211121121';
|
445 |
+
$chr['P'] = '112121121';
|
446 |
+
$chr['Q'] = '111111222';
|
447 |
+
$chr['R'] = '211111221';
|
448 |
+
$chr['S'] = '112111221';
|
449 |
+
$chr['T'] = '111121221';
|
450 |
+
$chr['U'] = '221111112';
|
451 |
+
$chr['V'] = '122111112';
|
452 |
+
$chr['W'] = '222111111';
|
453 |
+
$chr['X'] = '121121112';
|
454 |
+
$chr['Y'] = '221121111';
|
455 |
+
$chr['Z'] = '122121111';
|
456 |
+
$chr['-'] = '121111212';
|
457 |
+
$chr['.'] = '221111211';
|
458 |
+
$chr[' '] = '122111211';
|
459 |
+
$chr['$'] = '121212111';
|
460 |
+
$chr['/'] = '121211121';
|
461 |
+
$chr['+'] = '121112121';
|
462 |
+
$chr['%'] = '111212121';
|
463 |
+
$chr['*'] = '121121211';
|
464 |
+
|
465 |
+
$code = strtoupper($code);
|
466 |
+
$checkdigit = '';
|
467 |
+
if ($extended) {
|
468 |
+
// extended mode
|
469 |
+
$code = $this->encode_code39_ext($code);
|
470 |
+
}
|
471 |
+
if ($code === false) {
|
472 |
+
return false;
|
473 |
+
}
|
474 |
+
if ($checksum) {
|
475 |
+
// checksum
|
476 |
+
$checkdigit = $this->checksum_code39($code);
|
477 |
+
$code .= $checkdigit;
|
478 |
+
}
|
479 |
+
// add start and stop codes
|
480 |
+
$code = '*' . $code . '*';
|
481 |
+
|
482 |
+
$bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
|
483 |
+
$k = 0;
|
484 |
+
$clen = strlen($code);
|
485 |
+
for ($i = 0; $i < $clen; ++$i) {
|
486 |
+
$char = $code[$i];
|
487 |
+
if (!isset($chr[$char])) {
|
488 |
+
// invalid character
|
489 |
+
return false;
|
490 |
+
}
|
491 |
+
for ($j = 0; $j < 9; ++$j) {
|
492 |
+
if (($j % 2) == 0) {
|
493 |
+
$t = true; // bar
|
494 |
+
} else {
|
495 |
+
$t = false; // space
|
496 |
+
}
|
497 |
+
$x = $chr[$char][$j];
|
498 |
+
if ($x == 2) {
|
499 |
+
$w = $this->print_ratio;
|
500 |
+
} else {
|
501 |
+
$w = 1;
|
502 |
+
}
|
503 |
+
|
504 |
+
$bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0);
|
505 |
+
$bararray['maxw'] += $w;
|
506 |
+
++$k;
|
507 |
+
}
|
508 |
+
$bararray['bcode'][$k] = array('t' => false, 'w' => 1, 'h' => 1, 'p' => 0);
|
509 |
+
$bararray['maxw'] += 1;
|
510 |
+
++$k;
|
511 |
+
}
|
512 |
+
$bararray['checkdigit'] = $checkdigit;
|
513 |
+
return $bararray;
|
514 |
+
}
|
515 |
+
|
516 |
+
/**
|
517 |
+
* Encode a string to be used for CODE 39 Extended mode.
|
518 |
+
*/
|
519 |
+
protected function encode_code39_ext($code)
|
520 |
+
{
|
521 |
+
$encode = array(
|
522 |
+
chr(0) => '%U', chr(1) => '$A', chr(2) => '$B', chr(3) => '$C',
|
523 |
+
chr(4) => '$D', chr(5) => '$E', chr(6) => '$F', chr(7) => '$G',
|
524 |
+
chr(8) => '$H', chr(9) => '$I', chr(10) => '$J', chr(11) => '£K',
|
525 |
+
chr(12) => '$L', chr(13) => '$M', chr(14) => '$N', chr(15) => '$O',
|
526 |
+
chr(16) => '$P', chr(17) => '$Q', chr(18) => '$R', chr(19) => '$S',
|
527 |
+
chr(20) => '$T', chr(21) => '$U', chr(22) => '$V', chr(23) => '$W',
|
528 |
+
chr(24) => '$X', chr(25) => '$Y', chr(26) => '$Z', chr(27) => '%A',
|
529 |
+
chr(28) => '%B', chr(29) => '%C', chr(30) => '%D', chr(31) => '%E',
|
530 |
+
chr(32) => ' ', chr(33) => '/A', chr(34) => '/B', chr(35) => '/C',
|
531 |
+
chr(36) => '/D', chr(37) => '/E', chr(38) => '/F', chr(39) => '/G',
|
532 |
+
chr(40) => '/H', chr(41) => '/I', chr(42) => '/J', chr(43) => '/K',
|
533 |
+
chr(44) => '/L', chr(45) => '-', chr(46) => '.', chr(47) => '/O',
|
534 |
+
chr(48) => '0', chr(49) => '1', chr(50) => '2', chr(51) => '3',
|
535 |
+
chr(52) => '4', chr(53) => '5', chr(54) => '6', chr(55) => '7',
|
536 |
+
chr(56) => '8', chr(57) => '9', chr(58) => '/Z', chr(59) => '%F',
|
537 |
+
chr(60) => '%G', chr(61) => '%H', chr(62) => '%I', chr(63) => '%J',
|
538 |
+
chr(64) => '%V', chr(65) => 'A', chr(66) => 'B', chr(67) => 'C',
|
539 |
+
chr(68) => 'D', chr(69) => 'E', chr(70) => 'F', chr(71) => 'G',
|
540 |
+
chr(72) => 'H', chr(73) => 'I', chr(74) => 'J', chr(75) => 'K',
|
541 |
+
chr(76) => 'L', chr(77) => 'M', chr(78) => 'N', chr(79) => 'O',
|
542 |
+
chr(80) => 'P', chr(81) => 'Q', chr(82) => 'R', chr(83) => 'S',
|
543 |
+
chr(84) => 'T', chr(85) => 'U', chr(86) => 'V', chr(87) => 'W',
|
544 |
+
chr(88) => 'X', chr(89) => 'Y', chr(90) => 'Z', chr(91) => '%K',
|
545 |
+
chr(92) => '%L', chr(93) => '%M', chr(94) => '%N', chr(95) => '%O',
|
546 |
+
chr(96) => '%W', chr(97) => '+A', chr(98) => '+B', chr(99) => '+C',
|
547 |
+
chr(100) => '+D', chr(101) => '+E', chr(102) => '+F', chr(103) => '+G',
|
548 |
+
chr(104) => '+H', chr(105) => '+I', chr(106) => '+J', chr(107) => '+K',
|
549 |
+
chr(108) => '+L', chr(109) => '+M', chr(110) => '+N', chr(111) => '+O',
|
550 |
+
chr(112) => '+P', chr(113) => '+Q', chr(114) => '+R', chr(115) => '+S',
|
551 |
+
chr(116) => '+T', chr(117) => '+U', chr(118) => '+V', chr(119) => '+W',
|
552 |
+
chr(120) => '+X', chr(121) => '+Y', chr(122) => '+Z', chr(123) => '%P',
|
553 |
+
chr(124) => '%Q', chr(125) => '%R', chr(126) => '%S', chr(127) => '%T');
|
554 |
+
$code_ext = '';
|
555 |
+
$clen = strlen($code);
|
556 |
+
for ($i = 0; $i < $clen; ++$i) {
|
557 |
+
if (ord($code[$i]) > 127) {
|
558 |
+
return false;
|
559 |
+
}
|
560 |
+
$code_ext .= $encode[$code[$i]];
|
561 |
+
}
|
562 |
+
return $code_ext;
|
563 |
+
}
|
564 |
+
|
565 |
+
/**
|
566 |
+
* Calculate CODE 39 checksum (modulo 43).
|
567 |
+
*/
|
568 |
+
protected function checksum_code39($code)
|
569 |
+
{
|
570 |
+
$chars = array(
|
571 |
+
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
572 |
+
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
|
573 |
+
'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
|
574 |
+
'W', 'X', 'Y', 'Z', '-', '.', ' ', '$', '/', '+', '%');
|
575 |
+
$sum = 0;
|
576 |
+
$clen = strlen($code);
|
577 |
+
for ($i = 0; $i < $clen; ++$i) {
|
578 |
+
$k = array_keys($chars, $code[$i]);
|
579 |
+
$sum += $k[0];
|
580 |
+
}
|
581 |
+
$j = ($sum % 43);
|
582 |
+
return $chars[$j];
|
583 |
+
}
|
584 |
+
|
585 |
+
/**
|
586 |
+
* CODE 93 - USS-93
|
587 |
+
* Compact code similar to Code 39
|
588 |
+
*/
|
589 |
+
protected function barcode_code93($code)
|
590 |
+
{
|
591 |
+
$chr[48] = '131112'; // 0
|
592 |
+
$chr[49] = '111213'; // 1
|
593 |
+
$chr[50] = '111312'; // 2
|
594 |
+
$chr[51] = '111411'; // 3
|
595 |
+
$chr[52] = '121113'; // 4
|
596 |
+
$chr[53] = '121212'; // 5
|
597 |
+
$chr[54] = '121311'; // 6
|
598 |
+
$chr[55] = '111114'; // 7
|
599 |
+
$chr[56] = '131211'; // 8
|
600 |
+
$chr[57] = '141111'; // 9
|
601 |
+
$chr[65] = '211113'; // A
|
602 |
+
$chr[66] = '211212'; // B
|
603 |
+
$chr[67] = '211311'; // C
|
604 |
+
$chr[68] = '221112'; // D
|
605 |
+
$chr[69] = '221211'; // E
|
606 |
+
$chr[70] = '231111'; // F
|
607 |
+
$chr[71] = '112113'; // G
|
608 |
+
$chr[72] = '112212'; // H
|
609 |
+
$chr[73] = '112311'; // I
|
610 |
+
$chr[74] = '122112'; // J
|
611 |
+
$chr[75] = '132111'; // K
|
612 |
+
$chr[76] = '111123'; // L
|
613 |
+
$chr[77] = '111222'; // M
|
614 |
+
$chr[78] = '111321'; // N
|
615 |
+
$chr[79] = '121122'; // O
|
616 |
+
$chr[80] = '131121'; // P
|
617 |
+
$chr[81] = '212112'; // Q
|
618 |
+
$chr[82] = '212211'; // R
|
619 |
+
$chr[83] = '211122'; // S
|
620 |
+
$chr[84] = '211221'; // T
|
621 |
+
$chr[85] = '221121'; // U
|
622 |
+
$chr[86] = '222111'; // V
|
623 |
+
$chr[87] = '112122'; // W
|
624 |
+
$chr[88] = '112221'; // X
|
625 |
+
$chr[89] = '122121'; // Y
|
626 |
+
$chr[90] = '123111'; // Z
|
627 |
+
$chr[45] = '121131'; // -
|
628 |
+
$chr[46] = '311112'; // .
|
629 |
+
$chr[32] = '311211'; //
|
630 |
+
$chr[36] = '321111'; // $
|
631 |
+
$chr[47] = '112131'; // /
|
632 |
+
$chr[43] = '113121'; // +
|
633 |
+
$chr[37] = '211131'; // %
|
634 |
+
$chr[128] = '121221'; // ($)
|
635 |
+
$chr[129] = '311121'; // (/)
|
636 |
+
$chr[130] = '122211'; // (+)
|
637 |
+
$chr[131] = '312111'; // (%)
|
638 |
+
$chr[42] = '111141'; // start-stop
|
639 |
+
$code = strtoupper($code);
|
640 |
+
$encode = array(
|
641 |
+
chr(0) => chr(131) . 'U', chr(1) => chr(128) . 'A', chr(2) => chr(128) . 'B', chr(3) => chr(128) . 'C',
|
642 |
+
chr(4) => chr(128) . 'D', chr(5) => chr(128) . 'E', chr(6) => chr(128) . 'F', chr(7) => chr(128) . 'G',
|
643 |
+
chr(8) => chr(128) . 'H', chr(9) => chr(128) . 'I', chr(10) => chr(128) . 'J', chr(11) => '£K',
|
644 |
+
chr(12) => chr(128) . 'L', chr(13) => chr(128) . 'M', chr(14) => chr(128) . 'N', chr(15) => chr(128) . 'O',
|
645 |
+
chr(16) => chr(128) . 'P', chr(17) => chr(128) . 'Q', chr(18) => chr(128) . 'R', chr(19) => chr(128) . 'S',
|
646 |
+
chr(20) => chr(128) . 'T', chr(21) => chr(128) . 'U', chr(22) => chr(128) . 'V', chr(23) => chr(128) . 'W',
|
647 |
+
chr(24) => chr(128) . 'X', chr(25) => chr(128) . 'Y', chr(26) => chr(128) . 'Z', chr(27) => chr(131) . 'A',
|
648 |
+
chr(28) => chr(131) . 'B', chr(29) => chr(131) . 'C', chr(30) => chr(131) . 'D', chr(31) => chr(131) . 'E',
|
649 |
+
chr(32) => ' ', chr(33) => chr(129) . 'A', chr(34) => chr(129) . 'B', chr(35) => chr(129) . 'C',
|
650 |
+
chr(36) => chr(129) . 'D', chr(37) => chr(129) . 'E', chr(38) => chr(129) . 'F', chr(39) => chr(129) . 'G',
|
651 |
+
chr(40) => chr(129) . 'H', chr(41) => chr(129) . 'I', chr(42) => chr(129) . 'J', chr(43) => chr(129) . 'K',
|
652 |
+
chr(44) => chr(129) . 'L', chr(45) => '-', chr(46) => '.', chr(47) => chr(129) . 'O',
|
653 |
+
chr(48) => '0', chr(49) => '1', chr(50) => '2', chr(51) => '3',
|
654 |
+
chr(52) => '4', chr(53) => '5', chr(54) => '6', chr(55) => '7',
|
655 |
+
chr(56) => '8', chr(57) => '9', chr(58) => chr(129) . 'Z', chr(59) => chr(131) . 'F',
|
656 |
+
chr(60) => chr(131) . 'G', chr(61) => chr(131) . 'H', chr(62) => chr(131) . 'I', chr(63) => chr(131) . 'J',
|
657 |
+
chr(64) => chr(131) . 'V', chr(65) => 'A', chr(66) => 'B', chr(67) => 'C',
|
658 |
+
chr(68) => 'D', chr(69) => 'E', chr(70) => 'F', chr(71) => 'G',
|
659 |
+
chr(72) => 'H', chr(73) => 'I', chr(74) => 'J', chr(75) => 'K',
|
660 |
+
chr(76) => 'L', chr(77) => 'M', chr(78) => 'N', chr(79) => 'O',
|
661 |
+
chr(80) => 'P', chr(81) => 'Q', chr(82) => 'R', chr(83) => 'S',
|
662 |
+
chr(84) => 'T', chr(85) => 'U', chr(86) => 'V', chr(87) => 'W',
|
663 |
+
chr(88) => 'X', chr(89) => 'Y', chr(90) => 'Z', chr(91) => chr(131) . 'K',
|
664 |
+
chr(92) => chr(131) . 'L', chr(93) => chr(131) . 'M', chr(94) => chr(131) . 'N', chr(95) => chr(131) . 'O',
|
665 |
+
chr(96) => chr(131) . 'W', chr(97) => chr(130) . 'A', chr(98) => chr(130) . 'B', chr(99) => chr(130) . 'C',
|
666 |
+
chr(100) => chr(130) . 'D', chr(101) => chr(130) . 'E', chr(102) => chr(130) . 'F', chr(103) => chr(130) . 'G',
|
667 |
+
chr(104) => chr(130) . 'H', chr(105) => chr(130) . 'I', chr(106) => chr(130) . 'J', chr(107) => chr(130) . 'K',
|
668 |
+
chr(108) => chr(130) . 'L', chr(109) => chr(130) . 'M', chr(110) => chr(130) . 'N', chr(111) => chr(130) . 'O',
|
669 |
+
chr(112) => chr(130) . 'P', chr(113) => chr(130) . 'Q', chr(114) => chr(130) . 'R', chr(115) => chr(130) . 'S',
|
670 |
+
chr(116) => chr(130) . 'T', chr(117) => chr(130) . 'U', chr(118) => chr(130) . 'V', chr(119) => chr(130) . 'W',
|
671 |
+
chr(120) => chr(130) . 'X', chr(121) => chr(130) . 'Y', chr(122) => chr(130) . 'Z', chr(123) => chr(131) . 'P',
|
672 |
+
chr(124) => chr(131) . 'Q', chr(125) => chr(131) . 'R', chr(126) => chr(131) . 'S', chr(127) => chr(131) . 'T');
|
673 |
+
$code_ext = '';
|
674 |
+
$clen = strlen($code);
|
675 |
+
for ($i = 0; $i < $clen; ++$i) {
|
676 |
+
if (ord($code{$i}) > 127) {
|
677 |
+
return false;
|
678 |
+
}
|
679 |
+
$code_ext .= $encode[$code{$i}];
|
680 |
+
}
|
681 |
+
// checksum
|
682 |
+
$code_ext .= $this->checksum_code93($code_ext);
|
683 |
+
// add start and stop codes
|
684 |
+
$code = '*' . $code_ext . '*';
|
685 |
+
$bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
|
686 |
+
$k = 0;
|
687 |
+
$clen = strlen($code);
|
688 |
+
for ($i = 0; $i < $clen; ++$i) {
|
689 |
+
$char = ord($code{$i});
|
690 |
+
if (!isset($chr[$char])) {
|
691 |
+
// invalid character
|
692 |
+
return false;
|
693 |
+
}
|
694 |
+
for ($j = 0; $j < 6; ++$j) {
|
695 |
+
if (($j % 2) == 0) {
|
696 |
+
$t = true; // bar
|
697 |
+
} else {
|
698 |
+
$t = false; // space
|
699 |
+
}
|
700 |
+
$w = $chr[$char]{$j};
|
701 |
+
$bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0);
|
702 |
+
$bararray['maxw'] += $w;
|
703 |
+
++$k;
|
704 |
+
}
|
705 |
+
}
|
706 |
+
$bararray['bcode'][$k] = array('t' => true, 'w' => 1, 'h' => 1, 'p' => 0);
|
707 |
+
$bararray['maxw'] += 1;
|
708 |
+
++$k;
|
709 |
+
return $bararray;
|
710 |
+
}
|
711 |
+
|
712 |
+
/**
|
713 |
+
* Calculate CODE 93 checksum (modulo 47).
|
714 |
+
*/
|
715 |
+
protected function checksum_code93($code)
|
716 |
+
{
|
717 |
+
$chars = array(
|
718 |
+
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
719 |
+
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
|
720 |
+
'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
|
721 |
+
'W', 'X', 'Y', 'Z', '-', '.', ' ', '$', '/', '+', '%',
|
722 |
+
'<', '=', '>', '?');
|
723 |
+
// translate special characters
|
724 |
+
$code = strtr($code, chr(128) . chr(131) . chr(129) . chr(130), '<=>?');
|
725 |
+
$len = strlen($code);
|
726 |
+
// calculate check digit C
|
727 |
+
$p = 1;
|
728 |
+
$check = 0;
|
729 |
+
for ($i = ($len - 1); $i >= 0; --$i) {
|
730 |
+
$k = array_keys($chars, $code{$i});
|
731 |
+
$check += ($k[0] * $p);
|
732 |
+
++$p;
|
733 |
+
if ($p > 20) {
|
734 |
+
$p = 1;
|
735 |
+
}
|
736 |
+
}
|
737 |
+
$check %= 47;
|
738 |
+
$c = $chars[$check];
|
739 |
+
$code .= $c;
|
740 |
+
// calculate check digit K
|
741 |
+
$p = 1;
|
742 |
+
$check = 0;
|
743 |
+
for ($i = $len; $i >= 0; --$i) {
|
744 |
+
$k = array_keys($chars, $code{$i});
|
745 |
+
$check += ($k[0] * $p);
|
746 |
+
++$p;
|
747 |
+
if ($p > 15) {
|
748 |
+
$p = 1;
|
749 |
+
}
|
750 |
+
}
|
751 |
+
$check %= 47;
|
752 |
+
$k = $chars[$check];
|
753 |
+
$checksum = $c . $k;
|
754 |
+
// resto respecial characters
|
755 |
+
$checksum = strtr($checksum, '<=>?', chr(128) . chr(131) . chr(129) . chr(130));
|
756 |
+
return $checksum;
|
757 |
+
}
|
758 |
+
|
759 |
+
/**
|
760 |
+
* Checksum for standard 2 of 5 barcodes.
|
761 |
+
*/
|
762 |
+
protected function checksum_s25($code)
|
763 |
+
{
|
764 |
+
$len = strlen($code);
|
765 |
+
$sum = 0;
|
766 |
+
for ($i = 0; $i < $len; $i+=2) {
|
767 |
+
$sum += $code[$i];
|
768 |
+
}
|
769 |
+
$sum *= 3;
|
770 |
+
for ($i = 1; $i < $len; $i+=2) {
|
771 |
+
$sum += ($code[$i]);
|
772 |
+
}
|
773 |
+
$r = $sum % 10;
|
774 |
+
if ($r > 0) {
|
775 |
+
$r = (10 - $r);
|
776 |
+
}
|
777 |
+
return $r;
|
778 |
+
}
|
779 |
+
|
780 |
+
/**
|
781 |
+
* MSI.
|
782 |
+
* Variation of Plessey code, with similar applications
|
783 |
+
* Contains digits (0 to 9) and encodes the data only in the width of bars.
|
784 |
+
*/
|
785 |
+
protected function barcode_msi($code, $checksum = false)
|
786 |
+
{
|
787 |
+
$chr['0'] = '100100100100';
|
788 |
+
$chr['1'] = '100100100110';
|
789 |
+
$chr['2'] = '100100110100';
|
790 |
+
$chr['3'] = '100100110110';
|
791 |
+
$chr['4'] = '100110100100';
|
792 |
+
$chr['5'] = '100110100110';
|
793 |
+
$chr['6'] = '100110110100';
|
794 |
+
$chr['7'] = '100110110110';
|
795 |
+
$chr['8'] = '110100100100';
|
796 |
+
$chr['9'] = '110100100110';
|
797 |
+
$chr['A'] = '110100110100';
|
798 |
+
$chr['B'] = '110100110110';
|
799 |
+
$chr['C'] = '110110100100';
|
800 |
+
$chr['D'] = '110110100110';
|
801 |
+
$chr['E'] = '110110110100';
|
802 |
+
$chr['F'] = '110110110110';
|
803 |
+
$checkdigit = '';
|
804 |
+
if ($checksum) {
|
805 |
+
// add checksum
|
806 |
+
$clen = strlen($code);
|
807 |
+
$p = 2;
|
808 |
+
$check = 0;
|
809 |
+
for ($i = ($clen - 1); $i >= 0; --$i) {
|
810 |
+
$check += (hexdec($code[$i]) * $p);
|
811 |
+
++$p;
|
812 |
+
if ($p > 7) {
|
813 |
+
$p = 2;
|
814 |
+
}
|
815 |
+
}
|
816 |
+
$check %= 11;
|
817 |
+
if ($check > 0) {
|
818 |
+
$check = 11 - $check;
|
819 |
+
}
|
820 |
+
$code .= $check;
|
821 |
+
$checkdigit = $check;
|
822 |
+
}
|
823 |
+
$seq = '110'; // left guard
|
824 |
+
$clen = strlen($code);
|
825 |
+
for ($i = 0; $i < $clen; ++$i) {
|
826 |
+
$digit = $code[$i];
|
827 |
+
if (!isset($chr[$digit])) {
|
828 |
+
// invalid character
|
829 |
+
return false;
|
830 |
+
}
|
831 |
+
$seq .= $chr[$digit];
|
832 |
+
}
|
833 |
+
$seq .= '1001'; // right guard
|
834 |
+
$bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
|
835 |
+
$bararray['checkdigit'] = $checkdigit;
|
836 |
+
return $this->binseq_to_array($seq, $bararray);
|
837 |
+
}
|
838 |
+
|
839 |
+
/**
|
840 |
+
* Standard 2 of 5 barcodes.
|
841 |
+
* Used in airline ticket marking, photofinishing
|
842 |
+
* Contains digits (0 to 9) and encodes the data only in the width of bars.
|
843 |
+
*/
|
844 |
+
protected function barcode_s25($code, $checksum = false)
|
845 |
+
{
|
846 |
+
$chr['0'] = '10101110111010';
|
847 |
+
$chr['1'] = '11101010101110';
|
848 |
+
$chr['2'] = '10111010101110';
|
849 |
+
$chr['3'] = '11101110101010';
|
850 |
+
$chr['4'] = '10101110101110';
|
851 |
+
$chr['5'] = '11101011101010';
|
852 |
+
$chr['6'] = '10111011101010';
|
853 |
+
$chr['7'] = '10101011101110';
|
854 |
+
$chr['8'] = '10101110111010';
|
855 |
+
$chr['9'] = '10111010111010';
|
856 |
+
$checkdigit = '';
|
857 |
+
if ($checksum) {
|
858 |
+
// add checksum
|
859 |
+
$checkdigit = $this->checksum_s25($code);
|
860 |
+
$code .= $checkdigit;
|
861 |
+
}
|
862 |
+
if ((strlen($code) % 2) != 0) {
|
863 |
+
// add leading zero if code-length is odd
|
864 |
+
$code = '0' . $code;
|
865 |
+
}
|
866 |
+
$seq = '11011010';
|
867 |
+
$clen = strlen($code);
|
868 |
+
for ($i = 0; $i < $clen; ++$i) {
|
869 |
+
$digit = $code[$i];
|
870 |
+
if (!isset($chr[$digit])) {
|
871 |
+
// invalid character
|
872 |
+
return false;
|
873 |
+
}
|
874 |
+
$seq .= $chr[$digit];
|
875 |
+
}
|
876 |
+
$seq .= '1101011';
|
877 |
+
$bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
|
878 |
+
$bararray['checkdigit'] = $checkdigit;
|
879 |
+
return $this->binseq_to_array($seq, $bararray);
|
880 |
+
}
|
881 |
+
|
882 |
+
/**
|
883 |
+
* Convert binary barcode sequence to barcode array
|
884 |
+
*/
|
885 |
+
protected function binseq_to_array($seq, $bararray)
|
886 |
+
{
|
887 |
+
$len = strlen($seq);
|
888 |
+
$w = 0;
|
889 |
+
$k = 0;
|
890 |
+
for ($i = 0; $i < $len; ++$i) {
|
891 |
+
$w += 1;
|
892 |
+
if (($i == ($len - 1)) OR ( ($i < ($len - 1)) AND ( $seq[$i] != $seq[($i + 1)]))) {
|
893 |
+
if ($seq[$i] == '1') {
|
894 |
+
$t = true; // bar
|
895 |
+
} else {
|
896 |
+
$t = false; // space
|
897 |
+
}
|
898 |
+
$bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0);
|
899 |
+
$bararray['maxw'] += $w;
|
900 |
+
++$k;
|
901 |
+
$w = 0;
|
902 |
+
}
|
903 |
+
}
|
904 |
+
return $bararray;
|
905 |
+
}
|
906 |
+
|
907 |
+
/**
|
908 |
+
* Interleaved 2 of 5 barcodes.
|
909 |
+
* Compact numeric code, widely used in industry, air cargo
|
910 |
+
* Contains digits (0 to 9) and encodes the data in the width of both bars and spaces.
|
911 |
+
*/
|
912 |
+
protected function barcode_i25($code, $checksum = false)
|
913 |
+
{
|
914 |
+
$chr['0'] = '11221';
|
915 |
+
$chr['1'] = '21112';
|
916 |
+
$chr['2'] = '12112';
|
917 |
+
$chr['3'] = '22111';
|
918 |
+
$chr['4'] = '11212';
|
919 |
+
$chr['5'] = '21211';
|
920 |
+
$chr['6'] = '12211';
|
921 |
+
$chr['7'] = '11122';
|
922 |
+
$chr['8'] = '21121';
|
923 |
+
$chr['9'] = '12121';
|
924 |
+
$chr['A'] = '11';
|
925 |
+
$chr['Z'] = '21';
|
926 |
+
$checkdigit = '';
|
927 |
+
if ($checksum) {
|
928 |
+
// add checksum
|
929 |
+
$checkdigit = $this->checksum_s25($code);
|
930 |
+
$code .= $checkdigit;
|
931 |
+
}
|
932 |
+
if ((strlen($code) % 2) != 0) {
|
933 |
+
// add leading zero if code-length is odd
|
934 |
+
$code = '0' . $code;
|
935 |
+
}
|
936 |
+
// add start and stop codes
|
937 |
+
$code = 'AA' . strtolower($code) . 'ZA';
|
938 |
+
|
939 |
+
$bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
|
940 |
+
$k = 0;
|
941 |
+
$clen = strlen($code);
|
942 |
+
for ($i = 0; $i < $clen; $i = ($i + 2)) {
|
943 |
+
$char_bar = $code[$i];
|
944 |
+
$char_space = $code[$i + 1];
|
945 |
+
if ((!isset($chr[$char_bar])) OR ( !isset($chr[$char_space]))) {
|
946 |
+
// invalid character
|
947 |
+
return false;
|
948 |
+
}
|
949 |
+
// create a bar-space sequence
|
950 |
+
$seq = '';
|
951 |
+
$chrlen = strlen($chr[$char_bar]);
|
952 |
+
for ($s = 0; $s < $chrlen; $s++) {
|
953 |
+
$seq .= $chr[$char_bar][$s] . $chr[$char_space][$s];
|
954 |
+
}
|
955 |
+
$seqlen = strlen($seq);
|
956 |
+
for ($j = 0; $j < $seqlen; ++$j) {
|
957 |
+
if (($j % 2) == 0) {
|
958 |
+
$t = true; // bar
|
959 |
+
} else {
|
960 |
+
$t = false; // space
|
961 |
+
}
|
962 |
+
$x = $seq[$j];
|
963 |
+
if ($x == 2) {
|
964 |
+
$w = $this->print_ratio;
|
965 |
+
} else {
|
966 |
+
$w = 1;
|
967 |
+
}
|
968 |
+
|
969 |
+
$bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0);
|
970 |
+
$bararray['maxw'] += $w;
|
971 |
+
++$k;
|
972 |
+
}
|
973 |
+
}
|
974 |
+
$bararray['checkdigit'] = $checkdigit;
|
975 |
+
return $bararray;
|
976 |
+
}
|
977 |
+
|
978 |
+
/**
|
979 |
+
* C128 barcodes.
|
980 |
+
* Very capable code, excellent density, high reliability; in very wide use world-wide
|
981 |
+
*/
|
982 |
+
protected function barcode_c128($code, $type = 'B', $ean = false)
|
983 |
+
{
|
984 |
+
$code = strcode2utf($code); // mPDF 5.7.1 Allows e.g. <barcode code="5432
1068" type="C128A" />
|
985 |
+
$chr = array(
|
986 |
+
'212222', /* 00 */
|
987 |
+
'222122', /* 01 */
|
988 |
+
'222221', /* 02 */
|
989 |
+
'121223', /* 03 */
|
990 |
+
'121322', /* 04 */
|
991 |
+
'131222', /* 05 */
|
992 |
+
'122213', /* 06 */
|
993 |
+
'122312', /* 07 */
|
994 |
+
'132212', /* 08 */
|
995 |
+
'221213', /* 09 */
|
996 |
+
'221312', /* 10 */
|
997 |
+
'231212', /* 11 */
|
998 |
+
'112232', /* 12 */
|
999 |
+
'122132', /* 13 */
|
1000 |
+
'122231', /* 14 */
|
1001 |
+
'113222', /* 15 */
|
1002 |
+
'123122', /* 16 */
|
1003 |
+
'123221', /* 17 */
|
1004 |
+
'223211', /* 18 */
|
1005 |
+
'221132', /* 19 */
|
1006 |
+
'221231', /* 20 */
|
1007 |
+
'213212', /* 21 */
|
1008 |
+
'223112', /* 22 */
|
1009 |
+
'312131', /* 23 */
|
1010 |
+
'311222', /* 24 */
|
1011 |
+
'321122', /* 25 */
|
1012 |
+
'321221', /* 26 */
|
1013 |
+
'312212', /* 27 */
|
1014 |
+
'322112', /* 28 */
|
1015 |
+
'322211', /* 29 */
|
1016 |
+
'212123', /* 30 */
|
1017 |
+
'212321', /* 31 */
|
1018 |
+
'232121', /* 32 */
|
1019 |
+
'111323', /* 33 */
|
1020 |
+
'131123', /* 34 */
|
1021 |
+
'131321', /* 35 */
|
1022 |
+
'112313', /* 36 */
|
1023 |
+
'132113', /* 37 */
|
1024 |
+
'132311', /* 38 */
|
1025 |
+
'211313', /* 39 */
|
1026 |
+
'231113', /* 40 */
|
1027 |
+
'231311', /* 41 */
|
1028 |
+
'112133', /* 42 */
|
1029 |
+
'112331', /* 43 */
|
1030 |
+
'132131', /* 44 */
|
1031 |
+
'113123', /* 45 */
|
1032 |
+
'113321', /* 46 */
|
1033 |
+
'133121', /* 47 */
|
1034 |
+
'313121', /* 48 */
|
1035 |
+
'211331', /* 49 */
|
1036 |
+
'231131', /* 50 */
|
1037 |
+
'213113', /* 51 */
|
1038 |
+
'213311', /* 52 */
|
1039 |
+
'213131', /* 53 */
|
1040 |
+
'311123', /* 54 */
|
1041 |
+
'311321', /* 55 */
|
1042 |
+
'331121', /* 56 */
|
1043 |
+
'312113', /* 57 */
|
1044 |
+
'312311', /* 58 */
|
1045 |
+
'332111', /* 59 */
|
1046 |
+
'314111', /* 60 */
|
1047 |
+
'221411', /* 61 */
|
1048 |
+
'431111', /* 62 */
|
1049 |
+
'111224', /* 63 */
|
1050 |
+
'111422', /* 64 */
|
1051 |
+
'121124', /* 65 */
|
1052 |
+
'121421', /* 66 */
|
1053 |
+
'141122', /* 67 */
|
1054 |
+
'141221', /* 68 */
|
1055 |
+
'112214', /* 69 */
|
1056 |
+
'112412', /* 70 */
|
1057 |
+
'122114', /* 71 */
|
1058 |
+
'122411', /* 72 */
|
1059 |
+
'142112', /* 73 */
|
1060 |
+
'142211', /* 74 */
|
1061 |
+
'241211', /* 75 */
|
1062 |
+
'221114', /* 76 */
|
1063 |
+
'413111', /* 77 */
|
1064 |
+
'241112', /* 78 */
|
1065 |
+
'134111', /* 79 */
|
1066 |
+
'111242', /* 80 */
|
1067 |
+
'121142', /* 81 */
|
1068 |
+
'121241', /* 82 */
|
1069 |
+
'114212', /* 83 */
|
1070 |
+
'124112', /* 84 */
|
1071 |
+
'124211', /* 85 */
|
1072 |
+
'411212', /* 86 */
|
1073 |
+
'421112', /* 87 */
|
1074 |
+
'421211', /* 88 */
|
1075 |
+
'212141', /* 89 */
|
1076 |
+
'214121', /* 90 */
|
1077 |
+
'412121', /* 91 */
|
1078 |
+
'111143', /* 92 */
|
1079 |
+
'111341', /* 93 */
|
1080 |
+
'131141', /* 94 */
|
1081 |
+
'114113', /* 95 */
|
1082 |
+
'114311', /* 96 */
|
1083 |
+
'411113', /* 97 */
|
1084 |
+
'411311', /* 98 */
|
1085 |
+
'113141', /* 99 */
|
1086 |
+
'114131', /* 100 */
|
1087 |
+
'311141', /* 101 */
|
1088 |
+
'411131', /* 102 */
|
1089 |
+
'211412', /* 103 START A */
|
1090 |
+
'211214', /* 104 START B */
|
1091 |
+
'211232', /* 105 START C */
|
1092 |
+
'233111', /* STOP */
|
1093 |
+
'200000' /* END */
|
1094 |
+
);
|
1095 |
+
$keys = '';
|
1096 |
+
switch (strtoupper($type)) {
|
1097 |
+
case 'A': {
|
1098 |
+
$startid = 103;
|
1099 |
+
$keys = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_';
|
1100 |
+
for ($i = 0; $i < 32; ++$i) {
|
1101 |
+
$keys .= chr($i);
|
1102 |
+
}
|
1103 |
+
break;
|
1104 |
+
}
|
1105 |
+
case 'B': {
|
1106 |
+
$startid = 104;
|
1107 |
+
$keys = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~' . chr(127);
|
1108 |
+
break;
|
1109 |
+
}
|
1110 |
+
case 'C': {
|
1111 |
+
$startid = 105;
|
1112 |
+
$keys = '';
|
1113 |
+
if ((strlen($code) % 2) != 0) {
|
1114 |
+
// The length of barcode value must be even ($code). You must pad the number with zeros
|
1115 |
+
return false;
|
1116 |
+
}
|
1117 |
+
for ($i = 0; $i <= 99; ++$i) {
|
1118 |
+
$keys .= chr($i);
|
1119 |
+
}
|
1120 |
+
$new_code = '';
|
1121 |
+
$hclen = (strlen($code) / 2);
|
1122 |
+
for ($i = 0; $i < $hclen; ++$i) {
|
1123 |
+
$new_code .= chr(intval($code{(2 * $i)} . $code{(2 * $i + 1)}));
|
1124 |
+
}
|
1125 |
+
$code = $new_code;
|
1126 |
+
break;
|
1127 |
+
}
|
1128 |
+
default: {
|
1129 |
+
return false;
|
1130 |
+
}
|
1131 |
+
}
|
1132 |
+
|
1133 |
+
// calculate check character
|
1134 |
+
$sum = $startid;
|
1135 |
+
if ($ean) {
|
1136 |
+
$code = chr(102) . $code;
|
1137 |
+
} // Add FNC 1 - which identifies it as EAN-128
|
1138 |
+
$clen = strlen($code);
|
1139 |
+
for ($i = 0; $i < $clen; ++$i) {
|
1140 |
+
if ($ean && $i == 0) {
|
1141 |
+
$sum += 102;
|
1142 |
+
} else {
|
1143 |
+
$sum += (strpos($keys, $code[$i]) * ($i + 1));
|
1144 |
+
}
|
1145 |
+
}
|
1146 |
+
$check = ($sum % 103);
|
1147 |
+
$checkdigit = $check;
|
1148 |
+
// add start, check and stop codes
|
1149 |
+
$code = chr($startid) . $code . chr($check) . chr(106) . chr(107);
|
1150 |
+
$bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
|
1151 |
+
$k = 0;
|
1152 |
+
$len = strlen($code);
|
1153 |
+
for ($i = 0; $i < $len; ++$i) {
|
1154 |
+
$ck = strpos($keys, $code[$i]);
|
1155 |
+
if (($i == 0) || ($ean && $i == 1) | ($i > ($len - 4))) {
|
1156 |
+
$char_num = ord($code[$i]);
|
1157 |
+
$seq = $chr[$char_num];
|
1158 |
+
} elseif (($ck >= 0) AND isset($chr[$ck])) {
|
1159 |
+
$seq = $chr[$ck];
|
1160 |
+
} else {
|
1161 |
+
// invalid character
|
1162 |
+
return false;
|
1163 |
+
}
|
1164 |
+
for ($j = 0; $j < 6; ++$j) {
|
1165 |
+
if (($j % 2) == 0) {
|
1166 |
+
$t = true; // bar
|
1167 |
+
} else {
|
1168 |
+
$t = false; // space
|
1169 |
+
}
|
1170 |
+
$w = $seq[$j];
|
1171 |
+
$bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0);
|
1172 |
+
$bararray['maxw'] += $w;
|
1173 |
+
++$k;
|
1174 |
+
}
|
1175 |
+
}
|
1176 |
+
$bararray['checkdigit'] = $checkdigit;
|
1177 |
+
return $bararray;
|
1178 |
+
}
|
1179 |
+
|
1180 |
+
/**
|
1181 |
+
* EAN13 and UPC-A barcodes.
|
1182 |
+
* EAN13: European Article Numbering international retail product code
|
1183 |
+
* UPC-A: Universal product code seen on almost all retail products in the USA and Canada
|
1184 |
+
* UPC-E: Short version of UPC symbol
|
1185 |
+
*/
|
1186 |
+
protected function barcode_eanupc($code, $len = 13)
|
1187 |
+
{
|
1188 |
+
$upce = false;
|
1189 |
+
$checkdigit = false;
|
1190 |
+
if ($len == 6) {
|
1191 |
+
$len = 12; // UPC-A
|
1192 |
+
$upce = true; // UPC-E mode
|
1193 |
+
}
|
1194 |
+
$data_len = $len - 1;
|
1195 |
+
//Padding
|
1196 |
+
$code = str_pad($code, $data_len, '0', STR_PAD_LEFT);
|
1197 |
+
$code_len = strlen($code);
|
1198 |
+
// calculate check digit
|
1199 |
+
$sum_a = 0;
|
1200 |
+
for ($i = 1; $i < $data_len; $i+=2) {
|
1201 |
+
$sum_a += $code[$i];
|
1202 |
+
}
|
1203 |
+
if ($len > 12) {
|
1204 |
+
$sum_a *= 3;
|
1205 |
+
}
|
1206 |
+
$sum_b = 0;
|
1207 |
+
for ($i = 0; $i < $data_len; $i+=2) {
|
1208 |
+
$sum_b += ($code[$i]);
|
1209 |
+
}
|
1210 |
+
if ($len < 13) {
|
1211 |
+
$sum_b *= 3;
|
1212 |
+
}
|
1213 |
+
$r = ($sum_a + $sum_b) % 10;
|
1214 |
+
if ($r > 0) {
|
1215 |
+
$r = (10 - $r);
|
1216 |
+
}
|
1217 |
+
if ($code_len == $data_len) {
|
1218 |
+
// add check digit
|
1219 |
+
$code .= $r;
|
1220 |
+
$checkdigit = $r;
|
1221 |
+
} elseif ($r !== intval($code[$data_len])) {
|
1222 |
+
// wrong checkdigit
|
1223 |
+
return false;
|
1224 |
+
}
|
1225 |
+
if ($len == 12) {
|
1226 |
+
// UPC-A
|
1227 |
+
$code = '0' . $code;
|
1228 |
+
++$len;
|
1229 |
+
}
|
1230 |
+
if ($upce) {
|
1231 |
+
// convert UPC-A to UPC-E
|
1232 |
+
$tmp = substr($code, 4, 3);
|
1233 |
+
$prod_code = intval(substr($code, 7, 5)); // product code
|
1234 |
+
$invalid_upce = false;
|
1235 |
+
if (($tmp == '000') OR ( $tmp == '100') OR ( $tmp == '200')) {
|
1236 |
+
// manufacturer code ends in 000, 100, or 200
|
1237 |
+
$upce_code = substr($code, 2, 2) . substr($code, 9, 3) . substr($code, 4, 1);
|
1238 |
+
if ($prod_code > 999) {
|
1239 |
+
$invalid_upce = true;
|
1240 |
+
}
|
1241 |
+
} else {
|
1242 |
+
$tmp = substr($code, 5, 2);
|
1243 |
+
if ($tmp == '00') {
|
1244 |
+
// manufacturer code ends in 00
|
1245 |
+
$upce_code = substr($code, 2, 3) . substr($code, 10, 2) . '3';
|
1246 |
+
if ($prod_code > 99) {
|
1247 |
+
$invalid_upce = true;
|
1248 |
+
}
|
1249 |
+
} else {
|
1250 |
+
$tmp = substr($code, 6, 1);
|
1251 |
+
if ($tmp == '0') {
|
1252 |
+
// manufacturer code ends in 0
|
1253 |
+
$upce_code = substr($code, 2, 4) . substr($code, 11, 1) . '4';
|
1254 |
+
if ($prod_code > 9) {
|
1255 |
+
$invalid_upce = true;
|
1256 |
+
}
|
1257 |
+
} else {
|
1258 |
+
// manufacturer code does not end in zero
|
1259 |
+
$upce_code = substr($code, 2, 5) . substr($code, 11, 1);
|
1260 |
+
if ($prod_code > 9) {
|
1261 |
+
$invalid_upce = true;
|
1262 |
+
}
|
1263 |
+
}
|
1264 |
+
}
|
1265 |
+
}
|
1266 |
+
if ($invalid_upce) {
|
1267 |
+
throw new MpdfException('Error - UPC-A cannot produce a valid UPC-E barcode');
|
1268 |
+
} // Error generating a UPCE code
|
1269 |
+
}
|
1270 |
+
// Convert digits to bars
|
1271 |
+
$codes = array(
|
1272 |
+
'A' => array(// left odd parity
|
1273 |
+
'0' => '0001101',
|
1274 |
+
'1' => '0011001',
|
1275 |
+
'2' => '0010011',
|
1276 |
+
'3' => '0111101',
|
1277 |
+
'4' => '0100011',
|
1278 |
+
'5' => '0110001',
|
1279 |
+
'6' => '0101111',
|
1280 |
+
'7' => '0111011',
|
1281 |
+
'8' => '0110111',
|
1282 |
+
'9' => '0001011'),
|
1283 |
+
'B' => array(// left even parity
|
1284 |
+
'0' => '0100111',
|
1285 |
+
'1' => '0110011',
|
1286 |
+
'2' => '0011011',
|
1287 |
+
'3' => '0100001',
|
1288 |
+
'4' => '0011101',
|
1289 |
+
'5' => '0111001',
|
1290 |
+
'6' => '0000101',
|
1291 |
+
'7' => '0010001',
|
1292 |
+
'8' => '0001001',
|
1293 |
+
'9' => '0010111'),
|
1294 |
+
'C' => array(// right
|
1295 |
+
'0' => '1110010',
|
1296 |
+
'1' => '1100110',
|
1297 |
+
'2' => '1101100',
|
1298 |
+
'3' => '1000010',
|
1299 |
+
'4' => '1011100',
|
1300 |
+
'5' => '1001110',
|
1301 |
+
'6' => '1010000',
|
1302 |
+
'7' => '1000100',
|
1303 |
+
'8' => '1001000',
|
1304 |
+
'9' => '1110100')
|
1305 |
+
);
|
1306 |
+
$parities = array(
|
1307 |
+
'0' => array('A', 'A', 'A', 'A', 'A', 'A'),
|
1308 |
+
'1' => array('A', 'A', 'B', 'A', 'B', 'B'),
|
1309 |
+
'2' => array('A', 'A', 'B', 'B', 'A', 'B'),
|
1310 |
+
'3' => array('A', 'A', 'B', 'B', 'B', 'A'),
|
1311 |
+
'4' => array('A', 'B', 'A', 'A', 'B', 'B'),
|
1312 |
+
'5' => array('A', 'B', 'B', 'A', 'A', 'B'),
|
1313 |
+
'6' => array('A', 'B', 'B', 'B', 'A', 'A'),
|
1314 |
+
'7' => array('A', 'B', 'A', 'B', 'A', 'B'),
|
1315 |
+
'8' => array('A', 'B', 'A', 'B', 'B', 'A'),
|
1316 |
+
'9' => array('A', 'B', 'B', 'A', 'B', 'A')
|
1317 |
+
);
|
1318 |
+
$upce_parities = array();
|
1319 |
+
$upce_parities[0] = array(
|
1320 |
+
'0' => array('B', 'B', 'B', 'A', 'A', 'A'),
|
1321 |
+
'1' => array('B', 'B', 'A', 'B', 'A', 'A'),
|
1322 |
+
'2' => array('B', 'B', 'A', 'A', 'B', 'A'),
|
1323 |
+
'3' => array('B', 'B', 'A', 'A', 'A', 'B'),
|
1324 |
+
'4' => array('B', 'A', 'B', 'B', 'A', 'A'),
|
1325 |
+
'5' => array('B', 'A', 'A', 'B', 'B', 'A'),
|
1326 |
+
'6' => array('B', 'A', 'A', 'A', 'B', 'B'),
|
1327 |
+
'7' => array('B', 'A', 'B', 'A', 'B', 'A'),
|
1328 |
+
'8' => array('B', 'A', 'B', 'A', 'A', 'B'),
|
1329 |
+
'9' => array('B', 'A', 'A', 'B', 'A', 'B')
|
1330 |
+
);
|
1331 |
+
$upce_parities[1] = array(
|
1332 |
+
'0' => array('A', 'A', 'A', 'B', 'B', 'B'),
|
1333 |
+
'1' => array('A', 'A', 'B', 'A', 'B', 'B'),
|
1334 |
+
'2' => array('A', 'A', 'B', 'B', 'A', 'B'),
|
1335 |
+
'3' => array('A', 'A', 'B', 'B', 'B', 'A'),
|
1336 |
+
'4' => array('A', 'B', 'A', 'A', 'B', 'B'),
|
1337 |
+
'5' => array('A', 'B', 'B', 'A', 'A', 'B'),
|
1338 |
+
'6' => array('A', 'B', 'B', 'B', 'A', 'A'),
|
1339 |
+
'7' => array('A', 'B', 'A', 'B', 'A', 'B'),
|
1340 |
+
'8' => array('A', 'B', 'A', 'B', 'B', 'A'),
|
1341 |
+
'9' => array('A', 'B', 'B', 'A', 'B', 'A')
|
1342 |
+
);
|
1343 |
+
$k = 0;
|
1344 |
+
$seq = '101'; // left guard bar
|
1345 |
+
if ($upce) {
|
1346 |
+
$bararray = array('code' => $upce_code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
|
1347 |
+
$p = $upce_parities[$code{1}][$r];
|
1348 |
+
for ($i = 0; $i < 6; ++$i) {
|
1349 |
+
$seq .= $codes[$p[$i]][$upce_code[$i]];
|
1350 |
+
}
|
1351 |
+
$seq .= '010101'; // right guard bar
|
1352 |
+
} else {
|
1353 |
+
$bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
|
1354 |
+
$half_len = ceil($len / 2);
|
1355 |
+
if ($len == 8) {
|
1356 |
+
for ($i = 0; $i < $half_len; ++$i) {
|
1357 |
+
$seq .= $codes['A'][$code[(int) $i]];
|
1358 |
+
}
|
1359 |
+
} else {
|
1360 |
+
$p = $parities[$code{0}];
|
1361 |
+
for ($i = 1; $i < $half_len; ++$i) {
|
1362 |
+
$seq .= $codes[$p[$i - 1]][$code[(int) $i]];
|
1363 |
+
}
|
1364 |
+
}
|
1365 |
+
$seq .= '01010'; // center guard bar
|
1366 |
+
for ($i = $half_len; $i < $len; ++$i) {
|
1367 |
+
$seq .= $codes['C'][$code[(int) $i]];
|
1368 |
+
}
|
1369 |
+
$seq .= '101'; // right guard bar
|
1370 |
+
}
|
1371 |
+
$clen = strlen($seq);
|
1372 |
+
$w = 0;
|
1373 |
+
for ($i = 0; $i < $clen; ++$i) {
|
1374 |
+
$w += 1;
|
1375 |
+
if (($i == ($clen - 1)) OR ( ($i < ($clen - 1)) AND ( $seq[$i] != $seq[($i + 1)]))) {
|
1376 |
+
if ($seq[$i] == '1') {
|
1377 |
+
$t = true; // bar
|
1378 |
+
} else {
|
1379 |
+
$t = false; // space
|
1380 |
+
}
|
1381 |
+
$bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0);
|
1382 |
+
$bararray['maxw'] += $w;
|
1383 |
+
++$k;
|
1384 |
+
$w = 0;
|
1385 |
+
}
|
1386 |
+
}
|
1387 |
+
$bararray['checkdigit'] = $checkdigit;
|
1388 |
+
return $bararray;
|
1389 |
+
}
|
1390 |
+
|
1391 |
+
/**
|
1392 |
+
* UPC-Based Extentions
|
1393 |
+
* 2-Digit Ext.: Used to indicate magazines and newspaper issue numbers
|
1394 |
+
* 5-Digit Ext.: Used to mark suggested retail price of books
|
1395 |
+
*/
|
1396 |
+
protected function barcode_eanext($code, $len = 5)
|
1397 |
+
{
|
1398 |
+
//Padding
|
1399 |
+
$code = str_pad($code, $len, '0', STR_PAD_LEFT);
|
1400 |
+
// calculate check digit
|
1401 |
+
if ($len == 2) {
|
1402 |
+
$r = $code % 4;
|
1403 |
+
} elseif ($len == 5) {
|
1404 |
+
$r = (3 * ($code{0} + $code{2} + $code{4})) + (9 * ($code{1} + $code{3}));
|
1405 |
+
$r %= 10;
|
1406 |
+
} else {
|
1407 |
+
return false;
|
1408 |
+
}
|
1409 |
+
//Convert digits to bars
|
1410 |
+
$codes = array(
|
1411 |
+
'A' => array(// left odd parity
|
1412 |
+
'0' => '0001101',
|
1413 |
+
'1' => '0011001',
|
1414 |
+
'2' => '0010011',
|
1415 |
+
'3' => '0111101',
|
1416 |
+
'4' => '0100011',
|
1417 |
+
'5' => '0110001',
|
1418 |
+
'6' => '0101111',
|
1419 |
+
'7' => '0111011',
|
1420 |
+
'8' => '0110111',
|
1421 |
+
'9' => '0001011'),
|
1422 |
+
'B' => array(// left even parity
|
1423 |
+
'0' => '0100111',
|
1424 |
+
'1' => '0110011',
|
1425 |
+
'2' => '0011011',
|
1426 |
+
'3' => '0100001',
|
1427 |
+
'4' => '0011101',
|
1428 |
+
'5' => '0111001',
|
1429 |
+
'6' => '0000101',
|
1430 |
+
'7' => '0010001',
|
1431 |
+
'8' => '0001001',
|
1432 |
+
'9' => '0010111')
|
1433 |
+
);
|
1434 |
+
$parities = array();
|
1435 |
+
$parities[2] = array(
|
1436 |
+
'0' => array('A', 'A'),
|
1437 |
+
'1' => array('A', 'B'),
|
1438 |
+
'2' => array('B', 'A'),
|
1439 |
+
'3' => array('B', 'B')
|
1440 |
+
);
|
1441 |
+
$parities[5] = array(
|
1442 |
+
'0' => array('B', 'B', 'A', 'A', 'A'),
|
1443 |
+
'1' => array('B', 'A', 'B', 'A', 'A'),
|
1444 |
+
'2' => array('B', 'A', 'A', 'B', 'A'),
|
1445 |
+
'3' => array('B', 'A', 'A', 'A', 'B'),
|
1446 |
+
'4' => array('A', 'B', 'B', 'A', 'A'),
|
1447 |
+
'5' => array('A', 'A', 'B', 'B', 'A'),
|
1448 |
+
'6' => array('A', 'A', 'A', 'B', 'B'),
|
1449 |
+
'7' => array('A', 'B', 'A', 'B', 'A'),
|
1450 |
+
'8' => array('A', 'B', 'A', 'A', 'B'),
|
1451 |
+
'9' => array('A', 'A', 'B', 'A', 'B')
|
1452 |
+
);
|
1453 |
+
$p = $parities[$len][$r];
|
1454 |
+
$seq = '1011'; // left guard bar
|
1455 |
+
$seq .= $codes[$p[0]][$code{0}];
|
1456 |
+
for ($i = 1; $i < $len; ++$i) {
|
1457 |
+
$seq .= '01'; // separator
|
1458 |
+
$seq .= $codes[$p[$i]][$code[$i]];
|
1459 |
+
}
|
1460 |
+
$bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
|
1461 |
+
return $this->binseq_to_array($seq, $bararray);
|
1462 |
+
}
|
1463 |
+
|
1464 |
+
/**
|
1465 |
+
* POSTNET and PLANET barcodes.
|
1466 |
+
* Used by U.S. Postal Service for automated mail sorting
|
1467 |
+
*/
|
1468 |
+
protected function barcode_postnet($code, $planet = false)
|
1469 |
+
{
|
1470 |
+
// bar lenght
|
1471 |
+
if ($planet) {
|
1472 |
+
$barlen = Array(
|
1473 |
+
0 => Array(1, 1, 2, 2, 2),
|
1474 |
+
1 => Array(2, 2, 2, 1, 1),
|
1475 |
+
2 => Array(2, 2, 1, 2, 1),
|
1476 |
+
3 => Array(2, 2, 1, 1, 2),
|
1477 |
+
4 => Array(2, 1, 2, 2, 1),
|
1478 |
+
5 => Array(2, 1, 2, 1, 2),
|
1479 |
+
6 => Array(2, 1, 1, 2, 2),
|
1480 |
+
7 => Array(1, 2, 2, 2, 1),
|
1481 |
+
8 => Array(1, 2, 2, 1, 2),
|
1482 |
+
9 => Array(1, 2, 1, 2, 2)
|
1483 |
+
);
|
1484 |
+
} else {
|
1485 |
+
$barlen = Array(
|
1486 |
+
0 => Array(2, 2, 1, 1, 1),
|
1487 |
+
1 => Array(1, 1, 1, 2, 2),
|
1488 |
+
2 => Array(1, 1, 2, 1, 2),
|
1489 |
+
3 => Array(1, 1, 2, 2, 1),
|
1490 |
+
4 => Array(1, 2, 1, 1, 2),
|
1491 |
+
5 => Array(1, 2, 1, 2, 1),
|
1492 |
+
6 => Array(1, 2, 2, 1, 1),
|
1493 |
+
7 => Array(2, 1, 1, 1, 2),
|
1494 |
+
8 => Array(2, 1, 1, 2, 1),
|
1495 |
+
9 => Array(2, 1, 2, 1, 1)
|
1496 |
+
);
|
1497 |
+
}
|
1498 |
+
$bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 5, 'bcode' => array());
|
1499 |
+
$k = 0;
|
1500 |
+
$code = str_replace('-', '', $code);
|
1501 |
+
$code = str_replace(' ', '', $code);
|
1502 |
+
$len = strlen($code);
|
1503 |
+
// calculate checksum
|
1504 |
+
$sum = 0;
|
1505 |
+
for ($i = 0; $i < $len; ++$i) {
|
1506 |
+
$sum += intval($code[$i]);
|
1507 |
+
}
|
1508 |
+
$chkd = ($sum % 10);
|
1509 |
+
if ($chkd > 0) {
|
1510 |
+
$chkd = (10 - $chkd);
|
1511 |
+
}
|
1512 |
+
$code .= $chkd;
|
1513 |
+
$checkdigit = $chkd;
|
1514 |
+
$len = strlen($code);
|
1515 |
+
// start bar
|
1516 |
+
$bararray['bcode'][$k++] = array('t' => 1, 'w' => 1, 'h' => 5, 'p' => 0);
|
1517 |
+
$bararray['bcode'][$k++] = array('t' => 0, 'w' => $this->gapwidth, 'h' => 5, 'p' => 0);
|
1518 |
+
$bararray['maxw'] += (1 + $this->gapwidth );
|
1519 |
+
for ($i = 0; $i < $len; ++$i) {
|
1520 |
+
for ($j = 0; $j < 5; ++$j) {
|
1521 |
+
$bh = $barlen[$code[$i]][$j];
|
1522 |
+
if ($bh == 2) {
|
1523 |
+
$h = 5;
|
1524 |
+
$p = 0;
|
1525 |
+
} else {
|
1526 |
+
$h = 2;
|
1527 |
+
$p = 3;
|
1528 |
+
}
|
1529 |
+
$bararray['bcode'][$k++] = array('t' => 1, 'w' => 1, 'h' => $h, 'p' => $p);
|
1530 |
+
$bararray['bcode'][$k++] = array('t' => 0, 'w' => $this->gapwidth, 'h' => 2, 'p' => 0);
|
1531 |
+
$bararray['maxw'] += (1 + $this->gapwidth );
|
1532 |
+
}
|
1533 |
+
}
|
1534 |
+
// end bar
|
1535 |
+
$bararray['bcode'][$k++] = array('t' => 1, 'w' => 1, 'h' => 5, 'p' => 0);
|
1536 |
+
$bararray['maxw'] += 1;
|
1537 |
+
$bararray['checkdigit'] = $checkdigit;
|
1538 |
+
return $bararray;
|
1539 |
+
}
|
1540 |
+
|
1541 |
+
/**
|
1542 |
+
* RM4SCC - CBC - KIX
|
1543 |
+
* RM4SCC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code) - KIX (Klant index - Customer index)
|
1544 |
+
* RM4SCC is the name of the barcode symbology used by the Royal Mail for its Cleanmail service.
|
1545 |
+
*/
|
1546 |
+
protected function barcode_rm4scc($code, $kix = false)
|
1547 |
+
{
|
1548 |
+
$notkix = !$kix;
|
1549 |
+
// bar mode
|
1550 |
+
// 1 = pos 1, length 2
|
1551 |
+
// 2 = pos 1, length 3
|
1552 |
+
// 3 = pos 2, length 1
|
1553 |
+
// 4 = pos 2, length 2
|
1554 |
+
$barmode = array(
|
1555 |
+
'0' => array(3, 3, 2, 2),
|
1556 |
+
'1' => array(3, 4, 1, 2),
|
1557 |
+
'2' => array(3, 4, 2, 1),
|
1558 |
+
'3' => array(4, 3, 1, 2),
|
1559 |
+
'4' => array(4, 3, 2, 1),
|
1560 |
+
'5' => array(4, 4, 1, 1),
|
1561 |
+
'6' => array(3, 1, 4, 2),
|
1562 |
+
'7' => array(3, 2, 3, 2),
|
1563 |
+
'8' => array(3, 2, 4, 1),
|
1564 |
+
'9' => array(4, 1, 3, 2),
|
1565 |
+
'A' => array(4, 1, 4, 1),
|
1566 |
+
'B' => array(4, 2, 3, 1),
|
1567 |
+
'C' => array(3, 1, 2, 4),
|
1568 |
+
'D' => array(3, 2, 1, 4),
|
1569 |
+
'E' => array(3, 2, 2, 3),
|
1570 |
+
'F' => array(4, 1, 1, 4),
|
1571 |
+
'G' => array(4, 1, 2, 3),
|
1572 |
+
'H' => array(4, 2, 1, 3),
|
1573 |
+
'I' => array(1, 3, 4, 2),
|
1574 |
+
'J' => array(1, 4, 3, 2),
|
1575 |
+
'K' => array(1, 4, 4, 1),
|
1576 |
+
'L' => array(2, 3, 3, 2),
|
1577 |
+
'M' => array(2, 3, 4, 1),
|
1578 |
+
'N' => array(2, 4, 3, 1),
|
1579 |
+
'O' => array(1, 3, 2, 4),
|
1580 |
+
'P' => array(1, 4, 1, 4),
|
1581 |
+
'Q' => array(1, 4, 2, 3),
|
1582 |
+
'R' => array(2, 3, 1, 4),
|
1583 |
+
'S' => array(2, 3, 2, 3),
|
1584 |
+
'T' => array(2, 4, 1, 3),
|
1585 |
+
'U' => array(1, 1, 4, 4),
|
1586 |
+
'V' => array(1, 2, 3, 4),
|
1587 |
+
'W' => array(1, 2, 4, 3),
|
1588 |
+
'X' => array(2, 1, 3, 4),
|
1589 |
+
'Y' => array(2, 1, 4, 3),
|
1590 |
+
'Z' => array(2, 2, 3, 3)
|
1591 |
+
);
|
1592 |
+
$code = strtoupper($code);
|
1593 |
+
$len = strlen($code);
|
1594 |
+
$bararray = array('code' => $code, 'maxw' => 0, 'maxh' => $this->daft['F'], 'bcode' => array());
|
1595 |
+
if ($notkix) {
|
1596 |
+
// table for checksum calculation (row,col)
|
1597 |
+
$checktable = array(
|
1598 |
+
'0' => array(1, 1),
|
1599 |
+
'1' => array(1, 2),
|
1600 |
+
'2' => array(1, 3),
|
1601 |
+
'3' => array(1, 4),
|
1602 |
+
'4' => array(1, 5),
|
1603 |
+
'5' => array(1, 0),
|
1604 |
+
'6' => array(2, 1),
|
1605 |
+
'7' => array(2, 2),
|
1606 |
+
'8' => array(2, 3),
|
1607 |
+
'9' => array(2, 4),
|
1608 |
+
'A' => array(2, 5),
|
1609 |
+
'B' => array(2, 0),
|
1610 |
+
'C' => array(3, 1),
|
1611 |
+
'D' => array(3, 2),
|
1612 |
+
'E' => array(3, 3),
|
1613 |
+
'F' => array(3, 4),
|
1614 |
+
'G' => array(3, 5),
|
1615 |
+
'H' => array(3, 0),
|
1616 |
+
'I' => array(4, 1),
|
1617 |
+
'J' => array(4, 2),
|
1618 |
+
'K' => array(4, 3),
|
1619 |
+
'L' => array(4, 4),
|
1620 |
+
'M' => array(4, 5),
|
1621 |
+
'N' => array(4, 0),
|
1622 |
+
'O' => array(5, 1),
|
1623 |
+
'P' => array(5, 2),
|
1624 |
+
'Q' => array(5, 3),
|
1625 |
+
'R' => array(5, 4),
|
1626 |
+
'S' => array(5, 5),
|
1627 |
+
'T' => array(5, 0),
|
1628 |
+
'U' => array(0, 1),
|
1629 |
+
'V' => array(0, 2),
|
1630 |
+
'W' => array(0, 3),
|
1631 |
+
'X' => array(0, 4),
|
1632 |
+
'Y' => array(0, 5),
|
1633 |
+
'Z' => array(0, 0)
|
1634 |
+
);
|
1635 |
+
$row = 0;
|
1636 |
+
$col = 0;
|
1637 |
+
for ($i = 0; $i < $len; ++$i) {
|
1638 |
+
$row += $checktable[$code[$i]][0];
|
1639 |
+
$col += $checktable[$code[$i]][1];
|
1640 |
+
}
|
1641 |
+
$row %= 6;
|
1642 |
+
$col %= 6;
|
1643 |
+
$chk = array_keys($checktable, array($row, $col));
|
1644 |
+
$code .= $chk[0];
|
1645 |
+
$bararray['checkdigit'] = $chk[0];
|
1646 |
+
++$len;
|
1647 |
+
}
|
1648 |
+
$k = 0;
|
1649 |
+
if ($notkix) {
|
1650 |
+
// start bar
|
1651 |
+
$bararray['bcode'][$k++] = array('t' => 1, 'w' => 1, 'h' => $this->daft['A'], 'p' => 0);
|
1652 |
+
$bararray['bcode'][$k++] = array('t' => 0, 'w' => $this->gapwidth, 'h' => $this->daft['A'], 'p' => 0);
|
1653 |
+
$bararray['maxw'] += (1 + $this->gapwidth);
|
1654 |
+
}
|
1655 |
+
for ($i = 0; $i < $len; ++$i) {
|
1656 |
+
for ($j = 0; $j < 4; ++$j) {
|
1657 |
+
switch ($barmode[$code[$i]][$j]) {
|
1658 |
+
case 1: {
|
1659 |
+
// ascender (A)
|
1660 |
+
$p = 0;
|
1661 |
+
$h = $this->daft['A'];
|
1662 |
+
break;
|
1663 |
+
}
|
1664 |
+
case 2: {
|
1665 |
+
// full bar (F)
|
1666 |
+
$p = 0;
|
1667 |
+
$h = $this->daft['F'];
|
1668 |
+
break;
|
1669 |
+
}
|
1670 |
+
case 3: {
|
1671 |
+
// tracker (T)
|
1672 |
+
$p = ($this->daft['F'] - $this->daft['T']) / 2;
|
1673 |
+
$h = $this->daft['T'];
|
1674 |
+
break;
|
1675 |
+
}
|
1676 |
+
case 4: {
|
1677 |
+
// descender (D)
|
1678 |
+
$p = $this->daft['F'] - $this->daft['D'];
|
1679 |
+
$h = $this->daft['D'];
|
1680 |
+
break;
|
1681 |
+
}
|
1682 |
+
}
|
1683 |
+
|
1684 |
+
$bararray['bcode'][$k++] = array('t' => 1, 'w' => 1, 'h' => $h, 'p' => $p);
|
1685 |
+
$bararray['bcode'][$k++] = array('t' => 0, 'w' => $this->gapwidth, 'h' => 2, 'p' => 0);
|
1686 |
+
$bararray['maxw'] += (1 + $this->gapwidth);
|
1687 |
+
}
|
1688 |
+
}
|
1689 |
+
if ($notkix) {
|
1690 |
+
// stop bar
|
1691 |
+
$bararray['bcode'][$k++] = array('t' => 1, 'w' => 1, 'h' => $this->daft['F'], 'p' => 0);
|
1692 |
+
$bararray['maxw'] += 1;
|
1693 |
+
}
|
1694 |
+
return $bararray;
|
1695 |
+
}
|
1696 |
+
|
1697 |
+
/**
|
1698 |
+
* CODABAR barcodes.
|
1699 |
+
* Older code often used in library systems, sometimes in blood banks
|
1700 |
+
*/
|
1701 |
+
protected function barcode_codabar($code)
|
1702 |
+
{
|
1703 |
+
$chr = array(
|
1704 |
+
'0' => '11111221',
|
1705 |
+
'1' => '11112211',
|
1706 |
+
'2' => '11121121',
|
1707 |
+
'3' => '22111111',
|
1708 |
+
'4' => '11211211',
|
1709 |
+
'5' => '21111211',
|
1710 |
+
'6' => '12111121',
|
1711 |
+
'7' => '12112111',
|
1712 |
+
'8' => '12211111',
|
1713 |
+
'9' => '21121111',
|
1714 |
+
'-' => '11122111',
|
1715 |
+
'$' => '11221111',
|
1716 |
+
':' => '21112121',
|
1717 |
+
'/' => '21211121',
|
1718 |
+
'.' => '21212111',
|
1719 |
+
'+' => '11222221',
|
1720 |
+
'A' => '11221211',
|
1721 |
+
'B' => '12121121',
|
1722 |
+
'C' => '11121221',
|
1723 |
+
'D' => '11122211'
|
1724 |
+
);
|
1725 |
+
$bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
|
1726 |
+
$k = 0;
|
1727 |
+
$w = 0;
|
1728 |
+
$seq = '';
|
1729 |
+
$code = strtoupper($code);
|
1730 |
+
$len = strlen($code);
|
1731 |
+
for ($i = 0; $i < $len; ++$i) {
|
1732 |
+
if (!isset($chr[$code[$i]])) {
|
1733 |
+
return false;
|
1734 |
+
}
|
1735 |
+
$seq = $chr[$code[$i]];
|
1736 |
+
for ($j = 0; $j < 8; ++$j) {
|
1737 |
+
if (($j % 2) == 0) {
|
1738 |
+
$t = true; // bar
|
1739 |
+
} else {
|
1740 |
+
$t = false; // space
|
1741 |
+
}
|
1742 |
+
$x = $seq[$j];
|
1743 |
+
if ($x == 2) {
|
1744 |
+
$w = $this->print_ratio;
|
1745 |
+
} else {
|
1746 |
+
$w = 1;
|
1747 |
+
}
|
1748 |
+
$bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0);
|
1749 |
+
$bararray['maxw'] += $w;
|
1750 |
+
++$k;
|
1751 |
+
}
|
1752 |
+
}
|
1753 |
+
return $bararray;
|
1754 |
+
}
|
1755 |
+
|
1756 |
+
/**
|
1757 |
+
* CODE11 barcodes.
|
1758 |
+
* Used primarily for labeling telecommunications equipment
|
1759 |
+
*/
|
1760 |
+
protected function barcode_code11($code)
|
1761 |
+
{
|
1762 |
+
$chr = array(
|
1763 |
+
'0' => '111121',
|
1764 |
+
'1' => '211121',
|
1765 |
+
'2' => '121121',
|
1766 |
+
'3' => '221111',
|
1767 |
+
'4' => '112121',
|
1768 |
+
'5' => '212111',
|
1769 |
+
'6' => '122111',
|
1770 |
+
'7' => '111221',
|
1771 |
+
'8' => '211211',
|
1772 |
+
'9' => '211111',
|
1773 |
+
'-' => '112111',
|
1774 |
+
'S' => '112211'
|
1775 |
+
);
|
1776 |
+
|
1777 |
+
$bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
|
1778 |
+
$k = 0;
|
1779 |
+
$w = 0;
|
1780 |
+
$seq = '';
|
1781 |
+
$len = strlen($code);
|
1782 |
+
// calculate check digit C
|
1783 |
+
$p = 1;
|
1784 |
+
$check = 0;
|
1785 |
+
for ($i = ($len - 1); $i >= 0; --$i) {
|
1786 |
+
$digit = $code[$i];
|
1787 |
+
if ($digit == '-') {
|
1788 |
+
$dval = 10;
|
1789 |
+
} else {
|
1790 |
+
$dval = intval($digit);
|
1791 |
+
}
|
1792 |
+
$check += ($dval * $p);
|
1793 |
+
++$p;
|
1794 |
+
if ($p > 10) {
|
1795 |
+
$p = 1;
|
1796 |
+
}
|
1797 |
+
}
|
1798 |
+
$check %= 11;
|
1799 |
+
if ($check == 10) {
|
1800 |
+
$check = '-';
|
1801 |
+
}
|
1802 |
+
$code .= $check;
|
1803 |
+
$checkdigit = $check;
|
1804 |
+
if ($len > 10) {
|
1805 |
+
// calculate check digit K
|
1806 |
+
$p = 1;
|
1807 |
+
$check = 0;
|
1808 |
+
for ($i = $len; $i >= 0; --$i) {
|
1809 |
+
$digit = $code[$i];
|
1810 |
+
if ($digit == '-') {
|
1811 |
+
$dval = 10;
|
1812 |
+
} else {
|
1813 |
+
$dval = intval($digit);
|
1814 |
+
}
|
1815 |
+
$check += ($dval * $p);
|
1816 |
+
++$p;
|
1817 |
+
if ($p > 9) {
|
1818 |
+
$p = 1;
|
1819 |
+
}
|
1820 |
+
}
|
1821 |
+
$check %= 11;
|
1822 |
+
$code .= $check;
|
1823 |
+
$checkdigit .= $check;
|
1824 |
+
++$len;
|
1825 |
+
}
|
1826 |
+
$code = 'S' . $code . 'S';
|
1827 |
+
$len += 3;
|
1828 |
+
for ($i = 0; $i < $len; ++$i) {
|
1829 |
+
if (!isset($chr[$code[$i]])) {
|
1830 |
+
return false;
|
1831 |
+
}
|
1832 |
+
$seq = $chr[$code[$i]];
|
1833 |
+
for ($j = 0; $j < 6; ++$j) {
|
1834 |
+
if (($j % 2) == 0) {
|
1835 |
+
$t = true; // bar
|
1836 |
+
} else {
|
1837 |
+
$t = false; // space
|
1838 |
+
}
|
1839 |
+
$x = $seq[$j];
|
1840 |
+
if ($x == 2) {
|
1841 |
+
$w = $this->print_ratio;
|
1842 |
+
} else {
|
1843 |
+
$w = 1;
|
1844 |
+
}
|
1845 |
+
$bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0);
|
1846 |
+
$bararray['maxw'] += $w;
|
1847 |
+
++$k;
|
1848 |
+
}
|
1849 |
+
}
|
1850 |
+
$bararray['checkdigit'] = $checkdigit;
|
1851 |
+
return $bararray;
|
1852 |
+
}
|
1853 |
+
|
1854 |
+
/**
|
1855 |
+
* IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200
|
1856 |
+
* (requires PHP bcmath extension)
|
1857 |
+
* Intelligent Mail barcode is a 65-bar code for use on mail in the United States.
|
1858 |
+
* The fields are described as follows:<ul><li>The Barcode Identifier shall be assigned by USPS to encode the presort identification that is currently printed in human readable form on the optional endorsement line (OEL) as well as for future USPS use. This shall be two digits, with the second digit in the range of 0-4. The allowable encoding ranges shall be 00-04, 10-14, 20-24, 30-34, 40-44, 50-54, 60-64, 70-74, 80-84, and 90-94.</li><li>The Service Type Identifier shall be assigned by USPS for any combination of services requested on the mailpiece. The allowable encoding range shall be 000-999. Each 3-digit value shall correspond to a particular mail class with a particular combination of service(s). Each service program, such as OneCode Confirm and OneCode ACS, shall provide the list of Service Type Identifier values.</li><li>The Mailer or Customer Identifier shall be assigned by USPS as a unique, 6 or 9 digit number that identifies a business entity. The allowable encoding range for the 6 digit Mailer ID shall be 000000- 899999, while the allowable encoding range for the 9 digit Mailer ID shall be 900000000-999999999.</li><li>The Serial or Sequence Number shall be assigned by the mailer for uniquely identifying and tracking mailpieces. The allowable encoding range shall be 000000000-999999999 when used with a 6 digit Mailer ID and 000000-999999 when used with a 9 digit Mailer ID. e. The Delivery Point ZIP Code shall be assigned by the mailer for routing the mailpiece. This shall replace POSTNET for routing the mailpiece to its final delivery point. The length may be 0, 5, 9, or 11 digits. The allowable encoding ranges shall be no ZIP Code, 00000-99999, 000000000-999999999, and 00000000000-99999999999.</li></ul>
|
1859 |
+
*/
|
1860 |
+
protected function barcode_imb($code)
|
1861 |
+
{
|
1862 |
+
$asc_chr = array(4, 0, 2, 6, 3, 5, 1, 9, 8, 7, 1, 2, 0, 6, 4, 8, 2, 9, 5, 3, 0, 1, 3, 7, 4, 6, 8, 9, 2, 0, 5, 1, 9, 4, 3, 8, 6, 7, 1, 2, 4, 3, 9, 5, 7, 8, 3, 0, 2, 1, 4, 0, 9, 1, 7, 0, 2, 4, 6, 3, 7, 1, 9, 5, 8);
|
1863 |
+
$dsc_chr = array(7, 1, 9, 5, 8, 0, 2, 4, 6, 3, 5, 8, 9, 7, 3, 0, 6, 1, 7, 4, 6, 8, 9, 2, 5, 1, 7, 5, 4, 3, 8, 7, 6, 0, 2, 5, 4, 9, 3, 0, 1, 6, 8, 2, 0, 4, 5, 9, 6, 7, 5, 2, 6, 3, 8, 5, 1, 9, 8, 7, 4, 0, 2, 6, 3);
|
1864 |
+
$asc_pos = array(3, 0, 8, 11, 1, 12, 8, 11, 10, 6, 4, 12, 2, 7, 9, 6, 7, 9, 2, 8, 4, 0, 12, 7, 10, 9, 0, 7, 10, 5, 7, 9, 6, 8, 2, 12, 1, 4, 2, 0, 1, 5, 4, 6, 12, 1, 0, 9, 4, 7, 5, 10, 2, 6, 9, 11, 2, 12, 6, 7, 5, 11, 0, 3, 2);
|
1865 |
+
$dsc_pos = array(2, 10, 12, 5, 9, 1, 5, 4, 3, 9, 11, 5, 10, 1, 6, 3, 4, 1, 10, 0, 2, 11, 8, 6, 1, 12, 3, 8, 6, 4, 4, 11, 0, 6, 1, 9, 11, 5, 3, 7, 3, 10, 7, 11, 8, 2, 10, 3, 5, 8, 0, 3, 12, 11, 8, 4, 5, 1, 3, 0, 7, 12, 9, 8, 10);
|
1866 |
+
$code_arr = explode('-', $code);
|
1867 |
+
$tracking_number = $code_arr[0];
|
1868 |
+
if (isset($code_arr[1])) {
|
1869 |
+
$routing_code = $code_arr[1];
|
1870 |
+
} else {
|
1871 |
+
$routing_code = '';
|
1872 |
+
}
|
1873 |
+
// Conversion of Routing Code
|
1874 |
+
switch (strlen($routing_code)) {
|
1875 |
+
case 0: {
|
1876 |
+
$binary_code = 0;
|
1877 |
+
break;
|
1878 |
+
}
|
1879 |
+
case 5: {
|
1880 |
+
$binary_code = bcadd($routing_code, '1');
|
1881 |
+
break;
|
1882 |
+
}
|
1883 |
+
case 9: {
|
1884 |
+
$binary_code = bcadd($routing_code, '100001');
|
1885 |
+
break;
|
1886 |
+
}
|
1887 |
+
case 11: {
|
1888 |
+
$binary_code = bcadd($routing_code, '1000100001');
|
1889 |
+
break;
|
1890 |
+
}
|
1891 |
+
default: {
|
1892 |
+
return false;
|
1893 |
+
break;
|
1894 |
+
}
|
1895 |
+
}
|
1896 |
+
$binary_code = bcmul($binary_code, 10);
|
1897 |
+
$binary_code = bcadd($binary_code, $tracking_number{0});
|
1898 |
+
$binary_code = bcmul($binary_code, 5);
|
1899 |
+
$binary_code = bcadd($binary_code, $tracking_number{1});
|
1900 |
+
$binary_code .= substr($tracking_number, 2, 18);
|
1901 |
+
// convert to hexadecimal
|
1902 |
+
$binary_code = $this->dec_to_hex($binary_code);
|
1903 |
+
// pad to get 13 bytes
|
1904 |
+
$binary_code = str_pad($binary_code, 26, '0', STR_PAD_LEFT);
|
1905 |
+
// convert string to array of bytes
|
1906 |
+
$binary_code_arr = chunk_split($binary_code, 2, "\r");
|
1907 |
+
$binary_code_arr = substr($binary_code_arr, 0, -1);
|
1908 |
+
$binary_code_arr = explode("\r", $binary_code_arr);
|
1909 |
+
// calculate frame check sequence
|
1910 |
+
$fcs = $this->imb_crc11fcs($binary_code_arr);
|
1911 |
+
// exclude first 2 bits from first byte
|
1912 |
+
$first_byte = sprintf('%2s', dechex((hexdec($binary_code_arr[0]) << 2) >> 2));
|
1913 |
+
$binary_code_102bit = $first_byte . substr($binary_code, 2);
|
1914 |
+
// convert binary data to codewords
|
1915 |
+
$codewords = array();
|
1916 |
+
$data = $this->hex_to_dec($binary_code_102bit);
|
1917 |
+
$codewords[0] = bcmod($data, 636) * 2;
|
1918 |
+
$data = bcdiv($data, 636);
|
1919 |
+
for ($i = 1; $i < 9; ++$i) {
|
1920 |
+
$codewords[$i] = bcmod($data, 1365);
|
1921 |
+
$data = bcdiv($data, 1365);
|
1922 |
+
}
|
1923 |
+
$codewords[9] = $data;
|
1924 |
+
if (($fcs >> 10) == 1) {
|
1925 |
+
$codewords[9] += 659;
|
1926 |
+
}
|
1927 |
+
// generate lookup tables
|
1928 |
+
$table2of13 = $this->imb_tables(2, 78);
|
1929 |
+
$table5of13 = $this->imb_tables(5, 1287);
|
1930 |
+
// convert codewords to characters
|
1931 |
+
$characters = array();
|
1932 |
+
$bitmask = 512;
|
1933 |
+
foreach ($codewords as $k => $val) {
|
1934 |
+
if ($val <= 1286) {
|
1935 |
+
$chrcode = $table5of13[$val];
|
1936 |
+
} else {
|
1937 |
+
$chrcode = $table2of13[($val - 1287)];
|
1938 |
+
}
|
1939 |
+
if (($fcs & $bitmask) > 0) {
|
1940 |
+
// bitwise invert
|
1941 |
+
$chrcode = ((~$chrcode) & 8191);
|
1942 |
+
}
|
1943 |
+
$characters[] = $chrcode;
|
1944 |
+
$bitmask /= 2;
|
1945 |
+
}
|
1946 |
+
$characters = array_reverse($characters);
|
1947 |
+
// build bars
|
1948 |
+
$k = 0;
|
1949 |
+
$bararray = array('code' => $code, 'maxw' => 0, 'maxh' => $this->daft['F'], 'bcode' => array());
|
1950 |
+
for ($i = 0; $i < 65; ++$i) {
|
1951 |
+
$asc = (($characters[$asc_chr[$i]] & pow(2, $asc_pos[$i])) > 0);
|
1952 |
+
$dsc = (($characters[$dsc_chr[$i]] & pow(2, $dsc_pos[$i])) > 0);
|
1953 |
+
if ($asc AND $dsc) {
|
1954 |
+
// full bar (F)
|
1955 |
+
$p = 0;
|
1956 |
+
$h = $this->daft['F'];
|
1957 |
+
} elseif ($asc) {
|
1958 |
+
// ascender (A)
|
1959 |
+
$p = 0;
|
1960 |
+
$h = $this->daft['A'];
|
1961 |
+
} elseif ($dsc) {
|
1962 |
+
// descender (D)
|
1963 |
+
$p = $this->daft['F'] - $this->daft['D'];
|
1964 |
+
$h = $this->daft['D'];
|
1965 |
+
} else {
|
1966 |
+
// tracker (T)
|
1967 |
+
$p = ($this->daft['F'] - $this->daft['T']) / 2;
|
1968 |
+
$h = $this->daft['T'];
|
1969 |
+
}
|
1970 |
+
$bararray['bcode'][$k++] = array('t' => 1, 'w' => 1, 'h' => $h, 'p' => $p);
|
1971 |
+
// Gap
|
1972 |
+
$bararray['bcode'][$k++] = array('t' => 0, 'w' => $this->gapwidth, 'h' => 1, 'p' => 0);
|
1973 |
+
$bararray['maxw'] += (1 + $this->gapwidth );
|
1974 |
+
}
|
1975 |
+
unset($bararray['bcode'][($k - 1)]);
|
1976 |
+
$bararray['maxw'] -= $this->gapwidth;
|
1977 |
+
return $bararray;
|
1978 |
+
}
|
1979 |
+
|
1980 |
+
/**
|
1981 |
+
* Convert large integer number to hexadecimal representation.
|
1982 |
+
* (requires PHP bcmath extension)
|
1983 |
+
*/
|
1984 |
+
public function dec_to_hex($number)
|
1985 |
+
{
|
1986 |
+
$i = 0;
|
1987 |
+
$hex = array();
|
1988 |
+
if ($number == 0) {
|
1989 |
+
return '00';
|
1990 |
+
}
|
1991 |
+
while ($number > 0) {
|
1992 |
+
if ($number == 0) {
|
1993 |
+
array_push($hex, '0');
|
1994 |
+
} else {
|
1995 |
+
array_push($hex, strtoupper(dechex(bcmod($number, '16'))));
|
1996 |
+
$number = bcdiv($number, '16', 0);
|
1997 |
+
}
|
1998 |
+
}
|
1999 |
+
$hex = array_reverse($hex);
|
2000 |
+
return implode($hex);
|
2001 |
+
}
|
2002 |
+
|
2003 |
+
/**
|
2004 |
+
* Convert large hexadecimal number to decimal representation (string).
|
2005 |
+
* (requires PHP bcmath extension)
|
2006 |
+
*/
|
2007 |
+
public function hex_to_dec($hex)
|
2008 |
+
{
|
2009 |
+
$dec = 0;
|
2010 |
+
$bitval = 1;
|
2011 |
+
$len = strlen($hex);
|
2012 |
+
for ($pos = ($len - 1); $pos >= 0; --$pos) {
|
2013 |
+
$dec = bcadd($dec, bcmul(hexdec($hex[$pos]), $bitval));
|
2014 |
+
$bitval = bcmul($bitval, 16);
|
2015 |
+
}
|
2016 |
+
return $dec;
|
2017 |
+
}
|
2018 |
+
|
2019 |
+
/**
|
2020 |
+
* Intelligent Mail Barcode calculation of Frame Check Sequence
|
2021 |
+
*/
|
2022 |
+
protected function imb_crc11fcs($code_arr)
|
2023 |
+
{
|
2024 |
+
$genpoly = 0x0F35; // generator polynomial
|
2025 |
+
$fcs = 0x07FF; // Frame Check Sequence
|
2026 |
+
// do most significant byte skipping the 2 most significant bits
|
2027 |
+
$data = hexdec($code_arr[0]) << 5;
|
2028 |
+
for ($bit = 2; $bit < 8; ++$bit) {
|
2029 |
+
if (($fcs ^ $data) & 0x400) {
|
2030 |
+
$fcs = ($fcs << 1) ^ $genpoly;
|
2031 |
+
} else {
|
2032 |
+
$fcs = ($fcs << 1);
|
2033 |
+
}
|
2034 |
+
$fcs &= 0x7FF;
|
2035 |
+
$data <<= 1;
|
2036 |
+
}
|
2037 |
+
// do rest of bytes
|
2038 |
+
for ($byte = 1; $byte < 13; ++$byte) {
|
2039 |
+
$data = hexdec($code_arr[$byte]) << 3;
|
2040 |
+
for ($bit = 0; $bit < 8; ++$bit) {
|
2041 |
+
if (($fcs ^ $data) & 0x400) {
|
2042 |
+
$fcs = ($fcs << 1) ^ $genpoly;
|
2043 |
+
} else {
|
2044 |
+
$fcs = ($fcs << 1);
|
2045 |
+
}
|
2046 |
+
$fcs &= 0x7FF;
|
2047 |
+
$data <<= 1;
|
2048 |
+
}
|
2049 |
+
}
|
2050 |
+
return $fcs;
|
2051 |
+
}
|
2052 |
+
|
2053 |
+
/**
|
2054 |
+
* Reverse unsigned short value
|
2055 |
+
*/
|
2056 |
+
protected function imb_reverse_us($num)
|
2057 |
+
{
|
2058 |
+
$rev = 0;
|
2059 |
+
for ($i = 0; $i < 16; ++$i) {
|
2060 |
+
$rev <<= 1;
|
2061 |
+
$rev |= ($num & 1);
|
2062 |
+
$num >>= 1;
|
2063 |
+
}
|
2064 |
+
return $rev;
|
2065 |
+
}
|
2066 |
+
|
2067 |
+
/**
|
2068 |
+
* generate Nof13 tables used for Intelligent Mail Barcode
|
2069 |
+
*/
|
2070 |
+
protected function imb_tables($n, $size)
|
2071 |
+
{
|
2072 |
+
$table = array();
|
2073 |
+
$lli = 0; // LUT lower index
|
2074 |
+
$lui = $size - 1; // LUT upper index
|
2075 |
+
for ($count = 0; $count < 8192; ++$count) {
|
2076 |
+
$bit_count = 0;
|
2077 |
+
for ($bit_index = 0; $bit_index < 13; ++$bit_index) {
|
2078 |
+
$bit_count += intval(($count & (1 << $bit_index)) != 0);
|
2079 |
+
}
|
2080 |
+
// if we don't have the right number of bits on, go on to the next value
|
2081 |
+
if ($bit_count == $n) {
|
2082 |
+
$reverse = ($this->imb_reverse_us($count) >> 3);
|
2083 |
+
// if the reverse is less than count, we have already visited this pair before
|
2084 |
+
if ($reverse >= $count) {
|
2085 |
+
// If count is symmetric, place it at the first free slot from the end of the list.
|
2086 |
+
// Otherwise, place it at the first free slot from the beginning of the list AND place $reverse ath the next free slot from the beginning of the list
|
2087 |
+
if ($reverse == $count) {
|
2088 |
+
$table[$lui] = $count;
|
2089 |
+
--$lui;
|
2090 |
+
} else {
|
2091 |
+
$table[$lli] = $count;
|
2092 |
+
++$lli;
|
2093 |
+
$table[$lli] = $reverse;
|
2094 |
+
++$lli;
|
2095 |
+
}
|
2096 |
+
}
|
2097 |
+
}
|
2098 |
+
}
|
2099 |
+
return $table;
|
2100 |
+
}
|
2101 |
+
|
2102 |
+
}
|
lib/mpdf/classes/bmp.php
CHANGED
@@ -1,248 +1,260 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class bmp
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
$
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
$
|
19 |
-
$
|
20 |
-
|
21 |
-
$
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
$
|
29 |
-
$
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
$info['
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
$
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
$
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
}
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
}
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class bmp
|
4 |
+
{
|
5 |
+
|
6 |
+
var $mpdf = null;
|
7 |
+
|
8 |
+
public function __construct(mPDF $mpdf)
|
9 |
+
{
|
10 |
+
$this->mpdf = $mpdf;
|
11 |
+
}
|
12 |
+
|
13 |
+
function _getBMPimage($data, $file)
|
14 |
+
{
|
15 |
+
$info = array();
|
16 |
+
// Adapted from script by Valentin Schmidt
|
17 |
+
// http://staff.dasdeck.de/valentin/fpdf/fpdf_bmp/
|
18 |
+
$bfOffBits = $this->_fourbytes2int_le(substr($data, 10, 4));
|
19 |
+
$width = $this->_fourbytes2int_le(substr($data, 18, 4));
|
20 |
+
$height = $this->_fourbytes2int_le(substr($data, 22, 4));
|
21 |
+
$flip = ($height < 0);
|
22 |
+
if ($flip)
|
23 |
+
$height = -$height;
|
24 |
+
$biBitCount = $this->_twobytes2int_le(substr($data, 28, 2));
|
25 |
+
$biCompression = $this->_fourbytes2int_le(substr($data, 30, 4));
|
26 |
+
$info = array('w' => $width, 'h' => $height);
|
27 |
+
if ($biBitCount < 16) {
|
28 |
+
$info['cs'] = 'Indexed';
|
29 |
+
$info['bpc'] = $biBitCount;
|
30 |
+
$palStr = substr($data, 54, ($bfOffBits - 54));
|
31 |
+
$pal = '';
|
32 |
+
$cnt = strlen($palStr) / 4;
|
33 |
+
for ($i = 0; $i < $cnt; $i++) {
|
34 |
+
$n = 4 * $i;
|
35 |
+
$pal .= $palStr[$n + 2] . $palStr[$n + 1] . $palStr[$n];
|
36 |
+
}
|
37 |
+
$info['pal'] = $pal;
|
38 |
+
} else {
|
39 |
+
$info['cs'] = 'DeviceRGB';
|
40 |
+
$info['bpc'] = 8;
|
41 |
+
}
|
42 |
+
|
43 |
+
if ($this->mpdf->restrictColorSpace == 1 || $this->mpdf->PDFX || $this->mpdf->restrictColorSpace == 3) {
|
44 |
+
if (($this->mpdf->PDFA && !$this->mpdf->PDFAauto) || ($this->mpdf->PDFX && !$this->mpdf->PDFXauto)) {
|
45 |
+
$this->mpdf->PDFAXwarnings[] = "Image cannot be converted to suitable colour space for PDFA or PDFX file - " . $file . " - (Image replaced by 'no-image'.)";
|
46 |
+
}
|
47 |
+
return array('error' => "BMP Image cannot be converted to suitable colour space - " . $file . " - (Image replaced by 'no-image'.)");
|
48 |
+
}
|
49 |
+
|
50 |
+
$biXPelsPerMeter = $this->_fourbytes2int_le(substr($data, 38, 4)); // horizontal pixels per meter, usually set to zero
|
51 |
+
//$biYPelsPerMeter=$this->_fourbytes2int_le(substr($data,42,4)); // vertical pixels per meter, usually set to zero
|
52 |
+
$biXPelsPerMeter = round($biXPelsPerMeter / 1000 * 25.4);
|
53 |
+
//$biYPelsPerMeter=round($biYPelsPerMeter/1000 *25.4);
|
54 |
+
$info['set-dpi'] = $biXPelsPerMeter;
|
55 |
+
|
56 |
+
switch ($biCompression) {
|
57 |
+
case 0:
|
58 |
+
$str = substr($data, $bfOffBits);
|
59 |
+
break;
|
60 |
+
case 1: # BI_RLE8
|
61 |
+
$str = $this->rle8_decode(substr($data, $bfOffBits), $width);
|
62 |
+
break;
|
63 |
+
case 2: # BI_RLE4
|
64 |
+
$str = $this->rle4_decode(substr($data, $bfOffBits), $width);
|
65 |
+
break;
|
66 |
+
}
|
67 |
+
$bmpdata = '';
|
68 |
+
$padCnt = (4 - ceil(($width / (8 / $biBitCount))) % 4) % 4;
|
69 |
+
switch ($biBitCount) {
|
70 |
+
case 1:
|
71 |
+
case 4:
|
72 |
+
case 8:
|
73 |
+
$w = floor($width / (8 / $biBitCount)) + ($width % (8 / $biBitCount) ? 1 : 0);
|
74 |
+
$w_row = $w + $padCnt;
|
75 |
+
if ($flip) {
|
76 |
+
for ($y = 0; $y < $height; $y++) {
|
77 |
+
$y0 = $y * $w_row;
|
78 |
+
for ($x = 0; $x < $w; $x++)
|
79 |
+
$bmpdata .= $str[$y0 + $x];
|
80 |
+
}
|
81 |
+
} else {
|
82 |
+
for ($y = $height - 1; $y >= 0; $y--) {
|
83 |
+
$y0 = $y * $w_row;
|
84 |
+
for ($x = 0; $x < $w; $x++)
|
85 |
+
$bmpdata .= $str[$y0 + $x];
|
86 |
+
}
|
87 |
+
}
|
88 |
+
break;
|
89 |
+
|
90 |
+
case 16:
|
91 |
+
$w_row = $width * 2 + $padCnt;
|
92 |
+
if ($flip) {
|
93 |
+
for ($y = 0; $y < $height; $y++) {
|
94 |
+
$y0 = $y * $w_row;
|
95 |
+
for ($x = 0; $x < $width; $x++) {
|
96 |
+
$n = (ord($str[$y0 + 2 * $x + 1]) * 256 + ord($str[$y0 + 2 * $x]));
|
97 |
+
$b = ($n & 31) << 3;
|
98 |
+
$g = ($n & 992) >> 2;
|
99 |
+
$r = ($n & 31744) >> 7128;
|
100 |
+
$bmpdata .= chr($r) . chr($g) . chr($b);
|
101 |
+
}
|
102 |
+
}
|
103 |
+
} else {
|
104 |
+
for ($y = $height - 1; $y >= 0; $y--) {
|
105 |
+
$y0 = $y * $w_row;
|
106 |
+
for ($x = 0; $x < $width; $x++) {
|
107 |
+
$n = (ord($str[$y0 + 2 * $x + 1]) * 256 + ord($str[$y0 + 2 * $x]));
|
108 |
+
$b = ($n & 31) << 3;
|
109 |
+
$g = ($n & 992) >> 2;
|
110 |
+
$r = ($n & 31744) >> 7;
|
111 |
+
$bmpdata .= chr($r) . chr($g) . chr($b);
|
112 |
+
}
|
113 |
+
}
|
114 |
+
}
|
115 |
+
break;
|
116 |
+
|
117 |
+
case 24:
|
118 |
+
case 32:
|
119 |
+
$byteCnt = $biBitCount / 8;
|
120 |
+
$w_row = $width * $byteCnt + $padCnt;
|
121 |
+
|
122 |
+
if ($flip) {
|
123 |
+
for ($y = 0; $y < $height; $y++) {
|
124 |
+
$y0 = $y * $w_row;
|
125 |
+
for ($x = 0; $x < $width; $x++) {
|
126 |
+
$i = $y0 + $x * $byteCnt; # + 1
|
127 |
+
$bmpdata .= $str[$i + 2] . $str[$i + 1] . $str[$i];
|
128 |
+
}
|
129 |
+
}
|
130 |
+
} else {
|
131 |
+
for ($y = $height - 1; $y >= 0; $y--) {
|
132 |
+
$y0 = $y * $w_row;
|
133 |
+
for ($x = 0; $x < $width; $x++) {
|
134 |
+
$i = $y0 + $x * $byteCnt; # + 1
|
135 |
+
$bmpdata .= $str[$i + 2] . $str[$i + 1] . $str[$i];
|
136 |
+
}
|
137 |
+
}
|
138 |
+
}
|
139 |
+
break;
|
140 |
+
|
141 |
+
default:
|
142 |
+
return array('error' => 'Error parsing BMP image - Unsupported image biBitCount');
|
143 |
+
}
|
144 |
+
if ($this->mpdf->compress) {
|
145 |
+
$bmpdata = gzcompress($bmpdata);
|
146 |
+
$info['f'] = 'FlateDecode';
|
147 |
+
}
|
148 |
+
$info['data'] = $bmpdata;
|
149 |
+
$info['type'] = 'bmp';
|
150 |
+
return $info;
|
151 |
+
}
|
152 |
+
|
153 |
+
function _fourbytes2int_le($s)
|
154 |
+
{
|
155 |
+
//Read a 4-byte integer from string
|
156 |
+
return (ord($s[3]) << 24) + (ord($s[2]) << 16) + (ord($s[1]) << 8) + ord($s[0]);
|
157 |
+
}
|
158 |
+
|
159 |
+
function _twobytes2int_le($s)
|
160 |
+
{
|
161 |
+
//Read a 2-byte integer from string
|
162 |
+
return (ord(substr($s, 1, 1)) << 8) + ord(substr($s, 0, 1));
|
163 |
+
}
|
164 |
+
|
165 |
+
# Decoder for RLE8 compression in windows bitmaps
|
166 |
+
# see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_6x0u.asp
|
167 |
+
function rle8_decode($str, $width)
|
168 |
+
{
|
169 |
+
$lineWidth = $width + (3 - ($width - 1) % 4);
|
170 |
+
$out = '';
|
171 |
+
$cnt = strlen($str);
|
172 |
+
for ($i = 0; $i < $cnt; $i++) {
|
173 |
+
$o = ord($str[$i]);
|
174 |
+
switch ($o) {
|
175 |
+
case 0: # ESCAPE
|
176 |
+
$i++;
|
177 |
+
switch (ord($str[$i])) {
|
178 |
+
case 0: # NEW LINE
|
179 |
+
$padCnt = $lineWidth - strlen($out) % $lineWidth;
|
180 |
+
if ($padCnt < $lineWidth)
|
181 |
+
$out .= str_repeat(chr(0), $padCnt);# pad line
|
182 |
+
break;
|
183 |
+
case 1: # END OF FILE
|
184 |
+
$padCnt = $lineWidth - strlen($out) % $lineWidth;
|
185 |
+
if ($padCnt < $lineWidth)
|
186 |
+
$out .= str_repeat(chr(0), $padCnt);# pad line
|
187 |
+
break 3;
|
188 |
+
case 2: # DELTA
|
189 |
+
$i += 2;
|
190 |
+
break;
|
191 |
+
default: # ABSOLUTE MODE
|
192 |
+
$num = ord($str[$i]);
|
193 |
+
for ($j = 0; $j < $num; $j++)
|
194 |
+
$out .= $str[++$i];
|
195 |
+
if ($num % 2)
|
196 |
+
$i++;
|
197 |
+
}
|
198 |
+
break;
|
199 |
+
default:
|
200 |
+
$out .= str_repeat($str[++$i], $o);
|
201 |
+
}
|
202 |
+
}
|
203 |
+
return $out;
|
204 |
+
}
|
205 |
+
|
206 |
+
# Decoder for RLE4 compression in windows bitmaps
|
207 |
+
# see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_6x0u.asp
|
208 |
+
function rle4_decode($str, $width)
|
209 |
+
{
|
210 |
+
$w = floor($width / 2) + ($width % 2);
|
211 |
+
$lineWidth = $w + (3 - ( ($width - 1) / 2) % 4);
|
212 |
+
$pixels = array();
|
213 |
+
$cnt = strlen($str);
|
214 |
+
for ($i = 0; $i < $cnt; $i++) {
|
215 |
+
$o = ord($str[$i]);
|
216 |
+
switch ($o) {
|
217 |
+
case 0: # ESCAPE
|
218 |
+
$i++;
|
219 |
+
switch (ord($str[$i])) {
|
220 |
+
case 0: # NEW LINE
|
221 |
+
while (count($pixels) % $lineWidth != 0)
|
222 |
+
$pixels[] = 0;
|
223 |
+
break;
|
224 |
+
case 1: # END OF FILE
|
225 |
+
while (count($pixels) % $lineWidth != 0)
|
226 |
+
$pixels[] = 0;
|
227 |
+
break 3;
|
228 |
+
case 2: # DELTA
|
229 |
+
$i += 2;
|
230 |
+
break;
|
231 |
+
default: # ABSOLUTE MODE
|
232 |
+
$num = ord($str[$i]);
|
233 |
+
for ($j = 0; $j < $num; $j++) {
|
234 |
+
if ($j % 2 == 0) {
|
235 |
+
$c = ord($str[++$i]);
|
236 |
+
$pixels[] = ($c & 240) >> 4;
|
237 |
+
} else
|
238 |
+
$pixels[] = $c & 15;
|
239 |
+
}
|
240 |
+
if ($num % 2)
|
241 |
+
$i++;
|
242 |
+
}
|
243 |
+
break;
|
244 |
+
default:
|
245 |
+
$c = ord($str[++$i]);
|
246 |
+
for ($j = 0; $j < $o; $j++)
|
247 |
+
$pixels[] = ($j % 2 == 0 ? ($c & 240) >> 4 : $c & 15);
|
248 |
+
}
|
249 |
+
}
|
250 |
+
|
251 |
+
$out = '';
|
252 |
+
if (count($pixels) % 2)
|
253 |
+
$pixels[] = 0;
|
254 |
+
$cnt = count($pixels) / 2;
|
255 |
+
for ($i = 0; $i < $cnt; $i++)
|
256 |
+
$out .= chr(16 * $pixels[2 * $i] + $pixels[2 * $i + 1]);
|
257 |
+
return $out;
|
258 |
+
}
|
259 |
+
|
260 |
+
}
|
lib/mpdf/classes/cssmgr.php
CHANGED
@@ -1,1721 +1,2043 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class cssmgr
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
var $
|
9 |
-
|
10 |
-
var $
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
$
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
}
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
$
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
$
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
$
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
$
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
$
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
$
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
$
|
143 |
-
|
144 |
-
$
|
145 |
-
|
146 |
-
|
147 |
-
$
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
if (
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
$
|
248 |
-
$
|
249 |
-
$
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
$
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
if ($
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
else if (
|
278 |
-
|
279 |
-
else if (preg_match('/^
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
if (isset($this->CSS[$tag]) && $tag) {
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
$
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
if ($t) {
|
295 |
-
$tag = '';
|
296 |
-
if (preg_match('/^[.](.*)$/'
|
297 |
-
|
298 |
-
else if (preg_match('
|
299 |
-
|
300 |
-
else if (preg_match('
|
301 |
-
|
302 |
-
|
303 |
-
else if (preg_match('
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
else
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
}
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
}
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
//
|
401 |
-
|
402 |
-
//
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
}
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
else if ($
|
473 |
-
|
474 |
-
$
|
475 |
-
|
476 |
-
$
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
if (
|
491 |
-
|
492 |
-
$
|
493 |
-
$
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
$
|
508 |
-
$
|
509 |
-
$
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
$newprop['
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
$
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
$
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
$
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
if ($
|
661 |
-
$
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
if (
|
671 |
-
$newprop['
|
672 |
-
|
673 |
-
|
674 |
-
if (
|
675 |
-
$newprop['
|
676 |
-
}
|
677 |
-
|
678 |
-
else if (
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
}
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
$
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
$
|
710 |
-
}
|
711 |
-
}
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
if (
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
$
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
else
|
796 |
-
|
797 |
-
$
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
}
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
}
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
$
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
$
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
if ($
|
1111 |
-
|
1112 |
-
|
1113 |
-
}
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
function
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
}
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
if (isset($
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
// STYLESHEET
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
$this->
|
1230 |
-
}
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
$
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
$
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
}
|
1255 |
-
}
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
$
|
1306 |
-
$
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
}
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
if (
|
1372 |
-
$p =
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
if ($
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
if (
|
1391 |
-
$p =
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
if ($
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
1444 |
-
}
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
-
|
1475 |
-
|
1476 |
-
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
|
1481 |
-
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
|
1486 |
-
|
1487 |
-
|
1488 |
-
|
1489 |
-
|
1490 |
-
|
1491 |
-
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
-
|
1496 |
-
|
1497 |
-
|
1498 |
-
|
1499 |
-
|
1500 |
-
$
|
1501 |
-
}
|
1502 |
-
|
1503 |
-
|
1504 |
-
|
1505 |
-
|
1506 |
-
|
1507 |
-
|
1508 |
-
|
1509 |
-
|
1510 |
-
|
1511 |
-
|
1512 |
-
|
1513 |
-
|
1514 |
-
|
1515 |
-
|
1516 |
-
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
1530 |
-
|
1531 |
-
|
1532 |
-
|
1533 |
-
|
1534 |
-
|
1535 |
-
|
1536 |
-
|
1537 |
-
|
1538 |
-
|
1539 |
-
|
1540 |
-
|
1541 |
-
|
1542 |
-
|
1543 |
-
|
1544 |
-
|
1545 |
-
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
-
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
1553 |
-
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
1560 |
-
|
1561 |
-
|
1562 |
-
|
1563 |
-
|
1564 |
-
|
1565 |
-
|
1566 |
-
|
1567 |
-
|
1568 |
-
|
1569 |
-
|
1570 |
-
|
1571 |
-
|
1572 |
-
|
1573 |
-
|
1574 |
-
|
1575 |
-
|
1576 |
-
|
1577 |
-
|
1578 |
-
|
1579 |
-
|
1580 |
-
|
1581 |
-
|
1582 |
-
|
1583 |
-
|
1584 |
-
|
1585 |
-
|
1586 |
-
|
1587 |
-
|
1588 |
-
|
1589 |
-
|
1590 |
-
|
1591 |
-
|
1592 |
-
|
1593 |
-
|
1594 |
-
|
1595 |
-
|
1596 |
-
|
1597 |
-
|
1598 |
-
|
1599 |
-
|
1600 |
-
|
1601 |
-
|
1602 |
-
|
1603 |
-
|
1604 |
-
|
1605 |
-
|
1606 |
-
|
1607 |
-
|
1608 |
-
|
1609 |
-
|
1610 |
-
|
1611 |
-
|
1612 |
-
|
1613 |
-
|
1614 |
-
|
1615 |
-
|
1616 |
-
|
1617 |
-
|
1618 |
-
|
1619 |
-
|
1620 |
-
//
|
1621 |
-
|
1622 |
-
|
1623 |
-
|
1624 |
-
|
1625 |
-
|
1626 |
-
|
1627 |
-
|
1628 |
-
if (isset($
|
1629 |
-
|
1630 |
-
|
1631 |
-
|
1632 |
-
|
1633 |
-
|
1634 |
-
|
1635 |
-
|
1636 |
-
|
1637 |
-
|
1638 |
-
|
1639 |
-
|
1640 |
-
|
1641 |
-
|
1642 |
-
//
|
1643 |
-
|
1644 |
-
|
1645 |
-
|
1646 |
-
|
1647 |
-
|
1648 |
-
|
1649 |
-
|
1650 |
-
|
1651 |
-
|
1652 |
-
|
1653 |
-
|
1654 |
-
|
1655 |
-
|
1656 |
-
|
1657 |
-
|
1658 |
-
|
1659 |
-
|
1660 |
-
|
1661 |
-
|
1662 |
-
|
1663 |
-
|
1664 |
-
|
1665 |
-
|
1666 |
-
|
1667 |
-
|
1668 |
-
|
1669 |
-
|
1670 |
-
|
1671 |
-
|
1672 |
-
|
1673 |
-
|
1674 |
-
|
1675 |
-
if (
|
1676 |
-
|
1677 |
-
|
1678 |
-
|
1679 |
-
}
|
1680 |
-
|
1681 |
-
|
1682 |
-
|
1683 |
-
|
1684 |
-
|
1685 |
-
|
1686 |
-
|
1687 |
-
|
1688 |
-
|
1689 |
-
|
1690 |
-
|
1691 |
-
|
1692 |
-
|
1693 |
-
|
1694 |
-
|
1695 |
-
|
1696 |
-
|
1697 |
-
|
1698 |
-
|
1699 |
-
|
1700 |
-
|
1701 |
-
|
1702 |
-
|
1703 |
-
|
1704 |
-
|
1705 |
-
|
1706 |
-
|
1707 |
-
|
1708 |
-
|
1709 |
-
|
1710 |
-
|
1711 |
-
|
1712 |
-
|
1713 |
-
|
1714 |
-
|
1715 |
-
|
1716 |
-
|
1717 |
-
|
1718 |
-
|
1719 |
-
}
|
1720 |
-
|
1721 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class cssmgr
|
4 |
+
{
|
5 |
+
|
6 |
+
var $mpdf = null;
|
7 |
+
|
8 |
+
var $tablecascadeCSS;
|
9 |
+
|
10 |
+
var $cascadeCSS;
|
11 |
+
|
12 |
+
var $CSS;
|
13 |
+
|
14 |
+
var $tbCSSlvl;
|
15 |
+
|
16 |
+
public function __construct(mPDF $mpdf)
|
17 |
+
{
|
18 |
+
$this->mpdf = $mpdf;
|
19 |
+
$this->tablecascadeCSS = array();
|
20 |
+
$this->CSS = array();
|
21 |
+
$this->cascadeCSS = array();
|
22 |
+
$this->tbCSSlvl = 0;
|
23 |
+
}
|
24 |
+
|
25 |
+
function ReadCSS($html)
|
26 |
+
{
|
27 |
+
preg_match_all('/<style[^>]*media=["\']([^"\'>]*)["\'].*?<\/style>/is', $html, $m);
|
28 |
+
for ($i = 0; $i < count($m[0]); $i++) {
|
29 |
+
if ($this->mpdf->CSSselectMedia && !preg_match('/(' . trim($this->mpdf->CSSselectMedia) . '|all)/i', $m[1][$i])) {
|
30 |
+
$html = preg_replace('/' . preg_quote($m[0][$i], '/') . '/', '', $html);
|
31 |
+
}
|
32 |
+
}
|
33 |
+
preg_match_all('/<link[^>]*media=["\']([^"\'>]*)["\'].*?>/is', $html, $m);
|
34 |
+
for ($i = 0; $i < count($m[0]); $i++) {
|
35 |
+
if ($this->mpdf->CSSselectMedia && !preg_match('/(' . trim($this->mpdf->CSSselectMedia) . '|all)/i', $m[1][$i])) {
|
36 |
+
$html = preg_replace('/' . preg_quote($m[0][$i], '/') . '/', '', $html);
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
// mPDF 5.5.02
|
41 |
+
// Remove Comment tags <!-- ... --> inside CSS as <style> in HTML document
|
42 |
+
// Remove Comment tags /* ... */ inside CSS as <style> in HTML document
|
43 |
+
// But first, we replace upper and mixed case closing style tag with lower
|
44 |
+
// case so we can use str_replace later.
|
45 |
+
preg_match_all('/<style.*?>(.*?)<\/style>/si',$html,$m);
|
46 |
+
if (count($m[1])) {
|
47 |
+
for ($i = 0; $i < count($m[1]); $i++) {
|
48 |
+
// Remove comment tags
|
49 |
+
$sub = preg_replace('/(<\!\-\-|\-\->)/s',' ',$m[1][$i]);
|
50 |
+
$sub = '>'.preg_replace('|/\*.*?\*/|s',' ',$sub).'</style>';
|
51 |
+
$html = str_replace('>'.$m[1][$i].'</style>', $sub, $html);
|
52 |
+
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
$html = preg_replace('/<!--mpdf/i', '', $html);
|
57 |
+
$html = preg_replace('/mpdf-->/i', '', $html);
|
58 |
+
$html = preg_replace('/<\!\-\-.*?\-\->/s', ' ', $html);
|
59 |
+
|
60 |
+
$match = 0; // no match for instance
|
61 |
+
$regexp = ''; // This helps debugging: showing what is the REAL string being processed
|
62 |
+
$CSSext = array();
|
63 |
+
|
64 |
+
//CSS inside external files
|
65 |
+
$regexp = '/<link[^>]*rel=["\']stylesheet["\'][^>]*href=["\']([^>"\']*)["\'].*?>/si';
|
66 |
+
$x = preg_match_all($regexp, $html, $cxt);
|
67 |
+
if ($x) {
|
68 |
+
$match += $x;
|
69 |
+
$CSSext = $cxt[1];
|
70 |
+
}
|
71 |
+
$regexp = '/<link[^>]*href=["\']([^>"\']*)["\'][^>]*?rel=["\']stylesheet["\'].*?>/si';
|
72 |
+
$x = preg_match_all($regexp, $html, $cxt);
|
73 |
+
if ($x) {
|
74 |
+
$match += $x;
|
75 |
+
$CSSext = array_merge($CSSext, $cxt[1]);
|
76 |
+
}
|
77 |
+
|
78 |
+
// look for @import stylesheets
|
79 |
+
//$regexp = '/@import url\([\'\"]{0,1}([^\)]*?\.css)[\'\"]{0,1}\)/si';
|
80 |
+
$regexp = '/@import url\([\'\"]{0,1}([^\)]*?\.css(\?\S+)?)[\'\"]{0,1}\)/si';
|
81 |
+
$x = preg_match_all($regexp, $html, $cxt);
|
82 |
+
if ($x) {
|
83 |
+
$match += $x;
|
84 |
+
$CSSext = array_merge($CSSext, $cxt[1]);
|
85 |
+
}
|
86 |
+
|
87 |
+
// look for @import without the url()
|
88 |
+
//$regexp = '/@import [\'\"]{0,1}([^;]*?\.css)[\'\"]{0,1}/si';
|
89 |
+
$regexp = '/@import [\'\"]{0,1}([^;]*?\.css(\?\S+)?)[\'\"]{0,1}/si';
|
90 |
+
$x = preg_match_all($regexp, $html, $cxt);
|
91 |
+
if ($x) {
|
92 |
+
$match += $x;
|
93 |
+
$CSSext = array_merge($CSSext, $cxt[1]);
|
94 |
+
}
|
95 |
+
|
96 |
+
$ind = 0;
|
97 |
+
$CSSstr = '';
|
98 |
+
|
99 |
+
if (!is_array($this->cascadeCSS))
|
100 |
+
$this->cascadeCSS = array();
|
101 |
+
|
102 |
+
while ($match) {
|
103 |
+
$path = $CSSext[$ind];
|
104 |
+
|
105 |
+
$path = htmlspecialchars_decode($path); // mPDF 6
|
106 |
+
|
107 |
+
$this->mpdf->GetFullPath($path);
|
108 |
+
$CSSextblock = $this->mpdf->_get_file($path);
|
109 |
+
if ($CSSextblock) {
|
110 |
+
// look for embedded @import stylesheets in other stylesheets
|
111 |
+
// and fix url paths (including background-images) relative to stylesheet
|
112 |
+
//$regexpem = '/@import url\([\'\"]{0,1}(.*?\.css)[\'\"]{0,1}\)/si';
|
113 |
+
$regexpem = '/@import url\([\'\"]{0,1}(.*?\.css(\?\S+)?)[\'\"]{0,1}\)/si';
|
114 |
+
$xem = preg_match_all($regexpem, $CSSextblock, $cxtem);
|
115 |
+
$cssBasePath = preg_replace('/\/[^\/]*$/', '', $path) . '/';
|
116 |
+
if ($xem) {
|
117 |
+
foreach ($cxtem[1] AS $cxtembedded) {
|
118 |
+
// path is relative to original stlyesheet!!
|
119 |
+
$this->mpdf->GetFullPath($cxtembedded, $cssBasePath);
|
120 |
+
$match++;
|
121 |
+
$CSSext[] = $cxtembedded;
|
122 |
+
}
|
123 |
+
}
|
124 |
+
$regexpem = '/(background[^;]*url\s*\(\s*[\'\"]{0,1})([^\)\'\"]*)([\'\"]{0,1}\s*\))/si';
|
125 |
+
$xem = preg_match_all($regexpem, $CSSextblock, $cxtem);
|
126 |
+
if ($xem) {
|
127 |
+
for ($i = 0; $i < count($cxtem[0]); $i++) {
|
128 |
+
// path is relative to original stlyesheet!!
|
129 |
+
$embedded = $cxtem[2][$i];
|
130 |
+
if (!preg_match('/^data:image/i', $embedded)) { // mPDF 5.5.13
|
131 |
+
$this->mpdf->GetFullPath($embedded, $cssBasePath);
|
132 |
+
$CSSextblock = preg_replace('/' . preg_quote($cxtem[0][$i], '/') . '/', ($cxtem[1][$i] . $embedded . $cxtem[3][$i]), $CSSextblock);
|
133 |
+
}
|
134 |
+
}
|
135 |
+
}
|
136 |
+
$CSSstr .= ' ' . $CSSextblock;
|
137 |
+
}
|
138 |
+
$match--;
|
139 |
+
$ind++;
|
140 |
+
} //end of match
|
141 |
+
|
142 |
+
$match = 0; // reset value, if needed
|
143 |
+
// CSS as <style> in HTML document
|
144 |
+
$regexp = '/<style.*?>(.*?)<\/style>/si';
|
145 |
+
$match = preg_match_all($regexp, $html, $CSSblock);
|
146 |
+
if ($match) {
|
147 |
+
$tmpCSSstr = implode(' ', $CSSblock[1]);
|
148 |
+
$regexpem = '/(background[^;]*url\s*\(\s*[\'\"]{0,1})([^\)\'\"]*)([\'\"]{0,1}\s*\))/si';
|
149 |
+
$xem = preg_match_all($regexpem, $tmpCSSstr, $cxtem);
|
150 |
+
if ($xem) {
|
151 |
+
for ($i = 0; $i < count($cxtem[0]); $i++) {
|
152 |
+
$embedded = $cxtem[2][$i];
|
153 |
+
if (!preg_match('/^data:image/i', $embedded)) { // mPDF 5.5.13
|
154 |
+
$this->mpdf->GetFullPath($embedded);
|
155 |
+
$tmpCSSstr = preg_replace('/' . preg_quote($cxtem[0][$i], '/') . '/', ($cxtem[1][$i] . $embedded . $cxtem[3][$i]), $tmpCSSstr);
|
156 |
+
}
|
157 |
+
}
|
158 |
+
}
|
159 |
+
$CSSstr .= ' ' . $tmpCSSstr;
|
160 |
+
}
|
161 |
+
// Remove comments
|
162 |
+
$CSSstr = preg_replace('|/\*.*?\*/|s', ' ', $CSSstr);
|
163 |
+
$CSSstr = preg_replace('/[\s\n\r\t\f]/s', ' ', $CSSstr);
|
164 |
+
|
165 |
+
if (preg_match('/@media/', $CSSstr)) {
|
166 |
+
preg_match_all('/@media(.*?)\{(([^\{\}]*\{[^\{\}]*\})+)\s*\}/is', $CSSstr, $m);
|
167 |
+
for ($i = 0; $i < count($m[0]); $i++) {
|
168 |
+
if ($this->mpdf->CSSselectMedia && !preg_match('/(' . trim($this->mpdf->CSSselectMedia) . '|all)/i', $m[1][$i])) {
|
169 |
+
$CSSstr = preg_replace('/' . preg_quote($m[0][$i], '/') . '/', '', $CSSstr);
|
170 |
+
} else {
|
171 |
+
$CSSstr = preg_replace('/' . preg_quote($m[0][$i], '/') . '/', ' ' . $m[2][$i] . ' ', $CSSstr);
|
172 |
+
}
|
173 |
+
}
|
174 |
+
}
|
175 |
+
|
176 |
+
// Replace any background: url(data:image... with temporary image file reference
|
177 |
+
preg_match_all("/(url\(data:image\/(jpeg|gif|png);base64,(.*?)\))/si", $CSSstr, $idata); // mPDF 5.7.2
|
178 |
+
if (count($idata[0])) {
|
179 |
+
for ($i = 0; $i < count($idata[0]); $i++) {
|
180 |
+
$file = _MPDF_TEMP_PATH . '_tempCSSidata' . RAND(1, 10000) . '_' . $i . '.' . $idata[2][$i];
|
181 |
+
//Save to local file
|
182 |
+
file_put_contents($file, base64_decode($idata[3][$i]));
|
183 |
+
// $this->mpdf->GetFullPath($file); // ? is this needed - NO mPDF 5.6.03
|
184 |
+
$CSSstr = str_replace($idata[0][$i], 'url("' . $file . '")', $CSSstr); // mPDF 5.5.17
|
185 |
+
}
|
186 |
+
}
|
187 |
+
|
188 |
+
$CSSstr = preg_replace('/(<\!\-\-|\-\->)/s', ' ', $CSSstr);
|
189 |
+
|
190 |
+
// mPDF 5.7.4 URLs
|
191 |
+
// Characters "(" ")" and ";" in url() e.g. background-image, cause problems parsing the CSS string
|
192 |
+
// URLencode ( and ), but change ";" to a code which can be converted back after parsing (so as not to confuse ;
|
193 |
+
// with a segment delimiter in the URI)
|
194 |
+
$tempmarker = '%ZZ';
|
195 |
+
if (strpos($CSSstr, 'url(') !== false) {
|
196 |
+
preg_match_all('/url\(\"(.*?)\"\)/', $CSSstr, $m);
|
197 |
+
for ($i = 0; $i < count($m[1]); $i++) {
|
198 |
+
$tmp = str_replace(array('(', ')', ';'), array('%28', '%29', $tempmarker), $m[1][$i]);
|
199 |
+
$CSSstr = preg_replace('/' . preg_quote($m[0][$i], '/') . '/', 'url(\'' . $tmp . '\')', $CSSstr);
|
200 |
+
}
|
201 |
+
preg_match_all('/url\(\'(.*?)\'\)/', $CSSstr, $m);
|
202 |
+
for ($i = 0; $i < count($m[1]); $i++) {
|
203 |
+
$tmp = str_replace(array('(', ')', ';'), array('%28', '%29', $tempmarker), $m[1][$i]);
|
204 |
+
$CSSstr = preg_replace('/' . preg_quote($m[0][$i], '/') . '/', 'url(\'' . $tmp . '\')', $CSSstr);
|
205 |
+
}
|
206 |
+
preg_match_all('/url\(([^\'\"].*?[^\'\"])\)/', $CSSstr, $m);
|
207 |
+
for ($i = 0; $i < count($m[1]); $i++) {
|
208 |
+
$tmp = str_replace(array('(', ')', ';'), array('%28', '%29', $tempmarker), $m[1][$i]);
|
209 |
+
$CSSstr = preg_replace('/' . preg_quote($m[0][$i], '/') . '/', 'url(\'' . $tmp . '\')', $CSSstr);
|
210 |
+
}
|
211 |
+
}
|
212 |
+
|
213 |
+
|
214 |
+
|
215 |
+
if ($CSSstr) {
|
216 |
+
$classproperties = array(); // mPDF 6
|
217 |
+
preg_match_all('/(.*?)\{(.*?)\}/', $CSSstr, $styles);
|
218 |
+
for ($i = 0; $i < count($styles[1]); $i++) {
|
219 |
+
// SET array e.g. $classproperties['COLOR'] = '#ffffff';
|
220 |
+
$stylestr = trim($styles[2][$i]);
|
221 |
+
$stylearr = explode(';', $stylestr);
|
222 |
+
foreach ($stylearr AS $sta) {
|
223 |
+
if (trim($sta)) {
|
224 |
+
// Changed to allow style="background: url('http://www.bpm1.com/bg.jpg')"
|
225 |
+
$tmp = explode(':', $sta, 2);
|
226 |
+
$property = $tmp[0];
|
227 |
+
if (isset($tmp[1])) {
|
228 |
+
$value = $tmp[1];
|
229 |
+
} else {
|
230 |
+
$value = '';
|
231 |
+
}
|
232 |
+
$value = str_replace($tempmarker, ';', $value); // mPDF 5.7.4 URLs
|
233 |
+
$property = trim($property);
|
234 |
+
$value = preg_replace('/\s*!important/i', '', $value);
|
235 |
+
$value = trim($value);
|
236 |
+
if ($property && ($value || $value === '0')) {
|
237 |
+
// Ignores -webkit-gradient so doesn't override -moz-
|
238 |
+
if ((strtoupper($property) == 'BACKGROUND-IMAGE' || strtoupper($property) == 'BACKGROUND') && preg_match('/-webkit-gradient/i', $value)) {
|
239 |
+
continue;
|
240 |
+
}
|
241 |
+
$classproperties[strtoupper($property)] = $value;
|
242 |
+
}
|
243 |
+
}
|
244 |
+
}
|
245 |
+
$classproperties = $this->fixCSS($classproperties);
|
246 |
+
$tagstr = strtoupper(trim($styles[1][$i]));
|
247 |
+
$tagarr = explode(',', $tagstr);
|
248 |
+
$pageselectors = false; // used to turn on $this->mpdf->mirrorMargins
|
249 |
+
foreach ($tagarr AS $tg) {
|
250 |
+
// mPDF 5.7.4
|
251 |
+
if (preg_match('/NTH-CHILD\((\s*(([\-+]?\d*)N(\s*[\-+]\s*\d+)?|[\-+]?\d+|ODD|EVEN)\s*)\)/', $tg, $m)) {
|
252 |
+
$tg = preg_replace('/NTH-CHILD\(.*\)/', 'NTH-CHILD(' . str_replace(' ', '', $m[1]) . ')', $tg);
|
253 |
+
}
|
254 |
+
$tags = preg_split('/\s+/', trim($tg));
|
255 |
+
$level = count($tags);
|
256 |
+
$t = '';
|
257 |
+
$t2 = '';
|
258 |
+
$t3 = '';
|
259 |
+
if (trim($tags[0]) == '@PAGE') {
|
260 |
+
if (isset($tags[0])) {
|
261 |
+
$t = trim($tags[0]);
|
262 |
+
}
|
263 |
+
if (isset($tags[1])) {
|
264 |
+
$t2 = trim($tags[1]);
|
265 |
+
}
|
266 |
+
if (isset($tags[2])) {
|
267 |
+
$t3 = trim($tags[2]);
|
268 |
+
}
|
269 |
+
$tag = '';
|
270 |
+
if ($level == 1) {
|
271 |
+
$tag = $t;
|
272 |
+
} else if ($level == 2 && preg_match('/^[:](.*)$/', $t2, $m)) {
|
273 |
+
$tag = $t . '>>PSEUDO>>' . $m[1];
|
274 |
+
if ($m[1] == 'LEFT' || $m[1] == 'RIGHT') {
|
275 |
+
$pageselectors = true;
|
276 |
+
} // used to turn on $this->mpdf->mirrorMargins
|
277 |
+
} else if ($level == 2) {
|
278 |
+
$tag = $t . '>>NAMED>>' . $t2;
|
279 |
+
} else if ($level == 3 && preg_match('/^[:](.*)$/', $t3, $m)) {
|
280 |
+
$tag = $t . '>>NAMED>>' . $t2 . '>>PSEUDO>>' . $m[1];
|
281 |
+
if ($m[1] == 'LEFT' || $m[1] == 'RIGHT') {
|
282 |
+
$pageselectors = true;
|
283 |
+
} // used to turn on $this->mpdf->mirrorMargins
|
284 |
+
}
|
285 |
+
if (isset($this->CSS[$tag]) && $tag) {
|
286 |
+
$this->CSS[$tag] = $this->array_merge_recursive_unique($this->CSS[$tag], $classproperties);
|
287 |
+
} else if ($tag) {
|
288 |
+
$this->CSS[$tag] = $classproperties;
|
289 |
+
}
|
290 |
+
} else if ($level == 1) { // e.g. p or .class or #id or p.class or p#id
|
291 |
+
if (isset($tags[0])) {
|
292 |
+
$t = trim($tags[0]);
|
293 |
+
}
|
294 |
+
if ($t) {
|
295 |
+
$tag = '';
|
296 |
+
if (preg_match('/^[.](.*)$/', $t, $m)) {
|
297 |
+
$tag = 'CLASS>>' . $m[1];
|
298 |
+
} else if (preg_match('/^[#](.*)$/', $t, $m)) {
|
299 |
+
$tag = 'ID>>' . $m[1];
|
300 |
+
} else if (preg_match('/^\[LANG=[\'\"]{0,1}([A-Z\-]{2,11})[\'\"]{0,1}\]$/', $t, $m)) {
|
301 |
+
$tag = 'LANG>>' . strtolower($m[1]);
|
302 |
+
} // mPDF 6 Special case for lang as attribute selector
|
303 |
+
else if (preg_match('/^:LANG\([\'\"]{0,1}([A-Z\-]{2,11})[\'\"]{0,1}\)$/', $t, $m)) {
|
304 |
+
$tag = 'LANG>>' . strtolower($m[1]);
|
305 |
+
} // mPDF 6 Special case for lang as attribute selector
|
306 |
+
else if (preg_match('/^(' . $this->mpdf->allowedCSStags . ')[.](.*)$/', $t, $m)) {
|
307 |
+
$tag = $m[1] . '>>CLASS>>' . $m[2];
|
308 |
+
} else if (preg_match('/^(' . $this->mpdf->allowedCSStags . ')\s*:NTH-CHILD\((.*)\)$/', $t, $m)) {
|
309 |
+
$tag = $m[1] . '>>SELECTORNTHCHILD>>' . $m[2];
|
310 |
+
} else if (preg_match('/^(' . $this->mpdf->allowedCSStags . ')[#](.*)$/', $t, $m)) {
|
311 |
+
$tag = $m[1] . '>>ID>>' . $m[2];
|
312 |
+
} else if (preg_match('/^(' . $this->mpdf->allowedCSStags . ')\[LANG=[\'\"]{0,1}([A-Z\-]{2,11})[\'\"]{0,1}\]$/', $t, $m)) {
|
313 |
+
$tag = $m[1] . '>>LANG>>' . strtolower($m[2]);
|
314 |
+
} // mPDF 6 Special case for lang as attribute selector
|
315 |
+
else if (preg_match('/^(' . $this->mpdf->allowedCSStags . '):LANG\([\'\"]{0,1}([A-Z\-]{2,11})[\'\"]{0,1}\)$/', $t, $m)) {
|
316 |
+
$tag = $m[1] . '>>LANG>>' . strtolower($m[2]);
|
317 |
+
} // mPDF 6 Special case for lang as attribute selector
|
318 |
+
else if (preg_match('/^(' . $this->mpdf->allowedCSStags . ')$/', $t)) {
|
319 |
+
$tag = $t;
|
320 |
+
}
|
321 |
+
if (isset($this->CSS[$tag]) && $tag) {
|
322 |
+
$this->CSS[$tag] = $this->array_merge_recursive_unique($this->CSS[$tag], $classproperties);
|
323 |
+
} else if ($tag) {
|
324 |
+
$this->CSS[$tag] = $classproperties;
|
325 |
+
}
|
326 |
+
}
|
327 |
+
} else {
|
328 |
+
$tmp = array();
|
329 |
+
for ($n = 0; $n < $level; $n++) {
|
330 |
+
if (isset($tags[$n])) {
|
331 |
+
$t = trim($tags[$n]);
|
332 |
+
} else {
|
333 |
+
$t = '';
|
334 |
+
}
|
335 |
+
if ($t) {
|
336 |
+
$tag = '';
|
337 |
+
if (preg_match('/^[.](.*)$/', $t, $m)) {
|
338 |
+
$tag = 'CLASS>>' . $m[1];
|
339 |
+
} else if (preg_match('/^[#](.*)$/', $t, $m)) {
|
340 |
+
$tag = 'ID>>' . $m[1];
|
341 |
+
} else if (preg_match('/^\[LANG=[\'\"]{0,1}([A-Z\-]{2,11})[\'\"]{0,1}\]$/', $t, $m)) {
|
342 |
+
$tag = 'LANG>>' . strtolower($m[1]);
|
343 |
+
} // mPDF 6 Special case for lang as attribute selector
|
344 |
+
else if (preg_match('/^:LANG\([\'\"]{0,1}([A-Z\-]{2,11})[\'\"]{0,1}\)$/', $t, $m)) {
|
345 |
+
$tag = 'LANG>>' . strtolower($m[1]);
|
346 |
+
} // mPDF 6 Special case for lang as attribute selector
|
347 |
+
else if (preg_match('/^(' . $this->mpdf->allowedCSStags . ')[.](.*)$/', $t, $m)) {
|
348 |
+
$tag = $m[1] . '>>CLASS>>' . $m[2];
|
349 |
+
} else if (preg_match('/^(' . $this->mpdf->allowedCSStags . ')\s*:NTH-CHILD\((.*)\)$/', $t, $m)) {
|
350 |
+
$tag = $m[1] . '>>SELECTORNTHCHILD>>' . $m[2];
|
351 |
+
} else if (preg_match('/^(' . $this->mpdf->allowedCSStags . ')[#](.*)$/', $t, $m)) {
|
352 |
+
$tag = $m[1] . '>>ID>>' . $m[2];
|
353 |
+
} else if (preg_match('/^(' . $this->mpdf->allowedCSStags . ')\[LANG=[\'\"]{0,1}([A-Z\-]{2,11})[\'\"]{0,1}\]$/', $t, $m)) {
|
354 |
+
$tag = $m[1] . '>>LANG>>' . strtolower($m[2]);
|
355 |
+
} // mPDF 6 Special case for lang as attribute selector
|
356 |
+
else if (preg_match('/^(' . $this->mpdf->allowedCSStags . '):LANG\([\'\"]{0,1}([A-Z\-]{2,11})[\'\"]{0,1}\)$/', $t, $m)) {
|
357 |
+
$tag = $m[1] . '>>LANG>>' . strtolower($m[2]);
|
358 |
+
} // mPDF 6 Special case for lang as attribute selector
|
359 |
+
else if (preg_match('/^(' . $this->mpdf->allowedCSStags . ')$/', $t)) {
|
360 |
+
$tag = $t;
|
361 |
+
}
|
362 |
+
|
363 |
+
if ($tag)
|
364 |
+
$tmp[] = $tag;
|
365 |
+
else {
|
366 |
+
break;
|
367 |
+
}
|
368 |
+
}
|
369 |
+
}
|
370 |
+
|
371 |
+
if ($tag) {
|
372 |
+
$x = &$this->cascadeCSS;
|
373 |
+
foreach ($tmp AS $tp) {
|
374 |
+
$x = &$x[$tp];
|
375 |
+
}
|
376 |
+
$x = $this->array_merge_recursive_unique($x, $classproperties);
|
377 |
+
$x['depth'] = $level;
|
378 |
+
}
|
379 |
+
}
|
380 |
+
}
|
381 |
+
if ($pageselectors) {
|
382 |
+
$this->mpdf->mirrorMargins = true;
|
383 |
+
}
|
384 |
+
$properties = array();
|
385 |
+
$values = array();
|
386 |
+
$classproperties = array();
|
387 |
+
}
|
388 |
+
} // end of if
|
389 |
+
//Remove CSS (tags and content), if any
|
390 |
+
$regexp = '/<style.*?>(.*?)<\/style>/si'; // it can be <style> or <style type="txt/css">
|
391 |
+
$html = preg_replace($regexp, '', $html);
|
392 |
+
//print_r($this->CSS); exit;
|
393 |
+
//print_r($this->cascadeCSS); exit;
|
394 |
+
return $html;
|
395 |
+
}
|
396 |
+
|
397 |
+
function readInlineCSS($html)
|
398 |
+
{
|
399 |
+
$html = htmlspecialchars_decode($html); // mPDF 5.7.4 URLs
|
400 |
+
// mPDF 5.7.4 URLs
|
401 |
+
// Characters "(" ")" and ";" in url() e.g. background-image, cause probems parsing the CSS string
|
402 |
+
// URLencode ( and ), but change ";" to a code which can be converted back after parsing (so as not to confuse ;
|
403 |
+
// with a segment delimiter in the URI)
|
404 |
+
$tempmarker = '%ZZ';
|
405 |
+
if (strpos($html, 'url(') !== false) {
|
406 |
+
preg_match_all('/url\(\"(.*?)\"\)/', $html, $m);
|
407 |
+
for ($i = 0; $i < count($m[1]); $i++) {
|
408 |
+
$tmp = str_replace(array('(', ')', ';'), array('%28', '%29', $tempmarker), $m[1][$i]);
|
409 |
+
$html = preg_replace('/' . preg_quote($m[0][$i], '/') . '/', 'url(\'' . $tmp . '\')', $html);
|
410 |
+
}
|
411 |
+
preg_match_all('/url\(\'(.*?)\'\)/', $html, $m);
|
412 |
+
for ($i = 0; $i < count($m[1]); $i++) {
|
413 |
+
$tmp = str_replace(array('(', ')', ';'), array('%28', '%29', $tempmarker), $m[1][$i]);
|
414 |
+
$html = preg_replace('/' . preg_quote($m[0][$i], '/') . '/', 'url(\'' . $tmp . '\')', $html);
|
415 |
+
}
|
416 |
+
preg_match_all('/url\(([^\'\"].*?[^\'\"])\)/', $html, $m);
|
417 |
+
for ($i = 0; $i < count($m[1]); $i++) {
|
418 |
+
$tmp = str_replace(array('(', ')', ';'), array('%28', '%29', $tempmarker), $m[1][$i]);
|
419 |
+
$html = preg_replace('/' . preg_quote($m[0][$i], '/') . '/', 'url(\'' . $tmp . '\')', $html);
|
420 |
+
}
|
421 |
+
}
|
422 |
+
//Fix incomplete CSS code
|
423 |
+
$size = strlen($html) - 1;
|
424 |
+
if (substr($html, $size, 1) != ';')
|
425 |
+
$html .= ';';
|
426 |
+
//Make CSS[Name-of-the-class] = array(key => value)
|
427 |
+
$regexp = '|\\s*?(\\S+?):(.+?);|i';
|
428 |
+
preg_match_all($regexp, $html, $styleinfo);
|
429 |
+
$properties = $styleinfo[1];
|
430 |
+
$values = $styleinfo[2];
|
431 |
+
//Array-properties and Array-values must have the SAME SIZE!
|
432 |
+
$classproperties = array();
|
433 |
+
for ($i = 0; $i < count($properties); $i++) {
|
434 |
+
// Ignores -webkit-gradient so doesn't override -moz-
|
435 |
+
if ((strtoupper($properties[$i]) == 'BACKGROUND-IMAGE' || strtoupper($properties[$i]) == 'BACKGROUND') && preg_match('/-webkit-gradient/i', $values[$i])) {
|
436 |
+
continue;
|
437 |
+
}
|
438 |
+
$values[$i] = str_replace($tempmarker, ';', $values[$i]); // mPDF 5.7.4 URLs
|
439 |
+
$classproperties[strtoupper($properties[$i])] = trim($values[$i]);
|
440 |
+
}
|
441 |
+
return $this->fixCSS($classproperties);
|
442 |
+
}
|
443 |
+
|
444 |
+
function _fix_borderStr($bd)
|
445 |
+
{
|
446 |
+
preg_match_all("/\((.*?)\)/", $bd, $m);
|
447 |
+
if (count($m[1])) {
|
448 |
+
for ($i = 0; $i < count($m[1]); $i++) {
|
449 |
+
$sub = preg_replace("/ /", "", $m[1][$i]);
|
450 |
+
$bd = preg_replace('/' . preg_quote($m[1][$i], '/') . '/si', $sub, $bd);
|
451 |
+
}
|
452 |
+
}
|
453 |
+
|
454 |
+
$prop = preg_split('/\s+/', trim($bd));
|
455 |
+
$w = 'medium';
|
456 |
+
$c = '#000000';
|
457 |
+
$s = 'none';
|
458 |
+
|
459 |
+
if (count($prop) == 1) {
|
460 |
+
// solid
|
461 |
+
if (in_array($prop[0], $this->mpdf->borderstyles) || $prop[0] == 'none' || $prop[0] == 'hidden') {
|
462 |
+
$s = $prop[0];
|
463 |
+
}
|
464 |
+
// #000000
|
465 |
+
else if (is_array($this->mpdf->ConvertColor($prop[0]))) {
|
466 |
+
$c = $prop[0];
|
467 |
+
}
|
468 |
+
// 1px
|
469 |
+
else {
|
470 |
+
$w = $prop[0];
|
471 |
+
}
|
472 |
+
} else if (count($prop) == 2) {
|
473 |
+
// 1px solid
|
474 |
+
if (in_array($prop[1], $this->mpdf->borderstyles) || $prop[1] == 'none' || $prop[1] == 'hidden') {
|
475 |
+
$w = $prop[0];
|
476 |
+
$s = $prop[1];
|
477 |
+
}
|
478 |
+
// solid #000000
|
479 |
+
else if (in_array($prop[0], $this->mpdf->borderstyles) || $prop[0] == 'none' || $prop[0] == 'hidden') {
|
480 |
+
$s = $prop[0];
|
481 |
+
$c = $prop[1];
|
482 |
+
}
|
483 |
+
// 1px #000000
|
484 |
+
else {
|
485 |
+
$w = $prop[0];
|
486 |
+
$c = $prop[1];
|
487 |
+
}
|
488 |
+
} else if (count($prop) == 3) {
|
489 |
+
// Change #000000 1px solid to 1px solid #000000 (proper)
|
490 |
+
if (substr($prop[0], 0, 1) == '#') {
|
491 |
+
$c = $prop[0];
|
492 |
+
$w = $prop[1];
|
493 |
+
$s = $prop[2];
|
494 |
+
}
|
495 |
+
// Change solid #000000 1px to 1px solid #000000 (proper)
|
496 |
+
else if (substr($prop[0], 1, 1) == '#') {
|
497 |
+
$s = $prop[0];
|
498 |
+
$c = $prop[1];
|
499 |
+
$w = $prop[2];
|
500 |
+
}
|
501 |
+
// Change solid 1px #000000 to 1px solid #000000 (proper)
|
502 |
+
else if (in_array($prop[0], $this->mpdf->borderstyles) || $prop[0] == 'none' || $prop[0] == 'hidden') {
|
503 |
+
$s = $prop[0];
|
504 |
+
$w = $prop[1];
|
505 |
+
$c = $prop[2];
|
506 |
+
} else {
|
507 |
+
$w = $prop[0];
|
508 |
+
$s = $prop[1];
|
509 |
+
$c = $prop[2];
|
510 |
+
}
|
511 |
+
} else {
|
512 |
+
return '';
|
513 |
+
}
|
514 |
+
$s = strtolower($s);
|
515 |
+
return $w . ' ' . $s . ' ' . $c;
|
516 |
+
}
|
517 |
+
|
518 |
+
function fixCSS($prop)
|
519 |
+
{
|
520 |
+
if (!is_array($prop) || (count($prop) == 0))
|
521 |
+
return array();
|
522 |
+
$newprop = array();
|
523 |
+
foreach ($prop AS $k => $v) {
|
524 |
+
if ($k != 'BACKGROUND-IMAGE' && $k != 'BACKGROUND' && $k != 'ODD-HEADER-NAME' && $k != 'EVEN-HEADER-NAME' && $k != 'ODD-FOOTER-NAME' && $k != 'EVEN-FOOTER-NAME' && $k != 'HEADER' && $k != 'FOOTER') {
|
525 |
+
$v = strtolower($v);
|
526 |
+
}
|
527 |
+
|
528 |
+
if ($k == 'FONT') {
|
529 |
+
$s = trim($v);
|
530 |
+
preg_match_all('/\"(.*?)\"/', $s, $ff);
|
531 |
+
if (count($ff[1])) {
|
532 |
+
foreach ($ff[1] AS $ffp) {
|
533 |
+
$w = preg_split('/\s+/', $ffp);
|
534 |
+
$s = preg_replace('/\"' . $ffp . '\"/', $w[0], $s);
|
535 |
+
}
|
536 |
+
}
|
537 |
+
preg_match_all('/\'(.*?)\'/', $s, $ff);
|
538 |
+
if (count($ff[1])) {
|
539 |
+
foreach ($ff[1] AS $ffp) {
|
540 |
+
$w = preg_split('/\s+/', $ffp);
|
541 |
+
$s = preg_replace('/\'' . $ffp . '\'/', $w[0], $s);
|
542 |
+
}
|
543 |
+
}
|
544 |
+
$s = preg_replace('/\s*,\s*/', ',', $s);
|
545 |
+
$bits = preg_split('/\s+/', $s);
|
546 |
+
if (count($bits) > 1) {
|
547 |
+
$k = 'FONT-FAMILY';
|
548 |
+
$v = $bits[(count($bits) - 1)];
|
549 |
+
$fs = $bits[(count($bits) - 2)];
|
550 |
+
if (preg_match('/(.*?)\/(.*)/', $fs, $fsp)) {
|
551 |
+
$newprop['FONT-SIZE'] = $fsp[1];
|
552 |
+
$newprop['LINE-HEIGHT'] = $fsp[2];
|
553 |
+
} else {
|
554 |
+
$newprop['FONT-SIZE'] = $fs;
|
555 |
+
}
|
556 |
+
if (preg_match('/(italic|oblique)/i', $s)) {
|
557 |
+
$newprop['FONT-STYLE'] = 'italic';
|
558 |
+
} else {
|
559 |
+
$newprop['FONT-STYLE'] = 'normal';
|
560 |
+
}
|
561 |
+
if (preg_match('/bold/i', $s)) {
|
562 |
+
$newprop['FONT-WEIGHT'] = 'bold';
|
563 |
+
} else {
|
564 |
+
$newprop['FONT-WEIGHT'] = 'normal';
|
565 |
+
}
|
566 |
+
if (preg_match('/small-caps/i', $s)) {
|
567 |
+
$newprop['TEXT-TRANSFORM'] = 'uppercase';
|
568 |
+
}
|
569 |
+
}
|
570 |
+
} else if ($k == 'FONT-FAMILY') {
|
571 |
+
$aux_fontlist = explode(",", $v);
|
572 |
+
$found = 0;
|
573 |
+
foreach ($aux_fontlist AS $f) {
|
574 |
+
$fonttype = trim($f);
|
575 |
+
$fonttype = preg_replace('/["\']*(.*?)["\']*/', '\\1', $fonttype);
|
576 |
+
$fonttype = preg_replace('/ /', '', $fonttype);
|
577 |
+
$v = strtolower(trim($fonttype));
|
578 |
+
if (isset($this->mpdf->fonttrans[$v]) && $this->mpdf->fonttrans[$v]) {
|
579 |
+
$v = $this->mpdf->fonttrans[$v];
|
580 |
+
}
|
581 |
+
if ((!$this->mpdf->onlyCoreFonts && in_array($v, $this->mpdf->available_unifonts)) ||
|
582 |
+
in_array($v, array('ccourier', 'ctimes', 'chelvetica')) ||
|
583 |
+
($this->mpdf->onlyCoreFonts && in_array($v, array('courier', 'times', 'helvetica', 'arial'))) ||
|
584 |
+
in_array($v, array('sjis', 'uhc', 'big5', 'gb'))) {
|
585 |
+
$newprop[$k] = $v;
|
586 |
+
$found = 1;
|
587 |
+
break;
|
588 |
+
}
|
589 |
+
}
|
590 |
+
if (!$found) {
|
591 |
+
foreach ($aux_fontlist AS $f) {
|
592 |
+
$fonttype = trim($f);
|
593 |
+
$fonttype = preg_replace('/["\']*(.*?)["\']*/', '\\1', $fonttype);
|
594 |
+
$fonttype = preg_replace('/ /', '', $fonttype);
|
595 |
+
$v = strtolower(trim($fonttype));
|
596 |
+
if (isset($this->mpdf->fonttrans[$v]) && $this->mpdf->fonttrans[$v]) {
|
597 |
+
$v = $this->mpdf->fonttrans[$v];
|
598 |
+
}
|
599 |
+
if (in_array($v, $this->mpdf->sans_fonts) || in_array($v, $this->mpdf->serif_fonts) || in_array($v, $this->mpdf->mono_fonts)) {
|
600 |
+
$newprop[$k] = $v;
|
601 |
+
break;
|
602 |
+
}
|
603 |
+
}
|
604 |
+
}
|
605 |
+
}
|
606 |
+
// mPDF 5.7.1
|
607 |
+
else if ($k == 'FONT-VARIANT') {
|
608 |
+
if (preg_match('/(normal|none)/', $v, $m)) { // mPDF 6
|
609 |
+
$newprop['FONT-VARIANT-LIGATURES'] = $m[1];
|
610 |
+
$newprop['FONT-VARIANT-CAPS'] = $m[1];
|
611 |
+
$newprop['FONT-VARIANT-NUMERIC'] = $m[1];
|
612 |
+
$newprop['FONT-VARIANT-ALTERNATES'] = $m[1];
|
613 |
+
} else {
|
614 |
+
if (preg_match_all('/(no-common-ligatures|\bcommon-ligatures|no-discretionary-ligatures|\bdiscretionary-ligatures|no-historical-ligatures|\bhistorical-ligatures|no-contextual|\bcontextual)/i', $v, $m)) {
|
615 |
+
$newprop['FONT-VARIANT-LIGATURES'] = implode(' ', $m[1]);
|
616 |
+
}
|
617 |
+
if (preg_match('/(all-small-caps|\bsmall-caps|all-petite-caps|\bpetite-caps|unicase|titling-caps)/i', $v, $m)) {
|
618 |
+
$newprop['FONT-VARIANT-CAPS'] = $m[1];
|
619 |
+
}
|
620 |
+
if (preg_match_all('/(lining-nums|oldstyle-nums|proportional-nums|tabular-nums|diagonal-fractions|stacked-fractions)/i', $v, $m)) {
|
621 |
+
$newprop['FONT-VARIANT-NUMERIC'] = implode(' ', $m[1]);
|
622 |
+
}
|
623 |
+
if (preg_match('/(historical-forms)/i', $v, $m)) {
|
624 |
+
$newprop['FONT-VARIANT-ALTERNATES'] = $m[1];
|
625 |
+
}
|
626 |
+
}
|
627 |
+
} else if ($k == 'MARGIN') {
|
628 |
+
$tmp = $this->expand24($v);
|
629 |
+
$newprop['MARGIN-TOP'] = $tmp['T'];
|
630 |
+
$newprop['MARGIN-RIGHT'] = $tmp['R'];
|
631 |
+
$newprop['MARGIN-BOTTOM'] = $tmp['B'];
|
632 |
+
$newprop['MARGIN-LEFT'] = $tmp['L'];
|
633 |
+
}
|
634 |
+
/* -- BORDER-RADIUS -- */ else if ($k == 'BORDER-RADIUS' || $k == 'BORDER-TOP-LEFT-RADIUS' || $k == 'BORDER-TOP-RIGHT-RADIUS' || $k == 'BORDER-BOTTOM-LEFT-RADIUS' || $k == 'BORDER-BOTTOM-RIGHT-RADIUS') {
|
635 |
+
$tmp = $this->border_radius_expand($v, $k);
|
636 |
+
if (isset($tmp['TL-H']))
|
637 |
+
$newprop['BORDER-TOP-LEFT-RADIUS-H'] = $tmp['TL-H'];
|
638 |
+
if (isset($tmp['TL-V']))
|
639 |
+
$newprop['BORDER-TOP-LEFT-RADIUS-V'] = $tmp['TL-V'];
|
640 |
+
if (isset($tmp['TR-H']))
|
641 |
+
$newprop['BORDER-TOP-RIGHT-RADIUS-H'] = $tmp['TR-H'];
|
642 |
+
if (isset($tmp['TR-V']))
|
643 |
+
$newprop['BORDER-TOP-RIGHT-RADIUS-V'] = $tmp['TR-V'];
|
644 |
+
if (isset($tmp['BL-H']))
|
645 |
+
$newprop['BORDER-BOTTOM-LEFT-RADIUS-H'] = $tmp['BL-H'];
|
646 |
+
if (isset($tmp['BL-V']))
|
647 |
+
$newprop['BORDER-BOTTOM-LEFT-RADIUS-V'] = $tmp['BL-V'];
|
648 |
+
if (isset($tmp['BR-H']))
|
649 |
+
$newprop['BORDER-BOTTOM-RIGHT-RADIUS-H'] = $tmp['BR-H'];
|
650 |
+
if (isset($tmp['BR-V']))
|
651 |
+
$newprop['BORDER-BOTTOM-RIGHT-RADIUS-V'] = $tmp['BR-V'];
|
652 |
+
}
|
653 |
+
/* -- END BORDER-RADIUS -- */
|
654 |
+
else if ($k == 'PADDING') {
|
655 |
+
$tmp = $this->expand24($v);
|
656 |
+
$newprop['PADDING-TOP'] = $tmp['T'];
|
657 |
+
$newprop['PADDING-RIGHT'] = $tmp['R'];
|
658 |
+
$newprop['PADDING-BOTTOM'] = $tmp['B'];
|
659 |
+
$newprop['PADDING-LEFT'] = $tmp['L'];
|
660 |
+
} else if ($k == 'BORDER') {
|
661 |
+
if ($v == '1') {
|
662 |
+
$v = '1px solid #000000';
|
663 |
+
} else {
|
664 |
+
$v = $this->_fix_borderStr($v);
|
665 |
+
}
|
666 |
+
$newprop['BORDER-TOP'] = $v;
|
667 |
+
$newprop['BORDER-RIGHT'] = $v;
|
668 |
+
$newprop['BORDER-BOTTOM'] = $v;
|
669 |
+
$newprop['BORDER-LEFT'] = $v;
|
670 |
+
} else if ($k == 'BORDER-TOP') {
|
671 |
+
$newprop['BORDER-TOP'] = $this->_fix_borderStr($v);
|
672 |
+
} else if ($k == 'BORDER-RIGHT') {
|
673 |
+
$newprop['BORDER-RIGHT'] = $this->_fix_borderStr($v);
|
674 |
+
} else if ($k == 'BORDER-BOTTOM') {
|
675 |
+
$newprop['BORDER-BOTTOM'] = $this->_fix_borderStr($v);
|
676 |
+
} else if ($k == 'BORDER-LEFT') {
|
677 |
+
$newprop['BORDER-LEFT'] = $this->_fix_borderStr($v);
|
678 |
+
} else if ($k == 'BORDER-STYLE') {
|
679 |
+
$e = $this->expand24($v);
|
680 |
+
if (!empty($e)) {
|
681 |
+
$newprop['BORDER-TOP-STYLE'] = $e['T'];
|
682 |
+
$newprop['BORDER-RIGHT-STYLE'] = $e['R'];
|
683 |
+
$newprop['BORDER-BOTTOM-STYLE'] = $e['B'];
|
684 |
+
$newprop['BORDER-LEFT-STYLE'] = $e['L'];
|
685 |
+
}
|
686 |
+
} else if ($k == 'BORDER-WIDTH') {
|
687 |
+
$e = $this->expand24($v);
|
688 |
+
if (!empty($e)) {
|
689 |
+
$newprop['BORDER-TOP-WIDTH'] = $e['T'];
|
690 |
+
$newprop['BORDER-RIGHT-WIDTH'] = $e['R'];
|
691 |
+
$newprop['BORDER-BOTTOM-WIDTH'] = $e['B'];
|
692 |
+
$newprop['BORDER-LEFT-WIDTH'] = $e['L'];
|
693 |
+
}
|
694 |
+
} else if ($k == 'BORDER-COLOR') {
|
695 |
+
$e = $this->expand24($v);
|
696 |
+
if (!empty($e)) {
|
697 |
+
$newprop['BORDER-TOP-COLOR'] = $e['T'];
|
698 |
+
$newprop['BORDER-RIGHT-COLOR'] = $e['R'];
|
699 |
+
$newprop['BORDER-BOTTOM-COLOR'] = $e['B'];
|
700 |
+
$newprop['BORDER-LEFT-COLOR'] = $e['L'];
|
701 |
+
}
|
702 |
+
} else if ($k == 'BORDER-SPACING') {
|
703 |
+
$prop = preg_split('/\s+/', trim($v));
|
704 |
+
if (count($prop) == 1) {
|
705 |
+
$newprop['BORDER-SPACING-H'] = $prop[0];
|
706 |
+
$newprop['BORDER-SPACING-V'] = $prop[0];
|
707 |
+
} else if (count($prop) == 2) {
|
708 |
+
$newprop['BORDER-SPACING-H'] = $prop[0];
|
709 |
+
$newprop['BORDER-SPACING-V'] = $prop[1];
|
710 |
+
}
|
711 |
+
} else if ($k == 'TEXT-OUTLINE') { // mPDF 5.6.07
|
712 |
+
$prop = preg_split('/\s+/', trim($v));
|
713 |
+
if (trim(strtolower($v)) == 'none') {
|
714 |
+
$newprop['TEXT-OUTLINE'] = 'none';
|
715 |
+
} else if (count($prop) == 2) {
|
716 |
+
$newprop['TEXT-OUTLINE-WIDTH'] = $prop[0];
|
717 |
+
$newprop['TEXT-OUTLINE-COLOR'] = $prop[1];
|
718 |
+
} else if (count($prop) == 3) {
|
719 |
+
$newprop['TEXT-OUTLINE-WIDTH'] = $prop[0];
|
720 |
+
$newprop['TEXT-OUTLINE-COLOR'] = $prop[2];
|
721 |
+
}
|
722 |
+
} else if ($k == 'SIZE') {
|
723 |
+
$prop = preg_split('/\s+/', trim($v));
|
724 |
+
if (preg_match('/(auto|portrait|landscape)/', $prop[0])) {
|
725 |
+
$newprop['SIZE'] = strtoupper($prop[0]);
|
726 |
+
} else if (count($prop) == 1) {
|
727 |
+
$newprop['SIZE']['W'] = $this->mpdf->ConvertSize($prop[0]);
|
728 |
+
$newprop['SIZE']['H'] = $this->mpdf->ConvertSize($prop[0]);
|
729 |
+
} else if (count($prop) == 2) {
|
730 |
+
$newprop['SIZE']['W'] = $this->mpdf->ConvertSize($prop[0]);
|
731 |
+
$newprop['SIZE']['H'] = $this->mpdf->ConvertSize($prop[1]);
|
732 |
+
}
|
733 |
+
} else if ($k == 'SHEET-SIZE') {
|
734 |
+
$prop = preg_split('/\s+/', trim($v));
|
735 |
+
if (count($prop) == 2) {
|
736 |
+
$newprop['SHEET-SIZE'] = array($this->mpdf->ConvertSize($prop[0]), $this->mpdf->ConvertSize($prop[1]));
|
737 |
+
} else {
|
738 |
+
if (preg_match('/([0-9a-zA-Z]*)-L/i', $v, $m)) { // e.g. A4-L = A$ landscape
|
739 |
+
$ft = $this->mpdf->_getPageFormat($m[1]);
|
740 |
+
$format = array($ft[1], $ft[0]);
|
741 |
+
} else {
|
742 |
+
$format = $this->mpdf->_getPageFormat($v);
|
743 |
+
}
|
744 |
+
if ($format) {
|
745 |
+
$newprop['SHEET-SIZE'] = array($format[0] / _MPDFK, $format[1] / _MPDFK);
|
746 |
+
}
|
747 |
+
}
|
748 |
+
} else if ($k == 'BACKGROUND') {
|
749 |
+
$bg = $this->parseCSSbackground($v);
|
750 |
+
if ($bg['c']) {
|
751 |
+
$newprop['BACKGROUND-COLOR'] = $bg['c'];
|
752 |
+
} else {
|
753 |
+
$newprop['BACKGROUND-COLOR'] = 'transparent';
|
754 |
+
}
|
755 |
+
/* -- BACKGROUNDS -- */
|
756 |
+
if ($bg['i']) {
|
757 |
+
$newprop['BACKGROUND-IMAGE'] = $bg['i'];
|
758 |
+
if ($bg['r']) {
|
759 |
+
$newprop['BACKGROUND-REPEAT'] = $bg['r'];
|
760 |
+
}
|
761 |
+
if ($bg['p']) {
|
762 |
+
$newprop['BACKGROUND-POSITION'] = $bg['p'];
|
763 |
+
}
|
764 |
+
} else {
|
765 |
+
$newprop['BACKGROUND-IMAGE'] = '';
|
766 |
+
}
|
767 |
+
/* -- END BACKGROUNDS -- */
|
768 |
+
}
|
769 |
+
/* -- BACKGROUNDS -- */ else if ($k == 'BACKGROUND-IMAGE') {
|
770 |
+
if (preg_match('/(-moz-)*(repeating-)*(linear|radial)-gradient\(.*\)/i', $v, $m)) {
|
771 |
+
$newprop['BACKGROUND-IMAGE'] = $m[0];
|
772 |
+
continue;
|
773 |
+
}
|
774 |
+
if (preg_match('/url\([\'\"]{0,1}(.*?)[\'\"]{0,1}\)/i', $v, $m)) {
|
775 |
+
$newprop['BACKGROUND-IMAGE'] = $m[1];
|
776 |
+
} else if (strtolower($v) == 'none') {
|
777 |
+
$newprop['BACKGROUND-IMAGE'] = '';
|
778 |
+
}
|
779 |
+
} else if ($k == 'BACKGROUND-REPEAT') {
|
780 |
+
if (preg_match('/(repeat-x|repeat-y|no-repeat|repeat)/i', $v, $m)) {
|
781 |
+
$newprop['BACKGROUND-REPEAT'] = strtolower($m[1]);
|
782 |
+
}
|
783 |
+
} else if ($k == 'BACKGROUND-POSITION') {
|
784 |
+
$s = $v;
|
785 |
+
$bits = preg_split('/\s+/', trim($s));
|
786 |
+
// These should be Position x1 or x2
|
787 |
+
if (count($bits) == 1) {
|
788 |
+
if (preg_match('/bottom/', $bits[0])) {
|
789 |
+
$bg['p'] = '50% 100%';
|
790 |
+
} else if (preg_match('/top/', $bits[0])) {
|
791 |
+
$bg['p'] = '50% 0%';
|
792 |
+
} else {
|
793 |
+
$bg['p'] = $bits[0] . ' 50%';
|
794 |
+
}
|
795 |
+
} else if (count($bits) == 2) {
|
796 |
+
// Can be either right center or center right
|
797 |
+
if (preg_match('/(top|bottom)/', $bits[0]) || preg_match('/(left|right)/', $bits[1])) {
|
798 |
+
$bg['p'] = $bits[1] . ' ' . $bits[0];
|
799 |
+
} else {
|
800 |
+
$bg['p'] = $bits[0] . ' ' . $bits[1];
|
801 |
+
}
|
802 |
+
}
|
803 |
+
if ($bg['p']) {
|
804 |
+
$bg['p'] = preg_replace('/(left|top)/', '0%', $bg['p']);
|
805 |
+
$bg['p'] = preg_replace('/(right|bottom)/', '100%', $bg['p']);
|
806 |
+
$bg['p'] = preg_replace('/(center)/', '50%', $bg['p']);
|
807 |
+
if (!preg_match('/[\-]{0,1}\d+(in|cm|mm|pt|pc|em|ex|px|%)* [\-]{0,1}\d+(in|cm|mm|pt|pc|em|ex|px|%)*/', $bg['p'])) {
|
808 |
+
$bg['p'] = false;
|
809 |
+
}
|
810 |
+
}
|
811 |
+
if ($bg['p']) {
|
812 |
+
$newprop['BACKGROUND-POSITION'] = $bg['p'];
|
813 |
+
}
|
814 |
+
}
|
815 |
+
/* -- END BACKGROUNDS -- */ else if ($k == 'IMAGE-ORIENTATION') {
|
816 |
+
if (preg_match('/([\-]*[0-9\.]+)(deg|grad|rad)/i', $v, $m)) {
|
817 |
+
$angle = $m[1] + 0;
|
818 |
+
if (strtolower($m[2]) == 'deg') {
|
819 |
+
$angle = $angle;
|
820 |
+
} else if (strtolower($m[2]) == 'grad') {
|
821 |
+
$angle *= (360 / 400);
|
822 |
+
} else if (strtolower($m[2]) == 'rad') {
|
823 |
+
$angle = rad2deg($angle);
|
824 |
+
}
|
825 |
+
while ($angle < 0) {
|
826 |
+
$angle += 360;
|
827 |
+
}
|
828 |
+
$angle = ($angle % 360);
|
829 |
+
$angle /= 90;
|
830 |
+
$angle = round($angle) * 90;
|
831 |
+
$newprop['IMAGE-ORIENTATION'] = $angle;
|
832 |
+
}
|
833 |
+
} else if ($k == 'TEXT-ALIGN') {
|
834 |
+
if (preg_match('/["\'](.){1}["\']/i', $v, $m)) {
|
835 |
+
$d = array_search($m[1], $this->mpdf->decimal_align);
|
836 |
+
if ($d !== false) {
|
837 |
+
$newprop['TEXT-ALIGN'] = $d;
|
838 |
+
}
|
839 |
+
if (preg_match('/(center|left|right)/i', $v, $m)) {
|
840 |
+
$newprop['TEXT-ALIGN'] .= strtoupper(substr($m[1], 0, 1));
|
841 |
+
} else {
|
842 |
+
$newprop['TEXT-ALIGN'] .= 'R';
|
843 |
+
} // default = R
|
844 |
+
} else if (preg_match('/["\'](\\\[a-fA-F0-9]{1,6})["\']/i', $v, $m)) {
|
845 |
+
$utf8 = codeHex2utf(substr($m[1], 1, 6));
|
846 |
+
$d = array_search($utf8, $this->mpdf->decimal_align);
|
847 |
+
if ($d !== false) {
|
848 |
+
$newprop['TEXT-ALIGN'] = $d;
|
849 |
+
}
|
850 |
+
if (preg_match('/(center|left|right)/i', $v, $m)) {
|
851 |
+
$newprop['TEXT-ALIGN'] .= strtoupper(substr($m[1], 0, 1));
|
852 |
+
} else {
|
853 |
+
$newprop['TEXT-ALIGN'] .= 'R';
|
854 |
+
} // default = R
|
855 |
+
} else {
|
856 |
+
$newprop[$k] = $v;
|
857 |
+
}
|
858 |
+
}
|
859 |
+
// mpDF 6 Lists
|
860 |
+
else if ($k == 'LIST-STYLE') {
|
861 |
+
if (preg_match('/none/i', $v, $m)) {
|
862 |
+
$newprop['LIST-STYLE-TYPE'] = 'none';
|
863 |
+
$newprop['LIST-STYLE-IMAGE'] = 'none';
|
864 |
+
}
|
865 |
+
if (preg_match('/(lower-roman|upper-roman|lower-latin|lower-alpha|upper-latin|upper-alpha|decimal|disc|circle|square|arabic-indic|bengali|devanagari|gujarati|gurmukhi|kannada|malayalam|oriya|persian|tamil|telugu|thai|urdu|cambodian|khmer|lao|cjk-decimal|hebrew)/i', $v, $m)) {
|
866 |
+
$newprop['LIST-STYLE-TYPE'] = strtolower(trim($m[1]));
|
867 |
+
} else if (preg_match('/U\+([a-fA-F0-9]+)/i', $v, $m)) {
|
868 |
+
$newprop['LIST-STYLE-TYPE'] = strtolower(trim($m[1]));
|
869 |
+
}
|
870 |
+
if (preg_match('/url\([\'\"]{0,1}(.*?)[\'\"]{0,1}\)/i', $v, $m)) {
|
871 |
+
$newprop['LIST-STYLE-IMAGE'] = strtolower(trim($m[1]));
|
872 |
+
}
|
873 |
+
if (preg_match('/(inside|outside)/i', $v, $m)) {
|
874 |
+
$newprop['LIST-STYLE-POSITION'] = strtolower(trim($m[1]));
|
875 |
+
}
|
876 |
+
} else {
|
877 |
+
$newprop[$k] = $v;
|
878 |
+
}
|
879 |
+
}
|
880 |
+
|
881 |
+
return $newprop;
|
882 |
+
}
|
883 |
+
|
884 |
+
function setCSSboxshadow($v)
|
885 |
+
{
|
886 |
+
$sh = array();
|
887 |
+
$c = preg_match_all('/(rgba|rgb|device-cmyka|cmyka|device-cmyk|cmyk|hsla|hsl)\(.*?\)/', $v, $x); // mPDF 5.6.05
|
888 |
+
for ($i = 0; $i < $c; $i++) {
|
889 |
+
$col = preg_replace('/,/', '*', $x[0][$i]);
|
890 |
+
$v = preg_replace('/' . preg_quote($x[0][$i], '/') . '/', $col, $v);
|
891 |
+
}
|
892 |
+
$ss = explode(',', $v);
|
893 |
+
foreach ($ss AS $s) {
|
894 |
+
$new = array('inset' => false, 'blur' => 0, 'spread' => 0);
|
895 |
+
if (preg_match('/inset/i', $s)) {
|
896 |
+
$new['inset'] = true;
|
897 |
+
$s = preg_replace('/\s*inset\s*/', '', $s);
|
898 |
+
}
|
899 |
+
$p = explode(' ', trim($s));
|
900 |
+
if (isset($p[0])) {
|
901 |
+
$new['x'] = $this->mpdf->ConvertSize(trim($p[0]), $this->mpdf->blk[$this->mpdf->blklvl - 1]['inner_width'], $this->mpdf->FontSize, false);
|
902 |
+
}
|
903 |
+
if (isset($p[1])) {
|
904 |
+
$new['y'] = $this->mpdf->ConvertSize(trim($p[1]), $this->mpdf->blk[$this->mpdf->blklvl - 1]['inner_width'], $this->mpdf->FontSize, false);
|
905 |
+
}
|
906 |
+
if (isset($p[2])) {
|
907 |
+
if (preg_match('/^\s*[\.\-0-9]/', $p[2])) {
|
908 |
+
$new['blur'] = $this->mpdf->ConvertSize(trim($p[2]), $this->mpdf->blk[$this->mpdf->blklvl - 1]['inner_width'], $this->mpdf->FontSize, false);
|
909 |
+
} else {
|
910 |
+
$new['col'] = $this->mpdf->ConvertColor(preg_replace('/\*/', ',', $p[2]));
|
911 |
+
}
|
912 |
+
if (isset($p[3])) {
|
913 |
+
if (preg_match('/^\s*[\.\-0-9]/', $p[3])) {
|
914 |
+
$new['spread'] = $this->mpdf->ConvertSize(trim($p[3]), $this->mpdf->blk[$this->mpdf->blklvl - 1]['inner_width'], $this->mpdf->FontSize, false);
|
915 |
+
} else {
|
916 |
+
$new['col'] = $this->mpdf->ConvertColor(preg_replace('/\*/', ',', $p[3]));
|
917 |
+
}
|
918 |
+
if (isset($p[4])) {
|
919 |
+
$new['col'] = $this->mpdf->ConvertColor(preg_replace('/\*/', ',', $p[4]));
|
920 |
+
}
|
921 |
+
}
|
922 |
+
}
|
923 |
+
if (!$new['col']) {
|
924 |
+
$new['col'] = $this->mpdf->ConvertColor('#888888');
|
925 |
+
}
|
926 |
+
if (isset($new['y'])) {
|
927 |
+
array_unshift($sh, $new);
|
928 |
+
}
|
929 |
+
}
|
930 |
+
return $sh;
|
931 |
+
}
|
932 |
+
|
933 |
+
function setCSStextshadow($v)
|
934 |
+
{
|
935 |
+
$sh = array();
|
936 |
+
$c = preg_match_all('/(rgba|rgb|device-cmyka|cmyka|device-cmyk|cmyk|hsla|hsl)\(.*?\)/', $v, $x); // mPDF 5.6.05
|
937 |
+
for ($i = 0; $i < $c; $i++) {
|
938 |
+
$col = preg_replace('/,/', '*', $x[0][$i]);
|
939 |
+
$v = preg_replace('/' . preg_quote($x[0][$i], '/') . '/', $col, $v);
|
940 |
+
}
|
941 |
+
$ss = explode(',', $v);
|
942 |
+
foreach ($ss AS $s) {
|
943 |
+
$new = array('blur' => 0);
|
944 |
+
$p = explode(' ', trim($s));
|
945 |
+
if (isset($p[0])) {
|
946 |
+
$new['x'] = $this->mpdf->ConvertSize(trim($p[0]), $this->mpdf->FontSize, $this->mpdf->FontSize, false);
|
947 |
+
}
|
948 |
+
if (isset($p[1])) {
|
949 |
+
$new['y'] = $this->mpdf->ConvertSize(trim($p[1]), $this->mpdf->FontSize, $this->mpdf->FontSize, false);
|
950 |
+
}
|
951 |
+
if (isset($p[2])) {
|
952 |
+
if (preg_match('/^\s*[\.\-0-9]/', $p[2])) {
|
953 |
+
$new['blur'] = $this->mpdf->ConvertSize(trim($p[2]), $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
|
954 |
+
} else {
|
955 |
+
$new['col'] = $this->mpdf->ConvertColor(preg_replace('/\*/', ',', $p[2]));
|
956 |
+
}
|
957 |
+
if (isset($p[3])) {
|
958 |
+
$new['col'] = $this->mpdf->ConvertColor(preg_replace('/\*/', ',', $p[3]));
|
959 |
+
}
|
960 |
+
}
|
961 |
+
if (!isset($new['col']) || !$new['col']) {
|
962 |
+
$new['col'] = $this->mpdf->ConvertColor('#888888');
|
963 |
+
}
|
964 |
+
if (isset($new['y'])) {
|
965 |
+
array_unshift($sh, $new);
|
966 |
+
}
|
967 |
+
}
|
968 |
+
return $sh;
|
969 |
+
}
|
970 |
+
|
971 |
+
function parseCSSbackground($s)
|
972 |
+
{
|
973 |
+
$bg = array('c' => false, 'i' => false, 'r' => false, 'p' => false,);
|
974 |
+
/* -- BACKGROUNDS -- */
|
975 |
+
if (preg_match('/(-moz-)*(repeating-)*(linear|radial)-gradient\(.*\)/i', $s, $m)) {
|
976 |
+
$bg['i'] = $m[0];
|
977 |
+
} else
|
978 |
+
/* -- END BACKGROUNDS -- */
|
979 |
+
if (preg_match('/url\(/i', $s)) {
|
980 |
+
// If color, set and strip it off
|
981 |
+
// mPDF 5.6.05
|
982 |
+
if (preg_match('/^\s*(#[0-9a-fA-F]{3,6}|(rgba|rgb|device-cmyka|cmyka|device-cmyk|cmyk|hsla|hsl|spot)\(.*?\)|[a-zA-Z]{3,})\s+(url\(.*)/i', $s, $m)) {
|
983 |
+
$bg['c'] = strtolower($m[1]);
|
984 |
+
$s = $m[3];
|
985 |
+
}
|
986 |
+
/* -- BACKGROUNDS -- */
|
987 |
+
if (preg_match('/url\([\'\"]{0,1}(.*?)[\'\"]{0,1}\)\s*(.*)/i', $s, $m)) {
|
988 |
+
$bg['i'] = $m[1];
|
989 |
+
$s = strtolower($m[2]);
|
990 |
+
if (preg_match('/(repeat-x|repeat-y|no-repeat|repeat)/', $s, $m)) {
|
991 |
+
$bg['r'] = $m[1];
|
992 |
+
}
|
993 |
+
// Remove repeat, attachment (discarded) and also any inherit
|
994 |
+
$s = preg_replace('/(repeat-x|repeat-y|no-repeat|repeat|scroll|fixed|inherit)/', '', $s);
|
995 |
+
$bits = preg_split('/\s+/', trim($s));
|
996 |
+
// These should be Position x1 or x2
|
997 |
+
if (count($bits) == 1) {
|
998 |
+
if (preg_match('/bottom/', $bits[0])) {
|
999 |
+
$bg['p'] = '50% 100%';
|
1000 |
+
} else if (preg_match('/top/', $bits[0])) {
|
1001 |
+
$bg['p'] = '50% 0%';
|
1002 |
+
} else {
|
1003 |
+
$bg['p'] = $bits[0] . ' 50%';
|
1004 |
+
}
|
1005 |
+
} else if (count($bits) == 2) {
|
1006 |
+
// Can be either right center or center right
|
1007 |
+
if (preg_match('/(top|bottom)/', $bits[0]) || preg_match('/(left|right)/', $bits[1])) {
|
1008 |
+
$bg['p'] = $bits[1] . ' ' . $bits[0];
|
1009 |
+
} else {
|
1010 |
+
$bg['p'] = $bits[0] . ' ' . $bits[1];
|
1011 |
+
}
|
1012 |
+
}
|
1013 |
+
if ($bg['p']) {
|
1014 |
+
$bg['p'] = preg_replace('/(left|top)/', '0%', $bg['p']);
|
1015 |
+
$bg['p'] = preg_replace('/(right|bottom)/', '100%', $bg['p']);
|
1016 |
+
$bg['p'] = preg_replace('/(center)/', '50%', $bg['p']);
|
1017 |
+
if (!preg_match('/[\-]{0,1}\d+(in|cm|mm|pt|pc|em|ex|px|%)* [\-]{0,1}\d+(in|cm|mm|pt|pc|em|ex|px|%)*/', $bg['p'])) {
|
1018 |
+
$bg['p'] = false;
|
1019 |
+
}
|
1020 |
+
}
|
1021 |
+
}
|
1022 |
+
/* -- END BACKGROUNDS -- */
|
1023 |
+
} else if (preg_match('/^\s*(#[0-9a-fA-F]{3,6}|(rgba|rgb|device-cmyka|cmyka|device-cmyk|cmyk|hsla|hsl|spot)\(.*?\)|[a-zA-Z]{3,})/i', $s, $m)) {
|
1024 |
+
$bg['c'] = strtolower($m[1]);
|
1025 |
+
} // mPDF 5.6.05
|
1026 |
+
return ($bg);
|
1027 |
+
}
|
1028 |
+
|
1029 |
+
function expand24($mp)
|
1030 |
+
{
|
1031 |
+
$prop = preg_split('/\s+/', trim($mp));
|
1032 |
+
if (count($prop) == 1) {
|
1033 |
+
return array('T' => $prop[0], 'R' => $prop[0], 'B' => $prop[0], 'L' => $prop[0]);
|
1034 |
+
}
|
1035 |
+
if (count($prop) == 2) {
|
1036 |
+
return array('T' => $prop[0], 'R' => $prop[1], 'B' => $prop[0], 'L' => $prop[1]);
|
1037 |
+
}
|
1038 |
+
|
1039 |
+
if (count($prop) == 3) {
|
1040 |
+
return array('T' => $prop[0], 'R' => $prop[1], 'B' => $prop[2], 'L' => $prop[1]);
|
1041 |
+
}
|
1042 |
+
if (count($prop) == 4) {
|
1043 |
+
return array('T' => $prop[0], 'R' => $prop[1], 'B' => $prop[2], 'L' => $prop[3]);
|
1044 |
+
}
|
1045 |
+
return array();
|
1046 |
+
}
|
1047 |
+
|
1048 |
+
/* -- BORDER-RADIUS -- */
|
1049 |
+
|
1050 |
+
function border_radius_expand($val, $k)
|
1051 |
+
{
|
1052 |
+
$b = array();
|
1053 |
+
if ($k == 'BORDER-RADIUS') {
|
1054 |
+
$hv = explode('/', trim($val));
|
1055 |
+
$prop = preg_split('/\s+/', trim($hv[0]));
|
1056 |
+
if (count($prop) == 1) {
|
1057 |
+
$b['TL-H'] = $b['TR-H'] = $b['BR-H'] = $b['BL-H'] = $prop[0];
|
1058 |
+
} else if (count($prop) == 2) {
|
1059 |
+
$b['TL-H'] = $b['BR-H'] = $prop[0];
|
1060 |
+
$b['TR-H'] = $b['BL-H'] = $prop[1];
|
1061 |
+
} else if (count($prop) == 3) {
|
1062 |
+
$b['TL-H'] = $prop[0];
|
1063 |
+
$b['TR-H'] = $b['BL-H'] = $prop[1];
|
1064 |
+
$b['BR-H'] = $prop[2];
|
1065 |
+
} else if (count($prop) == 4) {
|
1066 |
+
$b['TL-H'] = $prop[0];
|
1067 |
+
$b['TR-H'] = $prop[1];
|
1068 |
+
$b['BR-H'] = $prop[2];
|
1069 |
+
$b['BL-H'] = $prop[3];
|
1070 |
+
}
|
1071 |
+
if (count($hv) == 2) {
|
1072 |
+
$prop = preg_split('/\s+/', trim($hv[1]));
|
1073 |
+
if (count($prop) == 1) {
|
1074 |
+
$b['TL-V'] = $b['TR-V'] = $b['BR-V'] = $b['BL-V'] = $prop[0];
|
1075 |
+
} else if (count($prop) == 2) {
|
1076 |
+
$b['TL-V'] = $b['BR-V'] = $prop[0];
|
1077 |
+
$b['TR-V'] = $b['BL-V'] = $prop[1];
|
1078 |
+
} else if (count($prop) == 3) {
|
1079 |
+
$b['TL-V'] = $prop[0];
|
1080 |
+
$b['TR-V'] = $b['BL-V'] = $prop[1];
|
1081 |
+
$b['BR-V'] = $prop[2];
|
1082 |
+
} else if (count($prop) == 4) {
|
1083 |
+
$b['TL-V'] = $prop[0];
|
1084 |
+
$b['TR-V'] = $prop[1];
|
1085 |
+
$b['BR-V'] = $prop[2];
|
1086 |
+
$b['BL-V'] = $prop[3];
|
1087 |
+
}
|
1088 |
+
} else {
|
1089 |
+
$b['TL-V'] = $b['TL-H'];
|
1090 |
+
$b['TR-V'] = $b['TR-H'];
|
1091 |
+
$b['BL-V'] = $b['BL-H'];
|
1092 |
+
$b['BR-V'] = $b['BR-H'];
|
1093 |
+
}
|
1094 |
+
return $b;
|
1095 |
+
}
|
1096 |
+
|
1097 |
+
// Parse 2
|
1098 |
+
$h = 0;
|
1099 |
+
$v = 0;
|
1100 |
+
$prop = preg_split('/\s+/', trim($val));
|
1101 |
+
if (count($prop) == 1) {
|
1102 |
+
$h = $v = $val;
|
1103 |
+
} else {
|
1104 |
+
$h = $prop[0];
|
1105 |
+
$v = $prop[1];
|
1106 |
+
}
|
1107 |
+
if ($h == 0 || $v == 0) {
|
1108 |
+
$h = $v = 0;
|
1109 |
+
}
|
1110 |
+
if ($k == 'BORDER-TOP-LEFT-RADIUS') {
|
1111 |
+
$b['TL-H'] = $h;
|
1112 |
+
$b['TL-V'] = $v;
|
1113 |
+
} else if ($k == 'BORDER-TOP-RIGHT-RADIUS') {
|
1114 |
+
$b['TR-H'] = $h;
|
1115 |
+
$b['TR-V'] = $v;
|
1116 |
+
} else if ($k == 'BORDER-BOTTOM-LEFT-RADIUS') {
|
1117 |
+
$b['BL-H'] = $h;
|
1118 |
+
$b['BL-V'] = $v;
|
1119 |
+
} else if ($k == 'BORDER-BOTTOM-RIGHT-RADIUS') {
|
1120 |
+
$b['BR-H'] = $h;
|
1121 |
+
$b['BR-V'] = $v;
|
1122 |
+
}
|
1123 |
+
return $b;
|
1124 |
+
}
|
1125 |
+
|
1126 |
+
/* -- END BORDER-RADIUS -- */
|
1127 |
+
|
1128 |
+
function _mergeCSS($p, &$t)
|
1129 |
+
{
|
1130 |
+
// Save Cascading CSS e.g. "div.topic p" at this block level
|
1131 |
+
if (isset($p) && $p) {
|
1132 |
+
if ($t) {
|
1133 |
+
$t = $this->array_merge_recursive_unique($t, $p);
|
1134 |
+
} else {
|
1135 |
+
$t = $p;
|
1136 |
+
}
|
1137 |
+
}
|
1138 |
+
}
|
1139 |
+
|
1140 |
+
// for CSS handling
|
1141 |
+
function array_merge_recursive_unique($array1, $array2)
|
1142 |
+
{
|
1143 |
+
$arrays = func_get_args();
|
1144 |
+
$narrays = count($arrays);
|
1145 |
+
$ret = $arrays[0];
|
1146 |
+
for ($i = 1; $i < $narrays; $i ++) {
|
1147 |
+
foreach ($arrays[$i] as $key => $value) {
|
1148 |
+
if (((string) $key) === ((string) intval($key))) { // integer or string as integer key - append
|
1149 |
+
$ret[] = $value;
|
1150 |
+
} else { // string key - merge
|
1151 |
+
if (is_array($value) && isset($ret[$key])) {
|
1152 |
+
$ret[$key] = $this->array_merge_recursive_unique($ret[$key], $value);
|
1153 |
+
} else {
|
1154 |
+
$ret[$key] = $value;
|
1155 |
+
}
|
1156 |
+
}
|
1157 |
+
}
|
1158 |
+
}
|
1159 |
+
return $ret;
|
1160 |
+
}
|
1161 |
+
|
1162 |
+
function _mergeFullCSS($p, &$t, $tag, $classes, $id, $lang)
|
1163 |
+
{ // mPDF 6
|
1164 |
+
if (isset($p[$tag])) {
|
1165 |
+
$this->_mergeCSS($p[$tag], $t);
|
1166 |
+
}
|
1167 |
+
// STYLESHEET CLASS e.g. .smallone{} .redletter{}
|
1168 |
+
foreach ($classes AS $class) {
|
1169 |
+
if (isset($p['CLASS>>' . $class])) {
|
1170 |
+
$this->_mergeCSS($p['CLASS>>' . $class], $t);
|
1171 |
+
}
|
1172 |
+
}
|
1173 |
+
// STYLESHEET nth-child SELECTOR e.g. tr:nth-child(odd) td:nth-child(2n+1)
|
1174 |
+
if ($tag == 'TR' && isset($p) && $p) {
|
1175 |
+
foreach ($p AS $k => $val) {
|
1176 |
+
if (preg_match('/' . $tag . '>>SELECTORNTHCHILD>>(.*)/', $k, $m)) {
|
1177 |
+
$select = false;
|
1178 |
+
if ($tag == 'TR') {
|
1179 |
+
$row = $this->mpdf->row;
|
1180 |
+
$thnr = (isset($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_thead']) ? count($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_thead']) : 0);
|
1181 |
+
$tfnr = (isset($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_tfoot']) ? count($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_tfoot']) : 0);
|
1182 |
+
if ($this->mpdf->tabletfoot) {
|
1183 |
+
$row -= $thnr;
|
1184 |
+
} else if (!$this->mpdf->tablethead) {
|
1185 |
+
$row -= ($thnr + $tfnr);
|
1186 |
+
}
|
1187 |
+
if (preg_match('/(([\-+]?\d*)?N([\-+]\d+)?|[\-+]?\d+|ODD|EVEN)/', $m[1], $a)) { // mPDF 5.7.4
|
1188 |
+
$select = $this->_nthchild($a, $row);
|
1189 |
+
}
|
1190 |
+
} else if ($tag == 'TD' || $tag == 'TH') {
|
1191 |
+
if (preg_match('/(([\-+]?\d*)?N([\-+]\d+)?|[\-+]?\d+|ODD|EVEN)/', $m[1], $a)) { // mPDF 5.7.4
|
1192 |
+
$select = $this->_nthchild($a, $this->mpdf->col);
|
1193 |
+
}
|
1194 |
+
}
|
1195 |
+
if ($select) {
|
1196 |
+
$this->_mergeCSS($p[$tag . '>>SELECTORNTHCHILD>>' . $m[1]], $t);
|
1197 |
+
}
|
1198 |
+
}
|
1199 |
+
}
|
1200 |
+
}
|
1201 |
+
// STYLESHEET CLASS e.g. [lang=fr]{} or :lang(fr)
|
1202 |
+
if (isset($lang) && isset($p['LANG>>' . $lang])) {
|
1203 |
+
$this->_mergeCSS($p['LANG>>' . $lang], $t);
|
1204 |
+
}
|
1205 |
+
// STYLESHEET CLASS e.g. #smallone{} #redletter{}
|
1206 |
+
if (isset($id) && isset($p['ID>>' . $id])) {
|
1207 |
+
$this->_mergeCSS($p['ID>>' . $id], $t);
|
1208 |
+
}
|
1209 |
+
|
1210 |
+
// STYLESHEET CLASS e.g. .smallone{} .redletter{}
|
1211 |
+
foreach ($classes AS $class) {
|
1212 |
+
if (isset($p[$tag . '>>CLASS>>' . $class])) {
|
1213 |
+
$this->_mergeCSS($p[$tag . '>>CLASS>>' . $class], $t);
|
1214 |
+
}
|
1215 |
+
}
|
1216 |
+
// STYLESHEET CLASS e.g. [lang=fr]{} or :lang(fr)
|
1217 |
+
if (isset($lang) && isset($p[$tag . '>>LANG>>' . $lang])) {
|
1218 |
+
$this->_mergeCSS($p[$tag . '>>LANG>>' . $lang], $t);
|
1219 |
+
}
|
1220 |
+
// STYLESHEET CLASS e.g. #smallone{} #redletter{}
|
1221 |
+
if (isset($id) && isset($p[$tag . '>>ID>>' . $id])) {
|
1222 |
+
$this->_mergeCSS($p[$tag . '>>ID>>' . $id], $t);
|
1223 |
+
}
|
1224 |
+
}
|
1225 |
+
|
1226 |
+
function setBorderDominance($prop, $val)
|
1227 |
+
{
|
1228 |
+
if (isset($prop['BORDER-LEFT']) && $prop['BORDER-LEFT']) {
|
1229 |
+
$this->cell_border_dominance_L = $val;
|
1230 |
+
}
|
1231 |
+
if (isset($prop['BORDER-RIGHT']) && $prop['BORDER-RIGHT']) {
|
1232 |
+
$this->cell_border_dominance_R = $val;
|
1233 |
+
}
|
1234 |
+
if (isset($prop['BORDER-TOP']) && $prop['BORDER-TOP']) {
|
1235 |
+
$this->cell_border_dominance_T = $val;
|
1236 |
+
}
|
1237 |
+
if (isset($prop['BORDER-BOTTOM']) && $prop['BORDER-BOTTOM']) {
|
1238 |
+
$this->cell_border_dominance_B = $val;
|
1239 |
+
}
|
1240 |
+
}
|
1241 |
+
|
1242 |
+
function _set_mergedCSS(&$m, &$p, $d = true, $bd = false)
|
1243 |
+
{
|
1244 |
+
if (isset($m)) {
|
1245 |
+
if ((isset($m['depth']) && $m['depth'] > 1) || $d == false) { // include check for 'depth'
|
1246 |
+
if ($bd) {
|
1247 |
+
$this->setBorderDominance($m, $bd);
|
1248 |
+
} // *TABLES*
|
1249 |
+
if (is_array($m)) {
|
1250 |
+
$p = array_merge($p, $m);
|
1251 |
+
$this->_mergeBorders($p, $m);
|
1252 |
+
}
|
1253 |
+
}
|
1254 |
+
}
|
1255 |
+
}
|
1256 |
+
|
1257 |
+
function _mergeBorders(&$b, &$a)
|
1258 |
+
{ // Merges $a['BORDER-TOP-STYLE'] to $b['BORDER-TOP'] etc.
|
1259 |
+
foreach (array('TOP', 'RIGHT', 'BOTTOM', 'LEFT') AS $side) {
|
1260 |
+
foreach (array('STYLE', 'WIDTH', 'COLOR') AS $el) {
|
1261 |
+
if (isset($a['BORDER-' . $side . '-' . $el])) { // e.g. $b['BORDER-TOP-STYLE']
|
1262 |
+
$s = trim($a['BORDER-' . $side . '-' . $el]);
|
1263 |
+
if (isset($b['BORDER-' . $side])) { // e.g. $b['BORDER-TOP']
|
1264 |
+
$p = trim($b['BORDER-' . $side]);
|
1265 |
+
} else {
|
1266 |
+
$p = '';
|
1267 |
+
}
|
1268 |
+
if ($el == 'STYLE') {
|
1269 |
+
if ($p) {
|
1270 |
+
$b['BORDER-' . $side] = preg_replace('/(\S+)\s+(\S+)\s+(\S+)/', '\\1 ' . $s . ' \\3', $p);
|
1271 |
+
} else {
|
1272 |
+
$b['BORDER-' . $side] = '0px ' . $s . ' #000000';
|
1273 |
+
}
|
1274 |
+
} else if ($el == 'WIDTH') {
|
1275 |
+
if ($p) {
|
1276 |
+
$b['BORDER-' . $side] = preg_replace('/(\S+)\s+(\S+)\s+(\S+)/', $s . ' \\2 \\3', $p);
|
1277 |
+
} else {
|
1278 |
+
$b['BORDER-' . $side] = $s . ' none #000000';
|
1279 |
+
}
|
1280 |
+
} else if ($el == 'COLOR') {
|
1281 |
+
if ($p) {
|
1282 |
+
$b['BORDER-' . $side] = preg_replace('/(\S+)\s+(\S+)\s+(\S+)/', '\\1 \\2 ' . $s, $p);
|
1283 |
+
} else {
|
1284 |
+
$b['BORDER-' . $side] = '0px none ' . $s;
|
1285 |
+
}
|
1286 |
+
}
|
1287 |
+
}
|
1288 |
+
}
|
1289 |
+
}
|
1290 |
+
}
|
1291 |
+
|
1292 |
+
function MergeCSS($inherit, $tag, $attr)
|
1293 |
+
{
|
1294 |
+
$p = array();
|
1295 |
+
$zp = array();
|
1296 |
+
|
1297 |
+
$classes = array();
|
1298 |
+
if (isset($attr['CLASS'])) {
|
1299 |
+
$classes = preg_split('/\s+/', $attr['CLASS']);
|
1300 |
+
}
|
1301 |
+
if (!isset($attr['ID'])) {
|
1302 |
+
$attr['ID'] = '';
|
1303 |
+
}
|
1304 |
+
// mPDF 6
|
1305 |
+
$shortlang = '';
|
1306 |
+
if (!isset($attr['LANG'])) {
|
1307 |
+
$attr['LANG'] = '';
|
1308 |
+
} else {
|
1309 |
+
$attr['LANG'] = strtolower($attr['LANG']);
|
1310 |
+
if (strlen($attr['LANG']) == 5) {
|
1311 |
+
$shortlang = substr($attr['LANG'], 0, 2);
|
1312 |
+
}
|
1313 |
+
}
|
1314 |
+
//===============================================
|
1315 |
+
/* -- TABLES -- */
|
1316 |
+
// Set Inherited properties
|
1317 |
+
if ($inherit == 'TOPTABLE') { // $tag = TABLE
|
1318 |
+
//===============================================
|
1319 |
+
// Save Cascading CSS e.g. "div.topic p" at this block level
|
1320 |
+
if (isset($this->mpdf->blk[$this->mpdf->blklvl]['cascadeCSS'])) {
|
1321 |
+
$this->tablecascadeCSS[0] = $this->mpdf->blk[$this->mpdf->blklvl]['cascadeCSS'];
|
1322 |
+
} else {
|
1323 |
+
$this->tablecascadeCSS[0] = $this->cascadeCSS;
|
1324 |
+
}
|
1325 |
+
}
|
1326 |
+
//===============================================
|
1327 |
+
// Set Inherited properties
|
1328 |
+
if ($inherit == 'TOPTABLE' || $inherit == 'TABLE') {
|
1329 |
+
//Cascade everything from last level that is not an actual property, or defined by current tag/attributes
|
1330 |
+
if (isset($this->tablecascadeCSS[$this->tbCSSlvl - 1]) && is_array($this->tablecascadeCSS[$this->tbCSSlvl - 1])) {
|
1331 |
+
foreach ($this->tablecascadeCSS[$this->tbCSSlvl - 1] AS $k => $v) {
|
1332 |
+
$this->tablecascadeCSS[$this->tbCSSlvl][$k] = $v;
|
1333 |
+
}
|
1334 |
+
}
|
1335 |
+
$this->_mergeFullCSS($this->cascadeCSS, $this->tablecascadeCSS[$this->tbCSSlvl], $tag, $classes, $attr['ID'], $attr['LANG']);
|
1336 |
+
//===============================================
|
1337 |
+
// Cascading forward CSS e.g. "table.topic td" for this table in $this->tablecascadeCSS
|
1338 |
+
//===============================================
|
1339 |
+
// STYLESHEET TAG e.g. table
|
1340 |
+
$this->_mergeFullCSS($this->tablecascadeCSS[$this->tbCSSlvl - 1], $this->tablecascadeCSS[$this->tbCSSlvl], $tag, $classes, $attr['ID'], $attr['LANG']);
|
1341 |
+
//===============================================
|
1342 |
+
}
|
1343 |
+
/* -- END TABLES -- */
|
1344 |
+
//===============================================
|
1345 |
+
// Set Inherited properties
|
1346 |
+
if ($inherit == 'BLOCK') {
|
1347 |
+
if (isset($this->mpdf->blk[$this->mpdf->blklvl - 1]['cascadeCSS']) && is_array($this->mpdf->blk[$this->mpdf->blklvl - 1]['cascadeCSS'])) {
|
1348 |
+
foreach ($this->mpdf->blk[$this->mpdf->blklvl - 1]['cascadeCSS'] AS $k => $v) {
|
1349 |
+
$this->mpdf->blk[$this->mpdf->blklvl]['cascadeCSS'][$k] = $v;
|
1350 |
+
}
|
1351 |
+
}
|
1352 |
+
|
1353 |
+
//===============================================
|
1354 |
+
// Save Cascading CSS e.g. "div.topic p" at this block level
|
1355 |
+
$this->_mergeFullCSS($this->cascadeCSS, $this->mpdf->blk[$this->mpdf->blklvl]['cascadeCSS'], $tag, $classes, $attr['ID'], $attr['LANG']);
|
1356 |
+
//===============================================
|
1357 |
+
// Cascading forward CSS
|
1358 |
+
//===============================================
|
1359 |
+
if (isset($this->mpdf->blk[$this->mpdf->blklvl - 1])) {
|
1360 |
+
$this->_mergeFullCSS($this->mpdf->blk[$this->mpdf->blklvl - 1]['cascadeCSS'], $this->mpdf->blk[$this->mpdf->blklvl]['cascadeCSS'], $tag, $classes, $attr['ID'], $attr['LANG']);
|
1361 |
+
}
|
1362 |
+
//===============================================
|
1363 |
+
// Block properties which are inherited
|
1364 |
+
if (isset($this->mpdf->blk[$this->mpdf->blklvl - 1]['margin_collapse']) && $this->mpdf->blk[$this->mpdf->blklvl - 1]['margin_collapse']) {
|
1365 |
+
$p['MARGIN-COLLAPSE'] = 'COLLAPSE';
|
1366 |
+
} // custom tag, but follows CSS principle that border-collapse is inherited
|
1367 |
+
if (isset($this->mpdf->blk[$this->mpdf->blklvl - 1]['line_height']) && $this->mpdf->blk[$this->mpdf->blklvl - 1]['line_height']) {
|
1368 |
+
$p['LINE-HEIGHT'] = $this->mpdf->blk[$this->mpdf->blklvl - 1]['line_height'];
|
1369 |
+
}
|
1370 |
+
// mPDF 6
|
1371 |
+
if (isset($this->mpdf->blk[$this->mpdf->blklvl - 1]['line_stacking_strategy']) && $this->mpdf->blk[$this->mpdf->blklvl - 1]['line_stacking_strategy']) {
|
1372 |
+
$p['LINE-STACKING-STRATEGY'] = $this->mpdf->blk[$this->mpdf->blklvl - 1]['line_stacking_strategy'];
|
1373 |
+
}
|
1374 |
+
if (isset($this->mpdf->blk[$this->mpdf->blklvl - 1]['line_stacking_shift']) && $this->mpdf->blk[$this->mpdf->blklvl - 1]['line_stacking_shift']) {
|
1375 |
+
$p['LINE-STACKING-SHIFT'] = $this->mpdf->blk[$this->mpdf->blklvl - 1]['line_stacking_shift'];
|
1376 |
+
}
|
1377 |
+
|
1378 |
+
if (isset($this->mpdf->blk[$this->mpdf->blklvl - 1]['direction']) && $this->mpdf->blk[$this->mpdf->blklvl - 1]['direction']) {
|
1379 |
+
$p['DIRECTION'] = $this->mpdf->blk[$this->mpdf->blklvl - 1]['direction'];
|
1380 |
+
}
|
1381 |
+
// mPDF 6 Lists
|
1382 |
+
if ($tag == 'LI') {
|
1383 |
+
if (isset($this->mpdf->blk[$this->mpdf->blklvl - 1]['list_style_type']) && $this->mpdf->blk[$this->mpdf->blklvl - 1]['list_style_type']) {
|
1384 |
+
$p['LIST-STYLE-TYPE'] = $this->mpdf->blk[$this->mpdf->blklvl - 1]['list_style_type'];
|
1385 |
+
}
|
1386 |
+
}
|
1387 |
+
if (isset($this->mpdf->blk[$this->mpdf->blklvl - 1]['list_style_image']) && $this->mpdf->blk[$this->mpdf->blklvl - 1]['list_style_image']) {
|
1388 |
+
$p['LIST-STYLE-IMAGE'] = $this->mpdf->blk[$this->mpdf->blklvl - 1]['list_style_image'];
|
1389 |
+
}
|
1390 |
+
if (isset($this->mpdf->blk[$this->mpdf->blklvl - 1]['list_style_position']) && $this->mpdf->blk[$this->mpdf->blklvl - 1]['list_style_position']) {
|
1391 |
+
$p['LIST-STYLE-POSITION'] = $this->mpdf->blk[$this->mpdf->blklvl - 1]['list_style_position'];
|
1392 |
+
}
|
1393 |
+
|
1394 |
+
if (isset($this->mpdf->blk[$this->mpdf->blklvl - 1]['align']) && $this->mpdf->blk[$this->mpdf->blklvl - 1]['align']) {
|
1395 |
+
if ($this->mpdf->blk[$this->mpdf->blklvl - 1]['align'] == 'L') {
|
1396 |
+
$p['TEXT-ALIGN'] = 'left';
|
1397 |
+
} else if ($this->mpdf->blk[$this->mpdf->blklvl - 1]['align'] == 'J') {
|
1398 |
+
$p['TEXT-ALIGN'] = 'justify';
|
1399 |
+
} else if ($this->mpdf->blk[$this->mpdf->blklvl - 1]['align'] == 'R') {
|
1400 |
+
$p['TEXT-ALIGN'] = 'right';
|
1401 |
+
} else if ($this->mpdf->blk[$this->mpdf->blklvl - 1]['align'] == 'C') {
|
1402 |
+
$p['TEXT-ALIGN'] = 'center';
|
1403 |
+
}
|
1404 |
+
}
|
1405 |
+
if ($this->mpdf->ColActive || $this->mpdf->keep_block_together) {
|
1406 |
+
if (isset($this->mpdf->blk[$this->mpdf->blklvl - 1]['bgcolor']) && $this->mpdf->blk[$this->mpdf->blklvl - 1]['bgcolor']) { // Doesn't officially inherit, but default value is transparent (?=inherited)
|
1407 |
+
$cor = $this->mpdf->blk[$this->mpdf->blklvl - 1]['bgcolorarray'];
|
1408 |
+
$p['BACKGROUND-COLOR'] = $this->mpdf->_colAtoString($cor);
|
1409 |
+
}
|
1410 |
+
}
|
1411 |
+
|
1412 |
+
if (isset($this->mpdf->blk[$this->mpdf->blklvl - 1]['text_indent']) && ($this->mpdf->blk[$this->mpdf->blklvl - 1]['text_indent'] || $this->mpdf->blk[$this->mpdf->blklvl - 1]['text_indent'] === 0)) {
|
1413 |
+
$p['TEXT-INDENT'] = $this->mpdf->blk[$this->mpdf->blklvl - 1]['text_indent'];
|
1414 |
+
}
|
1415 |
+
if (isset($this->mpdf->blk[$this->mpdf->blklvl - 1]['InlineProperties'])) {
|
1416 |
+
$biilp = $this->mpdf->blk[$this->mpdf->blklvl - 1]['InlineProperties'];
|
1417 |
+
$this->inlinePropsToCSS($biilp, $p); // mPDF 5.7.1
|
1418 |
+
} else {
|
1419 |
+
$biilp = null;
|
1420 |
+
}
|
1421 |
+
}
|
1422 |
+
//===============================================
|
1423 |
+
//===============================================
|
1424 |
+
// INLINE HTML ATTRIBUTES e.g. .. ALIGN="CENTER">
|
1425 |
+
// mPDF 6 (added)
|
1426 |
+
if (isset($attr['DIR']) and $attr['DIR'] != '') {
|
1427 |
+
$p['DIRECTION'] = $attr['DIR'];
|
1428 |
+
}
|
1429 |
+
// mPDF 6 (moved)
|
1430 |
+
if (isset($attr['LANG']) and $attr['LANG'] != '') {
|
1431 |
+
$p['LANG'] = $attr['LANG'];
|
1432 |
+
}
|
1433 |
+
if (isset($attr['COLOR']) and $attr['COLOR'] != '') {
|
1434 |
+
$p['COLOR'] = $attr['COLOR'];
|
1435 |
+
}
|
1436 |
+
|
1437 |
+
if ($tag != 'INPUT') {
|
1438 |
+
if (isset($attr['WIDTH']) and $attr['WIDTH'] != '') {
|
1439 |
+
$p['WIDTH'] = $attr['WIDTH'];
|
1440 |
+
}
|
1441 |
+
if (isset($attr['HEIGHT']) and $attr['HEIGHT'] != '') {
|
1442 |
+
$p['HEIGHT'] = $attr['HEIGHT'];
|
1443 |
+
}
|
1444 |
+
}
|
1445 |
+
if ($tag == 'FONT') {
|
1446 |
+
if (isset($attr['FACE'])) {
|
1447 |
+
$p['FONT-FAMILY'] = $attr['FACE'];
|
1448 |
+
}
|
1449 |
+
if (isset($attr['SIZE']) and $attr['SIZE'] != '') {
|
1450 |
+
$s = '';
|
1451 |
+
if ($attr['SIZE'] === '+1') {
|
1452 |
+
$s = '120%';
|
1453 |
+
} else if ($attr['SIZE'] === '-1') {
|
1454 |
+
$s = '86%';
|
1455 |
+
} else if ($attr['SIZE'] === '1') {
|
1456 |
+
$s = 'XX-SMALL';
|
1457 |
+
} else if ($attr['SIZE'] == '2') {
|
1458 |
+
$s = 'X-SMALL';
|
1459 |
+
} else if ($attr['SIZE'] == '3') {
|
1460 |
+
$s = 'SMALL';
|
1461 |
+
} else if ($attr['SIZE'] == '4') {
|
1462 |
+
$s = 'MEDIUM';
|
1463 |
+
} else if ($attr['SIZE'] == '5') {
|
1464 |
+
$s = 'LARGE';
|
1465 |
+
} else if ($attr['SIZE'] == '6') {
|
1466 |
+
$s = 'X-LARGE';
|
1467 |
+
} else if ($attr['SIZE'] == '7') {
|
1468 |
+
$s = 'XX-LARGE';
|
1469 |
+
}
|
1470 |
+
if ($s)
|
1471 |
+
$p['FONT-SIZE'] = $s;
|
1472 |
+
}
|
1473 |
+
}
|
1474 |
+
if (isset($attr['VALIGN']) and $attr['VALIGN'] != '') {
|
1475 |
+
$p['VERTICAL-ALIGN'] = $attr['VALIGN'];
|
1476 |
+
}
|
1477 |
+
if (isset($attr['VSPACE']) and $attr['VSPACE'] != '') {
|
1478 |
+
$p['MARGIN-TOP'] = $attr['VSPACE'];
|
1479 |
+
$p['MARGIN-BOTTOM'] = $attr['VSPACE'];
|
1480 |
+
}
|
1481 |
+
if (isset($attr['HSPACE']) and $attr['HSPACE'] != '') {
|
1482 |
+
$p['MARGIN-LEFT'] = $attr['HSPACE'];
|
1483 |
+
$p['MARGIN-RIGHT'] = $attr['HSPACE'];
|
1484 |
+
}
|
1485 |
+
//===============================================
|
1486 |
+
//===============================================
|
1487 |
+
// DEFAULT for this TAG set in DefaultCSS
|
1488 |
+
if (isset($this->mpdf->defaultCSS[$tag])) {
|
1489 |
+
$zp = $this->fixCSS($this->mpdf->defaultCSS[$tag]);
|
1490 |
+
if (is_array($zp)) { // Default overwrites Inherited
|
1491 |
+
$p = array_merge($p, $zp); // !! Note other way round !!
|
1492 |
+
$this->_mergeBorders($p, $zp);
|
1493 |
+
}
|
1494 |
+
}
|
1495 |
+
//===============================================
|
1496 |
+
/* -- TABLES -- */
|
1497 |
+
// mPDF 5.7.3
|
1498 |
+
// cellSpacing overwrites TABLE default but not specific CSS set on table
|
1499 |
+
if ($tag == 'TABLE' && isset($attr['CELLSPACING'])) {
|
1500 |
+
$p['BORDER-SPACING-H'] = $p['BORDER-SPACING-V'] = $attr['CELLSPACING'];
|
1501 |
+
}
|
1502 |
+
// cellPadding overwrites TD/TH default but not specific CSS set on cell
|
1503 |
+
if (($tag == 'TD' || $tag == 'TH') && isset($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['cell_padding']) && ($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['cell_padding'] || $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['cell_padding'] === '0')) { // mPDF 5.7.3
|
1504 |
+
$p['PADDING-LEFT'] = $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['cell_padding'];
|
1505 |
+
$p['PADDING-RIGHT'] = $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['cell_padding'];
|
1506 |
+
$p['PADDING-TOP'] = $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['cell_padding'];
|
1507 |
+
$p['PADDING-BOTTOM'] = $this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['cell_padding'];
|
1508 |
+
}
|
1509 |
+
/* -- END TABLES -- */
|
1510 |
+
//===============================================
|
1511 |
+
// STYLESHEET TAG e.g. h1 p div table
|
1512 |
+
if (isset($this->CSS[$tag]) && $this->CSS[$tag]) {
|
1513 |
+
$zp = $this->CSS[$tag];
|
1514 |
+
if ($tag == 'TD' || $tag == 'TH') {
|
1515 |
+
$this->setBorderDominance($zp, 9);
|
1516 |
+
} // *TABLES* // *TABLES-ADVANCED-BORDERS*
|
1517 |
+
if (is_array($zp)) {
|
1518 |
+
$p = array_merge($p, $zp);
|
1519 |
+
$this->_mergeBorders($p, $zp);
|
1520 |
+
}
|
1521 |
+
}
|
1522 |
+
//===============================================
|
1523 |
+
// STYLESHEET CLASS e.g. .smallone{} .redletter{}
|
1524 |
+
foreach ($classes AS $class) {
|
1525 |
+
$zp = array();
|
1526 |
+
if (isset($this->CSS['CLASS>>' . $class]) && $this->CSS['CLASS>>' . $class]) {
|
1527 |
+
$zp = $this->CSS['CLASS>>' . $class];
|
1528 |
+
}
|
1529 |
+
if ($tag == 'TD' || $tag == 'TH') {
|
1530 |
+
$this->setBorderDominance($zp, 9);
|
1531 |
+
} // *TABLES* // *TABLES-ADVANCED-BORDERS*
|
1532 |
+
if (is_array($zp)) {
|
1533 |
+
$p = array_merge($p, $zp);
|
1534 |
+
$this->_mergeBorders($p, $zp);
|
1535 |
+
}
|
1536 |
+
}
|
1537 |
+
//===============================================
|
1538 |
+
/* -- TABLES -- */
|
1539 |
+
// STYLESHEET nth-child SELECTOR e.g. tr:nth-child(odd) td:nth-child(2n+1)
|
1540 |
+
if ($tag == 'TR' || $tag == 'TD' || $tag == 'TH') {
|
1541 |
+
foreach ($this->CSS AS $k => $val) {
|
1542 |
+
if (preg_match('/' . $tag . '>>SELECTORNTHCHILD>>(.*)/', $k, $m)) {
|
1543 |
+
$select = false;
|
1544 |
+
if ($tag == 'TR') {
|
1545 |
+
$row = $this->mpdf->row;
|
1546 |
+
$thnr = (isset($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_thead']) ? count($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_thead']) : 0);
|
1547 |
+
$tfnr = (isset($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_tfoot']) ? count($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_tfoot']) : 0);
|
1548 |
+
if ($this->mpdf->tabletfoot) {
|
1549 |
+
$row -= $thnr;
|
1550 |
+
} else if (!$this->mpdf->tablethead) {
|
1551 |
+
$row -= ($thnr + $tfnr);
|
1552 |
+
}
|
1553 |
+
if (preg_match('/(([\-+]?\d*)?N([\-+]\d+)?|[\-+]?\d+|ODD|EVEN)/', $m[1], $a)) { // mPDF 5.7.4
|
1554 |
+
$select = $this->_nthchild($a, $row);
|
1555 |
+
}
|
1556 |
+
} else if ($tag == 'TD' || $tag == 'TH') {
|
1557 |
+
if (preg_match('/(([\-+]?\d*)?N([\-+]\d+)?|[\-+]?\d+|ODD|EVEN)/', $m[1], $a)) { // mPDF 5.7.4
|
1558 |
+
$select = $this->_nthchild($a, $this->mpdf->col);
|
1559 |
+
}
|
1560 |
+
}
|
1561 |
+
if ($select) {
|
1562 |
+
$zp = $this->CSS[$tag . '>>SELECTORNTHCHILD>>' . $m[1]];
|
1563 |
+
if ($tag == 'TD' || $tag == 'TH') {
|
1564 |
+
$this->setBorderDominance($zp, 9);
|
1565 |
+
}
|
1566 |
+
if (is_array($zp)) {
|
1567 |
+
$p = array_merge($p, $zp);
|
1568 |
+
$this->_mergeBorders($p, $zp);
|
1569 |
+
}
|
1570 |
+
}
|
1571 |
+
}
|
1572 |
+
}
|
1573 |
+
}
|
1574 |
+
/* -- END TABLES -- */
|
1575 |
+
//===============================================
|
1576 |
+
// STYLESHEET LANG e.g. [lang=fr]{} or :lang(fr)
|
1577 |
+
if (isset($attr['LANG'])) {
|
1578 |
+
if (isset($this->CSS['LANG>>' . $attr['LANG']]) && $this->CSS['LANG>>' . $attr['LANG']]) {
|
1579 |
+
$zp = $this->CSS['LANG>>' . $attr['LANG']];
|
1580 |
+
if ($tag == 'TD' || $tag == 'TH') {
|
1581 |
+
$this->setBorderDominance($zp, 9);
|
1582 |
+
} // *TABLES* // *TABLES-ADVANCED-BORDERS*
|
1583 |
+
if (is_array($zp)) {
|
1584 |
+
$p = array_merge($p, $zp);
|
1585 |
+
$this->_mergeBorders($p, $zp);
|
1586 |
+
}
|
1587 |
+
} else if (isset($this->CSS['LANG>>' . $shortlang]) && $this->CSS['LANG>>' . $shortlang]) {
|
1588 |
+
$zp = $this->CSS['LANG>>' . $shortlang];
|
1589 |
+
if ($tag == 'TD' || $tag == 'TH') {
|
1590 |
+
$this->setBorderDominance($zp, 9);
|
1591 |
+
} // *TABLES* // *TABLES-ADVANCED-BORDERS*
|
1592 |
+
if (is_array($zp)) {
|
1593 |
+
$p = array_merge($p, $zp);
|
1594 |
+
$this->_mergeBorders($p, $zp);
|
1595 |
+
}
|
1596 |
+
}
|
1597 |
+
}
|
1598 |
+
//===============================================
|
1599 |
+
// STYLESHEET ID e.g. #smallone{} #redletter{}
|
1600 |
+
if (isset($attr['ID']) && isset($this->CSS['ID>>' . $attr['ID']]) && $this->CSS['ID>>' . $attr['ID']]) {
|
1601 |
+
$zp = $this->CSS['ID>>' . $attr['ID']];
|
1602 |
+
if ($tag == 'TD' || $tag == 'TH') {
|
1603 |
+
$this->setBorderDominance($zp, 9);
|
1604 |
+
} // *TABLES* // *TABLES-ADVANCED-BORDERS*
|
1605 |
+
if (is_array($zp)) {
|
1606 |
+
$p = array_merge($p, $zp);
|
1607 |
+
$this->_mergeBorders($p, $zp);
|
1608 |
+
}
|
1609 |
+
}
|
1610 |
+
|
1611 |
+
//===============================================
|
1612 |
+
// STYLESHEET CLASS e.g. p.smallone{} div.redletter{}
|
1613 |
+
foreach ($classes AS $class) {
|
1614 |
+
$zp = array();
|
1615 |
+
if (isset($this->CSS[$tag . '>>CLASS>>' . $class]) && $this->CSS[$tag . '>>CLASS>>' . $class]) {
|
1616 |
+
$zp = $this->CSS[$tag . '>>CLASS>>' . $class];
|
1617 |
+
}
|
1618 |
+
if ($tag == 'TD' || $tag == 'TH') {
|
1619 |
+
$this->setBorderDominance($zp, 9);
|
1620 |
+
} // *TABLES* // *TABLES-ADVANCED-BORDERS*
|
1621 |
+
if (is_array($zp)) {
|
1622 |
+
$p = array_merge($p, $zp);
|
1623 |
+
$this->_mergeBorders($p, $zp);
|
1624 |
+
}
|
1625 |
+
}
|
1626 |
+
//===============================================
|
1627 |
+
// STYLESHEET LANG e.g. [lang=fr]{} or :lang(fr)
|
1628 |
+
if (isset($attr['LANG'])) {
|
1629 |
+
if (isset($this->CSS[$tag . '>>LANG>>' . $attr['LANG']]) && $this->CSS[$tag . '>>LANG>>' . $attr['LANG']]) {
|
1630 |
+
$zp = $this->CSS[$tag . '>>LANG>>' . $attr['LANG']];
|
1631 |
+
if ($tag == 'TD' || $tag == 'TH') {
|
1632 |
+
$this->setBorderDominance($zp, 9);
|
1633 |
+
} // *TABLES* // *TABLES-ADVANCED-BORDERS*
|
1634 |
+
if (is_array($zp)) {
|
1635 |
+
$p = array_merge($p, $zp);
|
1636 |
+
$this->_mergeBorders($p, $zp);
|
1637 |
+
}
|
1638 |
+
} else if (isset($this->CSS[$tag . '>>LANG>>' . $shortlang]) && $this->CSS[$tag . '>>LANG>>' . $shortlang]) {
|
1639 |
+
$zp = $this->CSS[$tag . '>>LANG>>' . $shortlang];
|
1640 |
+
if ($tag == 'TD' || $tag == 'TH') {
|
1641 |
+
$this->setBorderDominance($zp, 9);
|
1642 |
+
} // *TABLES* // *TABLES-ADVANCED-BORDERS*
|
1643 |
+
if (is_array($zp)) {
|
1644 |
+
$p = array_merge($p, $zp);
|
1645 |
+
$this->_mergeBorders($p, $zp);
|
1646 |
+
}
|
1647 |
+
}
|
1648 |
+
}
|
1649 |
+
//===============================================
|
1650 |
+
// STYLESHEET CLASS e.g. p#smallone{} div#redletter{}
|
1651 |
+
if (isset($attr['ID']) && isset($this->CSS[$tag . '>>ID>>' . $attr['ID']]) && $this->CSS[$tag . '>>ID>>' . $attr['ID']]) {
|
1652 |
+
$zp = $this->CSS[$tag . '>>ID>>' . $attr['ID']];
|
1653 |
+
if ($tag == 'TD' || $tag == 'TH') {
|
1654 |
+
$this->setBorderDominance($zp, 9);
|
1655 |
+
} // *TABLES* // *TABLES-ADVANCED-BORDERS*
|
1656 |
+
if (is_array($zp)) {
|
1657 |
+
$p = array_merge($p, $zp);
|
1658 |
+
$this->_mergeBorders($p, $zp);
|
1659 |
+
}
|
1660 |
+
}
|
1661 |
+
//===============================================
|
1662 |
+
// Cascaded e.g. div.class p only works for block level
|
1663 |
+
if ($inherit == 'BLOCK') {
|
1664 |
+
if (isset($this->mpdf->blk[$this->mpdf->blklvl - 1])) { // mPDF 6
|
1665 |
+
$this->_set_mergedCSS($this->mpdf->blk[$this->mpdf->blklvl - 1]['cascadeCSS'][$tag], $p);
|
1666 |
+
foreach ($classes AS $class) {
|
1667 |
+
$this->_set_mergedCSS($this->mpdf->blk[$this->mpdf->blklvl - 1]['cascadeCSS']['CLASS>>' . $class], $p);
|
1668 |
+
}
|
1669 |
+
$this->_set_mergedCSS($this->mpdf->blk[$this->mpdf->blklvl - 1]['cascadeCSS']['ID>>' . $attr['ID']], $p);
|
1670 |
+
foreach ($classes AS $class) {
|
1671 |
+
$this->_set_mergedCSS($this->mpdf->blk[$this->mpdf->blklvl - 1]['cascadeCSS'][$tag . '>>CLASS>>' . $class], $p);
|
1672 |
+
}
|
1673 |
+
$this->_set_mergedCSS($this->mpdf->blk[$this->mpdf->blklvl - 1]['cascadeCSS'][$tag . '>>ID>>' . $attr['ID']], $p);
|
1674 |
+
}
|
1675 |
+
} else if ($inherit == 'INLINE') {
|
1676 |
+
$this->_set_mergedCSS($this->mpdf->blk[$this->mpdf->blklvl]['cascadeCSS'][$tag], $p);
|
1677 |
+
foreach ($classes AS $class) {
|
1678 |
+
$this->_set_mergedCSS($this->mpdf->blk[$this->mpdf->blklvl]['cascadeCSS']['CLASS>>' . $class], $p);
|
1679 |
+
}
|
1680 |
+
$this->_set_mergedCSS($this->mpdf->blk[$this->mpdf->blklvl]['cascadeCSS']['ID>>' . $attr['ID']], $p);
|
1681 |
+
foreach ($classes AS $class) {
|
1682 |
+
$this->_set_mergedCSS($this->mpdf->blk[$this->mpdf->blklvl]['cascadeCSS'][$tag . '>>CLASS>>' . $class], $p);
|
1683 |
+
}
|
1684 |
+
$this->_set_mergedCSS($this->mpdf->blk[$this->mpdf->blklvl]['cascadeCSS'][$tag . '>>ID>>' . $attr['ID']], $p);
|
1685 |
+
}
|
1686 |
+
/* -- TABLES -- */ else if ($inherit == 'TOPTABLE' || $inherit == 'TABLE') { // NB looks at $this->tablecascadeCSS-1 for cascading CSS
|
1687 |
+
if (isset($this->tablecascadeCSS[$this->tbCSSlvl - 1])) { // mPDF 6
|
1688 |
+
// false, 9 = don't check for 'depth' and do set border dominance
|
1689 |
+
$this->_set_mergedCSS($this->tablecascadeCSS[$this->tbCSSlvl - 1][$tag], $p, false, 9);
|
1690 |
+
foreach ($classes AS $class) {
|
1691 |
+
$this->_set_mergedCSS($this->tablecascadeCSS[$this->tbCSSlvl - 1]['CLASS>>' . $class], $p, false, 9);
|
1692 |
+
}
|
1693 |
+
// STYLESHEET nth-child SELECTOR e.g. tr:nth-child(odd) td:nth-child(2n+1)
|
1694 |
+
if ($tag == 'TR' || $tag == 'TD' || $tag == 'TH') {
|
1695 |
+
foreach ($this->tablecascadeCSS[$this->tbCSSlvl - 1] AS $k => $val) {
|
1696 |
+
if (preg_match('/' . $tag . '>>SELECTORNTHCHILD>>(.*)/', $k, $m)) {
|
1697 |
+
$select = false;
|
1698 |
+
if ($tag == 'TR') {
|
1699 |
+
$row = $this->mpdf->row;
|
1700 |
+
$thnr = (isset($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_thead']) ? count($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_thead']) : 0);
|
1701 |
+
$tfnr = (isset($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_tfoot']) ? count($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['is_tfoot']) : 0);
|
1702 |
+
if ($this->mpdf->tabletfoot) {
|
1703 |
+
$row -= $thnr;
|
1704 |
+
} else if (!$this->mpdf->tablethead) {
|
1705 |
+
$row -= ($thnr + $tfnr);
|
1706 |
+
}
|
1707 |
+
if (preg_match('/(([\-+]?\d*)?N([\-+]\d+)?|[\-+]?\d+|ODD|EVEN)/', $m[1], $a)) { // mPDF 5.7.4
|
1708 |
+
$select = $this->_nthchild($a, $row);
|
1709 |
+
}
|
1710 |
+
} else if ($tag == 'TD' || $tag == 'TH') {
|
1711 |
+
if (preg_match('/(([\-+]?\d*)?N([\-+]\d+)?|[\-+]?\d+|ODD|EVEN)/', $m[1], $a)) { // mPDF 5.7.4
|
1712 |
+
$select = $this->_nthchild($a, $this->mpdf->col);
|
1713 |
+
}
|
1714 |
+
}
|
1715 |
+
if ($select) {
|
1716 |
+
$this->_set_mergedCSS($this->tablecascadeCSS[$this->tbCSSlvl - 1][$tag . '>>SELECTORNTHCHILD>>' . $m[1]], $p, false, 9);
|
1717 |
+
}
|
1718 |
+
}
|
1719 |
+
}
|
1720 |
+
}
|
1721 |
+
}
|
1722 |
+
$this->_set_mergedCSS($this->tablecascadeCSS[$this->tbCSSlvl - 1]['ID>>' . $attr['ID']], $p, false, 9);
|
1723 |
+
foreach ($classes AS $class) {
|
1724 |
+
$this->_set_mergedCSS($this->tablecascadeCSS[$this->tbCSSlvl - 1][$tag . '>>CLASS>>' . $class], $p, false, 9);
|
1725 |
+
}
|
1726 |
+
$this->_set_mergedCSS($this->tablecascadeCSS[$this->tbCSSlvl - 1][$tag . '>>ID>>' . $attr['ID']], $p, false, 9);
|
1727 |
+
}
|
1728 |
+
/* -- END TABLES -- */
|
1729 |
+
//===============================================
|
1730 |
+
//===============================================
|
1731 |
+
// INLINE STYLE e.g. style="CSS:property"
|
1732 |
+
if (isset($attr['STYLE'])) {
|
1733 |
+
$zp = $this->readInlineCSS($attr['STYLE']);
|
1734 |
+
if ($tag == 'TD' || $tag == 'TH') {
|
1735 |
+
$this->setBorderDominance($zp, 9);
|
1736 |
+
} // *TABLES* // *TABLES-ADVANCED-BORDERS*
|
1737 |
+
if (is_array($zp)) {
|
1738 |
+
$p = array_merge($p, $zp);
|
1739 |
+
$this->_mergeBorders($p, $zp);
|
1740 |
+
}
|
1741 |
+
}
|
1742 |
+
//===============================================
|
1743 |
+
//===============================================
|
1744 |
+
return $p;
|
1745 |
+
}
|
1746 |
+
|
1747 |
+
// Convert inline Properties back to CSS
|
1748 |
+
function inlinePropsToCSS($bilp, &$p)
|
1749 |
+
{
|
1750 |
+
if (isset($bilp['family']) && $bilp['family']) {
|
1751 |
+
$p['FONT-FAMILY'] = $bilp['family'];
|
1752 |
+
}
|
1753 |
+
if (isset($bilp['I']) && $bilp['I']) {
|
1754 |
+
$p['FONT-STYLE'] = 'italic';
|
1755 |
+
}
|
1756 |
+
if (isset($bilp['sizePt']) && $bilp['sizePt']) {
|
1757 |
+
$p['FONT-SIZE'] = $bilp['sizePt'] . 'pt';
|
1758 |
+
}
|
1759 |
+
if (isset($bilp['B']) && $bilp['B']) {
|
1760 |
+
$p['FONT-WEIGHT'] = 'bold';
|
1761 |
+
}
|
1762 |
+
if (isset($bilp['colorarray']) && $bilp['colorarray']) {
|
1763 |
+
$cor = $bilp['colorarray'];
|
1764 |
+
$p['COLOR'] = $this->mpdf->_colAtoString($cor);
|
1765 |
+
}
|
1766 |
+
if (isset($bilp['lSpacingCSS']) && $bilp['lSpacingCSS']) {
|
1767 |
+
$p['LETTER-SPACING'] = $bilp['lSpacingCSS'];
|
1768 |
+
}
|
1769 |
+
if (isset($bilp['wSpacingCSS']) && $bilp['wSpacingCSS']) {
|
1770 |
+
$p['WORD-SPACING'] = $bilp['wSpacingCSS'];
|
1771 |
+
}
|
1772 |
+
|
1773 |
+
if (isset($bilp['textparam']) && $bilp['textparam']) {
|
1774 |
+
if (isset($bilp['textparam']['hyphens'])) {
|
1775 |
+
if ($bilp['textparam']['hyphens'] == 2) {
|
1776 |
+
$p['HYPHENS'] = 'none';
|
1777 |
+
}
|
1778 |
+
if ($bilp['textparam']['hyphens'] == 1) {
|
1779 |
+
$p['HYPHENS'] = 'auto';
|
1780 |
+
}
|
1781 |
+
if ($bilp['textparam']['hyphens'] == 0) {
|
1782 |
+
$p['HYPHENS'] = 'manual';
|
1783 |
+
}
|
1784 |
+
}
|
1785 |
+
if (isset($bilp['textparam']['outline-s']) && !$bilp['textparam']['outline-s']) {
|
1786 |
+
$p['TEXT-OUTLINE'] = 'none';
|
1787 |
+
}
|
1788 |
+
if (isset($bilp['textparam']['outline-COLOR']) && $bilp['textparam']['outline-COLOR']) {
|
1789 |
+
$p['TEXT-OUTLINE-COLOR'] = $this->mpdf->_colAtoString($bilp['textparam']['outline-COLOR']);
|
1790 |
+
}
|
1791 |
+
if (isset($bilp['textparam']['outline-WIDTH']) && $bilp['textparam']['outline-WIDTH']) {
|
1792 |
+
$p['TEXT-OUTLINE-WIDTH'] = $bilp['textparam']['outline-WIDTH'] . 'mm';
|
1793 |
+
}
|
1794 |
+
}
|
1795 |
+
|
1796 |
+
if (isset($bilp['textvar']) && $bilp['textvar']) {
|
1797 |
+
// CSS says text-decoration is not inherited, but IE7 does??
|
1798 |
+
if ($bilp['textvar'] & FD_LINETHROUGH) {
|
1799 |
+
if ($bilp['textvar'] & FD_UNDERLINE) {
|
1800 |
+
$p['TEXT-DECORATION'] = 'underline line-through';
|
1801 |
+
} else {
|
1802 |
+
$p['TEXT-DECORATION'] = 'line-through';
|
1803 |
+
}
|
1804 |
+
} else if ($bilp['textvar'] & FD_UNDERLINE) {
|
1805 |
+
$p['TEXT-DECORATION'] = 'underline';
|
1806 |
+
} else {
|
1807 |
+
$p['TEXT-DECORATION'] = 'none';
|
1808 |
+
}
|
1809 |
+
|
1810 |
+
if ($bilp['textvar'] & FA_SUPERSCRIPT) {
|
1811 |
+
$p['VERTICAL-ALIGN'] = 'super';
|
1812 |
+
} else if ($bilp['textvar'] & FA_SUBSCRIPT) {
|
1813 |
+
$p['VERTICAL-ALIGN'] = 'sub';
|
1814 |
+
} else {
|
1815 |
+
$p['VERTICAL-ALIGN'] = 'baseline';
|
1816 |
+
}
|
1817 |
+
|
1818 |
+
if ($bilp['textvar'] & FT_CAPITALIZE) {
|
1819 |
+
$p['TEXT-TRANSFORM'] = 'capitalize';
|
1820 |
+
} else if ($bilp['textvar'] & FT_UPPERCASE) {
|
1821 |
+
$p['TEXT-TRANSFORM'] = 'uppercase';
|
1822 |
+
} else if ($bilp['textvar'] & FT_LOWERCASE) {
|
1823 |
+
$p['TEXT-TRANSFORM'] = 'lowercase';
|
1824 |
+
} else {
|
1825 |
+
$p['TEXT-TRANSFORM'] = 'none';
|
1826 |
+
}
|
1827 |
+
|
1828 |
+
if ($bilp['textvar'] & FC_KERNING) {
|
1829 |
+
$p['FONT-KERNING'] = 'normal';
|
1830 |
+
} // ignore 'auto' as default already applied
|
1831 |
+
//if (isset($bilp[ 'OTLtags' ]) && $bilp[ 'OTLtags' ]['Plus'] contains 'kern'
|
1832 |
+
else {
|
1833 |
+
$p['FONT-KERNING'] = 'none';
|
1834 |
+
}
|
1835 |
+
|
1836 |
+
if ($bilp['textvar'] & FA_SUPERSCRIPT) {
|
1837 |
+
$p['FONT-VARIANT-POSITION'] = 'super';
|
1838 |
+
}
|
1839 |
+
//if (isset($bilp[ 'OTLtags' ]) && $bilp[ 'OTLtags' ]['Plus'] contains 'sups' / 'subs'
|
1840 |
+
else if ($bilp['textvar'] & FA_SUBSCRIPT) {
|
1841 |
+
$p['FONT-VARIANT-POSITION'] = 'sub';
|
1842 |
+
} else {
|
1843 |
+
$p['FONT-VARIANT-POSITION'] = 'normal';
|
1844 |
+
}
|
1845 |
+
|
1846 |
+
if ($bilp['textvar'] & FC_SMALLCAPS) {
|
1847 |
+
$p['FONT-VARIANT-CAPS'] = 'small-caps';
|
1848 |
+
}
|
1849 |
+
}
|
1850 |
+
if (isset($bilp['fontLanguageOverride'])) {
|
1851 |
+
if ($bilp['fontLanguageOverride']) {
|
1852 |
+
$p['FONT-LANGUAGE-OVERRIDE'] = $bilp['fontLanguageOverride'];
|
1853 |
+
} else {
|
1854 |
+
$p['FONT-LANGUAGE-OVERRIDE'] = 'normal';
|
1855 |
+
}
|
1856 |
+
}
|
1857 |
+
// All the variations of font-variant-* we are going to set as font-feature-settings...
|
1858 |
+
if (isset($bilp['OTLtags']) && $bilp['OTLtags']) {
|
1859 |
+
$ffs = array();
|
1860 |
+
if (isset($bilp['OTLtags']['Minus']) && $bilp['OTLtags']['Minus']) {
|
1861 |
+
$f = preg_split('/\s+/', trim($bilp['OTLtags']['Minus']));
|
1862 |
+
foreach ($f AS $ff) {
|
1863 |
+
$ffs[] = "'" . $ff . "' 0";
|
1864 |
+
}
|
1865 |
+
}
|
1866 |
+
if (isset($bilp['OTLtags']['FFMinus']) && $bilp['OTLtags']['FFMinus']) {
|
1867 |
+
$f = preg_split('/\s+/', trim($bilp['OTLtags']['FFMinus']));
|
1868 |
+
foreach ($f AS $ff) {
|
1869 |
+
$ffs[] = "'" . $ff . "' 0";
|
1870 |
+
}
|
1871 |
+
}
|
1872 |
+
if (isset($bilp['OTLtags']['Plus']) && $bilp['OTLtags']['Plus']) {
|
1873 |
+
$f = preg_split('/\s+/', trim($bilp['OTLtags']['Plus']));
|
1874 |
+
foreach ($f AS $ff) {
|
1875 |
+
$ffs[] = "'" . $ff . "' 1";
|
1876 |
+
}
|
1877 |
+
}
|
1878 |
+
if (isset($bilp['OTLtags']['FFPlus']) && $bilp['OTLtags']['FFPlus']) { // May contain numeric value e.g. salt4
|
1879 |
+
$f = preg_split('/\s+/', trim($bilp['OTLtags']['FFPlus']));
|
1880 |
+
foreach ($f AS $ff) {
|
1881 |
+
if (strlen($ff) > 4) {
|
1882 |
+
$ffs[] = "'" . substr($ff, 0, 4) . "' " . substr($ff, 4);
|
1883 |
+
} else {
|
1884 |
+
$ffs[] = "'" . $ff . "' 1";
|
1885 |
+
}
|
1886 |
+
}
|
1887 |
+
}
|
1888 |
+
$p['FONT-FEATURE-SETTINGS'] = implode(', ', $ffs);
|
1889 |
+
}
|
1890 |
+
}
|
1891 |
+
|
1892 |
+
function PreviewBlockCSS($tag, $attr)
|
1893 |
+
{
|
1894 |
+
// Looks ahead from current block level to a new level
|
1895 |
+
$p = array();
|
1896 |
+
$zp = array();
|
1897 |
+
$oldcascadeCSS = $this->mpdf->blk[$this->mpdf->blklvl]['cascadeCSS'];
|
1898 |
+
$classes = array();
|
1899 |
+
if (isset($attr['CLASS'])) {
|
1900 |
+
$classes = preg_split('/\s+/', $attr['CLASS']);
|
1901 |
+
}
|
1902 |
+
//===============================================
|
1903 |
+
// DEFAULT for this TAG set in DefaultCSS
|
1904 |
+
if (isset($this->mpdf->defaultCSS[$tag])) {
|
1905 |
+
$zp = $this->fixCSS($this->mpdf->defaultCSS[$tag]);
|
1906 |
+
if (is_array($zp)) {
|
1907 |
+
$p = array_merge($zp, $p);
|
1908 |
+
} // Inherited overwrites default
|
1909 |
+
}
|
1910 |
+
// STYLESHEET TAG e.g. h1 p div table
|
1911 |
+
if (isset($this->CSS[$tag])) {
|
1912 |
+
$zp = $this->CSS[$tag];
|
1913 |
+
if (is_array($zp)) {
|
1914 |
+
$p = array_merge($p, $zp);
|
1915 |
+
}
|
1916 |
+
}
|
1917 |
+
// STYLESHEET CLASS e.g. .smallone{} .redletter{}
|
1918 |
+
foreach ($classes AS $class) {
|
1919 |
+
$zp = array();
|
1920 |
+
if (isset($this->CSS['CLASS>>' . $class])) {
|
1921 |
+
$zp = $this->CSS['CLASS>>' . $class];
|
1922 |
+
}
|
1923 |
+
if (is_array($zp)) {
|
1924 |
+
$p = array_merge($p, $zp);
|
1925 |
+
}
|
1926 |
+
}
|
1927 |
+
// STYLESHEET ID e.g. #smallone{} #redletter{}
|
1928 |
+
if (isset($attr['ID']) && isset($this->CSS['ID>>' . $attr['ID']])) {
|
1929 |
+
$zp = $this->CSS['ID>>' . $attr['ID']];
|
1930 |
+
if (is_array($zp)) {
|
1931 |
+
$p = array_merge($p, $zp);
|
1932 |
+
}
|
1933 |
+
}
|
1934 |
+
// STYLESHEET CLASS e.g. p.smallone{} div.redletter{}
|
1935 |
+
foreach ($classes AS $class) {
|
1936 |
+
$zp = array();
|
1937 |
+
if (isset($this->CSS[$tag . '>>CLASS>>' . $class])) {
|
1938 |
+
$zp = $this->CSS[$tag . '>>CLASS>>' . $class];
|
1939 |
+
}
|
1940 |
+
if (is_array($zp)) {
|
1941 |
+
$p = array_merge($p, $zp);
|
1942 |
+
}
|
1943 |
+
}
|
1944 |
+
// STYLESHEET CLASS e.g. p#smallone{} div#redletter{}
|
1945 |
+
if (isset($attr['ID']) && isset($this->CSS[$tag . '>>ID>>' . $attr['ID']])) {
|
1946 |
+
$zp = $this->CSS[$tag . '>>ID>>' . $attr['ID']];
|
1947 |
+
if (is_array($zp)) {
|
1948 |
+
$p = array_merge($p, $zp);
|
1949 |
+
}
|
1950 |
+
}
|
1951 |
+
//===============================================
|
1952 |
+
// STYLESHEET TAG e.g. div h1 div p
|
1953 |
+
|
1954 |
+
$this->_set_mergedCSS($oldcascadeCSS[$tag], $p);
|
1955 |
+
// STYLESHEET CLASS e.g. .smallone{} .redletter{}
|
1956 |
+
foreach ($classes AS $class) {
|
1957 |
+
|
1958 |
+
$this->_set_mergedCSS($oldcascadeCSS['CLASS>>' . $class], $p);
|
1959 |
+
}
|
1960 |
+
// STYLESHEET CLASS e.g. #smallone{} #redletter{}
|
1961 |
+
if (isset($attr['ID'])) {
|
1962 |
+
|
1963 |
+
$this->_set_mergedCSS($oldcascadeCSS['ID>>' . $attr['ID']], $p);
|
1964 |
+
}
|
1965 |
+
// STYLESHEET CLASS e.g. div.smallone{} p.redletter{}
|
1966 |
+
foreach ($classes AS $class) {
|
1967 |
+
|
1968 |
+
$this->_set_mergedCSS($oldcascadeCSS[$tag . '>>CLASS>>' . $class], $p);
|
1969 |
+
}
|
1970 |
+
// STYLESHEET CLASS e.g. div#smallone{} p#redletter{}
|
1971 |
+
if (isset($attr['ID'])) {
|
1972 |
+
|
1973 |
+
$this->_set_mergedCSS($oldcascadeCSS[$tag . '>>ID>>' . $attr['ID']], $p);
|
1974 |
+
}
|
1975 |
+
//===============================================
|
1976 |
+
// INLINE STYLE e.g. style="CSS:property"
|
1977 |
+
if (isset($attr['STYLE'])) {
|
1978 |
+
$zp = $this->readInlineCSS($attr['STYLE']);
|
1979 |
+
if (is_array($zp)) {
|
1980 |
+
$p = array_merge($p, $zp);
|
1981 |
+
}
|
1982 |
+
}
|
1983 |
+
//===============================================
|
1984 |
+
return $p;
|
1985 |
+
}
|
1986 |
+
|
1987 |
+
// mPDF 5.7.4 nth-child
|
1988 |
+
function _nthchild($f, $c)
|
1989 |
+
{
|
1990 |
+
// $f is formual e.g. 2N+1 spilt into a preg_match array
|
1991 |
+
// $c is the comparator value e.g row or column number
|
1992 |
+
$c += 1;
|
1993 |
+
$select = false;
|
1994 |
+
$a = 1;
|
1995 |
+
$b = 1;
|
1996 |
+
if ($f[0] == 'ODD') {
|
1997 |
+
$a = 2;
|
1998 |
+
$b = 1;
|
1999 |
+
} else if ($f[0] == 'EVEN') {
|
2000 |
+
$a = 2;
|
2001 |
+
$b = 0;
|
2002 |
+
} else if (count($f) == 2) {
|
2003 |
+
$a = 0;
|
2004 |
+
$b = $f[1] + 0;
|
2005 |
+
} // e.g. (+6)
|
2006 |
+
else if (count($f) == 3) { // e.g. (2N)
|
2007 |
+
if ($f[2] == '') {
|
2008 |
+
$a = 1;
|
2009 |
+
} else if ($f[2] == '-') {
|
2010 |
+
$a = -1;
|
2011 |
+
} else {
|
2012 |
+
$a = $f[2] + 0;
|
2013 |
+
}
|
2014 |
+
$b = 0;
|
2015 |
+
} else if (count($f) == 4) { // e.g. (2N+6)
|
2016 |
+
if ($f[2] == '') {
|
2017 |
+
$a = 1;
|
2018 |
+
} else if ($f[2] == '-') {
|
2019 |
+
$a = -1;
|
2020 |
+
} else {
|
2021 |
+
$a = $f[2] + 0;
|
2022 |
+
}
|
2023 |
+
$b = $f[3] + 0;
|
2024 |
+
} else {
|
2025 |
+
return false;
|
2026 |
+
}
|
2027 |
+
if ($a > 0) {
|
2028 |
+
if (((($c % $a) - $b) % $a) == 0 && $c >= $b) {
|
2029 |
+
$select = true;
|
2030 |
+
}
|
2031 |
+
} else if ($a == 0) {
|
2032 |
+
if ($c == $b) {
|
2033 |
+
$select = true;
|
2034 |
+
}
|
2035 |
+
} else { // if ($a<0)
|
2036 |
+
if (((($c % $a) - $b) % $a) == 0 && $c <= $b) {
|
2037 |
+
$select = true;
|
2038 |
+
}
|
2039 |
+
}
|
2040 |
+
return $select;
|
2041 |
+
}
|
2042 |
+
|
2043 |
+
}
|
lib/mpdf/classes/directw.php
CHANGED
@@ -1,412 +1,463 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class directw
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
//
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
$
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
$
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
$
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
if (
|
97 |
-
|
98 |
-
}
|
99 |
-
|
100 |
-
$this->mpdf->
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
$
|
141 |
-
}
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
//
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
$
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
$
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
$this->mpdf->
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
}
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
$
|
233 |
-
}
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
$
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class directw
|
4 |
+
{
|
5 |
+
|
6 |
+
var $mpdf = null;
|
7 |
+
|
8 |
+
public function __construct(mPDF $mpdf)
|
9 |
+
{
|
10 |
+
$this->mpdf = $mpdf;
|
11 |
+
}
|
12 |
+
|
13 |
+
function Write($h, $txt, $currentx = 0, $link = '', $directionality = 'ltr', $align = '')
|
14 |
+
{
|
15 |
+
if (!$align) {
|
16 |
+
if ($directionality == 'rtl') {
|
17 |
+
$align = 'R';
|
18 |
+
} else {
|
19 |
+
$align = 'L';
|
20 |
+
}
|
21 |
+
}
|
22 |
+
if ($h == 0) {
|
23 |
+
$this->mpdf->SetLineHeight();
|
24 |
+
$h = $this->mpdf->lineheight;
|
25 |
+
}
|
26 |
+
//Output text in flowing mode
|
27 |
+
$w = $this->mpdf->w - $this->mpdf->rMargin - $this->mpdf->x;
|
28 |
+
|
29 |
+
$wmax = ($w - ($this->mpdf->cMarginL + $this->mpdf->cMarginR));
|
30 |
+
$s = str_replace("\r", '', $txt);
|
31 |
+
if ($this->mpdf->usingCoreFont) {
|
32 |
+
$nb = strlen($s);
|
33 |
+
} else {
|
34 |
+
$nb = mb_strlen($s, $this->mpdf->mb_enc);
|
35 |
+
// handle single space character
|
36 |
+
if (($nb == 1) && $s == " ") {
|
37 |
+
$this->mpdf->x += $this->mpdf->GetStringWidth($s);
|
38 |
+
return;
|
39 |
+
}
|
40 |
+
}
|
41 |
+
$sep = -1;
|
42 |
+
$i = 0;
|
43 |
+
$j = 0;
|
44 |
+
$l = 0;
|
45 |
+
$nl = 1;
|
46 |
+
if (!$this->mpdf->usingCoreFont) {
|
47 |
+
if (preg_match("/([" . $this->mpdf->pregRTLchars . "])/u", $txt)) {
|
48 |
+
$this->mpdf->biDirectional = true;
|
49 |
+
} // *RTL*
|
50 |
+
while ($i < $nb) {
|
51 |
+
//Get next character
|
52 |
+
$c = mb_substr($s, $i, 1, $this->mpdf->mb_enc);
|
53 |
+
if ($c == "\n") {
|
54 |
+
// WORD SPACING
|
55 |
+
$this->mpdf->ResetSpacing();
|
56 |
+
//Explicit line break
|
57 |
+
$tmp = rtrim(mb_substr($s, $j, $i - $j, $this->mpdf->mb_enc));
|
58 |
+
$this->mpdf->Cell($w, $h, $tmp, 0, 2, $align, $fill, $link);
|
59 |
+
$i++;
|
60 |
+
$sep = -1;
|
61 |
+
$j = $i;
|
62 |
+
$l = 0;
|
63 |
+
if ($nl == 1) {
|
64 |
+
if ($currentx != 0)
|
65 |
+
$this->mpdf->x = $currentx;
|
66 |
+
else
|
67 |
+
$this->mpdf->x = $this->mpdf->lMargin;
|
68 |
+
$w = $this->mpdf->w - $this->mpdf->rMargin - $this->mpdf->x;
|
69 |
+
$wmax = ($w - ($this->mpdf->cMarginL + $this->mpdf->cMarginR));
|
70 |
+
}
|
71 |
+
$nl++;
|
72 |
+
continue;
|
73 |
+
}
|
74 |
+
if ($c == " ") {
|
75 |
+
$sep = $i;
|
76 |
+
}
|
77 |
+
$l += $this->mpdf->GetCharWidthNonCore($c); // mPDF 5.3.04
|
78 |
+
if ($l > $wmax) {
|
79 |
+
//Automatic line break (word wrapping)
|
80 |
+
if ($sep == -1) {
|
81 |
+
// WORD SPACING
|
82 |
+
$this->mpdf->ResetSpacing();
|
83 |
+
if ($this->mpdf->x > $this->mpdf->lMargin) {
|
84 |
+
//Move to next line
|
85 |
+
if ($currentx != 0)
|
86 |
+
$this->mpdf->x = $currentx;
|
87 |
+
else
|
88 |
+
$this->mpdf->x = $this->mpdf->lMargin;
|
89 |
+
$this->mpdf->y+=$h;
|
90 |
+
$w = $this->mpdf->w - $this->mpdf->rMargin - $this->mpdf->x;
|
91 |
+
$wmax = ($w - ($this->mpdf->cMarginL + $this->mpdf->cMarginR));
|
92 |
+
$i++;
|
93 |
+
$nl++;
|
94 |
+
continue;
|
95 |
+
}
|
96 |
+
if ($i == $j) {
|
97 |
+
$i++;
|
98 |
+
}
|
99 |
+
$tmp = rtrim(mb_substr($s, $j, $i - $j, $this->mpdf->mb_enc));
|
100 |
+
$this->mpdf->Cell($w, $h, $tmp, 0, 2, $align, $fill, $link);
|
101 |
+
} else {
|
102 |
+
$tmp = rtrim(mb_substr($s, $j, $sep - $j, $this->mpdf->mb_enc));
|
103 |
+
|
104 |
+
if ($align == 'J') {
|
105 |
+
//////////////////////////////////////////
|
106 |
+
// JUSTIFY J using Unicode fonts (Word spacing doesn't work)
|
107 |
+
// WORD SPACING
|
108 |
+
// Change NON_BREAKING SPACE to spaces so they are 'spaced' properly
|
109 |
+
$tmp = str_replace(chr(194) . chr(160), chr(32), $tmp);
|
110 |
+
$len_ligne = $this->mpdf->GetStringWidth($tmp);
|
111 |
+
$nb_carac = mb_strlen($tmp, $this->mpdf->mb_enc);
|
112 |
+
$nb_spaces = mb_substr_count($tmp, ' ', $this->mpdf->mb_enc);
|
113 |
+
$inclCursive = false;
|
114 |
+
if (isset($this->mpdf->CurrentFont['useOTL']) && $this->mpdf->CurrentFont['useOTL']) {
|
115 |
+
if (preg_match("/([" . $this->mpdf->pregCURSchars . "])/u", $tmp)) {
|
116 |
+
$inclCursive = true;
|
117 |
+
}
|
118 |
+
}
|
119 |
+
list($charspacing, $ws) = $this->mpdf->GetJspacing($nb_carac, $nb_spaces, ((($w - 2) - $len_ligne) * _MPDFK), $inclCursive);
|
120 |
+
$this->mpdf->SetSpacing($charspacing, $ws);
|
121 |
+
//////////////////////////////////////////
|
122 |
+
}
|
123 |
+
$this->mpdf->Cell($w, $h, $tmp, 0, 2, $align, $fill, $link);
|
124 |
+
$i = $sep + 1;
|
125 |
+
}
|
126 |
+
$sep = -1;
|
127 |
+
$j = $i;
|
128 |
+
$l = 0;
|
129 |
+
if ($nl == 1) {
|
130 |
+
if ($currentx != 0)
|
131 |
+
$this->mpdf->x = $currentx;
|
132 |
+
else
|
133 |
+
$this->mpdf->x = $this->mpdf->lMargin;
|
134 |
+
$w = $this->mpdf->w - $this->mpdf->rMargin - $this->mpdf->x;
|
135 |
+
$wmax = ($w - ($this->mpdf->cMarginL + $this->mpdf->cMarginR));
|
136 |
+
}
|
137 |
+
$nl++;
|
138 |
+
}
|
139 |
+
else {
|
140 |
+
$i++;
|
141 |
+
}
|
142 |
+
}
|
143 |
+
//Last chunk
|
144 |
+
// WORD SPACING
|
145 |
+
$this->mpdf->ResetSpacing();
|
146 |
+
} else {
|
147 |
+
while ($i < $nb) {
|
148 |
+
//Get next character
|
149 |
+
$c = $s[$i];
|
150 |
+
if ($c == "\n") {
|
151 |
+
//Explicit line break
|
152 |
+
// WORD SPACING
|
153 |
+
$this->mpdf->ResetSpacing();
|
154 |
+
$this->mpdf->Cell($w, $h, substr($s, $j, $i - $j), 0, 2, $align, $fill, $link);
|
155 |
+
$i++;
|
156 |
+
$sep = -1;
|
157 |
+
$j = $i;
|
158 |
+
$l = 0;
|
159 |
+
if ($nl == 1) {
|
160 |
+
if ($currentx != 0)
|
161 |
+
$this->mpdf->x = $currentx;
|
162 |
+
else
|
163 |
+
$this->mpdf->x = $this->mpdf->lMargin;
|
164 |
+
$w = $this->mpdf->w - $this->mpdf->rMargin - $this->mpdf->x;
|
165 |
+
$wmax = $w - ($this->mpdf->cMarginL + $this->mpdf->cMarginR);
|
166 |
+
}
|
167 |
+
$nl++;
|
168 |
+
continue;
|
169 |
+
}
|
170 |
+
if ($c == " ") {
|
171 |
+
$sep = $i;
|
172 |
+
}
|
173 |
+
$l += $this->mpdf->GetCharWidthCore($c); // mPDF 5.3.04
|
174 |
+
if ($l > $wmax) {
|
175 |
+
//Automatic line break (word wrapping)
|
176 |
+
if ($sep == -1) {
|
177 |
+
// WORD SPACING
|
178 |
+
$this->mpdf->ResetSpacing();
|
179 |
+
if ($this->mpdf->x > $this->mpdf->lMargin) {
|
180 |
+
//Move to next line
|
181 |
+
if ($currentx != 0)
|
182 |
+
$this->mpdf->x = $currentx;
|
183 |
+
else
|
184 |
+
$this->mpdf->x = $this->mpdf->lMargin;
|
185 |
+
$this->mpdf->y+=$h;
|
186 |
+
$w = $this->mpdf->w - $this->mpdf->rMargin - $this->mpdf->x;
|
187 |
+
$wmax = $w - ($this->mpdf->cMarginL + $this->mpdf->cMarginR);
|
188 |
+
$i++;
|
189 |
+
$nl++;
|
190 |
+
continue;
|
191 |
+
}
|
192 |
+
if ($i == $j) {
|
193 |
+
$i++;
|
194 |
+
}
|
195 |
+
$this->mpdf->Cell($w, $h, substr($s, $j, $i - $j), 0, 2, $align, $fill, $link);
|
196 |
+
} else {
|
197 |
+
$tmp = substr($s, $j, $sep - $j);
|
198 |
+
if ($align == 'J') {
|
199 |
+
//////////////////////////////////////////
|
200 |
+
// JUSTIFY J using Unicode fonts
|
201 |
+
// WORD SPACING is not fully supported for complex scripts
|
202 |
+
// Change NON_BREAKING SPACE to spaces so they are 'spaced' properly
|
203 |
+
$tmp = str_replace(chr(160), chr(32), $tmp);
|
204 |
+
$len_ligne = $this->mpdf->GetStringWidth($tmp);
|
205 |
+
$nb_carac = strlen($tmp);
|
206 |
+
$nb_spaces = substr_count($tmp, ' ');
|
207 |
+
list($charspacing, $ws) = $this->mpdf->GetJspacing($nb_carac, $nb_spaces, ((($w - 2) - $len_ligne) * _MPDFK), $false);
|
208 |
+
$this->mpdf->SetSpacing($charspacing, $ws);
|
209 |
+
//////////////////////////////////////////
|
210 |
+
}
|
211 |
+
$this->mpdf->Cell($w, $h, $tmp, 0, 2, $align, $fill, $link);
|
212 |
+
$i = $sep + 1;
|
213 |
+
}
|
214 |
+
$sep = -1;
|
215 |
+
$j = $i;
|
216 |
+
$l = 0;
|
217 |
+
if ($nl == 1) {
|
218 |
+
if ($currentx != 0)
|
219 |
+
$this->mpdf->x = $currentx;
|
220 |
+
else
|
221 |
+
$this->mpdf->x = $this->mpdf->lMargin;
|
222 |
+
$w = $this->mpdf->w - $this->mpdf->rMargin - $this->mpdf->x;
|
223 |
+
$wmax = $w - ($this->mpdf->cMarginL + $this->mpdf->cMarginR);
|
224 |
+
}
|
225 |
+
$nl++;
|
226 |
+
}
|
227 |
+
else {
|
228 |
+
$i++;
|
229 |
+
}
|
230 |
+
}
|
231 |
+
// WORD SPACING
|
232 |
+
$this->mpdf->ResetSpacing();
|
233 |
+
}
|
234 |
+
//Last chunk
|
235 |
+
if ($i != $j) {
|
236 |
+
if ($currentx != 0)
|
237 |
+
$this->mpdf->x = $currentx;
|
238 |
+
else
|
239 |
+
$this->mpdf->x = $this->mpdf->lMargin;
|
240 |
+
if ($this->mpdf->usingCoreFont) {
|
241 |
+
$tmp = substr($s, $j, $i - $j);
|
242 |
+
} else {
|
243 |
+
$tmp = mb_substr($s, $j, $i - $j, $this->mpdf->mb_enc);
|
244 |
+
}
|
245 |
+
$this->mpdf->Cell($w, $h, $tmp, 0, 0, $align, $fill, $link);
|
246 |
+
}
|
247 |
+
}
|
248 |
+
|
249 |
+
function CircularText($x, $y, $r, $text, $align = 'top', $fontfamily = '', $fontsizePt = 0, $fontstyle = '', $kerning = 120, $fontwidth = 100, $divider = '')
|
250 |
+
{
|
251 |
+
if ($fontfamily || $fontstyle || $fontsizePt)
|
252 |
+
$this->mpdf->SetFont($fontfamily, $fontstyle, $fontsizePt);
|
253 |
+
$kerning/=100;
|
254 |
+
$fontwidth/=100;
|
255 |
+
if ($kerning == 0)
|
256 |
+
$this->mpdf->Error('Please use values unequal to zero for kerning (CircularText)');
|
257 |
+
if ($fontwidth == 0)
|
258 |
+
$this->mpdf->Error('Please use values unequal to zero for font width (CircularText)');
|
259 |
+
$text = str_replace("\r", '', $text);
|
260 |
+
//circumference
|
261 |
+
$u = ($r * 2) * M_PI;
|
262 |
+
$checking = true;
|
263 |
+
$autoset = false;
|
264 |
+
while ($checking) {
|
265 |
+
$t = 0;
|
266 |
+
$w = array();
|
267 |
+
if ($this->mpdf->usingCoreFont) {
|
268 |
+
$nb = strlen($text);
|
269 |
+
for ($i = 0; $i < $nb; $i++) {
|
270 |
+
$w[$i] = $this->mpdf->GetStringWidth($text[$i]);
|
271 |
+
$w[$i]*=$kerning * $fontwidth;
|
272 |
+
$t+=$w[$i];
|
273 |
+
}
|
274 |
+
} else {
|
275 |
+
$nb = mb_strlen($text, $this->mpdf->mb_enc);
|
276 |
+
$lastchar = '';
|
277 |
+
$unicode = $this->mpdf->UTF8StringToArray($text);
|
278 |
+
for ($i = 0; $i < $nb; $i++) {
|
279 |
+
$c = mb_substr($text, $i, 1, $this->mpdf->mb_enc);
|
280 |
+
$w[$i] = $this->mpdf->GetStringWidth($c);
|
281 |
+
$w[$i]*=$kerning * $fontwidth;
|
282 |
+
$char = $unicode[$i];
|
283 |
+
if ($this->mpdf->useKerning && $lastchar) {
|
284 |
+
if (isset($this->mpdf->CurrentFont['kerninfo'][$lastchar][$char])) {
|
285 |
+
$tk = $this->mpdf->CurrentFont['kerninfo'][$lastchar][$char] * ($this->mpdf->FontSize / 1000) * $kerning * $fontwidth;
|
286 |
+
$w[$i] += $tk / 2;
|
287 |
+
$w[$i - 1] += $tk / 2;
|
288 |
+
$t+=$tk;
|
289 |
+
}
|
290 |
+
}
|
291 |
+
$lastchar = $char;
|
292 |
+
$t+=$w[$i];
|
293 |
+
}
|
294 |
+
}
|
295 |
+
if ($fontsizePt >= 0 || $autoset) {
|
296 |
+
$checking = false;
|
297 |
+
} else {
|
298 |
+
$t+=$this->mpdf->GetStringWidth(' ');
|
299 |
+
if ($divider)
|
300 |
+
$t+=$this->mpdf->GetStringWidth(' ');
|
301 |
+
if ($fontsizePt == -2)
|
302 |
+
$fontsizePt = $this->mpdf->FontSizePt * 0.5 * $u / $t;
|
303 |
+
else
|
304 |
+
$fontsizePt = $this->mpdf->FontSizePt * $u / $t;
|
305 |
+
$this->mpdf->SetFontSize($fontsizePt);
|
306 |
+
$autoset = true;
|
307 |
+
}
|
308 |
+
}
|
309 |
+
|
310 |
+
//total width of string in degrees
|
311 |
+
$d = ($t / $u) * 360;
|
312 |
+
|
313 |
+
$this->mpdf->StartTransform();
|
314 |
+
// rotate matrix for the first letter to center the text
|
315 |
+
// (half of total degrees)
|
316 |
+
if ($align == 'top') {
|
317 |
+
$this->mpdf->transformRotate(-$d / 2, $x, $y);
|
318 |
+
} else {
|
319 |
+
$this->mpdf->transformRotate($d / 2, $x, $y);
|
320 |
+
}
|
321 |
+
//run through the string
|
322 |
+
for ($i = 0; $i < $nb; $i++) {
|
323 |
+
if ($align == 'top') {
|
324 |
+
//rotate matrix half of the width of current letter + half of the width of preceding letter
|
325 |
+
if ($i == 0) {
|
326 |
+
$this->mpdf->transformRotate((($w[$i] / 2) / $u) * 360, $x, $y);
|
327 |
+
} else {
|
328 |
+
$this->mpdf->transformRotate((($w[$i] / 2 + $w[$i - 1] / 2) / $u) * 360, $x, $y);
|
329 |
+
}
|
330 |
+
if ($fontwidth != 1) {
|
331 |
+
$this->mpdf->StartTransform();
|
332 |
+
$this->mpdf->transformScale($fontwidth * 100, 100, $x, $y);
|
333 |
+
}
|
334 |
+
$this->mpdf->SetXY($x - $w[$i] / 2, $y - $r);
|
335 |
+
} else {
|
336 |
+
//rotate matrix half of the width of current letter + half of the width of preceding letter
|
337 |
+
if ($i == 0) {
|
338 |
+
$this->mpdf->transformRotate(-(($w[$i] / 2) / $u) * 360, $x, $y);
|
339 |
+
} else {
|
340 |
+
$this->mpdf->transformRotate(-(($w[$i] / 2 + $w[$i - 1] / 2) / $u) * 360, $x, $y);
|
341 |
+
}
|
342 |
+
if ($fontwidth != 1) {
|
343 |
+
$this->mpdf->StartTransform();
|
344 |
+
$this->mpdf->transformScale($fontwidth * 100, 100, $x, $y);
|
345 |
+
}
|
346 |
+
$this->mpdf->SetXY($x - $w[$i] / 2, $y + $r - ($this->mpdf->FontSize));
|
347 |
+
}
|
348 |
+
if ($this->mpdf->usingCoreFont) {
|
349 |
+
$c = $text[$i];
|
350 |
+
} else {
|
351 |
+
$c = mb_substr($text, $i, 1, $this->mpdf->mb_enc);
|
352 |
+
}
|
353 |
+
$this->mpdf->Cell(($w[$i]), $this->mpdf->FontSize, $c, 0, 0, 'C'); // mPDF 5.3.53
|
354 |
+
if ($fontwidth != 1) {
|
355 |
+
$this->mpdf->StopTransform();
|
356 |
+
}
|
357 |
+
}
|
358 |
+
$this->mpdf->StopTransform();
|
359 |
+
|
360 |
+
// mPDF 5.5.23
|
361 |
+
if ($align == 'top' && $divider != '') {
|
362 |
+
$wc = $this->mpdf->GetStringWidth($divider);
|
363 |
+
$wc*=$kerning * $fontwidth;
|
364 |
+
|
365 |
+
$this->mpdf->StartTransform();
|
366 |
+
$this->mpdf->transformRotate(90, $x, $y);
|
367 |
+
$this->mpdf->SetXY($x - $wc / 2, $y - $r);
|
368 |
+
$this->mpdf->Cell(($wc), $this->mpdf->FontSize, $divider, 0, 0, 'C');
|
369 |
+
$this->mpdf->StopTransform();
|
370 |
+
|
371 |
+
$this->mpdf->StartTransform();
|
372 |
+
$this->mpdf->transformRotate(-90, $x, $y);
|
373 |
+
$this->mpdf->SetXY($x - $wc / 2, $y - $r);
|
374 |
+
$this->mpdf->Cell(($wc), $this->mpdf->FontSize, $divider, 0, 0, 'C');
|
375 |
+
$this->mpdf->StopTransform();
|
376 |
+
}
|
377 |
+
}
|
378 |
+
|
379 |
+
function Shaded_box($text, $font = '', $fontstyle = 'B', $szfont = '', $width = '70%', $style = 'DF', $radius = 2.5, $fill = '#FFFFFF', $color = '#000000', $pad = 2)
|
380 |
+
{
|
381 |
+
// F (shading - no line),S (line, no shading),DF (both)
|
382 |
+
if (!$font) {
|
383 |
+
$font = $this->mpdf->default_font;
|
384 |
+
}
|
385 |
+
if (!$szfont) {
|
386 |
+
$szfont = ($this->mpdf->default_font_size * 1.8);
|
387 |
+
}
|
388 |
+
|
389 |
+
$text = ' ' . $text . ' ';
|
390 |
+
$this->mpdf->SetFont($font, $fontstyle, $szfont, false);
|
391 |
+
|
392 |
+
$text = $this->mpdf->purify_utf8_text($text);
|
393 |
+
if ($this->mpdf->text_input_as_HTML) {
|
394 |
+
$text = $this->mpdf->all_entities_to_utf8($text);
|
395 |
+
}
|
396 |
+
if ($this->mpdf->usingCoreFont) {
|
397 |
+
$text = mb_convert_encoding($text, $this->mpdf->mb_enc, 'UTF-8');
|
398 |
+
}
|
399 |
+
|
400 |
+
|
401 |
+
// DIRECTIONALITY
|
402 |
+
if (preg_match("/([" . $this->mpdf->pregRTLchars . "])/u", $text)) {
|
403 |
+
$this->mpdf->biDirectional = true;
|
404 |
+
} // *RTL*
|
405 |
+
|
406 |
+
$textvar = 0;
|
407 |
+
$save_OTLtags = $this->mpdf->OTLtags;
|
408 |
+
$this->mpdf->OTLtags = array();
|
409 |
+
if ($this->mpdf->useKerning) {
|
410 |
+
if ($this->mpdf->CurrentFont['haskernGPOS']) {
|
411 |
+
$this->mpdf->OTLtags['Plus'] .= ' kern';
|
412 |
+
} else {
|
413 |
+
$textvar = ($textvar | FC_KERNING);
|
414 |
+
}
|
415 |
+
}
|
416 |
+
// Use OTL OpenType Table Layout - GSUB & GPOS
|
417 |
+
if (isset($this->mpdf->CurrentFont['useOTL']) && $this->mpdf->CurrentFont['useOTL']) {
|
418 |
+
$text = $this->mpdf->otl->applyOTL($text, $this->mpdf->CurrentFont['useOTL']);
|
419 |
+
$OTLdata = $this->mpdf->otl->OTLdata;
|
420 |
+
}
|
421 |
+
$this->mpdf->OTLtags = $save_OTLtags;
|
422 |
+
|
423 |
+
$this->mpdf->magic_reverse_dir($text, $this->mpdf->directionality, $OTLdata);
|
424 |
+
|
425 |
+
if (!$width) {
|
426 |
+
$width = $this->mpdf->pgwidth;
|
427 |
+
} else {
|
428 |
+
$width = $this->mpdf->ConvertSize($width, $this->mpdf->pgwidth);
|
429 |
+
}
|
430 |
+
$midpt = $this->mpdf->lMargin + ($this->mpdf->pgwidth / 2);
|
431 |
+
$r1 = $midpt - ($width / 2); //($this->mpdf->w / 2) - 40;
|
432 |
+
$r2 = $r1 + $width; //$r1 + 80;
|
433 |
+
$y1 = $this->mpdf->y;
|
434 |
+
|
435 |
+
|
436 |
+
$mid = ($r1 + $r2 ) / 2;
|
437 |
+
$loop = 0;
|
438 |
+
|
439 |
+
while ($loop == 0) {
|
440 |
+
$this->mpdf->SetFont($font, $fontstyle, $szfont, false);
|
441 |
+
$sz = $this->mpdf->GetStringWidth($text, true, $OTLdata, $textvar);
|
442 |
+
if (($r1 + $sz) > $r2)
|
443 |
+
$szfont --;
|
444 |
+
else
|
445 |
+
$loop ++;
|
446 |
+
}
|
447 |
+
$this->mpdf->SetFont($font, $fontstyle, $szfont, true, true);
|
448 |
+
|
449 |
+
$y2 = $this->mpdf->FontSize + ($pad * 2);
|
450 |
+
|
451 |
+
$this->mpdf->SetLineWidth(0.1);
|
452 |
+
$fc = $this->mpdf->ConvertColor($fill);
|
453 |
+
$tc = $this->mpdf->ConvertColor($color);
|
454 |
+
$this->mpdf->SetFColor($fc);
|
455 |
+
$this->mpdf->SetTColor($tc);
|
456 |
+
$this->mpdf->RoundedRect($r1, $y1, ($r2 - $r1), $y2, $radius, $style);
|
457 |
+
$this->mpdf->SetX($r1);
|
458 |
+
$this->mpdf->Cell($r2 - $r1, $y2, $text, 0, 1, "C", 0, '', 0, 0, 0, 'M', 0, false, $OTLdata, $textvar);
|
459 |
+
$this->mpdf->SetY($y1 + $y2 + 2); // +2 = mm margin below shaded box
|
460 |
+
$this->mpdf->Reset();
|
461 |
+
}
|
462 |
+
|
463 |
+
}
|
lib/mpdf/classes/gif.php
CHANGED
@@ -1,700 +1,677 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
//
|
7 |
-
//
|
8 |
-
//
|
9 |
-
//
|
10 |
-
|
11 |
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
12 |
-
|
13 |
-
//
|
14 |
-
//
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
var $MAX_LZW_BITS;
|
23 |
-
|
24 |
-
var $
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
$this->
|
32 |
-
unSet($this->
|
33 |
-
unSet($this->
|
34 |
-
unSet($this->
|
35 |
-
|
36 |
-
|
37 |
-
$this->
|
38 |
-
$this->
|
39 |
-
$this->
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
$
|
48 |
-
|
49 |
-
$
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
$this->
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
$this->
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
}
|
140 |
-
|
141 |
-
$
|
142 |
-
|
143 |
-
|
144 |
-
$Code
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
}
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
$this->Done
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
$
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
var $
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
$
|
349 |
-
|
350 |
-
$this->
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
var $
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
$
|
424 |
-
|
425 |
-
$this->
|
426 |
-
$
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
var $
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
$
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
$
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
$this->
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
{
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
function
|
651 |
-
{
|
652 |
-
$
|
653 |
-
|
654 |
-
|
655 |
-
$this->
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
$this->
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
return false;
|
679 |
-
}
|
680 |
-
|
681 |
-
$this->m_lpData = substr($this->m_lpData, $len);
|
682 |
-
|
683 |
-
do {
|
684 |
-
$imgLen = 0;
|
685 |
-
if(!$this->m_img->load($this->m_lpData, $imgLen)) {
|
686 |
-
return false;
|
687 |
-
}
|
688 |
-
$this->m_lpData = substr($this->m_lpData, $imgLen);
|
689 |
-
}
|
690 |
-
while($iIndex-- > 0);
|
691 |
-
|
692 |
-
$this->m_bLoaded = true;
|
693 |
-
return true;
|
694 |
-
}
|
695 |
-
|
696 |
-
}
|
697 |
-
|
698 |
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
699 |
-
|
700 |
-
?>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
4 |
+
// 2009-12-22 Adapted for mPDF 4.2
|
5 |
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
6 |
+
// GIF Util - (C) 2003 Yamasoft (S/C)
|
7 |
+
// http://www.yamasoft.com
|
8 |
+
// All Rights Reserved
|
9 |
+
// This file can be freely copied, distributed, modified, updated by anyone under the only
|
10 |
+
// condition to leave the original address (Yamasoft, http://www.yamasoft.com) and this header.
|
11 |
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
12 |
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
13 |
+
// 2009-12-22 Adapted INB
|
14 |
+
// Functions calling functionname($x, $len = 0) were not working on PHP5.1.5 as pass by reference
|
15 |
+
// All edited to $len = 0; then call function.
|
16 |
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
17 |
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
18 |
+
|
19 |
+
class CGIFLZW
|
20 |
+
{
|
21 |
+
|
22 |
+
var $MAX_LZW_BITS;
|
23 |
+
|
24 |
+
var $Fresh, $CodeSize, $SetCodeSize, $MaxCode, $MaxCodeSize, $FirstCode, $OldCode;
|
25 |
+
|
26 |
+
var $ClearCode, $EndCode, $Next, $Vals, $Stack, $sp, $Buf, $CurBit, $LastBit, $Done, $LastByte;
|
27 |
+
|
28 |
+
public function __construct()
|
29 |
+
{
|
30 |
+
$this->MAX_LZW_BITS = 12;
|
31 |
+
unSet($this->Next);
|
32 |
+
unSet($this->Vals);
|
33 |
+
unSet($this->Stack);
|
34 |
+
unSet($this->Buf);
|
35 |
+
|
36 |
+
$this->Next = range(0, (1 << $this->MAX_LZW_BITS) - 1);
|
37 |
+
$this->Vals = range(0, (1 << $this->MAX_LZW_BITS) - 1);
|
38 |
+
$this->Stack = range(0, (1 << ($this->MAX_LZW_BITS + 1)) - 1);
|
39 |
+
$this->Buf = range(0, 279);
|
40 |
+
}
|
41 |
+
|
42 |
+
function deCompress($data, &$datLen)
|
43 |
+
{
|
44 |
+
$stLen = strlen($data);
|
45 |
+
$datLen = 0;
|
46 |
+
$ret = "";
|
47 |
+
$dp = 0; // data pointer
|
48 |
+
// INITIALIZATION
|
49 |
+
$this->LZWCommandInit($data, $dp);
|
50 |
+
|
51 |
+
while (($iIndex = $this->LZWCommand($data, $dp)) >= 0) {
|
52 |
+
$ret .= chr($iIndex);
|
53 |
+
}
|
54 |
+
|
55 |
+
$datLen = $dp;
|
56 |
+
|
57 |
+
if ($iIndex != -2) {
|
58 |
+
return false;
|
59 |
+
}
|
60 |
+
|
61 |
+
return $ret;
|
62 |
+
}
|
63 |
+
|
64 |
+
function LZWCommandInit(&$data, &$dp)
|
65 |
+
{
|
66 |
+
$this->SetCodeSize = ord($data[0]);
|
67 |
+
$dp += 1;
|
68 |
+
|
69 |
+
$this->CodeSize = $this->SetCodeSize + 1;
|
70 |
+
$this->ClearCode = 1 << $this->SetCodeSize;
|
71 |
+
$this->EndCode = $this->ClearCode + 1;
|
72 |
+
$this->MaxCode = $this->ClearCode + 2;
|
73 |
+
$this->MaxCodeSize = $this->ClearCode << 1;
|
74 |
+
|
75 |
+
$this->GetCodeInit($data, $dp);
|
76 |
+
|
77 |
+
$this->Fresh = 1;
|
78 |
+
for ($i = 0; $i < $this->ClearCode; $i++) {
|
79 |
+
$this->Next[$i] = 0;
|
80 |
+
$this->Vals[$i] = $i;
|
81 |
+
}
|
82 |
+
|
83 |
+
for (; $i < (1 << $this->MAX_LZW_BITS); $i++) {
|
84 |
+
$this->Next[$i] = 0;
|
85 |
+
$this->Vals[$i] = 0;
|
86 |
+
}
|
87 |
+
|
88 |
+
$this->sp = 0;
|
89 |
+
return 1;
|
90 |
+
}
|
91 |
+
|
92 |
+
function LZWCommand(&$data, &$dp)
|
93 |
+
{
|
94 |
+
if ($this->Fresh) {
|
95 |
+
$this->Fresh = 0;
|
96 |
+
do {
|
97 |
+
$this->FirstCode = $this->GetCode($data, $dp);
|
98 |
+
$this->OldCode = $this->FirstCode;
|
99 |
+
} while ($this->FirstCode == $this->ClearCode);
|
100 |
+
|
101 |
+
return $this->FirstCode;
|
102 |
+
}
|
103 |
+
|
104 |
+
if ($this->sp > 0) {
|
105 |
+
$this->sp--;
|
106 |
+
return $this->Stack[$this->sp];
|
107 |
+
}
|
108 |
+
|
109 |
+
while (($Code = $this->GetCode($data, $dp)) >= 0) {
|
110 |
+
if ($Code == $this->ClearCode) {
|
111 |
+
for ($i = 0; $i < $this->ClearCode; $i++) {
|
112 |
+
$this->Next[$i] = 0;
|
113 |
+
$this->Vals[$i] = $i;
|
114 |
+
}
|
115 |
+
|
116 |
+
for (; $i < (1 << $this->MAX_LZW_BITS); $i++) {
|
117 |
+
$this->Next[$i] = 0;
|
118 |
+
$this->Vals[$i] = 0;
|
119 |
+
}
|
120 |
+
|
121 |
+
$this->CodeSize = $this->SetCodeSize + 1;
|
122 |
+
$this->MaxCodeSize = $this->ClearCode << 1;
|
123 |
+
$this->MaxCode = $this->ClearCode + 2;
|
124 |
+
$this->sp = 0;
|
125 |
+
$this->FirstCode = $this->GetCode($data, $dp);
|
126 |
+
$this->OldCode = $this->FirstCode;
|
127 |
+
|
128 |
+
return $this->FirstCode;
|
129 |
+
}
|
130 |
+
|
131 |
+
if ($Code == $this->EndCode) {
|
132 |
+
return -2;
|
133 |
+
}
|
134 |
+
|
135 |
+
$InCode = $Code;
|
136 |
+
if ($Code >= $this->MaxCode) {
|
137 |
+
$this->Stack[$this->sp++] = $this->FirstCode;
|
138 |
+
$Code = $this->OldCode;
|
139 |
+
}
|
140 |
+
|
141 |
+
while ($Code >= $this->ClearCode) {
|
142 |
+
$this->Stack[$this->sp++] = $this->Vals[$Code];
|
143 |
+
|
144 |
+
if ($Code == $this->Next[$Code]) // Circular table entry, big GIF Error!
|
145 |
+
return -1;
|
146 |
+
|
147 |
+
$Code = $this->Next[$Code];
|
148 |
+
}
|
149 |
+
|
150 |
+
$this->FirstCode = $this->Vals[$Code];
|
151 |
+
$this->Stack[$this->sp++] = $this->FirstCode;
|
152 |
+
|
153 |
+
if (($Code = $this->MaxCode) < (1 << $this->MAX_LZW_BITS)) {
|
154 |
+
$this->Next[$Code] = $this->OldCode;
|
155 |
+
$this->Vals[$Code] = $this->FirstCode;
|
156 |
+
$this->MaxCode++;
|
157 |
+
|
158 |
+
if (($this->MaxCode >= $this->MaxCodeSize) && ($this->MaxCodeSize < (1 << $this->MAX_LZW_BITS))) {
|
159 |
+
$this->MaxCodeSize *= 2;
|
160 |
+
$this->CodeSize++;
|
161 |
+
}
|
162 |
+
}
|
163 |
+
|
164 |
+
$this->OldCode = $InCode;
|
165 |
+
if ($this->sp > 0) {
|
166 |
+
$this->sp--;
|
167 |
+
return $this->Stack[$this->sp];
|
168 |
+
}
|
169 |
+
}
|
170 |
+
|
171 |
+
return $Code;
|
172 |
+
}
|
173 |
+
|
174 |
+
function GetCodeInit(&$data, &$dp)
|
175 |
+
{
|
176 |
+
$this->CurBit = 0;
|
177 |
+
$this->LastBit = 0;
|
178 |
+
$this->Done = 0;
|
179 |
+
$this->LastByte = 2;
|
180 |
+
return 1;
|
181 |
+
}
|
182 |
+
|
183 |
+
function GetCode(&$data, &$dp)
|
184 |
+
{
|
185 |
+
if (($this->CurBit + $this->CodeSize) >= $this->LastBit) {
|
186 |
+
if ($this->Done) {
|
187 |
+
if ($this->CurBit >= $this->LastBit) {
|
188 |
+
// Ran off the end of my bits
|
189 |
+
return 0;
|
190 |
+
}
|
191 |
+
return -1;
|
192 |
+
}
|
193 |
+
|
194 |
+
$this->Buf[0] = $this->Buf[$this->LastByte - 2];
|
195 |
+
$this->Buf[1] = $this->Buf[$this->LastByte - 1];
|
196 |
+
|
197 |
+
$Count = ord($data[$dp]);
|
198 |
+
$dp += 1;
|
199 |
+
|
200 |
+
if ($Count) {
|
201 |
+
for ($i = 0; $i < $Count; $i++) {
|
202 |
+
$this->Buf[2 + $i] = ord($data[$dp + $i]);
|
203 |
+
}
|
204 |
+
$dp += $Count;
|
205 |
+
} else {
|
206 |
+
$this->Done = 1;
|
207 |
+
}
|
208 |
+
|
209 |
+
$this->LastByte = 2 + $Count;
|
210 |
+
$this->CurBit = ($this->CurBit - $this->LastBit) + 16;
|
211 |
+
$this->LastBit = (2 + $Count) << 3;
|
212 |
+
}
|
213 |
+
|
214 |
+
$iRet = 0;
|
215 |
+
for ($i = $this->CurBit, $j = 0; $j < $this->CodeSize; $i++, $j++) {
|
216 |
+
$iRet |= (($this->Buf[intval($i / 8)] & (1 << ($i % 8))) != 0) << $j;
|
217 |
+
}
|
218 |
+
|
219 |
+
$this->CurBit += $this->CodeSize;
|
220 |
+
return $iRet;
|
221 |
+
}
|
222 |
+
|
223 |
+
}
|
224 |
+
|
225 |
+
class CGIFCOLORTABLE
|
226 |
+
{
|
227 |
+
|
228 |
+
var $m_nColors;
|
229 |
+
|
230 |
+
var $m_arColors;
|
231 |
+
|
232 |
+
public function __construct()
|
233 |
+
{
|
234 |
+
unSet($this->m_nColors);
|
235 |
+
unSet($this->m_arColors);
|
236 |
+
}
|
237 |
+
|
238 |
+
function load($lpData, $num)
|
239 |
+
{
|
240 |
+
$this->m_nColors = 0;
|
241 |
+
$this->m_arColors = array();
|
242 |
+
|
243 |
+
for ($i = 0; $i < $num; $i++) {
|
244 |
+
$rgb = substr($lpData, $i * 3, 3);
|
245 |
+
if (strlen($rgb) < 3) {
|
246 |
+
return false;
|
247 |
+
}
|
248 |
+
|
249 |
+
$this->m_arColors[] = (ord($rgb[2]) << 16) + (ord($rgb[1]) << 8) + ord($rgb[0]);
|
250 |
+
$this->m_nColors++;
|
251 |
+
}
|
252 |
+
|
253 |
+
return true;
|
254 |
+
}
|
255 |
+
|
256 |
+
function toString()
|
257 |
+
{
|
258 |
+
$ret = "";
|
259 |
+
|
260 |
+
for ($i = 0; $i < $this->m_nColors; $i++) {
|
261 |
+
$ret .=
|
262 |
+
chr(($this->m_arColors[$i] & 0x000000FF)) . // R
|
263 |
+
chr(($this->m_arColors[$i] & 0x0000FF00) >> 8) . // G
|
264 |
+
chr(($this->m_arColors[$i] & 0x00FF0000) >> 16); // B
|
265 |
+
}
|
266 |
+
|
267 |
+
return $ret;
|
268 |
+
}
|
269 |
+
|
270 |
+
function colorIndex($rgb)
|
271 |
+
{
|
272 |
+
$rgb = intval($rgb) & 0xFFFFFF;
|
273 |
+
$r1 = ($rgb & 0x0000FF);
|
274 |
+
$g1 = ($rgb & 0x00FF00) >> 8;
|
275 |
+
$b1 = ($rgb & 0xFF0000) >> 16;
|
276 |
+
$idx = -1;
|
277 |
+
|
278 |
+
for ($i = 0; $i < $this->m_nColors; $i++) {
|
279 |
+
$r2 = ($this->m_arColors[$i] & 0x000000FF);
|
280 |
+
$g2 = ($this->m_arColors[$i] & 0x0000FF00) >> 8;
|
281 |
+
$b2 = ($this->m_arColors[$i] & 0x00FF0000) >> 16;
|
282 |
+
$d = abs($r2 - $r1) + abs($g2 - $g1) + abs($b2 - $b1);
|
283 |
+
|
284 |
+
if (($idx == -1) || ($d < $dif)) {
|
285 |
+
$idx = $i;
|
286 |
+
$dif = $d;
|
287 |
+
}
|
288 |
+
}
|
289 |
+
|
290 |
+
return $idx;
|
291 |
+
}
|
292 |
+
|
293 |
+
}
|
294 |
+
|
295 |
+
class CGIFFILEHEADER
|
296 |
+
{
|
297 |
+
|
298 |
+
var $m_lpVer;
|
299 |
+
|
300 |
+
var $m_nWidth;
|
301 |
+
|
302 |
+
var $m_nHeight;
|
303 |
+
|
304 |
+
var $m_bGlobalClr;
|
305 |
+
|
306 |
+
var $m_nColorRes;
|
307 |
+
|
308 |
+
var $m_bSorted;
|
309 |
+
|
310 |
+
var $m_nTableSize;
|
311 |
+
|
312 |
+
var $m_nBgColor;
|
313 |
+
|
314 |
+
var $m_nPixelRatio;
|
315 |
+
|
316 |
+
var $m_colorTable;
|
317 |
+
|
318 |
+
public function __construct()
|
319 |
+
{
|
320 |
+
unSet($this->m_lpVer);
|
321 |
+
unSet($this->m_nWidth);
|
322 |
+
unSet($this->m_nHeight);
|
323 |
+
unSet($this->m_bGlobalClr);
|
324 |
+
unSet($this->m_nColorRes);
|
325 |
+
unSet($this->m_bSorted);
|
326 |
+
unSet($this->m_nTableSize);
|
327 |
+
unSet($this->m_nBgColor);
|
328 |
+
unSet($this->m_nPixelRatio);
|
329 |
+
unSet($this->m_colorTable);
|
330 |
+
}
|
331 |
+
|
332 |
+
function load($lpData, &$hdrLen)
|
333 |
+
{
|
334 |
+
$hdrLen = 0;
|
335 |
+
|
336 |
+
$this->m_lpVer = substr($lpData, 0, 6);
|
337 |
+
if (($this->m_lpVer <> "GIF87a") && ($this->m_lpVer <> "GIF89a")) {
|
338 |
+
return false;
|
339 |
+
}
|
340 |
+
|
341 |
+
$this->m_nWidth = $this->w2i(substr($lpData, 6, 2));
|
342 |
+
$this->m_nHeight = $this->w2i(substr($lpData, 8, 2));
|
343 |
+
if (!$this->m_nWidth || !$this->m_nHeight) {
|
344 |
+
return false;
|
345 |
+
}
|
346 |
+
|
347 |
+
$b = ord(substr($lpData, 10, 1));
|
348 |
+
$this->m_bGlobalClr = ($b & 0x80) ? true : false;
|
349 |
+
$this->m_nColorRes = ($b & 0x70) >> 4;
|
350 |
+
$this->m_bSorted = ($b & 0x08) ? true : false;
|
351 |
+
$this->m_nTableSize = 2 << ($b & 0x07);
|
352 |
+
$this->m_nBgColor = ord(substr($lpData, 11, 1));
|
353 |
+
$this->m_nPixelRatio = ord(substr($lpData, 12, 1));
|
354 |
+
$hdrLen = 13;
|
355 |
+
|
356 |
+
if ($this->m_bGlobalClr) {
|
357 |
+
$this->m_colorTable = new CGIFCOLORTABLE();
|
358 |
+
if (!$this->m_colorTable->load(substr($lpData, $hdrLen), $this->m_nTableSize)) {
|
359 |
+
return false;
|
360 |
+
}
|
361 |
+
$hdrLen += 3 * $this->m_nTableSize;
|
362 |
+
}
|
363 |
+
|
364 |
+
return true;
|
365 |
+
}
|
366 |
+
|
367 |
+
function w2i($str)
|
368 |
+
{
|
369 |
+
return ord(substr($str, 0, 1)) + (ord(substr($str, 1, 1)) << 8);
|
370 |
+
}
|
371 |
+
|
372 |
+
}
|
373 |
+
|
374 |
+
class CGIFIMAGEHEADER
|
375 |
+
{
|
376 |
+
|
377 |
+
var $m_nLeft;
|
378 |
+
|
379 |
+
var $m_nTop;
|
380 |
+
|
381 |
+
var $m_nWidth;
|
382 |
+
|
383 |
+
var $m_nHeight;
|
384 |
+
|
385 |
+
var $m_bLocalClr;
|
386 |
+
|
387 |
+
var $m_bInterlace;
|
388 |
+
|
389 |
+
var $m_bSorted;
|
390 |
+
|
391 |
+
var $m_nTableSize;
|
392 |
+
|
393 |
+
var $m_colorTable;
|
394 |
+
|
395 |
+
public function __construct()
|
396 |
+
{
|
397 |
+
unSet($this->m_nLeft);
|
398 |
+
unSet($this->m_nTop);
|
399 |
+
unSet($this->m_nWidth);
|
400 |
+
unSet($this->m_nHeight);
|
401 |
+
unSet($this->m_bLocalClr);
|
402 |
+
unSet($this->m_bInterlace);
|
403 |
+
unSet($this->m_bSorted);
|
404 |
+
unSet($this->m_nTableSize);
|
405 |
+
unSet($this->m_colorTable);
|
406 |
+
}
|
407 |
+
|
408 |
+
function load($lpData, &$hdrLen)
|
409 |
+
{
|
410 |
+
$hdrLen = 0;
|
411 |
+
|
412 |
+
$this->m_nLeft = $this->w2i(substr($lpData, 0, 2));
|
413 |
+
$this->m_nTop = $this->w2i(substr($lpData, 2, 2));
|
414 |
+
$this->m_nWidth = $this->w2i(substr($lpData, 4, 2));
|
415 |
+
$this->m_nHeight = $this->w2i(substr($lpData, 6, 2));
|
416 |
+
|
417 |
+
if (!$this->m_nWidth || !$this->m_nHeight) {
|
418 |
+
return false;
|
419 |
+
}
|
420 |
+
|
421 |
+
$b = ord($lpData{8});
|
422 |
+
$this->m_bLocalClr = ($b & 0x80) ? true : false;
|
423 |
+
$this->m_bInterlace = ($b & 0x40) ? true : false;
|
424 |
+
$this->m_bSorted = ($b & 0x20) ? true : false;
|
425 |
+
$this->m_nTableSize = 2 << ($b & 0x07);
|
426 |
+
$hdrLen = 9;
|
427 |
+
|
428 |
+
if ($this->m_bLocalClr) {
|
429 |
+
$this->m_colorTable = new CGIFCOLORTABLE();
|
430 |
+
if (!$this->m_colorTable->load(substr($lpData, $hdrLen), $this->m_nTableSize)) {
|
431 |
+
return false;
|
432 |
+
}
|
433 |
+
$hdrLen += 3 * $this->m_nTableSize;
|
434 |
+
}
|
435 |
+
|
436 |
+
return true;
|
437 |
+
}
|
438 |
+
|
439 |
+
function w2i($str)
|
440 |
+
{
|
441 |
+
return ord(substr($str, 0, 1)) + (ord(substr($str, 1, 1)) << 8);
|
442 |
+
}
|
443 |
+
|
444 |
+
}
|
445 |
+
|
446 |
+
class CGIFIMAGE
|
447 |
+
{
|
448 |
+
|
449 |
+
var $m_disp;
|
450 |
+
|
451 |
+
var $m_bUser;
|
452 |
+
|
453 |
+
var $m_bTrans;
|
454 |
+
|
455 |
+
var $m_nDelay;
|
456 |
+
|
457 |
+
var $m_nTrans;
|
458 |
+
|
459 |
+
var $m_lpComm;
|
460 |
+
|
461 |
+
var $m_gih;
|
462 |
+
|
463 |
+
var $m_data;
|
464 |
+
|
465 |
+
var $m_lzw;
|
466 |
+
|
467 |
+
public function __construct()
|
468 |
+
{
|
469 |
+
unSet($this->m_disp);
|
470 |
+
unSet($this->m_bUser);
|
471 |
+
unSet($this->m_bTrans);
|
472 |
+
unSet($this->m_nDelay);
|
473 |
+
unSet($this->m_nTrans);
|
474 |
+
unSet($this->m_lpComm);
|
475 |
+
unSet($this->m_data);
|
476 |
+
$this->m_gih = new CGIFIMAGEHEADER();
|
477 |
+
$this->m_lzw = new CGIFLZW();
|
478 |
+
}
|
479 |
+
|
480 |
+
function load($data, &$datLen)
|
481 |
+
{
|
482 |
+
$datLen = 0;
|
483 |
+
|
484 |
+
while (true) {
|
485 |
+
$b = ord($data[0]);
|
486 |
+
$data = substr($data, 1);
|
487 |
+
$datLen++;
|
488 |
+
|
489 |
+
switch ($b) {
|
490 |
+
case 0x21: // Extension
|
491 |
+
$len = 0;
|
492 |
+
if (!$this->skipExt($data, $len)) {
|
493 |
+
return false;
|
494 |
+
}
|
495 |
+
$datLen += $len;
|
496 |
+
break;
|
497 |
+
|
498 |
+
case 0x2C: // Image
|
499 |
+
// LOAD HEADER & COLOR TABLE
|
500 |
+
$len = 0;
|
501 |
+
if (!$this->m_gih->load($data, $len)) {
|
502 |
+
return false;
|
503 |
+
}
|
504 |
+
$data = substr($data, $len);
|
505 |
+
$datLen += $len;
|
506 |
+
|
507 |
+
// ALLOC BUFFER
|
508 |
+
$len = 0;
|
509 |
+
|
510 |
+
if (!($this->m_data = $this->m_lzw->deCompress($data, $len))) {
|
511 |
+
return false;
|
512 |
+
}
|
513 |
+
|
514 |
+
$data = substr($data, $len);
|
515 |
+
$datLen += $len;
|
516 |
+
|
517 |
+
if ($this->m_gih->m_bInterlace) {
|
518 |
+
$this->deInterlace();
|
519 |
+
}
|
520 |
+
|
521 |
+
return true;
|
522 |
+
|
523 |
+
case 0x3B: // EOF
|
524 |
+
default:
|
525 |
+
return false;
|
526 |
+
}
|
527 |
+
}
|
528 |
+
return false;
|
529 |
+
}
|
530 |
+
|
531 |
+
function skipExt(&$data, &$extLen)
|
532 |
+
{
|
533 |
+
$extLen = 0;
|
534 |
+
|
535 |
+
$b = ord($data[0]);
|
536 |
+
$data = substr($data, 1);
|
537 |
+
$extLen++;
|
538 |
+
|
539 |
+
switch ($b) {
|
540 |
+
case 0xF9: // Graphic Control
|
541 |
+
$b = ord($data[1]);
|
542 |
+
$this->m_disp = ($b & 0x1C) >> 2;
|
543 |
+
$this->m_bUser = ($b & 0x02) ? true : false;
|
544 |
+
$this->m_bTrans = ($b & 0x01) ? true : false;
|
545 |
+
$this->m_nDelay = $this->w2i(substr($data, 2, 2));
|
546 |
+
$this->m_nTrans = ord($data[4]);
|
547 |
+
break;
|
548 |
+
|
549 |
+
case 0xFE: // Comment
|
550 |
+
$this->m_lpComm = substr($data, 1, ord($data[0]));
|
551 |
+
break;
|
552 |
+
|
553 |
+
case 0x01: // Plain text
|
554 |
+
break;
|
555 |
+
|
556 |
+
case 0xFF: // Application
|
557 |
+
break;
|
558 |
+
}
|
559 |
+
|
560 |
+
// SKIP DEFAULT AS DEFS MAY CHANGE
|
561 |
+
$b = ord($data[0]);
|
562 |
+
$data = substr($data, 1);
|
563 |
+
$extLen++;
|
564 |
+
while ($b > 0) {
|
565 |
+
$data = substr($data, $b);
|
566 |
+
$extLen += $b;
|
567 |
+
$b = ord($data[0]);
|
568 |
+
$data = substr($data, 1);
|
569 |
+
$extLen++;
|
570 |
+
}
|
571 |
+
return true;
|
572 |
+
}
|
573 |
+
|
574 |
+
function w2i($str)
|
575 |
+
{
|
576 |
+
return ord(substr($str, 0, 1)) + (ord(substr($str, 1, 1)) << 8);
|
577 |
+
}
|
578 |
+
|
579 |
+
function deInterlace()
|
580 |
+
{
|
581 |
+
$data = $this->m_data;
|
582 |
+
|
583 |
+
for ($i = 0; $i < 4; $i++) {
|
584 |
+
switch ($i) {
|
585 |
+
case 0:
|
586 |
+
$s = 8;
|
587 |
+
$y = 0;
|
588 |
+
break;
|
589 |
+
|
590 |
+
case 1:
|
591 |
+
$s = 8;
|
592 |
+
$y = 4;
|
593 |
+
break;
|
594 |
+
|
595 |
+
case 2:
|
596 |
+
$s = 4;
|
597 |
+
$y = 2;
|
598 |
+
break;
|
599 |
+
|
600 |
+
case 3:
|
601 |
+
$s = 2;
|
602 |
+
$y = 1;
|
603 |
+
break;
|
604 |
+
}
|
605 |
+
|
606 |
+
for (; $y < $this->m_gih->m_nHeight; $y += $s) {
|
607 |
+
$lne = substr($this->m_data, 0, $this->m_gih->m_nWidth);
|
608 |
+
$this->m_data = substr($this->m_data, $this->m_gih->m_nWidth);
|
609 |
+
|
610 |
+
$data = substr($data, 0, $y * $this->m_gih->m_nWidth) .
|
611 |
+
$lne .
|
612 |
+
substr($data, ($y + 1) * $this->m_gih->m_nWidth);
|
613 |
+
}
|
614 |
+
}
|
615 |
+
|
616 |
+
$this->m_data = $data;
|
617 |
+
}
|
618 |
+
|
619 |
+
}
|
620 |
+
|
621 |
+
class CGIF
|
622 |
+
{
|
623 |
+
|
624 |
+
var $m_gfh;
|
625 |
+
|
626 |
+
var $m_lpData;
|
627 |
+
|
628 |
+
var $m_img;
|
629 |
+
|
630 |
+
var $m_bLoaded;
|
631 |
+
|
632 |
+
public function __construct()
|
633 |
+
{
|
634 |
+
$this->m_gfh = new CGIFFILEHEADER();
|
635 |
+
$this->m_img = new CGIFIMAGE();
|
636 |
+
$this->m_lpData = "";
|
637 |
+
$this->m_bLoaded = false;
|
638 |
+
}
|
639 |
+
|
640 |
+
function ClearData()
|
641 |
+
{
|
642 |
+
$this->m_lpData = '';
|
643 |
+
unSet($this->m_img->m_data);
|
644 |
+
unSet($this->m_img->m_lzw->Next);
|
645 |
+
unSet($this->m_img->m_lzw->Vals);
|
646 |
+
unSet($this->m_img->m_lzw->Stack);
|
647 |
+
unSet($this->m_img->m_lzw->Buf);
|
648 |
+
}
|
649 |
+
|
650 |
+
function loadFile(&$data, $iIndex)
|
651 |
+
{
|
652 |
+
if ($iIndex < 0) {
|
653 |
+
return false;
|
654 |
+
}
|
655 |
+
$this->m_lpData = $data;
|
656 |
+
|
657 |
+
// GET FILE HEADER
|
658 |
+
$len = 0;
|
659 |
+
if (!$this->m_gfh->load($this->m_lpData, $len)) {
|
660 |
+
return false;
|
661 |
+
}
|
662 |
+
|
663 |
+
$this->m_lpData = substr($this->m_lpData, $len);
|
664 |
+
|
665 |
+
do {
|
666 |
+
$imgLen = 0;
|
667 |
+
if (!$this->m_img->load($this->m_lpData, $imgLen)) {
|
668 |
+
return false;
|
669 |
+
}
|
670 |
+
$this->m_lpData = substr($this->m_lpData, $imgLen);
|
671 |
+
} while ($iIndex-- > 0);
|
672 |
+
|
673 |
+
$this->m_bLoaded = true;
|
674 |
+
return true;
|
675 |
+
}
|
676 |
+
|
677 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/mpdf/classes/grad.php
CHANGED
@@ -1,724 +1,975 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class grad
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
$
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
$
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
if (
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
if (
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
$this->mpdf->gradients[$n]['stream_trans'].=chr(
|
76 |
-
}
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
$
|
109 |
-
$
|
110 |
-
$
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
if ($
|
119 |
-
|
120 |
-
|
121 |
-
$
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
$
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
$
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
else
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
if ($angle
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
$
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
$
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
$
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
$
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
$
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
$
|
578 |
-
|
579 |
-
|
580 |
-
$
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
//
|
591 |
-
if (preg_match('/
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
if (preg_match('/(\
|
597 |
-
|
598 |
-
$
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
$
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
$
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
}
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
$
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
}
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
}
|
723 |
-
|
724 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class grad
|
4 |
+
{
|
5 |
+
|
6 |
+
var $mpdf = null;
|
7 |
+
|
8 |
+
public function __construct(mPDF $mpdf)
|
9 |
+
{
|
10 |
+
$this->mpdf = $mpdf;
|
11 |
+
}
|
12 |
+
|
13 |
+
// mPDF 5.3.A1
|
14 |
+
function CoonsPatchMesh($x, $y, $w, $h, $patch_array = array(), $x_min = 0, $x_max = 1, $y_min = 0, $y_max = 1, $colspace = 'RGB', $return = false)
|
15 |
+
{
|
16 |
+
$s = ' q ';
|
17 |
+
$s.=sprintf(' %.3F %.3F %.3F %.3F re W n ', $x * _MPDFK, ($this->mpdf->h - $y) * _MPDFK, $w * _MPDFK, -$h * _MPDFK);
|
18 |
+
$s.=sprintf(' %.3F 0 0 %.3F %.3F %.3F cm ', $w * _MPDFK, $h * _MPDFK, $x * _MPDFK, ($this->mpdf->h - ($y + $h)) * _MPDFK);
|
19 |
+
$n = count($this->mpdf->gradients) + 1;
|
20 |
+
$this->mpdf->gradients[$n]['type'] = 6; //coons patch mesh
|
21 |
+
$this->mpdf->gradients[$n]['colorspace'] = $colspace; //coons patch mesh
|
22 |
+
$bpcd = 65535; //16 BitsPerCoordinate
|
23 |
+
$trans = false;
|
24 |
+
$this->mpdf->gradients[$n]['stream'] = '';
|
25 |
+
for ($i = 0; $i < count($patch_array); $i++) {
|
26 |
+
$this->mpdf->gradients[$n]['stream'].=chr($patch_array[$i]['f']); //start with the edge flag as 8 bit
|
27 |
+
for ($j = 0; $j < count($patch_array[$i]['points']); $j++) {
|
28 |
+
//each point as 16 bit
|
29 |
+
if (($j % 2) == 1) { // Y coordinate (adjusted as input is From top left)
|
30 |
+
$patch_array[$i]['points'][$j] = (($patch_array[$i]['points'][$j] - $y_min) / ($y_max - $y_min)) * $bpcd;
|
31 |
+
$patch_array[$i]['points'][$j] = $bpcd - $patch_array[$i]['points'][$j];
|
32 |
+
} else {
|
33 |
+
$patch_array[$i]['points'][$j] = (($patch_array[$i]['points'][$j] - $x_min) / ($x_max - $x_min)) * $bpcd;
|
34 |
+
}
|
35 |
+
if ($patch_array[$i]['points'][$j] < 0)
|
36 |
+
$patch_array[$i]['points'][$j] = 0;
|
37 |
+
if ($patch_array[$i]['points'][$j] > $bpcd)
|
38 |
+
$patch_array[$i]['points'][$j] = $bpcd;
|
39 |
+
$this->mpdf->gradients[$n]['stream'].=chr(floor($patch_array[$i]['points'][$j] / 256));
|
40 |
+
$this->mpdf->gradients[$n]['stream'].=chr(floor($patch_array[$i]['points'][$j] % 256));
|
41 |
+
}
|
42 |
+
for ($j = 0; $j < count($patch_array[$i]['colors']); $j++) {
|
43 |
+
//each color component as 8 bit
|
44 |
+
if ($colspace == 'RGB') {
|
45 |
+
$this->mpdf->gradients[$n]['stream'].=($patch_array[$i]['colors'][$j][1]);
|
46 |
+
$this->mpdf->gradients[$n]['stream'].=($patch_array[$i]['colors'][$j][2]);
|
47 |
+
$this->mpdf->gradients[$n]['stream'].=($patch_array[$i]['colors'][$j][3]);
|
48 |
+
if (isset($patch_array[$i]['colors'][$j][4]) && ord($patch_array[$i]['colors'][$j][4]) < 100) {
|
49 |
+
$trans = true;
|
50 |
+
}
|
51 |
+
} else if ($colspace == 'CMYK') {
|
52 |
+
$this->mpdf->gradients[$n]['stream'].=chr(ord($patch_array[$i]['colors'][$j][1]) * 2.55);
|
53 |
+
$this->mpdf->gradients[$n]['stream'].=chr(ord($patch_array[$i]['colors'][$j][2]) * 2.55);
|
54 |
+
$this->mpdf->gradients[$n]['stream'].=chr(ord($patch_array[$i]['colors'][$j][3]) * 2.55);
|
55 |
+
$this->mpdf->gradients[$n]['stream'].=chr(ord($patch_array[$i]['colors'][$j][4]) * 2.55);
|
56 |
+
if (isset($patch_array[$i]['colors'][$j][5]) && ord($patch_array[$i]['colors'][$j][5]) < 100) {
|
57 |
+
$trans = true;
|
58 |
+
}
|
59 |
+
} else if ($colspace == 'Gray') {
|
60 |
+
$this->mpdf->gradients[$n]['stream'].=($patch_array[$i]['colors'][$j][1]);
|
61 |
+
if ($patch_array[$i]['colors'][$j][2] == 1) {
|
62 |
+
$trans = true;
|
63 |
+
} // transparency converted from rgba or cmyka()
|
64 |
+
}
|
65 |
+
}
|
66 |
+
}
|
67 |
+
// TRANSPARENCY
|
68 |
+
if ($trans) {
|
69 |
+
$this->mpdf->gradients[$n]['stream_trans'] = '';
|
70 |
+
for ($i = 0; $i < count($patch_array); $i++) {
|
71 |
+
$this->mpdf->gradients[$n]['stream_trans'].=chr($patch_array[$i]['f']);
|
72 |
+
for ($j = 0; $j < count($patch_array[$i]['points']); $j++) {
|
73 |
+
//each point as 16 bit
|
74 |
+
$this->mpdf->gradients[$n]['stream_trans'].=chr(floor($patch_array[$i]['points'][$j] / 256));
|
75 |
+
$this->mpdf->gradients[$n]['stream_trans'].=chr(floor($patch_array[$i]['points'][$j] % 256));
|
76 |
+
}
|
77 |
+
for ($j = 0; $j < count($patch_array[$i]['colors']); $j++) {
|
78 |
+
//each color component as 8 bit // OPACITY
|
79 |
+
if ($colspace == 'RGB') {
|
80 |
+
$this->mpdf->gradients[$n]['stream_trans'].=chr(intval(ord($patch_array[$i]['colors'][$j][4]) * 2.55));
|
81 |
+
} else if ($colspace == 'CMYK') {
|
82 |
+
$this->mpdf->gradients[$n]['stream_trans'].=chr(intval(ord($patch_array[$i]['colors'][$j][5]) * 2.55));
|
83 |
+
} else if ($colspace == 'Gray') {
|
84 |
+
$this->mpdf->gradients[$n]['stream_trans'].=chr(intval(ord($patch_array[$i]['colors'][$j][3]) * 2.55));
|
85 |
+
}
|
86 |
+
}
|
87 |
+
}
|
88 |
+
$this->mpdf->gradients[$n]['trans'] = true;
|
89 |
+
$s .= ' /TGS' . $n . ' gs ';
|
90 |
+
}
|
91 |
+
//paint the gradient
|
92 |
+
$s .= '/Sh' . $n . ' sh' . "\n";
|
93 |
+
//restore previous Graphic State
|
94 |
+
$s .= 'Q' . "\n";
|
95 |
+
if ($return) {
|
96 |
+
return $s;
|
97 |
+
} else {
|
98 |
+
$this->mpdf->_out($s);
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
// type = linear:2; radial: 3;
|
103 |
+
// Linear: $coords - array of the form (x1, y1, x2, y2) which defines the gradient vector (see linear_gradient_coords.jpg).
|
104 |
+
// The default value is from left to right (x1=0, y1=0, x2=1, y2=0).
|
105 |
+
// Radial: $coords - array of the form (fx, fy, cx, cy, r) where (fx, fy) is the starting point of the gradient with color1,
|
106 |
+
// (cx, cy) is the center of the circle with color2, and r is the radius of the circle (see radial_gradient_coords.jpg).
|
107 |
+
// (fx, fy) should be inside the circle, otherwise some areas will not be defined
|
108 |
+
// $col = array(R,G,B/255); or array(G/255); or array(C,M,Y,K/100)
|
109 |
+
// $stops = array('col'=>$col [, 'opacity'=>0-1] [, 'offset'=>0-1])
|
110 |
+
function Gradient($x, $y, $w, $h, $type, $stops = array(), $colorspace = 'RGB', $coords = '', $extend = '', $return = false, $is_mask = false)
|
111 |
+
{
|
112 |
+
if (strtoupper(substr($type, 0, 1)) == 'L') {
|
113 |
+
$type = 2;
|
114 |
+
} // linear
|
115 |
+
else if (strtoupper(substr($type, 0, 1)) == 'R') {
|
116 |
+
$type = 3;
|
117 |
+
} // radial
|
118 |
+
if ($colorspace != 'CMYK' && $colorspace != 'Gray') {
|
119 |
+
$colorspace = 'RGB';
|
120 |
+
}
|
121 |
+
$bboxw = $w;
|
122 |
+
$bboxh = $h;
|
123 |
+
$usex = $x;
|
124 |
+
$usey = $y;
|
125 |
+
$usew = $bboxw;
|
126 |
+
$useh = $bboxh;
|
127 |
+
|
128 |
+
if ($type < 1) {
|
129 |
+
$type = 2;
|
130 |
+
}
|
131 |
+
if ($coords[0] !== false && preg_match('/([0-9.]+(px|em|ex|pc|pt|cm|mm|in))/i', $coords[0], $m)) {
|
132 |
+
$tmp = $this->mpdf->ConvertSize($m[1], $this->mpdf->w, $this->mpdf->FontSize, false);
|
133 |
+
if ($tmp) {
|
134 |
+
$coords[0] = $tmp / $w;
|
135 |
+
}
|
136 |
+
}
|
137 |
+
if ($coords[1] !== false && preg_match('/([0-9.]+(px|em|ex|pc|pt|cm|mm|in))/i', $coords[1], $m)) {
|
138 |
+
$tmp = $this->mpdf->ConvertSize($m[1], $this->mpdf->w, $this->mpdf->FontSize, false);
|
139 |
+
if ($tmp) {
|
140 |
+
$coords[1] = 1 - ($tmp / $h);
|
141 |
+
}
|
142 |
+
}
|
143 |
+
// LINEAR
|
144 |
+
if ($type == 2) {
|
145 |
+
$angle = (isset($coords[4]) ? $coords[4] : false);
|
146 |
+
$repeat = (isset($coords[5]) ? $coords[5] : false);
|
147 |
+
// ALL POINTS SET (default for custom mPDF linear gradient) - no -moz
|
148 |
+
if ($coords[0] !== false && $coords[1] !== false && $coords[2] !== false && $coords[3] !== false) {
|
149 |
+
// do nothing - coords used as they are
|
150 |
+
}
|
151 |
+
|
152 |
+
// If both a <point> and <angle> are defined, the gradient axis starts from the point and runs along the angle. The end point is
|
153 |
+
// defined as before - in this case start points may not be in corners, and axis may not correctly fall in the right quadrant.
|
154 |
+
// NO end points (Angle defined & Start points)
|
155 |
+
else if ($angle !== false && $coords[0] !== false && $coords[1] !== false && $coords[2] === false && $coords[3] === false) {
|
156 |
+
if ($angle == 0 || $angle == 360) {
|
157 |
+
$coords[3] = $coords[1];
|
158 |
+
if ($coords[0] == 1)
|
159 |
+
$coords[2] = 2;
|
160 |
+
else
|
161 |
+
$coords[2] = 1;
|
162 |
+
}
|
163 |
+
else if ($angle == 90) {
|
164 |
+
$coords[2] = $coords[0];
|
165 |
+
$coords[3] = 1;
|
166 |
+
if ($coords[1] == 1)
|
167 |
+
$coords[3] = 2;
|
168 |
+
else
|
169 |
+
$coords[3] = 1;
|
170 |
+
}
|
171 |
+
else if ($angle == 180) {
|
172 |
+
if ($coords[4] == 0)
|
173 |
+
$coords[2] = -1;
|
174 |
+
else
|
175 |
+
$coords[2] = 0;
|
176 |
+
$coords[3] = $coords[1];
|
177 |
+
}
|
178 |
+
else if ($angle == 270) {
|
179 |
+
$coords[2] = $coords[0];
|
180 |
+
if ($coords[1] == 0)
|
181 |
+
$coords[3] = -1;
|
182 |
+
else
|
183 |
+
$coords[3] = 0;
|
184 |
+
}
|
185 |
+
else {
|
186 |
+
$endx = 1;
|
187 |
+
$endy = 1;
|
188 |
+
if ($angle <= 90) {
|
189 |
+
if ($angle <= 45) {
|
190 |
+
$endy = tan(deg2rad($angle));
|
191 |
+
} else {
|
192 |
+
$endx = tan(deg2rad(90 - $angle));
|
193 |
+
}
|
194 |
+
$b = atan2(($endy * $bboxh), ($endx * $bboxw));
|
195 |
+
$ny = 1 - $coords[1] - (tan($b) * (1 - $coords[0]));
|
196 |
+
$tx = sin($b) * cos($b) * $ny;
|
197 |
+
$ty = cos($b) * cos($b) * $ny;
|
198 |
+
$coords[2] = 1 + $tx;
|
199 |
+
$coords[3] = 1 - $ty;
|
200 |
+
} else if ($angle <= 180) {
|
201 |
+
if ($angle <= 135) {
|
202 |
+
$endx = tan(deg2rad($angle - 90));
|
203 |
+
} else {
|
204 |
+
$endy = tan(deg2rad(180 - $angle));
|
205 |
+
}
|
206 |
+
$b = atan2(($endy * $bboxh), ($endx * $bboxw));
|
207 |
+
$ny = 1 - $coords[1] - (tan($b) * ($coords[0]));
|
208 |
+
$tx = sin($b) * cos($b) * $ny;
|
209 |
+
$ty = cos($b) * cos($b) * $ny;
|
210 |
+
$coords[2] = -$tx;
|
211 |
+
$coords[3] = 1 - $ty;
|
212 |
+
} else if ($angle <= 270) {
|
213 |
+
if ($angle <= 225) {
|
214 |
+
$endy = tan(deg2rad($angle - 180));
|
215 |
+
} else {
|
216 |
+
$endx = tan(deg2rad(270 - $angle));
|
217 |
+
}
|
218 |
+
$b = atan2(($endy * $bboxh), ($endx * $bboxw));
|
219 |
+
$ny = $coords[1] - (tan($b) * ($coords[0]));
|
220 |
+
$tx = sin($b) * cos($b) * $ny;
|
221 |
+
$ty = cos($b) * cos($b) * $ny;
|
222 |
+
$coords[2] = -$tx;
|
223 |
+
$coords[3] = $ty;
|
224 |
+
} else {
|
225 |
+
if ($angle <= 315) {
|
226 |
+
$endx = tan(deg2rad($angle - 270));
|
227 |
+
} else {
|
228 |
+
$endy = tan(deg2rad(360 - $angle));
|
229 |
+
}
|
230 |
+
$b = atan2(($endy * $bboxh), ($endx * $bboxw));
|
231 |
+
$ny = $coords[1] - (tan($b) * (1 - $coords[0]));
|
232 |
+
$tx = sin($b) * cos($b) * $ny;
|
233 |
+
$ty = cos($b) * cos($b) * $ny;
|
234 |
+
$coords[2] = 1 + $tx;
|
235 |
+
$coords[3] = $ty;
|
236 |
+
}
|
237 |
+
}
|
238 |
+
}
|
239 |
+
|
240 |
+
// -moz If the first parameter is only an <angle>, the gradient axis starts from the box's corner that would ensure the
|
241 |
+
// axis goes through the box. The axis runs along the specified angle. The end point of the axis is defined such that the
|
242 |
+
// farthest corner of the box from the starting point is perpendicular to the gradient axis at that point.
|
243 |
+
// NO end points or Start points (Angle defined)
|
244 |
+
else if ($angle !== false && $coords[0] === false && $coords[1] === false) {
|
245 |
+
if ($angle == 0 || $angle == 360) {
|
246 |
+
$coords[0] = 0;
|
247 |
+
$coords[1] = 0;
|
248 |
+
$coords[2] = 1;
|
249 |
+
$coords[3] = 0;
|
250 |
+
} else if ($angle == 90) {
|
251 |
+
$coords[0] = 0;
|
252 |
+
$coords[1] = 0;
|
253 |
+
$coords[2] = 0;
|
254 |
+
$coords[3] = 1;
|
255 |
+
} else if ($angle == 180) {
|
256 |
+
$coords[0] = 1;
|
257 |
+
$coords[1] = 0;
|
258 |
+
$coords[2] = 0;
|
259 |
+
$coords[3] = 0;
|
260 |
+
} else if ($angle == 270) {
|
261 |
+
$coords[0] = 0;
|
262 |
+
$coords[1] = 1;
|
263 |
+
$coords[2] = 0;
|
264 |
+
$coords[3] = 0;
|
265 |
+
} else {
|
266 |
+
if ($angle <= 90) {
|
267 |
+
$coords[0] = 0;
|
268 |
+
$coords[1] = 0;
|
269 |
+
if ($angle <= 45) {
|
270 |
+
$endx = 1;
|
271 |
+
$endy = tan(deg2rad($angle));
|
272 |
+
} else {
|
273 |
+
$endx = tan(deg2rad(90 - $angle));
|
274 |
+
$endy = 1;
|
275 |
+
}
|
276 |
+
} else if ($angle <= 180) {
|
277 |
+
$coords[0] = 1;
|
278 |
+
$coords[1] = 0;
|
279 |
+
if ($angle <= 135) {
|
280 |
+
$endx = tan(deg2rad($angle - 90));
|
281 |
+
$endy = 1;
|
282 |
+
} else {
|
283 |
+
$endx = 1;
|
284 |
+
$endy = tan(deg2rad(180 - $angle));
|
285 |
+
}
|
286 |
+
} else if ($angle <= 270) {
|
287 |
+
$coords[0] = 1;
|
288 |
+
$coords[1] = 1;
|
289 |
+
if ($angle <= 225) {
|
290 |
+
$endx = 1;
|
291 |
+
$endy = tan(deg2rad($angle - 180));
|
292 |
+
} else {
|
293 |
+
$endx = tan(deg2rad(270 - $angle));
|
294 |
+
$endy = 1;
|
295 |
+
}
|
296 |
+
} else {
|
297 |
+
$coords[0] = 0;
|
298 |
+
$coords[1] = 1;
|
299 |
+
if ($angle <= 315) {
|
300 |
+
$endx = tan(deg2rad($angle - 270));
|
301 |
+
$endy = 1;
|
302 |
+
} else {
|
303 |
+
$endx = 1;
|
304 |
+
$endy = tan(deg2rad(360 - $angle));
|
305 |
+
}
|
306 |
+
}
|
307 |
+
$b = atan2(($endy * $bboxh), ($endx * $bboxw));
|
308 |
+
$h2 = $bboxh - ($bboxh * tan($b));
|
309 |
+
$px = $bboxh + ($h2 * sin($b) * cos($b));
|
310 |
+
$py = ($bboxh * tan($b)) + ($h2 * sin($b) * sin($b));
|
311 |
+
$x1 = $px / $bboxh;
|
312 |
+
$y1 = $py / $bboxh;
|
313 |
+
if ($angle <= 90) {
|
314 |
+
$coords[2] = $x1;
|
315 |
+
$coords[3] = $y1;
|
316 |
+
} else if ($angle <= 180) {
|
317 |
+
$coords[2] = 1 - $x1;
|
318 |
+
$coords[3] = $y1;
|
319 |
+
} else if ($angle <= 270) {
|
320 |
+
$coords[2] = 1 - $x1;
|
321 |
+
$coords[3] = 1 - $y1;
|
322 |
+
} else {
|
323 |
+
$coords[2] = $x1;
|
324 |
+
$coords[3] = 1 - $y1;
|
325 |
+
}
|
326 |
+
}
|
327 |
+
}
|
328 |
+
// -moz If the first parameter to the gradient function is only a <point>, the gradient axis starts from the specified point,
|
329 |
+
// and ends at the point you would get if you rotated the starting point by 180 degrees about the center of the box that the
|
330 |
+
// gradient is to be applied to.
|
331 |
+
// NO angle and NO end points (Start points defined)
|
332 |
+
else if ((!isset($angle) || $angle === false) && $coords[0] !== false && $coords[1] !== false) { // should have start and end defined
|
333 |
+
$coords[2] = 1 - $coords[0];
|
334 |
+
$coords[3] = 1 - $coords[1];
|
335 |
+
$angle = rad2deg(atan2($coords[3] - $coords[1], $coords[2] - $coords[0]));
|
336 |
+
if ($angle < 0) {
|
337 |
+
$angle += 360;
|
338 |
+
} else if ($angle > 360) {
|
339 |
+
$angle -= 360;
|
340 |
+
}
|
341 |
+
if ($angle != 0 && $angle != 360 && $angle != 90 && $angle != 180 && $angle != 270) {
|
342 |
+
if ($w >= $h) {
|
343 |
+
$coords[1] *= $h / $w;
|
344 |
+
$coords[3] *= $h / $w;
|
345 |
+
$usew = $useh = $bboxw;
|
346 |
+
$usey -= ($w - $h);
|
347 |
+
} else {
|
348 |
+
$coords[0] *= $w / $h;
|
349 |
+
$coords[2] *= $w / $h;
|
350 |
+
$usew = $useh = $bboxh;
|
351 |
+
}
|
352 |
+
}
|
353 |
+
}
|
354 |
+
|
355 |
+
// -moz If neither a <point> or <angle> is specified, i.e. the entire function consists of only <stop> values, the gradient
|
356 |
+
// axis starts from the top of the box and runs vertically downwards, ending at the bottom of the box.
|
357 |
+
else { // default values T2B
|
358 |
+
// All values are set in parseMozGradient - so won't appear here
|
359 |
+
$coords = array(0, 0, 1, 0); // default for original linear gradient (L2R)
|
360 |
+
}
|
361 |
+
$s = ' q';
|
362 |
+
$s .= sprintf(' %.3F %.3F %.3F %.3F re W n', $x * _MPDFK, ($this->mpdf->h - $y) * _MPDFK, $w * _MPDFK, -$h * _MPDFK) . "\n";
|
363 |
+
$s .= sprintf(' %.3F 0 0 %.3F %.3F %.3F cm', $usew * _MPDFK, $useh * _MPDFK, $usex * _MPDFK, ($this->mpdf->h - ($usey + $useh)) * _MPDFK) . "\n";
|
364 |
+
}
|
365 |
+
|
366 |
+
// RADIAL
|
367 |
+
else if ($type == 3) {
|
368 |
+
$radius = (isset($coords[4]) ? $coords[4] : false);
|
369 |
+
$angle = (isset($coords[5]) ? $coords[5] : false); // ?? no effect
|
370 |
+
$shape = (isset($coords[6]) ? $coords[6] : false);
|
371 |
+
$size = (isset($coords[7]) ? $coords[7] : false);
|
372 |
+
$repeat = (isset($coords[8]) ? $coords[8] : false);
|
373 |
+
// ALL POINTS AND RADIUS SET (default for custom mPDF radial gradient) - no -moz
|
374 |
+
if ($coords[0] !== false && $coords[1] !== false && $coords[2] !== false && $coords[3] !== false && $coords[4] !== false) {
|
375 |
+
// do nothing - coords used as they are
|
376 |
+
}
|
377 |
+
// If a <point> is defined
|
378 |
+
else if ($shape !== false && $size !== false) {
|
379 |
+
if ($coords[2] == false) {
|
380 |
+
$coords[2] = $coords[0];
|
381 |
+
}
|
382 |
+
if ($coords[3] == false) {
|
383 |
+
$coords[3] = $coords[1];
|
384 |
+
}
|
385 |
+
// ELLIPSE
|
386 |
+
if ($shape == 'ellipse') {
|
387 |
+
$corner1 = sqrt(pow($coords[0], 2) + pow($coords[1], 2));
|
388 |
+
$corner2 = sqrt(pow($coords[0], 2) + pow((1 - $coords[1]), 2));
|
389 |
+
$corner3 = sqrt(pow((1 - $coords[0]), 2) + pow($coords[1], 2));
|
390 |
+
$corner4 = sqrt(pow((1 - $coords[0]), 2) + pow((1 - $coords[1]), 2));
|
391 |
+
if ($size == 'closest-side') {
|
392 |
+
$radius = min($coords[0], $coords[1], (1 - $coords[0]), (1 - $coords[1]));
|
393 |
+
} else if ($size == 'closest-corner') {
|
394 |
+
$radius = min($corner1, $corner2, $corner3, $corner4);
|
395 |
+
} else if ($size == 'farthest-side') {
|
396 |
+
$radius = max($coords[0], $coords[1], (1 - $coords[0]), (1 - $coords[1]));
|
397 |
+
} else {
|
398 |
+
$radius = max($corner1, $corner2, $corner3, $corner4);
|
399 |
+
} // farthest corner (default)
|
400 |
+
}
|
401 |
+
// CIRCLE
|
402 |
+
else if ($shape == 'circle') {
|
403 |
+
if ($w >= $h) {
|
404 |
+
$coords[1] = $coords[3] = ($coords[1] * $h / $w);
|
405 |
+
$corner1 = sqrt(pow($coords[0], 2) + pow($coords[1], 2));
|
406 |
+
$corner2 = sqrt(pow($coords[0], 2) + pow((($h / $w) - $coords[1]), 2));
|
407 |
+
$corner3 = sqrt(pow((1 - $coords[0]), 2) + pow($coords[1], 2));
|
408 |
+
$corner4 = sqrt(pow((1 - $coords[0]), 2) + pow((($h / $w) - $coords[1]), 2));
|
409 |
+
if ($size == 'closest-side') {
|
410 |
+
$radius = min($coords[0], $coords[1], (1 - $coords[0]), (($h / $w) - $coords[1]));
|
411 |
+
} else if ($size == 'closest-corner') {
|
412 |
+
$radius = min($corner1, $corner2, $corner3, $corner4);
|
413 |
+
} else if ($size == 'farthest-side') {
|
414 |
+
$radius = max($coords[0], $coords[1], (1 - $coords[0]), (($h / $w) - $coords[1]));
|
415 |
+
} else if ($size == 'farthest-corner') {
|
416 |
+
$radius = max($corner1, $corner2, $corner3, $corner4);
|
417 |
+
} // farthest corner (default)
|
418 |
+
$usew = $useh = $bboxw;
|
419 |
+
$usey -= ($w - $h);
|
420 |
+
} else {
|
421 |
+
$coords[0] = $coords[2] = ($coords[0] * $w / $h);
|
422 |
+
$corner1 = sqrt(pow($coords[0], 2) + pow($coords[1], 2));
|
423 |
+
$corner2 = sqrt(pow($coords[0], 2) + pow((1 - $coords[1]), 2));
|
424 |
+
$corner3 = sqrt(pow((($w / $h) - $coords[0]), 2) + pow($coords[1], 2));
|
425 |
+
$corner4 = sqrt(pow((($w / $h) - $coords[0]), 2) + pow((1 - $coords[1]), 2));
|
426 |
+
if ($size == 'closest-side') {
|
427 |
+
$radius = min($coords[0], $coords[1], (($w / $h) - $coords[0]), (1 - $coords[1]));
|
428 |
+
} else if ($size == 'closest-corner') {
|
429 |
+
$radius = min($corner1, $corner2, $corner3, $corner4);
|
430 |
+
} else if ($size == 'farthest-side') {
|
431 |
+
$radius = max($coords[0], $coords[1], (($w / $h) - $coords[0]), (1 - $coords[1]));
|
432 |
+
} else if ($size == 'farthest-corner') {
|
433 |
+
$radius = max($corner1, $corner2, $corner3, $corner4);
|
434 |
+
} // farthest corner (default)
|
435 |
+
$usew = $useh = $bboxh;
|
436 |
+
}
|
437 |
+
}
|
438 |
+
if ($radius == 0) {
|
439 |
+
$radius = 0.001;
|
440 |
+
} // to prevent error
|
441 |
+
$coords[4] = $radius;
|
442 |
+
}
|
443 |
+
|
444 |
+
// -moz If entire function consists of only <stop> values
|
445 |
+
else { // default values
|
446 |
+
// All values are set in parseMozGradient - so won't appear here
|
447 |
+
$coords = array(0.5, 0.5, 0.5, 0.5); // default for radial gradient (centred)
|
448 |
+
}
|
449 |
+
$s = ' q';
|
450 |
+
$s .= sprintf(' %.3F %.3F %.3F %.3F re W n', $x * _MPDFK, ($this->mpdf->h - $y) * _MPDFK, $w * _MPDFK, -$h * _MPDFK) . "\n";
|
451 |
+
$s .= sprintf(' %.3F 0 0 %.3F %.3F %.3F cm', $usew * _MPDFK, $useh * _MPDFK, $usex * _MPDFK, ($this->mpdf->h - ($usey + $useh)) * _MPDFK) . "\n";
|
452 |
+
}
|
453 |
+
|
454 |
+
$n = count($this->mpdf->gradients) + 1;
|
455 |
+
$this->mpdf->gradients[$n]['type'] = $type;
|
456 |
+
$this->mpdf->gradients[$n]['colorspace'] = $colorspace;
|
457 |
+
$trans = false;
|
458 |
+
$this->mpdf->gradients[$n]['is_mask'] = $is_mask;
|
459 |
+
if ($is_mask) {
|
460 |
+
$trans = true;
|
461 |
+
}
|
462 |
+
if (count($stops) == 1) {
|
463 |
+
$stops[1] = $stops[0];
|
464 |
+
}
|
465 |
+
if (!isset($stops[0]['offset'])) {
|
466 |
+
$stops[0]['offset'] = 0;
|
467 |
+
}
|
468 |
+
if (!isset($stops[(count($stops) - 1)]['offset'])) {
|
469 |
+
$stops[(count($stops) - 1)]['offset'] = 1;
|
470 |
+
}
|
471 |
+
|
472 |
+
// Fix stop-offsets set as absolute lengths
|
473 |
+
if ($type == 2) {
|
474 |
+
$axisx = ($coords[2] - $coords[0]) * $usew;
|
475 |
+
$axisy = ($coords[3] - $coords[1]) * $useh;
|
476 |
+
$axis_length = sqrt(pow($axisx, 2) + pow($axisy, 2));
|
477 |
+
} else {
|
478 |
+
$axis_length = $coords[4] * $usew;
|
479 |
+
} // Absolute lengths are meaningless for an ellipse - Firefox uses Width as reference
|
480 |
+
|
481 |
+
for ($i = 0; $i < count($stops); $i++) {
|
482 |
+
if (isset($stops[$i]['offset']) && preg_match('/([0-9.]+(px|em|ex|pc|pt|cm|mm|in))/i', $stops[$i]['offset'], $m)) {
|
483 |
+
$tmp = $this->mpdf->ConvertSize($m[1], $this->mpdf->w, $this->mpdf->FontSize, false);
|
484 |
+
$stops[$i]['offset'] = $tmp / $axis_length;
|
485 |
+
}
|
486 |
+
}
|
487 |
+
|
488 |
+
|
489 |
+
if (isset($stops[0]['offset']) && $stops[0]['offset'] > 0) {
|
490 |
+
$firststop = $stops[0];
|
491 |
+
$firststop['offset'] = 0;
|
492 |
+
array_unshift($stops, $firststop);
|
493 |
+
}
|
494 |
+
if (!$repeat && isset($stops[(count($stops) - 1)]['offset']) && $stops[(count($stops) - 1)]['offset'] < 1) {
|
495 |
+
$endstop = $stops[(count($stops) - 1)];
|
496 |
+
$endstop['offset'] = 1;
|
497 |
+
$stops[] = $endstop;
|
498 |
+
}
|
499 |
+
if ($stops[0]['offset'] > $stops[(count($stops) - 1)]['offset']) {
|
500 |
+
$stops[0]['offset'] = 0;
|
501 |
+
$stops[(count($stops) - 1)]['offset'] = 1;
|
502 |
+
}
|
503 |
+
|
504 |
+
for ($i = 0; $i < count($stops); $i++) {
|
505 |
+
// mPDF 5.3.74
|
506 |
+
if ($colorspace == 'CMYK') {
|
507 |
+
$this->mpdf->gradients[$n]['stops'][$i]['col'] = sprintf('%.3F %.3F %.3F %.3F', (ord($stops[$i]['col']{1}) / 100), (ord($stops[$i]['col']{2}) / 100), (ord($stops[$i]['col']{3}) / 100), (ord($stops[$i]['col']{4}) / 100));
|
508 |
+
} else if ($colorspace == 'Gray') {
|
509 |
+
$this->mpdf->gradients[$n]['stops'][$i]['col'] = sprintf('%.3F', (ord($stops[$i]['col']{1}) / 255));
|
510 |
+
} else {
|
511 |
+
$this->mpdf->gradients[$n]['stops'][$i]['col'] = sprintf('%.3F %.3F %.3F', (ord($stops[$i]['col']{1}) / 255), (ord($stops[$i]['col']{2}) / 255), (ord($stops[$i]['col']{3}) / 255));
|
512 |
+
}
|
513 |
+
if (!isset($stops[$i]['opacity'])) {
|
514 |
+
$stops[$i]['opacity'] = 1;
|
515 |
+
} else if ($stops[$i]['opacity'] > 1 || $stops[$i]['opacity'] < 0) {
|
516 |
+
$stops[$i]['opacity'] = 1;
|
517 |
+
} else if ($stops[$i]['opacity'] < 1) {
|
518 |
+
$trans = true;
|
519 |
+
}
|
520 |
+
$this->mpdf->gradients[$n]['stops'][$i]['opacity'] = $stops[$i]['opacity'];
|
521 |
+
// OFFSET
|
522 |
+
if ($i > 0 && $i < (count($stops) - 1)) {
|
523 |
+
if (!isset($stops[$i]['offset']) || (isset($stops[$i + 1]['offset']) && $stops[$i]['offset'] > $stops[$i + 1]['offset']) || $stops[$i]['offset'] < $stops[$i - 1]['offset']) {
|
524 |
+
if (isset($stops[$i - 1]['offset']) && isset($stops[$i + 1]['offset'])) {
|
525 |
+
$stops[$i]['offset'] = ($stops[$i - 1]['offset'] + $stops[$i + 1]['offset']) / 2;
|
526 |
+
} else {
|
527 |
+
for ($j = ($i + 1); $j < count($stops); $j++) {
|
528 |
+
if (isset($stops[$j]['offset'])) {
|
529 |
+
break;
|
530 |
+
}
|
531 |
+
}
|
532 |
+
$int = ($stops[$j]['offset'] - $stops[($i - 1)]['offset']) / ($j - $i + 1);
|
533 |
+
for ($f = 0; $f < ($j - $i - 1); $f++) {
|
534 |
+
$stops[($i + $f)]['offset'] = $stops[($i + $f - 1)]['offset'] + ($int);
|
535 |
+
}
|
536 |
+
}
|
537 |
+
}
|
538 |
+
}
|
539 |
+
$this->mpdf->gradients[$n]['stops'][$i]['offset'] = $stops[$i]['offset'];
|
540 |
+
$this->mpdf->gradients[$n]['stops'][$i]['offset'] = $stops[$i]['offset'];
|
541 |
+
}
|
542 |
+
|
543 |
+
if ($repeat) {
|
544 |
+
$ns = count($this->mpdf->gradients[$n]['stops']);
|
545 |
+
$offs = array();
|
546 |
+
for ($i = 0; $i < $ns; $i++) {
|
547 |
+
$offs[$i] = $this->mpdf->gradients[$n]['stops'][$i]['offset'];
|
548 |
+
}
|
549 |
+
$gp = 0;
|
550 |
+
$inside = true;
|
551 |
+
while ($inside) {
|
552 |
+
$gp++;
|
553 |
+
for ($i = 0; $i < $ns; $i++) {
|
554 |
+
$this->mpdf->gradients[$n]['stops'][(($ns * $gp) + $i)] = $this->mpdf->gradients[$n]['stops'][(($ns * ($gp - 1)) + $i)];
|
555 |
+
$tmp = $this->mpdf->gradients[$n]['stops'][(($ns * ($gp - 1)) + ($ns - 1))]['offset'] + $offs[$i];
|
556 |
+
if ($tmp < 1) {
|
557 |
+
$this->mpdf->gradients[$n]['stops'][(($ns * $gp) + $i)]['offset'] = $tmp;
|
558 |
+
} else {
|
559 |
+
$this->mpdf->gradients[$n]['stops'][(($ns * $gp) + $i)]['offset'] = 1;
|
560 |
+
$inside = false;
|
561 |
+
break(2);
|
562 |
+
}
|
563 |
+
}
|
564 |
+
}
|
565 |
+
}
|
566 |
+
|
567 |
+
if ($trans) {
|
568 |
+
$this->mpdf->gradients[$n]['trans'] = true;
|
569 |
+
$s .= ' /TGS' . $n . ' gs ';
|
570 |
+
}
|
571 |
+
if (!is_array($extend) || count($extend) < 1) {
|
572 |
+
$extend = array('true', 'true'); // These are supposed to be quoted - appear in PDF file as text
|
573 |
+
}
|
574 |
+
$this->mpdf->gradients[$n]['coords'] = $coords;
|
575 |
+
$this->mpdf->gradients[$n]['extend'] = $extend;
|
576 |
+
//paint the gradient
|
577 |
+
$s .= '/Sh' . $n . ' sh ' . "\n";
|
578 |
+
//restore previous Graphic State
|
579 |
+
$s .= ' Q ' . "\n";
|
580 |
+
if ($return) {
|
581 |
+
return $s;
|
582 |
+
} else {
|
583 |
+
$this->mpdf->_out($s);
|
584 |
+
}
|
585 |
+
}
|
586 |
+
|
587 |
+
function parseMozGradient($bg)
|
588 |
+
{
|
589 |
+
// background[-image]: -moz-linear-gradient(left, #c7Fdde 20%, #FF0000 );
|
590 |
+
// background[-image]: linear-gradient(left, #c7Fdde 20%, #FF0000 ); // CSS3
|
591 |
+
if (preg_match('/repeating-/', $bg)) {
|
592 |
+
$repeat = true;
|
593 |
+
} else {
|
594 |
+
$repeat = false;
|
595 |
+
}
|
596 |
+
if (preg_match('/linear-gradient\((.*)\)/', $bg, $m)) {
|
597 |
+
$g = array();
|
598 |
+
$g['type'] = 2;
|
599 |
+
$g['colorspace'] = 'RGB';
|
600 |
+
$g['extend'] = array('true', 'true');
|
601 |
+
$v = trim($m[1]);
|
602 |
+
// Change commas inside e.g. rgb(x,x,x)
|
603 |
+
while (preg_match('/(\([^\)]*?),/', $v)) {
|
604 |
+
$v = preg_replace('/(\([^\)]*?),/', '\\1@', $v);
|
605 |
+
}
|
606 |
+
// Remove spaces inside e.g. rgb(x, x, x)
|
607 |
+
while (preg_match('/(\([^\)]*?)[ ]/', $v)) {
|
608 |
+
$v = preg_replace('/(\([^\)]*?)[ ]/', '\\1', $v);
|
609 |
+
}
|
610 |
+
$bgr = preg_split('/\s*,\s*/', $v);
|
611 |
+
for ($i = 0; $i < count($bgr); $i++) {
|
612 |
+
$bgr[$i] = preg_replace('/@/', ',', $bgr[$i]);
|
613 |
+
}
|
614 |
+
// Is first part $bgr[0] a valid point/angle?
|
615 |
+
$first = preg_split('/\s+/', trim($bgr[0]));
|
616 |
+
if (preg_match('/(left|center|right|bottom|top|deg|grad|rad)/i', $bgr[0]) && !preg_match('/(<#|rgb|rgba|hsl|hsla)/i', $bgr[0])) {
|
617 |
+
$startStops = 1;
|
618 |
+
} else if (trim($first[(count($first) - 1)]) === "0") {
|
619 |
+
$startStops = 1;
|
620 |
+
} else {
|
621 |
+
$check = $this->mpdf->ConvertColor($first[0]);
|
622 |
+
if ($check)
|
623 |
+
$startStops = 0;
|
624 |
+
else
|
625 |
+
$startStops = 1;
|
626 |
+
}
|
627 |
+
// first part a valid point/angle?
|
628 |
+
if ($startStops == 1) { // default values
|
629 |
+
// [<point> || <angle>,] = [<% em px left center right bottom top> || <deg grad rad 0>,]
|
630 |
+
if (preg_match('/([\-]*[0-9\.]+)(deg|grad|rad)/i', $bgr[0], $m)) {
|
631 |
+
$angle = $m[1] + 0;
|
632 |
+
if (strtolower($m[2]) == 'deg') {
|
633 |
+
$angle = $angle;
|
634 |
+
} else if (strtolower($m[2]) == 'grad') {
|
635 |
+
$angle *= (360 / 400);
|
636 |
+
} else if (strtolower($m[2]) == 'rad') {
|
637 |
+
$angle = rad2deg($angle);
|
638 |
+
}
|
639 |
+
while ($angle < 0) {
|
640 |
+
$angle += 360;
|
641 |
+
}
|
642 |
+
$angle = ($angle % 360);
|
643 |
+
} else if (trim($first[(count($first) - 1)]) === "0") {
|
644 |
+
$angle = 0;
|
645 |
+
}
|
646 |
+
if (preg_match('/left/i', $bgr[0])) {
|
647 |
+
$startx = 0;
|
648 |
+
} else if (preg_match('/right/i', $bgr[0])) {
|
649 |
+
$startx = 1;
|
650 |
+
}
|
651 |
+
if (preg_match('/top/i', $bgr[0])) {
|
652 |
+
$starty = 1;
|
653 |
+
} else if (preg_match('/bottom/i', $bgr[0])) {
|
654 |
+
$starty = 0;
|
655 |
+
}
|
656 |
+
// Check for %? ?% or %%
|
657 |
+
if (preg_match('/(\d+)[%]/i', $first[0], $m)) {
|
658 |
+
$startx = $m[1] / 100;
|
659 |
+
} else if (!isset($startx) && preg_match('/([0-9.]+(px|em|ex|pc|pt|cm|mm|in))/i', $first[0], $m)) {
|
660 |
+
$tmp = $this->mpdf->ConvertSize($m[1], $this->mpdf->w, $this->mpdf->FontSize, false);
|
661 |
+
if ($tmp) {
|
662 |
+
$startx = $m[1];
|
663 |
+
}
|
664 |
+
}
|
665 |
+
if (isset($first[1]) && preg_match('/(\d+)[%]/i', $first[1], $m)) {
|
666 |
+
$starty = 1 - ($m[1] / 100);
|
667 |
+
} else if (!isset($starty) && isset($first[1]) && preg_match('/([0-9.]+(px|em|ex|pc|pt|cm|mm|in))/i', $first[1], $m)) {
|
668 |
+
$tmp = $this->mpdf->ConvertSize($m[1], $this->mpdf->w, $this->mpdf->FontSize, false);
|
669 |
+
if ($tmp) {
|
670 |
+
$starty = $m[1];
|
671 |
+
}
|
672 |
+
}
|
673 |
+
if (isset($startx) && !isset($starty)) {
|
674 |
+
$starty = 0.5;
|
675 |
+
}
|
676 |
+
if (!isset($startx) && isset($starty)) {
|
677 |
+
$startx = 0.5;
|
678 |
+
}
|
679 |
+
}
|
680 |
+
// If neither a <point> or <angle> is specified, i.e. the entire function consists of only <stop> values, the gradient axis starts from the top of the box and runs vertically downwards, ending at the bottom of the box.
|
681 |
+
else { // default values T2B
|
682 |
+
$starty = 1;
|
683 |
+
$startx = 0.5;
|
684 |
+
$endy = 0;
|
685 |
+
$endx = 0.5;
|
686 |
+
}
|
687 |
+
$coords = array();
|
688 |
+
if (!isset($startx)) {
|
689 |
+
$startx = false;
|
690 |
+
}
|
691 |
+
if (!isset($starty)) {
|
692 |
+
$starty = false;
|
693 |
+
}
|
694 |
+
if (!isset($endx)) {
|
695 |
+
$endx = false;
|
696 |
+
}
|
697 |
+
if (!isset($endy)) {
|
698 |
+
$endy = false;
|
699 |
+
}
|
700 |
+
if (!isset($angle)) {
|
701 |
+
$angle = false;
|
702 |
+
}
|
703 |
+
$g['coords'] = array($startx, $starty, $endx, $endy, $angle, $repeat);
|
704 |
+
$g['stops'] = array();
|
705 |
+
for ($i = $startStops; $i < count($bgr); $i++) {
|
706 |
+
$stop = array();
|
707 |
+
// parse stops
|
708 |
+
$el = preg_split('/\s+/', trim($bgr[$i]));
|
709 |
+
// mPDF 5.3.74
|
710 |
+
$col = $this->mpdf->ConvertColor($el[0]);
|
711 |
+
if ($col) {
|
712 |
+
$stop['col'] = $col;
|
713 |
+
} else {
|
714 |
+
$stop['col'] = $col = $this->mpdf->ConvertColor(255);
|
715 |
+
}
|
716 |
+
if ($col{0} == 1)
|
717 |
+
$g['colorspace'] = 'Gray';
|
718 |
+
else if ($col{0} == 4 || $col{0} == 6)
|
719 |
+
$g['colorspace'] = 'CMYK';
|
720 |
+
if ($col{0} == 5) {
|
721 |
+
$stop['opacity'] = ord($col{4}) / 100;
|
722 |
+
} // transparency from rgba()
|
723 |
+
else if ($col{0} == 6) {
|
724 |
+
$stop['opacity'] = ord($col{5}) / 100;
|
725 |
+
} // transparency from cmyka()
|
726 |
+
else if ($col{0} == 1 && $col{2} == 1) {
|
727 |
+
$stop['opacity'] = ord($col{3}) / 100;
|
728 |
+
} // transparency converted from rgba or cmyka()
|
729 |
+
|
730 |
+
if (isset($el[1]) && preg_match('/(\d+)[%]/', $el[1], $m)) {
|
731 |
+
$stop['offset'] = $m[1] / 100;
|
732 |
+
if ($stop['offset'] > 1) {
|
733 |
+
unset($stop['offset']);
|
734 |
+
}
|
735 |
+
} else if (isset($el[1]) && preg_match('/([0-9.]+(px|em|ex|pc|pt|cm|mm|in))/i', $el[1], $m)) {
|
736 |
+
$tmp = $this->mpdf->ConvertSize($m[1], $this->mpdf->w, $this->mpdf->FontSize, false);
|
737 |
+
if ($tmp) {
|
738 |
+
$stop['offset'] = $m[1];
|
739 |
+
}
|
740 |
+
}
|
741 |
+
$g['stops'][] = $stop;
|
742 |
+
}
|
743 |
+
if (count($g['stops'])) {
|
744 |
+
return $g;
|
745 |
+
}
|
746 |
+
} else if (preg_match('/radial-gradient\((.*)\)/', $bg, $m)) {
|
747 |
+
$g = array();
|
748 |
+
$g['type'] = 3;
|
749 |
+
$g['colorspace'] = 'RGB';
|
750 |
+
$g['extend'] = array('true', 'true');
|
751 |
+
$v = trim($m[1]);
|
752 |
+
// Change commas inside e.g. rgb(x,x,x)
|
753 |
+
while (preg_match('/(\([^\)]*?),/', $v)) {
|
754 |
+
$v = preg_replace('/(\([^\)]*?),/', '\\1@', $v);
|
755 |
+
}
|
756 |
+
// Remove spaces inside e.g. rgb(x, x, x)
|
757 |
+
while (preg_match('/(\([^\)]*?)[ ]/', $v)) {
|
758 |
+
$v = preg_replace('/(\([^\)]*?)[ ]/', '\\1', $v);
|
759 |
+
}
|
760 |
+
$bgr = preg_split('/\s*,\s*/', $v);
|
761 |
+
for ($i = 0; $i < count($bgr); $i++) {
|
762 |
+
$bgr[$i] = preg_replace('/@/', ',', $bgr[$i]);
|
763 |
+
}
|
764 |
+
|
765 |
+
// Is first part $bgr[0] a valid point/angle?
|
766 |
+
$startStops = 0;
|
767 |
+
$pos_angle = false;
|
768 |
+
$shape_size = false;
|
769 |
+
$first = preg_split('/\s+/', trim($bgr[0]));
|
770 |
+
$checkCol = $this->mpdf->ConvertColor($first[0]);
|
771 |
+
if (preg_match('/(left|center|right|bottom|top|deg|grad|rad)/i', $bgr[0]) && !preg_match('/(<#|rgb|rgba|hsl|hsla)/i', $bgr[0])) {
|
772 |
+
$startStops = 1;
|
773 |
+
$pos_angle = $bgr[0];
|
774 |
+
} else if (trim($first[(count($first) - 1)]) === "0") {
|
775 |
+
$startStops = 1;
|
776 |
+
$pos_angle = $bgr[0];
|
777 |
+
} else if (preg_match('/(circle|ellipse|closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)/i', $bgr[0])) {
|
778 |
+
$startStops = 1;
|
779 |
+
$shape_size = $bgr[0];
|
780 |
+
} else if (!$checkCol) {
|
781 |
+
$startStops = 1;
|
782 |
+
$pos_angle = $bgr[0];
|
783 |
+
}
|
784 |
+
if (preg_match('/(circle|ellipse|closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)/i', $bgr[1])) {
|
785 |
+
$startStops = 2;
|
786 |
+
$shape_size = $bgr[1];
|
787 |
+
}
|
788 |
+
|
789 |
+
// If valid point/angle?
|
790 |
+
if ($pos_angle) { // default values
|
791 |
+
// [<point> || <angle>,] = [<% em px left center right bottom top> || <deg grad rad 0>,]
|
792 |
+
if (preg_match('/left/i', $pos_angle)) {
|
793 |
+
$startx = 0;
|
794 |
+
} else if (preg_match('/right/i', $pos_angle)) {
|
795 |
+
$startx = 1;
|
796 |
+
}
|
797 |
+
if (preg_match('/top/i', $pos_angle)) {
|
798 |
+
$starty = 1;
|
799 |
+
} else if (preg_match('/bottom/i', $pos_angle)) {
|
800 |
+
$starty = 0;
|
801 |
+
}
|
802 |
+
// Check for %? ?% or %%
|
803 |
+
if (preg_match('/(\d+)[%]/i', $first[0], $m)) {
|
804 |
+
$startx = $m[1] / 100;
|
805 |
+
} else if (!isset($startx) && preg_match('/([0-9.]+(px|em|ex|pc|pt|cm|mm|in))/i', $first[0], $m)) {
|
806 |
+
$tmp = $this->mpdf->ConvertSize($m[1], $this->mpdf->w, $this->mpdf->FontSize, false);
|
807 |
+
if ($tmp) {
|
808 |
+
$startx = $m[1];
|
809 |
+
}
|
810 |
+
}
|
811 |
+
if (isset($first[1]) && preg_match('/(\d+)[%]/i', $first[1], $m)) {
|
812 |
+
$starty = 1 - ($m[1] / 100);
|
813 |
+
} else if (!isset($starty) && isset($first[1]) && preg_match('/([0-9.]+(px|em|ex|pc|pt|cm|mm|in))/i', $first[1], $m)) {
|
814 |
+
$tmp = $this->mpdf->ConvertSize($m[1], $this->mpdf->w, $this->mpdf->FontSize, false);
|
815 |
+
if ($tmp) {
|
816 |
+
$starty = $m[1];
|
817 |
+
}
|
818 |
+
}
|
819 |
+
|
820 |
+
/*
|
821 |
+
// ?? Angle has no effect in radial gradient (does not exist in CSS3 spec.)
|
822 |
+
if (preg_match('/([\-]*[0-9\.]+)(deg|grad|rad)/i',$pos_angle,$m)) {
|
823 |
+
$angle = $m[1] + 0;
|
824 |
+
if (strtolower($m[2])=='deg') { $angle = $angle; }
|
825 |
+
else if (strtolower($m[2])=='grad') { $angle *= (360/400); }
|
826 |
+
else if (strtolower($m[2])=='rad') { $angle = rad2deg($angle); }
|
827 |
+
while($angle < 0) { $angle += 360; }
|
828 |
+
$angle = ($angle % 360);
|
829 |
+
}
|
830 |
+
*/
|
831 |
+
if (!isset($starty)) {
|
832 |
+
$starty = 0.5;
|
833 |
+
}
|
834 |
+
if (!isset($startx)) {
|
835 |
+
$startx = 0.5;
|
836 |
+
}
|
837 |
+
}
|
838 |
+
// If neither a <point> or <angle> is specified, i.e. the entire function consists of only <stop> values, the gradient axis starts from the top of the box and runs vertically downwards, ending at the bottom of the box.
|
839 |
+
else { // default values Center
|
840 |
+
$starty = 0.5;
|
841 |
+
$startx = 0.5;
|
842 |
+
$endy = 0.5;
|
843 |
+
$endx = 0.5;
|
844 |
+
}
|
845 |
+
|
846 |
+
// If valid shape/size?
|
847 |
+
$shape = 'ellipse'; // default
|
848 |
+
$size = 'farthest-corner'; // default
|
849 |
+
if ($shape_size) { // default values
|
850 |
+
if (preg_match('/(circle|ellipse)/i', $shape_size, $m)) {
|
851 |
+
$shape = $m[1];
|
852 |
+
}
|
853 |
+
if (preg_match('/(closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)/i', $shape_size, $m)) {
|
854 |
+
$size = $m[1];
|
855 |
+
if ($size == 'contain') {
|
856 |
+
$size = 'closest-side';
|
857 |
+
} else if ($size == 'cover') {
|
858 |
+
$size = 'farthest-corner';
|
859 |
+
}
|
860 |
+
}
|
861 |
+
}
|
862 |
+
|
863 |
+
$coords = array();
|
864 |
+
if (!isset($startx)) {
|
865 |
+
$startx = false;
|
866 |
+
}
|
867 |
+
if (!isset($starty)) {
|
868 |
+
$starty = false;
|
869 |
+
}
|
870 |
+
if (!isset($endx)) {
|
871 |
+
$endx = false;
|
872 |
+
}
|
873 |
+
if (!isset($endy)) {
|
874 |
+
$endy = false;
|
875 |
+
}
|
876 |
+
if (!isset($radius)) {
|
877 |
+
$radius = false;
|
878 |
+
}
|
879 |
+
if (!isset($angle)) {
|
880 |
+
$angle = 0;
|
881 |
+
}
|
882 |
+
$g['coords'] = array($startx, $starty, $endx, $endy, $radius, $angle, $shape, $size, $repeat);
|
883 |
+
|
884 |
+
$g['stops'] = array();
|
885 |
+
for ($i = $startStops; $i < count($bgr); $i++) {
|
886 |
+
$stop = array();
|
887 |
+
// parse stops
|
888 |
+
$el = preg_split('/\s+/', trim($bgr[$i]));
|
889 |
+
// mPDF 5.3.74
|
890 |
+
$col = $this->mpdf->ConvertColor($el[0]);
|
891 |
+
if ($col) {
|
892 |
+
$stop['col'] = $col;
|
893 |
+
} else {
|
894 |
+
$stop['col'] = $col = $this->mpdf->ConvertColor(255);
|
895 |
+
}
|
896 |
+
if ($col{0} == 1)
|
897 |
+
$g['colorspace'] = 'Gray';
|
898 |
+
else if ($col{0} == 4 || $col{0} == 6)
|
899 |
+
$g['colorspace'] = 'CMYK';
|
900 |
+
if ($col{0} == 5) {
|
901 |
+
$stop['opacity'] = ord($col{4}) / 100;
|
902 |
+
} // transparency from rgba()
|
903 |
+
else if ($col{0} == 6) {
|
904 |
+
$stop['opacity'] = ord($col{5}) / 100;
|
905 |
+
} // transparency from cmyka()
|
906 |
+
else if ($col{0} == 1 && $col{2} == 1) {
|
907 |
+
$stop['opacity'] = ord($col{3}) / 100;
|
908 |
+
} // transparency converted from rgba or cmyka()
|
909 |
+
|
910 |
+
if (isset($el[1]) && preg_match('/(\d+)[%]/', $el[1], $m)) {
|
911 |
+
$stop['offset'] = $m[1] / 100;
|
912 |
+
if ($stop['offset'] > 1) {
|
913 |
+
unset($stop['offset']);
|
914 |
+
}
|
915 |
+
} else if (isset($el[1]) && preg_match('/([0-9.]+(px|em|ex|pc|pt|cm|mm|in))/i', $el[1], $m)) {
|
916 |
+
$tmp = $this->mpdf->ConvertSize($m[1], $this->mpdf->w, $this->mpdf->FontSize, false);
|
917 |
+
$stop['offset'] = $el[1];
|
918 |
+
}
|
919 |
+
$g['stops'][] = $stop;
|
920 |
+
}
|
921 |
+
if (count($g['stops'])) {
|
922 |
+
return $g;
|
923 |
+
}
|
924 |
+
}
|
925 |
+
return array();
|
926 |
+
}
|
927 |
+
|
928 |
+
function parseBackgroundGradient($bg)
|
929 |
+
{
|
930 |
+
// background-gradient: linear #00FFFF #FFFF00 0 0.5 1 0.5; or
|
931 |
+
// background-gradient: radial #00FFFF #FFFF00 0.5 0.5 1 1 1.2;
|
932 |
+
|
933 |
+
$v = trim($bg);
|
934 |
+
$bgr = preg_split('/\s+/', $v);
|
935 |
+
$g = array();
|
936 |
+
if (count($bgr) > 6) {
|
937 |
+
if (strtoupper(substr($bgr[0], 0, 1)) == 'L' && count($bgr) == 7) { // linear
|
938 |
+
$g['type'] = 2;
|
939 |
+
//$coords = array(0,0,1,1 ); // 0 0 1 0 or 0 1 1 1 is L 2 R; 1,1,0,1 is R2L; 1,1,1,0 is T2B; 1,0,1,1 is B2T
|
940 |
+
// Linear: $coords - array of the form (x1, y1, x2, y2) which defines the gradient vector (see linear_gradient_coords.jpg).
|
941 |
+
// The default value is from left to right (x1=0, y1=0, x2=1, y2=0).
|
942 |
+
$g['coords'] = array($bgr[3], $bgr[4], $bgr[5], $bgr[6]);
|
943 |
+
} else if (count($bgr) == 8) { // radial
|
944 |
+
$g['type'] = 3;
|
945 |
+
// Radial: $coords - array of the form (fx, fy, cx, cy, r) where (fx, fy) is the starting point of the gradient with color1,
|
946 |
+
// (cx, cy) is the center of the circle with color2, and r is the radius of the circle (see radial_gradient_coords.jpg).
|
947 |
+
// (fx, fy) should be inside the circle, otherwise some areas will not be defined
|
948 |
+
$g['coords'] = array($bgr[3], $bgr[4], $bgr[5], $bgr[6], $bgr[7]);
|
949 |
+
}
|
950 |
+
$g['colorspace'] = 'RGB';
|
951 |
+
// mPDF 5.3.74
|
952 |
+
$cor = $this->mpdf->ConvertColor($bgr[1]);
|
953 |
+
if ($cor{0} == 1)
|
954 |
+
$g['colorspace'] = 'Gray';
|
955 |
+
else if ($cor{0} == 4 || $cor{0} == 6)
|
956 |
+
$g['colorspace'] = 'CMYK';
|
957 |
+
if ($cor) {
|
958 |
+
$g['col'] = $cor;
|
959 |
+
} else {
|
960 |
+
$g['col'] = $this->mpdf->ConvertColor(255);
|
961 |
+
}
|
962 |
+
$cor = $this->mpdf->ConvertColor($bgr[2]);
|
963 |
+
if ($cor) {
|
964 |
+
$g['col2'] = $cor;
|
965 |
+
} else {
|
966 |
+
$g['col2'] = $this->mpdf->ConvertColor(255);
|
967 |
+
}
|
968 |
+
$g['extend'] = array('true', 'true');
|
969 |
+
$g['stops'] = array(array('col' => $g['col'], 'opacity' => 1, 'offset' => 0), array('col' => $g['col2'], 'opacity' => 1, 'offset' => 1));
|
970 |
+
return $g;
|
971 |
+
}
|
972 |
+
return false;
|
973 |
+
}
|
974 |
+
|
975 |
+
}
|
lib/mpdf/classes/indic.php
CHANGED
@@ -1,1714 +1,1864 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
const
|
11 |
-
const
|
12 |
-
const
|
13 |
-
const
|
14 |
-
const
|
15 |
-
const
|
16 |
-
const
|
17 |
-
const
|
18 |
-
const
|
19 |
-
const
|
20 |
-
const
|
21 |
-
const
|
22 |
-
const
|
23 |
-
const
|
24 |
-
const
|
25 |
-
const
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
'
|
34 |
-
'
|
35 |
-
'
|
36 |
-
'
|
37 |
-
'
|
38 |
-
'
|
39 |
-
'
|
40 |
-
'
|
41 |
-
'
|
42 |
-
|
43 |
-
'
|
44 |
-
|
45 |
-
'
|
46 |
-
'
|
47 |
-
'
|
48 |
-
'
|
49 |
-
'
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
/*
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
const
|
59 |
-
|
60 |
-
const
|
61 |
-
|
62 |
-
const
|
63 |
-
|
64 |
-
|
65 |
-
const
|
66 |
-
|
67 |
-
const
|
68 |
-
|
69 |
-
const
|
70 |
-
|
71 |
-
const
|
72 |
-
|
73 |
-
const
|
74 |
-
|
75 |
-
const
|
76 |
-
|
77 |
-
|
78 |
-
const
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
const
|
92 |
-
const
|
93 |
-
const
|
94 |
-
const
|
95 |
-
const
|
96 |
-
const
|
97 |
-
const
|
98 |
-
const
|
99 |
-
const
|
100 |
-
const
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
if ($
|
150 |
-
$cat = self::
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
}
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
$
|
232 |
-
$
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
$
|
285 |
-
$
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
$
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
}
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
$
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
/*
|
416 |
-
|
417 |
-
|
418 |
-
if (
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
)
|
423 |
-
/*
|
424 |
-
|
425 |
-
|
426 |
-
if (
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
$
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
}
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
if (
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
*/
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
}
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
$info[$i]
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
/*
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
/*
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
$
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
$
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
$
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
$
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
)
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
//
|
1269 |
-
|
1270 |
-
|
1271 |
-
const
|
1272 |
-
const
|
1273 |
-
const
|
1274 |
-
|
1275 |
-
|
1276 |
-
const
|
1277 |
-
const
|
1278 |
-
const
|
1279 |
-
const
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
-
|
1475 |
-
|
1476 |
-
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
|
1481 |
-
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
|
1486 |
-
|
1487 |
-
|
1488 |
-
|
1489 |
-
|
1490 |
-
|
1491 |
-
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
-
|
1496 |
-
|
1497 |
-
|
1498 |
-
|
1499 |
-
|
1500 |
-
|
1501 |
-
|
1502 |
-
|
1503 |
-
|
1504 |
-
|
1505 |
-
|
1506 |
-
|
1507 |
-
|
1508 |
-
|
1509 |
-
|
1510 |
-
|
1511 |
-
|
1512 |
-
|
1513 |
-
|
1514 |
-
|
1515 |
-
|
1516 |
-
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
1530 |
-
|
1531 |
-
|
1532 |
-
|
1533 |
-
|
1534 |
-
|
1535 |
-
|
1536 |
-
|
1537 |
-
|
1538 |
-
|
1539 |
-
|
1540 |
-
|
1541 |
-
|
1542 |
-
|
1543 |
-
|
1544 |
-
|
1545 |
-
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
-
public static
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
1553 |
-
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
/*
|
1560 |
-
|
1561 |
-
*/
|
1562 |
-
|
1563 |
-
|
1564 |
-
|
1565 |
-
|
1566 |
-
|
1567 |
-
|
1568 |
-
|
1569 |
-
|
1570 |
-
|
1571 |
-
public static function
|
1572 |
-
|
1573 |
-
|
1574 |
-
|
1575 |
-
|
1576 |
-
|
1577 |
-
|
1578 |
-
|
1579 |
-
|
1580 |
-
|
1581 |
-
|
1582 |
-
|
1583 |
-
|
1584 |
-
|
1585 |
-
|
1586 |
-
|
1587 |
-
|
1588 |
-
|
1589 |
-
|
1590 |
-
|
1591 |
-
|
1592 |
-
|
1593 |
-
|
1594 |
-
|
1595 |
-
|
1596 |
-
|
1597 |
-
|
1598 |
-
|
1599 |
-
|
1600 |
-
|
1601 |
-
|
1602 |
-
|
1603 |
-
|
1604 |
-
|
1605 |
-
|
1606 |
-
|
1607 |
-
|
1608 |
-
|
1609 |
-
|
1610 |
-
|
1611 |
-
|
1612 |
-
|
1613 |
-
|
1614 |
-
|
1615 |
-
|
1616 |
-
|
1617 |
-
|
1618 |
-
|
1619 |
-
|
1620 |
-
|
1621 |
-
|
1622 |
-
|
1623 |
-
|
1624 |
-
|
1625 |
-
|
1626 |
-
|
1627 |
-
|
1628 |
-
|
1629 |
-
|
1630 |
-
|
1631 |
-
|
1632 |
-
|
1633 |
-
|
1634 |
-
|
1635 |
-
|
1636 |
-
|
1637 |
-
|
1638 |
-
|
1639 |
-
|
1640 |
-
|
1641 |
-
|
1642 |
-
|
1643 |
-
|
1644 |
-
|
1645 |
-
|
1646 |
-
|
1647 |
-
|
1648 |
-
|
1649 |
-
|
1650 |
-
|
1651 |
-
|
1652 |
-
|
1653 |
-
|
1654 |
-
|
1655 |
-
|
1656 |
-
|
1657 |
-
|
1658 |
-
|
1659 |
-
|
1660 |
-
|
1661 |
-
|
1662 |
-
|
1663 |
-
|
1664 |
-
|
1665 |
-
|
1666 |
-
|
1667 |
-
|
1668 |
-
|
1669 |
-
|
1670 |
-
|
1671 |
-
|
1672 |
-
|
1673 |
-
|
1674 |
-
|
1675 |
-
|
1676 |
-
|
1677 |
-
|
1678 |
-
|
1679 |
-
|
1680 |
-
|
1681 |
-
|
1682 |
-
|
1683 |
-
|
1684 |
-
|
1685 |
-
|
1686 |
-
}
|
1687 |
-
|
1688 |
-
|
1689 |
-
|
1690 |
-
|
1691 |
-
|
1692 |
-
|
1693 |
-
|
1694 |
-
|
1695 |
-
|
1696 |
-
|
1697 |
-
|
1698 |
-
|
1699 |
-
|
1700 |
-
|
1701 |
-
|
1702 |
-
|
1703 |
-
|
1704 |
-
|
1705 |
-
|
1706 |
-
|
1707 |
-
|
1708 |
-
|
1709 |
-
|
1710 |
-
|
1711 |
-
|
1712 |
-
}
|
1713 |
-
|
1714 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once __DIR__ . '/../MpdfException.php';
|
4 |
+
|
5 |
+
class INDIC
|
6 |
+
{
|
7 |
+
/* FROM hb-ot-shape-complex-indic-private.hh */
|
8 |
+
|
9 |
+
// indic_category
|
10 |
+
const OT_X = 0;
|
11 |
+
const OT_C = 1;
|
12 |
+
const OT_V = 2;
|
13 |
+
const OT_N = 3;
|
14 |
+
const OT_H = 4;
|
15 |
+
const OT_ZWNJ = 5;
|
16 |
+
const OT_ZWJ = 6;
|
17 |
+
const OT_M = 7; /* Matra or Dependent Vowel */
|
18 |
+
const OT_SM = 8;
|
19 |
+
const OT_VD = 9;
|
20 |
+
const OT_A = 10;
|
21 |
+
const OT_NBSP = 11;
|
22 |
+
const OT_DOTTEDCIRCLE = 12; /* Not in the spec, but special in Uniscribe. /Very very/ special! */
|
23 |
+
const OT_RS = 13; /* Register Shifter, used in Khmer OT spec */
|
24 |
+
const OT_Coeng = 14;
|
25 |
+
const OT_Repha = 15;
|
26 |
+
|
27 |
+
const OT_Ra = 16; /* Not explicitly listed in the OT spec, but used in the grammar. */
|
28 |
+
const OT_CM = 17;
|
29 |
+
|
30 |
+
// Based on indic_category used to make string to find syllables
|
31 |
+
// OT_ to string character (using e.g. OT_C from INDIC) hb-ot-shape-complex-indic-private.hh
|
32 |
+
public static $indic_category_char = array(
|
33 |
+
'x',
|
34 |
+
'C',
|
35 |
+
'V',
|
36 |
+
'N',
|
37 |
+
'H',
|
38 |
+
'Z',
|
39 |
+
'J',
|
40 |
+
'M',
|
41 |
+
'S',
|
42 |
+
'v',
|
43 |
+
'A', /* Spec gives Andutta U+0952 as OT_A. However, testing shows that Uniscribe
|
44 |
+
* treats U+0951..U+0952 all as OT_VD - see set_indic_properties */
|
45 |
+
's',
|
46 |
+
'D',
|
47 |
+
'F', /* Register shift Khmer only */
|
48 |
+
'G', /* Khmer only */
|
49 |
+
'r', /* 0D4E (dot reph) only one in Malayalam */
|
50 |
+
'R',
|
51 |
+
'm', /* Consonant medial only used in Indic 0A75 in Gurmukhi (0A00..0A7F) : also in Lao, Myanmar, Tai Tham, Javanese & Cham */
|
52 |
+
);
|
53 |
+
|
54 |
+
/* Visual positions in a syllable from left to right. */
|
55 |
+
/* FROM hb-ot-shape-complex-indic-private.hh */
|
56 |
+
|
57 |
+
// indic_position
|
58 |
+
const POS_START = 0;
|
59 |
+
|
60 |
+
const POS_RA_TO_BECOME_REPH = 1;
|
61 |
+
const POS_PRE_M = 2;
|
62 |
+
const POS_PRE_C = 3;
|
63 |
+
|
64 |
+
const POS_BASE_C = 4;
|
65 |
+
const POS_AFTER_MAIN = 5;
|
66 |
+
|
67 |
+
const POS_ABOVE_C = 6;
|
68 |
+
|
69 |
+
const POS_BEFORE_SUB = 7;
|
70 |
+
const POS_BELOW_C = 8;
|
71 |
+
const POS_AFTER_SUB = 9;
|
72 |
+
|
73 |
+
const POS_BEFORE_POST = 10;
|
74 |
+
const POS_POST_C = 11;
|
75 |
+
const POS_AFTER_POST = 12;
|
76 |
+
|
77 |
+
const POS_FINAL_C = 13;
|
78 |
+
const POS_SMVD = 14;
|
79 |
+
|
80 |
+
const POS_END = 15;
|
81 |
+
|
82 |
+
/*
|
83 |
+
* Basic features.
|
84 |
+
* These features are applied in order, one at a time, after initial_reordering.
|
85 |
+
*/
|
86 |
+
/*
|
87 |
+
* Must be in the same order as the indic_features array. Ones starting with _ are F_GLOBAL
|
88 |
+
* Ones without the _ are only applied where the mask says!
|
89 |
+
*/
|
90 |
+
|
91 |
+
const _NUKT = 0;
|
92 |
+
const _AKHN = 1;
|
93 |
+
const RPHF = 2;
|
94 |
+
const _RKRF = 3;
|
95 |
+
const PREF = 4;
|
96 |
+
const BLWF = 5;
|
97 |
+
const HALF = 6;
|
98 |
+
const ABVF = 7;
|
99 |
+
const PSTF = 8;
|
100 |
+
const CFAR = 9; // Khmer only
|
101 |
+
const _VATU = 10;
|
102 |
+
const _CJCT = 11;
|
103 |
+
const INIT = 12;
|
104 |
+
|
105 |
+
public static function set_indic_properties(&$info, $scriptblock)
|
106 |
+
{
|
107 |
+
$u = $info['uni'];
|
108 |
+
$type = self::indic_get_categories($u);
|
109 |
+
$cat = ($type & 0x7F);
|
110 |
+
$pos = ($type >> 8);
|
111 |
+
|
112 |
+
/*
|
113 |
+
* Re-assign category
|
114 |
+
*/
|
115 |
+
|
116 |
+
if ($u == 0x17D1)
|
117 |
+
$cat = self::OT_X;
|
118 |
+
|
119 |
+
if ($cat == self::OT_X && self::in_range($u, 0x17CB, 0x17D3)) { /* Khmer Various signs */
|
120 |
+
/* These are like Top Matras. */
|
121 |
+
$cat = self::OT_M;
|
122 |
+
$pos = self::POS_ABOVE_C;
|
123 |
+
}
|
124 |
+
|
125 |
+
if ($u == 0x17C6)
|
126 |
+
$cat = self::OT_N; /* Khmer Bindu doesn't like to be repositioned. */
|
127 |
+
|
128 |
+
if ($u == 0x17D2)
|
129 |
+
$cat = self::OT_Coeng; /* Khmer coeng */
|
130 |
+
|
131 |
+
/* The spec says U+0952 is OT_A. However, testing shows that Uniscribe
|
132 |
+
* treats U+0951..U+0952 all as OT_VD.
|
133 |
+
* TESTS:
|
134 |
+
* U+092E,U+0947,U+0952
|
135 |
+
* U+092E,U+0952,U+0947
|
136 |
+
* U+092E,U+0947,U+0951
|
137 |
+
* U+092E,U+0951,U+0947
|
138 |
+
* */
|
139 |
+
//if ($u == 0x0952) $cat = self::OT_A;
|
140 |
+
if (self::in_range($u, 0x0951, 0x0954))
|
141 |
+
$cat = self::OT_VD;
|
142 |
+
|
143 |
+
if ($u == 0x200C)
|
144 |
+
$cat = self::OT_ZWNJ;
|
145 |
+
else if ($u == 0x200D)
|
146 |
+
$cat = self::OT_ZWJ;
|
147 |
+
else if ($u == 0x25CC)
|
148 |
+
$cat = self::OT_DOTTEDCIRCLE;
|
149 |
+
else if ($u == 0x0A71)
|
150 |
+
$cat = self::OT_SM; /* GURMUKHI ADDAK. More like consonant medial. like 0A75. */
|
151 |
+
|
152 |
+
if ($cat == self::OT_Repha) {
|
153 |
+
/* There are two kinds of characters marked as Repha:
|
154 |
+
* - The ones that are GenCat=Mn are already positioned visually, ie. after base. (eg. Khmer)
|
155 |
+
* - The ones that are GenCat=Lo is encoded logically, ie. beginning of syllable. (eg. Malayalam)
|
156 |
+
*
|
157 |
+
* We recategorize the first kind to look like a Nukta and attached to the base directly.
|
158 |
+
*/
|
159 |
+
if ($info['general_category'] == UCDN::UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
|
160 |
+
$cat = self::OT_N;
|
161 |
+
}
|
162 |
+
|
163 |
+
/*
|
164 |
+
* Re-assign position.
|
165 |
+
*/
|
166 |
+
|
167 |
+
if ((self::FLAG($cat) & (self::FLAG(self::OT_C) | self::FLAG(self::OT_CM) | self::FLAG(self::OT_Ra) | self::FLAG(self::OT_V) | self::FLAG(self::OT_NBSP) | self::FLAG(self::OT_DOTTEDCIRCLE)))) { // = CONSONANT_FLAGS like is_consonant
|
168 |
+
if ($scriptblock == UCDN::SCRIPT_KHMER)
|
169 |
+
$pos = self::POS_BELOW_C; /* Khmer differs from Indic here. */
|
170 |
+
else
|
171 |
+
$pos = self::POS_BASE_C; /* Will recategorize later based on font lookups. */
|
172 |
+
|
173 |
+
if (self::is_ra($u))
|
174 |
+
$cat = self::OT_Ra;
|
175 |
+
}
|
176 |
+
else if ($cat == self::OT_M) {
|
177 |
+
$pos = self::matra_position($u, $pos);
|
178 |
+
} else if ($cat == self::OT_SM || $cat == self::OT_VD) {
|
179 |
+
$pos = self::POS_SMVD;
|
180 |
+
}
|
181 |
+
|
182 |
+
if ($u == 0x0B01)
|
183 |
+
$pos = self::POS_BEFORE_SUB; /* Oriya Bindu is BeforeSub in the spec. */
|
184 |
+
|
185 |
+
$info['indic_category'] = $cat;
|
186 |
+
$info['indic_position'] = $pos;
|
187 |
+
}
|
188 |
+
|
189 |
+
// syllable_type
|
190 |
+
const CONSONANT_SYLLABLE = 0;
|
191 |
+
const VOWEL_SYLLABLE = 1;
|
192 |
+
const STANDALONE_CLUSTER = 2;
|
193 |
+
const BROKEN_CLUSTER = 3;
|
194 |
+
const NON_INDIC_CLUSTER = 4;
|
195 |
+
|
196 |
+
public static function set_syllables(&$o, $s, &$broken_syllables)
|
197 |
+
{
|
198 |
+
$ptr = 0;
|
199 |
+
$syllable_serial = 1;
|
200 |
+
$broken_syllables = false;
|
201 |
+
|
202 |
+
while ($ptr < strlen($s)) {
|
203 |
+
$match = '';
|
204 |
+
$syllable_length = 1;
|
205 |
+
$syllable_type = self::NON_INDIC_CLUSTER;
|
206 |
+
// CONSONANT_SYLLABLE Consonant syllable
|
207 |
+
// From OT spec:
|
208 |
+
if (preg_match('/^([CR]m*[N]?(H[ZJ]?|[ZJ]H))*[CR]m*[N]?[A]?(H[ZJ]?|[M]*[N]?[H]?)?[S]?[v]{0,2}/', substr($s, $ptr), $ma)) {
|
209 |
+
// From HarfBuzz:
|
210 |
+
//if (preg_match('/^r?([CR]J?(Z?[N]{0,2})?[ZJ]?H(J[N]?)?){0,4}[CR]J?(Z?[N]{0,2})?A?((([ZJ]?H(J[N]?)?)|HZ)|(HJ)?([ZJ]{0,3}M[N]?(H|JHJR)?){0,4})?(S[Z]?)?[v]{0,2}/', substr($s,$ptr), $ma)) {
|
211 |
+
$syllable_length = strlen($ma[0]);
|
212 |
+
$syllable_type = self::CONSONANT_SYLLABLE;
|
213 |
+
}
|
214 |
+
// VOWEL_SYLLABLE Vowel-based syllable
|
215 |
+
// From OT spec:
|
216 |
+
else if (preg_match('/^(RH|r)?V[N]?([ZJ]?H[CR]m*|J[CR]m*)?([M]*[N]?[H]?)?[S]?[v]{0,2}/', substr($s, $ptr), $ma)) {
|
217 |
+
// From HarfBuzz:
|
218 |
+
//else if (preg_match('/^(RH|r)?V(Z?[N]{0,2})?(J|([ZJ]?H(J[N]?)?[CR]J?(Z?[N]{0,2})?){0,4}((([ZJ]?H(J[N]?)?)|HZ)|(HJ)?([ZJ]{0,3}M[N]?(H|JHJR)?){0,4})?(S[Z]?)?[v]{0,2})/', substr($s,$ptr), $ma)) {
|
219 |
+
$syllable_length = strlen($ma[0]);
|
220 |
+
$syllable_type = self::VOWEL_SYLLABLE;
|
221 |
+
}
|
222 |
+
|
223 |
+
/* Apply only if it's a word start. */
|
224 |
+
// STANDALONE_CLUSTER Stand Alone syllable at start of word
|
225 |
+
// From OT spec:
|
226 |
+
else if (($ptr == 0 ||
|
227 |
+
$o[$ptr - 1]['general_category'] < UCDN::UNICODE_GENERAL_CATEGORY_LOWERCASE_LETTER ||
|
228 |
+
$o[$ptr - 1]['general_category'] > UCDN::UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK
|
229 |
+
) && (preg_match('/^(RH|r)?[sD][N]?([ZJ]?H[CR]m*)?([M]*[N]?[H]?)?[S]?[v]{0,2}/', substr($s, $ptr), $ma))) {
|
230 |
+
// From HarfBuzz:
|
231 |
+
// && (preg_match('/^(RH|r)?[sD](Z?[N]{0,2})?(([ZJ]?H(J[N]?)?)[CR]J?(Z?[N]{0,2})?){0,4}((([ZJ]?H(J[N]?)?)|HZ)|(HJ)?([ZJ]{0,3}M[N]?(H|JHJR)?){0,4})?(S[Z]?)?[v]{0,2}/', substr($s,$ptr), $ma)) {
|
232 |
+
$syllable_length = strlen($ma[0]);
|
233 |
+
$syllable_type = self::STANDALONE_CLUSTER;
|
234 |
+
}
|
235 |
+
|
236 |
+
// BROKEN_CLUSTER syllable
|
237 |
+
else if (preg_match('/^(RH|r)?[N]?([ZJ]?H[CR])?([M]*[N]?[H]?)?[S]?[v]{0,2}/', substr($s, $ptr), $ma)) {
|
238 |
+
// From HarfBuzz:
|
239 |
+
//else if (preg_match('/^(RH|r)?(Z?[N]{0,2})?(([ZJ]?H(J[N]?)?)[CR]J?(Z?[N]{0,2})?){0,4}((([ZJ]?H(J[N]?)?)|HZ)|(HJ)?([ZJ]{0,3}M[N]?(H|JHJR)?){0,4})(S[Z]?)?[v]{0,2}/', substr($s,$ptr), $ma)) {
|
240 |
+
if (strlen($ma[0])) { // May match blank
|
241 |
+
$syllable_length = strlen($ma[0]);
|
242 |
+
$syllable_type = self::BROKEN_CLUSTER;
|
243 |
+
$broken_syllables = true;
|
244 |
+
}
|
245 |
+
}
|
246 |
+
|
247 |
+
for ($i = $ptr; $i < $ptr + $syllable_length; $i++) {
|
248 |
+
$o[$i]['syllable'] = ($syllable_serial << 4) | $syllable_type;
|
249 |
+
}
|
250 |
+
$ptr += $syllable_length;
|
251 |
+
$syllable_serial++;
|
252 |
+
if ($syllable_serial == 16)
|
253 |
+
$syllable_serial = 1;
|
254 |
+
}
|
255 |
+
}
|
256 |
+
|
257 |
+
public static function set_syllables_sinhala(&$o, $s, &$broken_syllables)
|
258 |
+
{
|
259 |
+
$ptr = 0;
|
260 |
+
$syllable_serial = 1;
|
261 |
+
$broken_syllables = false;
|
262 |
+
|
263 |
+
while ($ptr < strlen($s)) {
|
264 |
+
$match = '';
|
265 |
+
$syllable_length = 1;
|
266 |
+
$syllable_type = self::NON_INDIC_CLUSTER;
|
267 |
+
// CONSONANT_SYLLABLE Consonant syllable
|
268 |
+
// From OT spec:
|
269 |
+
if (preg_match('/^([CR]HJ|[CR]JH){0,8}[CR][HM]{0,3}[S]{0,1}/', substr($s, $ptr), $ma)) {
|
270 |
+
$syllable_length = strlen($ma[0]);
|
271 |
+
$syllable_type = self::CONSONANT_SYLLABLE;
|
272 |
+
}
|
273 |
+
// VOWEL_SYLLABLE Vowel-based syllable
|
274 |
+
// From OT spec:
|
275 |
+
else if (preg_match('/^V[S]{0,1}/', substr($s, $ptr), $ma)) {
|
276 |
+
$syllable_length = strlen($ma[0]);
|
277 |
+
$syllable_type = self::VOWEL_SYLLABLE;
|
278 |
+
}
|
279 |
+
|
280 |
+
for ($i = $ptr; $i < $ptr + $syllable_length; $i++) {
|
281 |
+
$o[$i]['syllable'] = ($syllable_serial << 4) | $syllable_type;
|
282 |
+
}
|
283 |
+
$ptr += $syllable_length;
|
284 |
+
$syllable_serial++;
|
285 |
+
if ($syllable_serial == 16)
|
286 |
+
$syllable_serial = 1;
|
287 |
+
}
|
288 |
+
}
|
289 |
+
|
290 |
+
public static function set_syllables_khmer(&$o, $s, &$broken_syllables)
|
291 |
+
{
|
292 |
+
$ptr = 0;
|
293 |
+
$syllable_serial = 1;
|
294 |
+
$broken_syllables = false;
|
295 |
+
|
296 |
+
while ($ptr < strlen($s)) {
|
297 |
+
$match = '';
|
298 |
+
$syllable_length = 1;
|
299 |
+
$syllable_type = self::NON_INDIC_CLUSTER;
|
300 |
+
// CONSONANT_SYLLABLE Consonant syllable
|
301 |
+
if (preg_match('/^r?([CR]J?((Z?F)?[N]{0,2})?[ZJ]?G(JN?)?){0,4}[CR]J?((Z?F)?[N]{0,2})?A?((([ZJ]?G(JN?)?)|GZ)|(GJ)?([ZJ]{0,3}MN?(H|JHJR)?){0,4})?(G([CR]J?((Z?F)?[N]{0,2})?|V))?(SZ?)?[v]{0,2}/', substr($s, $ptr), $ma)) {
|
302 |
+
$syllable_length = strlen($ma[0]);
|
303 |
+
$syllable_type = self::CONSONANT_SYLLABLE;
|
304 |
+
}
|
305 |
+
// VOWEL_SYLLABLE Vowel-based syllable
|
306 |
+
else if (preg_match('/^(RH|r)?V((Z?F)?[N]{0,2})?(J|([ZJ]?G(JN?)?[CR]J?((Z?F)?[N]{0,2})?){0,4}((([ZJ]?G(JN?)?)|GZ)|(GJ)?([ZJ]{0,3}MN?(H|JHJR)?){0,4})?(G([CR]J?((Z?F)?[N]{0,2})?|V))?(SZ?)?[v]{0,2})/', substr($s, $ptr), $ma)) {
|
307 |
+
$syllable_length = strlen($ma[0]);
|
308 |
+
$syllable_type = self::VOWEL_SYLLABLE;
|
309 |
+
}
|
310 |
+
|
311 |
+
|
312 |
+
// BROKEN_CLUSTER syllable
|
313 |
+
else if (preg_match('/^(RH|r)?((Z?F)?[N]{0,2})?(([ZJ]?G(JN?)?)[CR]J?((Z?F)?[N]{0,2})?){0,4}((([ZJ]?G(JN?)?)|GZ)|(GJ)?([ZJ]{0,3}MN?(H|JHJR)?){0,4})(G([CR]J?((Z?F)?[N]{0,2})?|V))?(SZ?)?[v]{0,2}/', substr($s, $ptr), $ma)) {
|
314 |
+
if (strlen($ma[0])) { // May match blank
|
315 |
+
$syllable_length = strlen($ma[0]);
|
316 |
+
$syllable_type = self::BROKEN_CLUSTER;
|
317 |
+
$broken_syllables = true;
|
318 |
+
}
|
319 |
+
}
|
320 |
+
|
321 |
+
for ($i = $ptr; $i < $ptr + $syllable_length; $i++) {
|
322 |
+
$o[$i]['syllable'] = ($syllable_serial << 4) | $syllable_type;
|
323 |
+
}
|
324 |
+
$ptr += $syllable_length;
|
325 |
+
$syllable_serial++;
|
326 |
+
if ($syllable_serial == 16)
|
327 |
+
$syllable_serial = 1;
|
328 |
+
}
|
329 |
+
}
|
330 |
+
|
331 |
+
public static function initial_reordering(&$info, $GSUBdata, $broken_syllables, $indic_config, $scriptblock, $is_old_spec, $dottedcircle)
|
332 |
+
{
|
333 |
+
|
334 |
+
self::update_consonant_positions($info, $GSUBdata);
|
335 |
+
|
336 |
+
if ($broken_syllables && $dottedcircle) {
|
337 |
+
self::insert_dotted_circles($info, $dottedcircle);
|
338 |
+
}
|
339 |
+
|
340 |
+
$count = count($info);
|
341 |
+
if (!$count)
|
342 |
+
return;
|
343 |
+
$last = 0;
|
344 |
+
$last_syllable = $info[0]['syllable'];
|
345 |
+
for ($i = 1; $i < $count; $i++) {
|
346 |
+
if ($last_syllable != $info[$i]['syllable']) {
|
347 |
+
self::initial_reordering_syllable($info, $GSUBdata, $indic_config, $scriptblock, $is_old_spec, $last, $i);
|
348 |
+
$last = $i;
|
349 |
+
$last_syllable = $info[$last]['syllable'];
|
350 |
+
}
|
351 |
+
}
|
352 |
+
self::initial_reordering_syllable($info, $GSUBdata, $indic_config, $scriptblock, $is_old_spec, $last, $count);
|
353 |
+
}
|
354 |
+
|
355 |
+
public static function update_consonant_positions(&$info, $GSUBdata)
|
356 |
+
{
|
357 |
+
$count = count($info);
|
358 |
+
for ($i = 0; $i < $count; $i++) {
|
359 |
+
if ($info[$i]['indic_position'] == self::POS_BASE_C) {
|
360 |
+
$c = $info[$i]['uni'];
|
361 |
+
// If would substitute...
|
362 |
+
if (isset($GSUBdata['pref'][$c])) {
|
363 |
+
$info[$i]['indic_position'] = self::POS_POST_C;
|
364 |
+
} else if (isset($GSUBdata['blwf'][$c])) {
|
365 |
+
$info[$i]['indic_position'] = self::POS_BELOW_C;
|
366 |
+
} else if (isset($GSUBdata['pstf'][$c])) {
|
367 |
+
$info[$i]['indic_position'] = self::POS_POST_C;
|
368 |
+
}
|
369 |
+
}
|
370 |
+
}
|
371 |
+
}
|
372 |
+
|
373 |
+
public static function insert_dotted_circles(&$info, $dottedcircle)
|
374 |
+
{
|
375 |
+
$idx = 0;
|
376 |
+
$last_syllable = 0;
|
377 |
+
while ($idx < count($info)) {
|
378 |
+
$syllable = $info[$idx]['syllable'];
|
379 |
+
$syllable_type = ($syllable & 0x0F);
|
380 |
+
if ($last_syllable != $syllable && $syllable_type == self::BROKEN_CLUSTER) {
|
381 |
+
$last_syllable = $syllable;
|
382 |
+
|
383 |
+
$dottedcircle[0]['syllable'] = $info[$idx]['syllable'];
|
384 |
+
|
385 |
+
/* Insert dottedcircle after possible Repha. */
|
386 |
+
while ($idx < count($info) && $last_syllable == $info[$idx]['syllable'] && $info[$idx]['indic_category'] == self::OT_Repha)
|
387 |
+
$idx++;
|
388 |
+
array_splice($info, $idx, 0, $dottedcircle);
|
389 |
+
} else {
|
390 |
+
$idx++;
|
391 |
+
}
|
392 |
+
}
|
393 |
+
|
394 |
+
// I am not sue how this code below got in here, since $idx should now be > count($info) and thus invalid.
|
395 |
+
// In case I am missing something(!) I'll leave a warning here for now:
|
396 |
+
if (isset($info[$idx])) {
|
397 |
+
throw new MpdfException('Unexpected error occured in Indic processing');
|
398 |
+
}
|
399 |
+
// In case of final bloken cluster...
|
400 |
+
//$syllable = $info[$idx]['syllable'];
|
401 |
+
//$syllable_type = ($syllable & 0x0F);
|
402 |
+
//if ($last_syllable != $syllable && $syllable_type == self::BROKEN_CLUSTER) {
|
403 |
+
// $dottedcircle[0]['syllable'] = $info[$idx]['syllable'];
|
404 |
+
// array_splice($info, $idx, 0, $dottedcircle);
|
405 |
+
//}
|
406 |
+
}
|
407 |
+
|
408 |
+
/* Rules from:
|
409 |
+
* https://www.microsoft.com/typography/otfntdev/devanot/shaping.aspx */
|
410 |
+
|
411 |
+
public static function initial_reordering_syllable(&$info, $GSUBdata, $indic_config, $scriptblock, $is_old_spec, $start, $end)
|
412 |
+
{
|
413 |
+
/* vowel_syllable: We made the vowels look like consonants. So uses the consonant logic! */
|
414 |
+
/* broken_cluster: We already inserted dotted-circles, so just call the standalone_cluster. */
|
415 |
+
/* standalone_cluster: We treat NBSP/dotted-circle as if they are consonants, so we should just chain. */
|
416 |
+
|
417 |
+
$syllable_type = ($info[$start]['syllable'] & 0x0F);
|
418 |
+
if ($syllable_type == self::NON_INDIC_CLUSTER) {
|
419 |
+
return;
|
420 |
+
}
|
421 |
+
if ($syllable_type == self::BROKEN_CLUSTER || $syllable_type == self::STANDALONE_CLUSTER) {
|
422 |
+
//if ($uniscribe_bug_compatible) {
|
423 |
+
/* For dotted-circle, this is what Uniscribe does:
|
424 |
+
* If dotted-circle is the last glyph, it just does nothing.
|
425 |
+
* i.e. It doesn't form Reph. */
|
426 |
+
if ($info[$end - 1]['indic_category'] == self::OT_DOTTEDCIRCLE) {
|
427 |
+
return;
|
428 |
+
}
|
429 |
+
}
|
430 |
+
|
431 |
+
/* 1. Find base consonant:
|
432 |
+
*
|
433 |
+
* The shaping engine finds the base consonant of the syllable, using the
|
434 |
+
* following algorithm: starting from the end of the syllable, move backwards
|
435 |
+
* until a consonant is found that does not have a below-base or post-base
|
436 |
+
* form (post-base forms have to follow below-base forms), or that is not a
|
437 |
+
* pre-base reordering Ra, or arrive at the first consonant. The consonant
|
438 |
+
* stopped at will be the base.
|
439 |
+
*
|
440 |
+
* o If the syllable starts with Ra + Halant (in a script that has Reph)
|
441 |
+
* and has more than one consonant, Ra is excluded from candidates for
|
442 |
+
* base consonants.
|
443 |
+
*/
|
444 |
+
|
445 |
+
$base = $end;
|
446 |
+
$has_reph = false;
|
447 |
+
$limit = $start;
|
448 |
+
|
449 |
+
if ($scriptblock != UCDN::SCRIPT_KHMER) {
|
450 |
+
/* -> If the syllable starts with Ra + Halant (in a script that has Reph)
|
451 |
+
* and has more than one consonant, Ra is excluded from candidates for
|
452 |
+
* base consonants. */
|
453 |
+
if (count($GSUBdata['rphf']) /* ?? $indic_plan->mask_array[RPHF] */ && $start + 3 <= $end &&
|
454 |
+
(
|
455 |
+
($indic_config[4] == self::REPH_MODE_IMPLICIT && !self::is_joiner($info[$start + 2])) ||
|
456 |
+
($indic_config[4] == self::REPH_MODE_EXPLICIT && $info[$start + 2]['indic_category'] == self::OT_ZWJ)
|
457 |
+
)) {
|
458 |
+
/* See if it matches the 'rphf' feature. */
|
459 |
+
//$glyphs = array($info[$start]['uni'], $info[$start + 1]['uni']);
|
460 |
+
//if ($indic_plan->rphf->would_substitute ($glyphs, count($glyphs), true, face)) {
|
461 |
+
if (isset($GSUBdata['rphf'][$info[$start]['uni']]) && self::is_halant_or_coeng($info[$start + 1])) {
|
462 |
+
$limit += 2;
|
463 |
+
while ($limit < $end && self::is_joiner($info[$limit]))
|
464 |
+
$limit++;
|
465 |
+
$base = $start;
|
466 |
+
$has_reph = true;
|
467 |
+
}
|
468 |
+
} else if ($indic_config[4] == self::REPH_MODE_LOG_REPHA && $info[$start]['indic_category'] == self::OT_Repha) {
|
469 |
+
$limit += 1;
|
470 |
+
while ($limit < $end && self::is_joiner($info[$limit]))
|
471 |
+
$limit++;
|
472 |
+
$base = $start;
|
473 |
+
$has_reph = true;
|
474 |
+
}
|
475 |
+
}
|
476 |
+
|
477 |
+
switch ($indic_config[2]) { // base_pos
|
478 |
+
case self::BASE_POS_LAST:
|
479 |
+
/* -> starting from the end of the syllable, move backwards */
|
480 |
+
$i = $end;
|
481 |
+
$seen_below = false;
|
482 |
+
do {
|
483 |
+
$i--;
|
484 |
+
/* -> until a consonant is found */
|
485 |
+
if (self::is_consonant($info[$i])) {
|
486 |
+
/* -> that does not have a below-base or post-base form
|
487 |
+
* (post-base forms have to follow below-base forms), */
|
488 |
+
if ($info[$i]['indic_position'] != self::POS_BELOW_C && ($info[$i]['indic_position'] != self::POS_POST_C || $seen_below)) {
|
489 |
+
$base = $i;
|
490 |
+
break;
|
491 |
+
}
|
492 |
+
if ($info[$i]['indic_position'] == self::POS_BELOW_C)
|
493 |
+
$seen_below = true;
|
494 |
+
|
495 |
+
/* -> or that is not a pre-base reordering Ra,
|
496 |
+
*
|
497 |
+
* IMPLEMENTATION NOTES:
|
498 |
+
*
|
499 |
+
* Our pre-base reordering Ra's are marked POS_POST_C, so will be skipped
|
500 |
+
* by the logic above already.
|
501 |
+
*/
|
502 |
+
|
503 |
+
/* -> or arrive at the first consonant. The consonant stopped at will
|
504 |
+
* be the base. */
|
505 |
+
$base = $i;
|
506 |
+
}
|
507 |
+
else {
|
508 |
+
/* A ZWJ after a Halant stops the base search, and requests an explicit
|
509 |
+
* half form.
|
510 |
+
* [A ZWJ before a Halant, requests a subjoined form instead, and hence
|
511 |
+
* search continues. This is particularly important for Bengali
|
512 |
+
* sequence Ra,H,Ya that should form Ya-Phalaa by subjoining Ya] */
|
513 |
+
if ($start < $i && $info[$i]['indic_category'] == self::OT_ZWJ && $info[$i - 1]['indic_category'] == self::OT_H) {
|
514 |
+
if (!defined("OMIT_INDIC_FIX_1") || OMIT_INDIC_FIX_1 != 1) {
|
515 |
+
$base = $i;
|
516 |
+
} // INDIC_FIX_1
|
517 |
+
break;
|
518 |
+
}
|
519 |
+
// ZKI8
|
520 |
+
if ($start < $i && $info[$i]['indic_category'] == self::OT_ZWNJ) {
|
521 |
+
break;
|
522 |
+
}
|
523 |
+
}
|
524 |
+
} while ($i > $limit);
|
525 |
+
break;
|
526 |
+
|
527 |
+
case self::BASE_POS_FIRST:
|
528 |
+
/* In scripts without half forms (eg. Khmer), the first consonant is always the base. */
|
529 |
+
|
530 |
+
if (!$has_reph)
|
531 |
+
$base = $limit;
|
532 |
+
|
533 |
+
/* Find the last base consonant that is not blocked by ZWJ. If there is
|
534 |
+
* a ZWJ right before a base consonant, that would request a subjoined form. */
|
535 |
+
for ($i = $limit; $i < $end; $i++) {
|
536 |
+
if (self::is_consonant($info[$i]) && $info[$i]['indic_position'] == self::POS_BASE_C) {
|
537 |
+
if ($limit < $i && $info[$i - 1]['indic_category'] == self::OT_ZWJ)
|
538 |
+
break;
|
539 |
+
else
|
540 |
+
$base = $i;
|
541 |
+
}
|
542 |
+
}
|
543 |
+
|
544 |
+
/* Mark all subsequent consonants as below. */
|
545 |
+
for ($i = $base + 1; $i < $end; $i++) {
|
546 |
+
if (self::is_consonant($info[$i]) && $info[$i]['indic_position'] == self::POS_BASE_C)
|
547 |
+
$info[$i]['indic_position'] = self::POS_BELOW_C;
|
548 |
+
}
|
549 |
+
break;
|
550 |
+
//default:
|
551 |
+
//assert (false);
|
552 |
+
/* fallthrough */
|
553 |
+
}
|
554 |
+
|
555 |
+
/* -> If the syllable starts with Ra + Halant (in a script that has Reph)
|
556 |
+
* and has more than one consonant, Ra is excluded from candidates for
|
557 |
+
* base consonants.
|
558 |
+
*
|
559 |
+
* Only do this for unforced Reph. (ie. not for Ra,H,ZWJ. */
|
560 |
+
if ($scriptblock != UCDN::SCRIPT_KHMER) {
|
561 |
+
if ($has_reph && $base == $start && $limit - $base <= 2) {
|
562 |
+
/* Have no other consonant, so Reph is not formed and Ra becomes base. */
|
563 |
+
$has_reph = false;
|
564 |
+
}
|
565 |
+
}
|
566 |
+
|
567 |
+
/* 2. Decompose and reorder Matras:
|
568 |
+
*
|
569 |
+
* Each matra and any syllable modifier sign in the cluster are moved to the
|
570 |
+
* appropriate position relative to the consonant(s) in the cluster. The
|
571 |
+
* shaping engine decomposes two- or three-part matras into their constituent
|
572 |
+
* parts before any repositioning. Matra characters are classified by which
|
573 |
+
* consonant in a conjunct they have affinity for and are reordered to the
|
574 |
+
* following positions:
|
575 |
+
*
|
576 |
+
* o Before first half form in the syllable
|
577 |
+
* o After subjoined consonants
|
578 |
+
* o After post-form consonant
|
579 |
+
* o After main consonant (for above marks)
|
580 |
+
*
|
581 |
+
* IMPLEMENTATION NOTES:
|
582 |
+
*
|
583 |
+
* The normalize() routine has already decomposed matras for us, so we don't
|
584 |
+
* need to worry about that.
|
585 |
+
*/
|
586 |
+
|
587 |
+
|
588 |
+
/* 3. Reorder marks to canonical order:
|
589 |
+
*
|
590 |
+
* Adjacent nukta and halant or nukta and vedic sign are always repositioned
|
591 |
+
* if necessary, so that the nukta is first.
|
592 |
+
*
|
593 |
+
* IMPLEMENTATION NOTES:
|
594 |
+
*
|
595 |
+
* Use the combining Class from Unicode categories? to bubble_sort.
|
596 |
+
*/
|
597 |
+
|
598 |
+
/* Reorder characters */
|
599 |
+
|
600 |
+
for ($i = $start; $i < $base; $i++)
|
601 |
+
$info[$i]['indic_position'] = min(self::POS_PRE_C, $info[$i]['indic_position']);
|
602 |
+
|
603 |
+
if ($base < $end)
|
604 |
+
$info[$base]['indic_position'] = self::POS_BASE_C;
|
605 |
+
|
606 |
+
/* Mark final consonants. A final consonant is one appearing after a matra,
|
607 |
+
* ? only in Khmer. */
|
608 |
+
for ($i = $base + 1; $i < $end; $i++)
|
609 |
+
if ($info[$i]['indic_category'] == self::OT_M) {
|
610 |
+
for ($j = $i + 1; $j < $end; $j++)
|
611 |
+
if (self::is_consonant($info[$j])) {
|
612 |
+
$info[$j]['indic_position'] = self::POS_FINAL_C;
|
613 |
+
break;
|
614 |
+
}
|
615 |
+
break;
|
616 |
+
}
|
617 |
+
|
618 |
+
/* Handle beginning Ra */
|
619 |
+
if ($scriptblock != UCDN::SCRIPT_KHMER) {
|
620 |
+
if ($has_reph)
|
621 |
+
$info[$start]['indic_position'] = self::POS_RA_TO_BECOME_REPH;
|
622 |
+
}
|
623 |
+
|
624 |
+
|
625 |
+
/* For old-style Indic script tags, move the first post-base Halant after
|
626 |
+
* last consonant. Only do this if there is *not* a Halant after last
|
627 |
+
* consonant. Otherwise it becomes messy. */
|
628 |
+
if ($is_old_spec) {
|
629 |
+
for ($i = $base + 1; $i < $end; $i++) {
|
630 |
+
if ($info[$i]['indic_category'] == self::OT_H) {
|
631 |
+
for ($j = $end - 1; $j > $i; $j--) {
|
632 |
+
if (self::is_consonant($info[$j]) || $info[$j]['indic_category'] == self::OT_H) {
|
633 |
+
break;
|
634 |
+
}
|
635 |
+
}
|
636 |
+
if ($info[$j]['indic_category'] != self::OT_H && $j > $i) {
|
637 |
+
/* Move Halant to after last consonant. */
|
638 |
+
self::_move_info_pos($info, $i, $j + 1);
|
639 |
+
}
|
640 |
+
break;
|
641 |
+
}
|
642 |
+
}
|
643 |
+
}
|
644 |
+
|
645 |
+
/* Attach misc marks to previous char to move with them. */
|
646 |
+
$last_pos = self::POS_START;
|
647 |
+
for ($i = $start; $i < $end; $i++) {
|
648 |
+
if ((self::FLAG($info[$i]['indic_category']) & (self::FLAG(self::OT_ZWJ) | self::FLAG(self::OT_ZWNJ) | self::FLAG(self::OT_N) | self::FLAG(self::OT_RS) | self::FLAG(self::OT_H) | self::FLAG(self::OT_Coeng) ))) {
|
649 |
+
$info[$i]['indic_position'] = $last_pos;
|
650 |
+
if ($info[$i]['indic_category'] == self::OT_H && $info[$i]['indic_position'] == self::POS_PRE_M) {
|
651 |
+
/*
|
652 |
+
* Uniscribe doesn't move the Halant with Left Matra.
|
653 |
+
* TEST: U+092B,U+093F,U+094DE
|
654 |
+
* We follow. This is important for the Sinhala
|
655 |
+
* U+0DDA split matra since it decomposes to U+0DD9,U+0DCA
|
656 |
+
* where U+0DD9 is a left matra and U+0DCA is the virama.
|
657 |
+
* We don't want to move the virama with the left matra.
|
658 |
+
* TEST: U+0D9A,U+0DDA
|
659 |
+
*/
|
660 |
+
for ($j = $i; $j > $start; $j--)
|
661 |
+
if ($info[$j - 1]['indic_position'] != self::POS_PRE_M) {
|
662 |
+
$info[$i]['indic_position'] = $info[$j - 1]['indic_position'];
|
663 |
+
break;
|
664 |
+
}
|
665 |
+
}
|
666 |
+
} else if ($info[$i]['indic_position'] != self::POS_SMVD) {
|
667 |
+
$last_pos = $info[$i]['indic_position'];
|
668 |
+
}
|
669 |
+
}
|
670 |
+
|
671 |
+
/* Re-attach ZWJ, ZWNJ, and halant to next char, for after-base consonants. */
|
672 |
+
$last_halant = $end;
|
673 |
+
for ($i = $base + 1; $i < $end; $i++) {
|
674 |
+
if (self::is_halant_or_coeng($info[$i]))
|
675 |
+
$last_halant = $i;
|
676 |
+
else if (self::is_consonant($info[$i])) {
|
677 |
+
for ($j = $last_halant; $j < $i; $j++)
|
678 |
+
if ($info[$j]['indic_position'] != self::POS_SMVD)
|
679 |
+
$info[$j]['indic_position'] = $info[$i]['indic_position'];
|
680 |
+
}
|
681 |
+
}
|
682 |
+
|
683 |
+
|
684 |
+
if ($scriptblock == UCDN::SCRIPT_KHMER) {
|
685 |
+
/* KHMER_FIX_2 */
|
686 |
+
/* Move Coeng+RO (Halant,Ra) sequence before base consonant. */
|
687 |
+
for ($i = $base + 1; $i < $end; $i++) {
|
688 |
+
if (self::is_halant_or_coeng($info[$i]) && self::is_ra($info[$i + 1]['uni'])) {
|
689 |
+
$info[$i]['indic_position'] = self::POS_PRE_C;
|
690 |
+
$info[$i + 1]['indic_position'] = self::POS_PRE_C;
|
691 |
+
break;
|
692 |
+
}
|
693 |
+
}
|
694 |
+
}
|
695 |
+
|
696 |
+
|
697 |
+
/*
|
698 |
+
if (!defined("OMIT_INDIC_FIX_2") || OMIT_INDIC_FIX_2 != 1) {
|
699 |
+
// INDIC_FIX_2
|
700 |
+
$ZWNJ_found = false;
|
701 |
+
$POST_ZWNJ_c_found = false;
|
702 |
+
for ($i = $base + 1; $i < $end; $i++) {
|
703 |
+
if ($info[$i]['indic_category'] == self::OT_ZWNJ) { $ZWNJ_found = true; }
|
704 |
+
else if ($ZWNJ_found && $info[$i]['indic_category'] == self::OT_C) { $POST_ZWNJ_c_found = true; }
|
705 |
+
else if ($POST_ZWNJ_c_found && $info[$i]['indic_position'] == self::POS_BEFORE_SUB) { $info[$i]['indic_position'] = self::POS_AFTER_SUB; }
|
706 |
+
}
|
707 |
+
}
|
708 |
+
*/
|
709 |
+
|
710 |
+
/* Setup masks now */
|
711 |
+
for ($i = $start; $i < $end; $i++) {
|
712 |
+
$info[$i]['mask'] = 0;
|
713 |
+
}
|
714 |
+
|
715 |
+
|
716 |
+
if ($scriptblock == UCDN::SCRIPT_KHMER) {
|
717 |
+
/* Find a Coeng+RO (Halant,Ra) sequence and mark it for pre-base processing. */
|
718 |
+
$mask = self::FLAG(self::PREF);
|
719 |
+
for ($i = $base; $i < $end - 1; $i++) { /* KHMER_FIX_1 From $start (not base) */
|
720 |
+
if (self::is_halant_or_coeng($info[$i]) && self::is_ra($info[$i + 1]['uni'])) {
|
721 |
+
|
722 |
+
$info[$i]['mask'] |= self::FLAG(self::PREF);
|
723 |
+
$info[$i + 1]['mask'] |= self::FLAG(self::PREF);
|
724 |
+
|
725 |
+
/* Mark the subsequent stuff with 'cfar'. Used in Khmer.
|
726 |
+
* Read the feature spec.
|
727 |
+
* This allows distinguishing the following cases with MS Khmer fonts:
|
728 |
+
* U+1784,U+17D2,U+179A,U+17D2,U+1782 [C+Coeng+RO+Coeng+C] => Should activate CFAR
|
729 |
+
* U+1784,U+17D2,U+1782,U+17D2,U+179A [C+Coeng+C+Coeng+RO] => Should NOT activate CFAR
|
730 |
+
*/
|
731 |
+
for ($j = ($i + 2); $j < $end; $j++)
|
732 |
+
$info[$j]['mask'] |= self::FLAG(self::CFAR);
|
733 |
+
|
734 |
+
break;
|
735 |
+
}
|
736 |
+
}
|
737 |
+
}
|
738 |
+
|
739 |
+
|
740 |
+
|
741 |
+
/* Sit tight, rock 'n roll! */
|
742 |
+
self::bubble_sort($info, $start, $end - $start);
|
743 |
+
|
744 |
+
/* Find base again */
|
745 |
+
$base = $end;
|
746 |
+
for ($i = $start; $i < $end; $i++) {
|
747 |
+
if ($info[$i]['indic_position'] == self::POS_BASE_C) {
|
748 |
+
$base = $i;
|
749 |
+
break;
|
750 |
+
}
|
751 |
+
}
|
752 |
+
|
753 |
+
if ($scriptblock != UCDN::SCRIPT_KHMER) {
|
754 |
+
/* Reph */
|
755 |
+
for ($i = $start; $i < $end; $i++) {
|
756 |
+
if ($info[$i]['indic_position'] == self::POS_RA_TO_BECOME_REPH) {
|
757 |
+
$info[$i]['mask'] |= self::FLAG(self::RPHF);
|
758 |
+
}
|
759 |
+
}
|
760 |
+
|
761 |
+
/* Pre-base */
|
762 |
+
$mask = self::FLAG(self::HALF);
|
763 |
+
for ($i = $start; $i < $base; $i++) {
|
764 |
+
$info[$i]['mask'] |= $mask;
|
765 |
+
}
|
766 |
+
}
|
767 |
+
|
768 |
+
/* Post-base */
|
769 |
+
$mask = (self::FLAG(self::BLWF) | self::FLAG(self::ABVF) | self::FLAG(self::PSTF));
|
770 |
+
for ($i = $base + 1; $i < $end; $i++) {
|
771 |
+
$info[$i]['mask'] |= $mask;
|
772 |
+
}
|
773 |
+
|
774 |
+
|
775 |
+
if ($scriptblock != UCDN::SCRIPT_KHMER) {
|
776 |
+
if (!defined("OMIT_INDIC_FIX_3") || OMIT_INDIC_FIX_3 != 1) {
|
777 |
+
/* INDIC_FIX_3 */
|
778 |
+
/* Find a (pre-base) Consonant, Halant,Ra sequence and mark Halant|Ra for below-base BLWF processing. */
|
779 |
+
// TEST CASE ক্র্ক in FreeSans versus Vrinda
|
780 |
+
if (($base - $start) >= 3) {
|
781 |
+
for ($i = $start; $i < ($base - 2); $i++) {
|
782 |
+
if (self::is_consonant($info[$i])) {
|
783 |
+
if (self::is_halant_or_coeng($info[$i + 1]) && self::is_ra($info[$i + 2]['uni'])) {
|
784 |
+
// If would substitute Halant+Ra...BLWF
|
785 |
+
if (isset($GSUBdata['blwf'][$info[$i + 2]['uni']])) {
|
786 |
+
$info[$i + 1]['mask'] |= self::FLAG(self::BLWF);
|
787 |
+
$info[$i + 2]['mask'] |= self::FLAG(self::BLWF);
|
788 |
+
}
|
789 |
+
/* If would not substitute as blwf, mark Ra+Halant for RPHF using following Halant (if present) */ else if (self::is_halant_or_coeng($info[$i + 3])) {
|
790 |
+
$info[$i + 2]['mask'] |= self::FLAG(self::RPHF);
|
791 |
+
$info[$i + 3]['mask'] |= self::FLAG(self::RPHF);
|
792 |
+
}
|
793 |
+
break;
|
794 |
+
}
|
795 |
+
}
|
796 |
+
}
|
797 |
+
}
|
798 |
+
}
|
799 |
+
}
|
800 |
+
|
801 |
+
|
802 |
+
|
803 |
+
if ($is_old_spec && $scriptblock == UCDN::SCRIPT_DEVANAGARI) {
|
804 |
+
/* Old-spec eye-lash Ra needs special handling. From the spec:
|
805 |
+
* "The feature 'below-base form' is applied to consonants
|
806 |
+
* having below-base forms and following the base consonant.
|
807 |
+
* The exception is vattu, which may appear below half forms
|
808 |
+
* as well as below the base glyph. The feature 'below-base
|
809 |
+
* form' will be applied to all such occurrences of Ra as well."
|
810 |
+
*
|
811 |
+
* Test case: U+0924,U+094D,U+0930,U+094d,U+0915
|
812 |
+
* with Sanskrit 2003 font.
|
813 |
+
*
|
814 |
+
* However, note that Ra,Halant,ZWJ is the correct way to
|
815 |
+
* request eyelash form of Ra, so we wouldbn't inhibit it
|
816 |
+
* in that sequence.
|
817 |
+
*
|
818 |
+
* Test case: U+0924,U+094D,U+0930,U+094d,U+200D,U+0915
|
819 |
+
*/
|
820 |
+
for ($i = $start; ($i + 1) < $base; $i++) {
|
821 |
+
if ($info[$i]['indic_category'] == self::OT_Ra && $info[$i + 1]['indic_category'] == self::OT_H &&
|
822 |
+
($i + 2 == $base || $info[$i + 2]['indic_category'] != self::OT_ZWJ)) {
|
823 |
+
$info[$i]['mask'] |= self::FLAG(self::BLWF);
|
824 |
+
$info[$i + 1]['mask'] |= self::FLAG(self::BLWF);
|
825 |
+
}
|
826 |
+
}
|
827 |
+
}
|
828 |
+
|
829 |
+
if ($scriptblock != UCDN::SCRIPT_KHMER) {
|
830 |
+
if (count($GSUBdata['pref']) && $base + 2 < $end) {
|
831 |
+
/* Find a Halant,Ra sequence and mark it for pre-base processing. */
|
832 |
+
for ($i = $base + 1; $i + 1 < $end; $i++) {
|
833 |
+
// If old_spec find Ra-Halant...
|
834 |
+
if ((isset($GSUBdata['pref'][$info[$i + 1]['uni']]) && self::is_halant_or_coeng($info[$i]) && self::is_ra($info[$i + 1]['uni']) ) ||
|
835 |
+
($is_old_spec && isset($GSUBdata['pref'][$info[$i]['uni']]) && self::is_halant_or_coeng($info[$i + 1]) && self::is_ra($info[$i]['uni']) )
|
836 |
+
) {
|
837 |
+
$info[$i++]['mask'] |= self::FLAG(self::PREF);
|
838 |
+
$info[$i++]['mask'] |= self::FLAG(self::PREF);
|
839 |
+
break;
|
840 |
+
}
|
841 |
+
}
|
842 |
+
}
|
843 |
+
}
|
844 |
+
|
845 |
+
|
846 |
+
/* Apply ZWJ/ZWNJ effects */
|
847 |
+
for ($i = $start + 1; $i < $end; $i++) {
|
848 |
+
if (self::is_joiner($info[$i])) {
|
849 |
+
$non_joiner = ($info[$i]['indic_category'] == self::OT_ZWNJ);
|
850 |
+
$j = $i;
|
851 |
+
while ($j > $start) {
|
852 |
+
if (defined("OMIT_INDIC_FIX_4") && OMIT_INDIC_FIX_4 == 1) {
|
853 |
+
// INDIC_FIX_4 = do nothing - carry on //
|
854 |
+
// ZWNJ should block H C from forming blwf post-base - need to unmask backwards beyond first consonant arrived at //
|
855 |
+
if (!self::is_consonant($info[$j])) {
|
856 |
+
break;
|
857 |
+
}
|
858 |
+
}
|
859 |
+
$j--;
|
860 |
+
|
861 |
+
/* ZWJ/ZWNJ should disable CJCT. They do that by simply
|
862 |
+
* being there, since we don't skip them for the CJCT
|
863 |
+
* feature (ie. F_MANUAL_ZWJ) */
|
864 |
+
|
865 |
+
/* A ZWNJ disables HALF. */
|
866 |
+
if ($non_joiner) {
|
867 |
+
$info[$j]['mask'] &= ~(self::FLAG(self::HALF) | self::FLAG(self::BLWF));
|
868 |
+
}
|
869 |
+
}
|
870 |
+
}
|
871 |
+
}
|
872 |
+
}
|
873 |
+
|
874 |
+
public static function final_reordering(&$info, $GSUBdata, $indic_config, $scriptblock, $is_old_spec)
|
875 |
+
{
|
876 |
+
$count = count($info);
|
877 |
+
if (!$count)
|
878 |
+
return;
|
879 |
+
$last = 0;
|
880 |
+
$last_syllable = $info[0]['syllable'];
|
881 |
+
for ($i = 1; $i < $count; $i++) {
|
882 |
+
if ($last_syllable != $info[$i]['syllable']) {
|
883 |
+
self::final_reordering_syllable($info, $GSUBdata, $indic_config, $scriptblock, $is_old_spec, $last, $i);
|
884 |
+
$last = $i;
|
885 |
+
$last_syllable = $info[$last]['syllable'];
|
886 |
+
}
|
887 |
+
}
|
888 |
+
self::final_reordering_syllable($info, $GSUBdata, $indic_config, $scriptblock, $is_old_spec, $last, $count);
|
889 |
+
}
|
890 |
+
|
891 |
+
public static function final_reordering_syllable(&$info, $GSUBdata, $indic_config, $scriptblock, $is_old_spec, $start, $end)
|
892 |
+
{
|
893 |
+
|
894 |
+
/* 4. Final reordering:
|
895 |
+
*
|
896 |
+
* After the localized forms and basic shaping forms GSUB features have been
|
897 |
+
* applied (see below), the shaping engine performs some final glyph
|
898 |
+
* reordering before applying all the remaining font features to the entire
|
899 |
+
* cluster.
|
900 |
+
*/
|
901 |
+
|
902 |
+
/* Find base again */
|
903 |
+
for ($base = $start; $base < $end; $base++)
|
904 |
+
if ($info[$base]['indic_position'] >= self::POS_BASE_C) {
|
905 |
+
if ($start < $base && $info[$base]['indic_position'] > self::POS_BASE_C)
|
906 |
+
$base--;
|
907 |
+
break;
|
908 |
+
}
|
909 |
+
if ($base == $end && $start < $base && $info[$base - 1]['indic_category'] != self::OT_ZWJ)
|
910 |
+
$base--;
|
911 |
+
while ($start < $base && isset($info[$base]) && ($info[$base]['indic_category'] == self::OT_H || $info[$base]['indic_category'] == self::OT_N))
|
912 |
+
$base--;
|
913 |
+
|
914 |
+
|
915 |
+
/* o Reorder matras:
|
916 |
+
*
|
917 |
+
* If a pre-base matra character had been reordered before applying basic
|
918 |
+
* features, the glyph can be moved closer to the main consonant based on
|
919 |
+
* whether half-forms had been formed. Actual position for the matra is
|
920 |
+
* defined as "after last standalone halant glyph, after initial matra
|
921 |
+
* position and before the main consonant". If ZWJ or ZWNJ follow this
|
922 |
+
* halant, position is moved after it.
|
923 |
+
*/
|
924 |
+
|
925 |
+
|
926 |
+
if ($start + 1 < $end && $start < $base) { /* Otherwise there can't be any pre-base matra characters. */
|
927 |
+
/* If we lost track of base, alas, position before last thingy. */
|
928 |
+
$new_pos = ($base == $end) ? $base - 2 : $base - 1;
|
929 |
+
|
930 |
+
/* Malayalam / Tamil do not have "half" forms or explicit virama forms.
|
931 |
+
* The glyphs formed by 'half' are Chillus or ligated explicit viramas.
|
932 |
+
* We want to position matra after them.
|
933 |
+
*/
|
934 |
+
if ($scriptblock != UCDN::SCRIPT_MALAYALAM && $scriptblock != UCDN::SCRIPT_TAMIL) {
|
935 |
+
while ($new_pos > $start && !(self::is_one_of($info[$new_pos], (self::FLAG(self::OT_M) | self::FLAG(self::OT_H) | self::FLAG(self::OT_Coeng)))))
|
936 |
+
$new_pos--;
|
937 |
+
|
938 |
+
/* If we found no Halant we are done.
|
939 |
+
* Otherwise only proceed if the Halant does
|
940 |
+
* not belong to the Matra itself! */
|
941 |
+
if (self::is_halant_or_coeng($info[$new_pos]) && $info[$new_pos]['indic_position'] != self::POS_PRE_M) {
|
942 |
+
/* -> If ZWJ or ZWNJ follow this halant, position is moved after it. */
|
943 |
+
if ($new_pos + 1 < $end && self::is_joiner($info[$new_pos + 1]))
|
944 |
+
$new_pos++;
|
945 |
+
} else
|
946 |
+
$new_pos = $start; /* No move. */
|
947 |
+
}
|
948 |
+
|
949 |
+
if ($start < $new_pos && $info[$new_pos]['indic_position'] != self::POS_PRE_M) {
|
950 |
+
/* Now go see if there's actually any matras... */
|
951 |
+
for ($i = $new_pos; $i > $start; $i--)
|
952 |
+
if ($info[$i - 1]['indic_position'] == self::POS_PRE_M) {
|
953 |
+
$old_pos = $i - 1;
|
954 |
+
//memmove (&info[$old_pos], &info[$old_pos + 1], ($new_pos - $old_pos) * sizeof ($info[0]));
|
955 |
+
self::_move_info_pos($info, $old_pos, $new_pos + 1);
|
956 |
+
|
957 |
+
if ($old_pos < $base && $base <= $new_pos) /* Shouldn't actually happen. */
|
958 |
+
$base--;
|
959 |
+
$new_pos--;
|
960 |
+
}
|
961 |
+
}
|
962 |
+
}
|
963 |
+
|
964 |
+
|
965 |
+
/* o Reorder reph:
|
966 |
+
*
|
967 |
+
* Reph's original position is always at the beginning of the syllable,
|
968 |
+
* (i.e. it is not reordered at the character reordering stage). However,
|
969 |
+
* it will be reordered according to the basic-forms shaping results.
|
970 |
+
* Possible positions for reph, depending on the script, are; after main,
|
971 |
+
* before post-base consonant forms, and after post-base consonant forms.
|
972 |
+
*/
|
973 |
+
|
974 |
+
/* If there's anything after the Ra that has the REPH pos, it ought to be halant.
|
975 |
+
* Which means that the font has failed to ligate the Reph. In which case, we
|
976 |
+
* shouldn't move. */
|
977 |
+
if ($start + 1 < $end &&
|
978 |
+
$info[$start]['indic_position'] == self::POS_RA_TO_BECOME_REPH && $info[$start + 1]['indic_position'] != self::POS_RA_TO_BECOME_REPH) {
|
979 |
+
$reph_pos = $indic_config[3];
|
980 |
+
$skip_to_reph_step_5 = false;
|
981 |
+
$skip_to_reph_move = false;
|
982 |
+
|
983 |
+
/* 1. If reph should be positioned after post-base consonant forms,
|
984 |
+
* proceed to step 5.
|
985 |
+
*/
|
986 |
+
if ($reph_pos == self::REPH_POS_AFTER_POST) {
|
987 |
+
$skip_to_reph_step_5 = true;
|
988 |
+
}
|
989 |
+
|
990 |
+
/* 2. If the reph repositioning class is not after post-base: target
|
991 |
+
* position is after the first explicit halant glyph between the
|
992 |
+
* first post-reph consonant and last main consonant. If ZWJ or ZWNJ
|
993 |
+
* are following this halant, position is moved after it. If such
|
994 |
+
* position is found, this is the target position. Otherwise,
|
995 |
+
* proceed to the next step.
|
996 |
+
*
|
997 |
+
* Note: in old-implementation fonts, where classifications were
|
998 |
+
* fixed in shaping engine, there was no case where reph position
|
999 |
+
* will be found on this step.
|
1000 |
+
*/
|
1001 |
+
|
1002 |
+
if (!$skip_to_reph_step_5) {
|
1003 |
+
|
1004 |
+
$new_reph_pos = $start + 1;
|
1005 |
+
|
1006 |
+
while ($new_reph_pos < $base && !self::is_halant_or_coeng($info[$new_reph_pos]))
|
1007 |
+
$new_reph_pos++;
|
1008 |
+
|
1009 |
+
if ($new_reph_pos < $base && self::is_halant_or_coeng($info[$new_reph_pos])) {
|
1010 |
+
/* ->If ZWJ or ZWNJ are following this halant, position is moved after it. */
|
1011 |
+
if ($new_reph_pos + 1 < $base && self::is_joiner($info[$new_reph_pos + 1]))
|
1012 |
+
$new_reph_pos++;
|
1013 |
+
$skip_to_reph_move = true;
|
1014 |
+
}
|
1015 |
+
}
|
1016 |
+
|
1017 |
+
/* 3. If reph should be repositioned after the main consonant: find the
|
1018 |
+
* first consonant not ligated with main, or find the first
|
1019 |
+
* consonant that is not a potential pre-base reordering Ra.
|
1020 |
+
*/
|
1021 |
+
if ($reph_pos == self::REPH_POS_AFTER_MAIN && !$skip_to_reph_move && !$skip_to_reph_step_5) {
|
1022 |
+
$new_reph_pos = $base;
|
1023 |
+
/* XXX Skip potential pre-base reordering Ra. */
|
1024 |
+
while ($new_reph_pos + 1 < $end && $info[$new_reph_pos + 1]['indic_position'] <= self::POS_AFTER_MAIN)
|
1025 |
+
$new_reph_pos++;
|
1026 |
+
if ($new_reph_pos < $end)
|
1027 |
+
$skip_to_reph_move = true;
|
1028 |
+
}
|
1029 |
+
|
1030 |
+
/* 4. If reph should be positioned before post-base consonant, find
|
1031 |
+
* first post-base classified consonant not ligated with main. If no
|
1032 |
+
* consonant is found, the target position should be before the
|
1033 |
+
* first matra, syllable modifier sign or vedic sign.
|
1034 |
+
*/
|
1035 |
+
/* This is our take on what step 4 is trying to say (and failing, BADLY). */
|
1036 |
+
if ($reph_pos == self::REPH_POS_AFTER_SUB && !$skip_to_reph_move && !$skip_to_reph_step_5) {
|
1037 |
+
$new_reph_pos = $base;
|
1038 |
+
while ($new_reph_pos < $end && isset($info[$new_reph_pos + 1]['indic_position']) &&
|
1039 |
+
!( self::FLAG($info[$new_reph_pos + 1]['indic_position']) & (self::FLAG(self::POS_POST_C) | self::FLAG(self::POS_AFTER_POST) | self::FLAG(self::POS_SMVD)))) {
|
1040 |
+
$new_reph_pos++;
|
1041 |
+
}
|
1042 |
+
if ($new_reph_pos < $end) {
|
1043 |
+
$skip_to_reph_move = true;
|
1044 |
+
}
|
1045 |
+
}
|
1046 |
+
|
1047 |
+
/* 5. If no consonant is found in steps 3 or 4, move reph to a position
|
1048 |
+
* immediately before the first post-base matra, syllable modifier
|
1049 |
+
* sign or vedic sign that has a reordering class after the intended
|
1050 |
+
* reph position. For example, if the reordering position for reph
|
1051 |
+
* is post-main, it will skip above-base matras that also have a
|
1052 |
+
* post-main position.
|
1053 |
+
*/
|
1054 |
+
if (!$skip_to_reph_move) {
|
1055 |
+
/* Copied from step 2. */
|
1056 |
+
$new_reph_pos = $start + 1;
|
1057 |
+
while ($new_reph_pos < $base && !self::is_halant_or_coeng($info[$new_reph_pos]))
|
1058 |
+
$new_reph_pos++;
|
1059 |
+
|
1060 |
+
if ($new_reph_pos < $base && self::is_halant_or_coeng($info[$new_reph_pos])) {
|
1061 |
+
/* ->If ZWJ or ZWNJ are following this halant, position is moved after it. */
|
1062 |
+
if ($new_reph_pos + 1 < $base && self::is_joiner($info[$new_reph_pos + 1]))
|
1063 |
+
$new_reph_pos++;
|
1064 |
+
$skip_to_reph_move = true;
|
1065 |
+
}
|
1066 |
+
}
|
1067 |
+
|
1068 |
+
|
1069 |
+
/* 6. Otherwise, reorder reph to the end of the syllable.
|
1070 |
+
*/
|
1071 |
+
if (!$skip_to_reph_move) {
|
1072 |
+
$new_reph_pos = $end - 1;
|
1073 |
+
while ($new_reph_pos > $start && $info[$new_reph_pos]['indic_position'] == self::POS_SMVD)
|
1074 |
+
$new_reph_pos--;
|
1075 |
+
|
1076 |
+
/*
|
1077 |
+
* If the Reph is to be ending up after a Matra,Halant sequence,
|
1078 |
+
* position it before that Halant so it can interact with the Matra.
|
1079 |
+
* However, if it's a plain Consonant,Halant we shouldn't do that.
|
1080 |
+
* Uniscribe doesn't do this.
|
1081 |
+
* TEST: U+0930,U+094D,U+0915,U+094B,U+094D
|
1082 |
+
*/
|
1083 |
+
//if (!$hb_options.uniscribe_bug_compatible && self::is_halant_or_coeng($info[$new_reph_pos])) {
|
1084 |
+
if (self::is_halant_or_coeng($info[$new_reph_pos])) {
|
1085 |
+
for ($i = $base + 1; $i < $new_reph_pos; $i++)
|
1086 |
+
if ($info[$i]['indic_category'] == self::OT_M) {
|
1087 |
+
/* Ok, got it. */
|
1088 |
+
$new_reph_pos--;
|
1089 |
+
}
|
1090 |
+
}
|
1091 |
+
}
|
1092 |
+
|
1093 |
+
|
1094 |
+
/* Move */
|
1095 |
+
self::_move_info_pos($info, $start, $new_reph_pos + 1);
|
1096 |
+
|
1097 |
+
if ($start < $base && $base <= $new_reph_pos) {
|
1098 |
+
$base--;
|
1099 |
+
}
|
1100 |
+
}
|
1101 |
+
|
1102 |
+
|
1103 |
+
/* o Reorder pre-base reordering consonants:
|
1104 |
+
*
|
1105 |
+
* If a pre-base reordering consonant is found, reorder it according to
|
1106 |
+
* the following rules:
|
1107 |
+
*/
|
1108 |
+
|
1109 |
+
|
1110 |
+
if (count($GSUBdata['pref']) && $base + 1 < $end) { /* Otherwise there can't be any pre-base reordering Ra. */
|
1111 |
+
for ($i = $base + 1; $i < $end; $i++) {
|
1112 |
+
if ($info[$i]['mask'] & self::FLAG(self::PREF)) {
|
1113 |
+
/* 1. Only reorder a glyph produced by substitution during application
|
1114 |
+
* of the <pref> feature. (Note that a font may shape a Ra consonant with
|
1115 |
+
* the feature generally but block it in certain contexts.)
|
1116 |
+
*/
|
1117 |
+
// ??? Need to TEST if actual substitution has occurred
|
1118 |
+
if ($i + 1 == $end || ($info[$i + 1]['mask'] & self::FLAG(self::PREF)) == 0) {
|
1119 |
+
/*
|
1120 |
+
* 2. Try to find a target position the same way as for pre-base matra.
|
1121 |
+
* If it is found, reorder pre-base consonant glyph.
|
1122 |
+
*
|
1123 |
+
* 3. If position is not found, reorder immediately before main
|
1124 |
+
* consonant.
|
1125 |
+
*/
|
1126 |
+
$new_pos = $base;
|
1127 |
+
/* Malayalam / Tamil do not have "half" forms or explicit virama forms.
|
1128 |
+
* The glyphs formed by 'half' are Chillus or ligated explicit viramas.
|
1129 |
+
* We want to position matra after them.
|
1130 |
+
*/
|
1131 |
+
if ($scriptblock != UCDN::SCRIPT_MALAYALAM && $scriptblock != UCDN::SCRIPT_TAMIL) {
|
1132 |
+
while ($new_pos > $start &&
|
1133 |
+
!(self::is_one_of($info[$new_pos - 1], self::FLAG(self::OT_M) | self::FLAG(self::OT_H) | self::FLAG(self::OT_Coeng))))
|
1134 |
+
$new_pos--;
|
1135 |
+
|
1136 |
+
/* In Khmer coeng model, a V,Ra can go *after* matras. If it goes after a
|
1137 |
+
* split matra, it should be reordered to *before* the left part of such matra. */
|
1138 |
+
if ($new_pos > $start && $info[$new_pos - 1]['indic_category'] == self::OT_M) {
|
1139 |
+
$old_pos = i;
|
1140 |
+
for ($i = $base + 1; $i < $old_pos; $i++)
|
1141 |
+
if ($info[$i]['indic_category'] == self::OT_M) {
|
1142 |
+
$new_pos--;
|
1143 |
+
break;
|
1144 |
+
}
|
1145 |
+
}
|
1146 |
+
}
|
1147 |
+
|
1148 |
+
if ($new_pos > $start && self::is_halant_or_coeng($info[$new_pos - 1])) {
|
1149 |
+
/* -> If ZWJ or ZWNJ follow this halant, position is moved after it. */
|
1150 |
+
if ($new_pos < $end && self::is_joiner($info[$new_pos]))
|
1151 |
+
$new_pos++;
|
1152 |
+
}
|
1153 |
+
|
1154 |
+
$old_pos = $i;
|
1155 |
+
self::_move_info_pos($info, $old_pos, $new_pos);
|
1156 |
+
|
1157 |
+
if ($new_pos <= $base && $base < $old_pos)
|
1158 |
+
$base++;
|
1159 |
+
}
|
1160 |
+
|
1161 |
+
break;
|
1162 |
+
}
|
1163 |
+
}
|
1164 |
+
}
|
1165 |
+
|
1166 |
+
|
1167 |
+
/* Apply 'init' to the Left Matra if it's a word start. */
|
1168 |
+
if ($info[$start]['indic_position'] == self::POS_PRE_M &&
|
1169 |
+
($start == 0 ||
|
1170 |
+
($info[$start - 1]['general_category'] < UCDN::UNICODE_GENERAL_CATEGORY_FORMAT || $info[$start - 1]['general_category'] > UCDN::UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
|
1171 |
+
)) {
|
1172 |
+
$info[$start]['mask'] |= self::FLAG(self::INIT);
|
1173 |
+
}
|
1174 |
+
|
1175 |
+
|
1176 |
+
/*
|
1177 |
+
* Finish off and go home!
|
1178 |
+
*/
|
1179 |
+
}
|
1180 |
+
|
1181 |
+
public static function _move_info_pos(&$info, $from, $to)
|
1182 |
+
{
|
1183 |
+
$t = array();
|
1184 |
+
$t[0] = $info[$from];
|
1185 |
+
if ($from > $to) {
|
1186 |
+
array_splice($info, $from, 1);
|
1187 |
+
array_splice($info, $to, 0, $t);
|
1188 |
+
} else {
|
1189 |
+
array_splice($info, $to, 0, $t);
|
1190 |
+
array_splice($info, $from, 1);
|
1191 |
+
}
|
1192 |
+
}
|
1193 |
+
|
1194 |
+
public static $ra_chars = array(
|
1195 |
+
0x0930 => 1, /* Devanagari */
|
1196 |
+
0x09B0 => 1, /* Bengali */
|
1197 |
+
0x09F0 => 1, /* Bengali (Assamese) */
|
1198 |
+
0x0A30 => 1, /* Gurmukhi */ /* No Reph */
|
1199 |
+
0x0AB0 => 1, /* Gujarati */
|
1200 |
+
0x0B30 => 1, /* Oriya */
|
1201 |
+
0x0BB0 => 1, /* Tamil */ /* No Reph */
|
1202 |
+
0x0C30 => 1, /* Telugu */ /* Reph formed only with ZWJ */
|
1203 |
+
0x0CB0 => 1, /* Kannada */
|
1204 |
+
0x0D30 => 1, /* Malayalam */ /* No Reph, Logical Repha */
|
1205 |
+
0x0DBB => 1, /* Sinhala */ /* Reph formed only with ZWJ */
|
1206 |
+
0x179A => 1, /* Khmer */ /* No Reph, Visual Repha */
|
1207 |
+
);
|
1208 |
+
|
1209 |
+
public static function is_ra($u)
|
1210 |
+
{
|
1211 |
+
if (isset(self::$ra_chars[$u]))
|
1212 |
+
return true;
|
1213 |
+
return false;
|
1214 |
+
}
|
1215 |
+
|
1216 |
+
public static function is_one_of($info, $flags)
|
1217 |
+
{
|
1218 |
+
if (isset($info['is_ligature']) && $info['is_ligature'])
|
1219 |
+
return false; /* If it ligated, all bets are off. */
|
1220 |
+
return !!(self::FLAG($info['indic_category']) & $flags);
|
1221 |
+
}
|
1222 |
+
|
1223 |
+
public static function is_joiner($info)
|
1224 |
+
{
|
1225 |
+
return self::is_one_of($info, (self::FLAG(self::OT_ZWJ) | self::FLAG(self::OT_ZWNJ)));
|
1226 |
+
}
|
1227 |
+
|
1228 |
+
/* Vowels and placeholders treated as if they were consonants. */
|
1229 |
+
|
1230 |
+
public static function is_consonant($info)
|
1231 |
+
{
|
1232 |
+
return self::is_one_of($info, (self::FLAG(self::OT_C) | self::FLAG(self::OT_CM) | self::FLAG(self::OT_Ra) | self::FLAG(self::OT_V) | self::FLAG(self::OT_NBSP) | self::FLAG(self::OT_DOTTEDCIRCLE)));
|
1233 |
+
}
|
1234 |
+
|
1235 |
+
public static function is_halant_or_coeng($info)
|
1236 |
+
{
|
1237 |
+
return self::is_one_of($info, (self::FLAG(self::OT_H) | self::FLAG(self::OT_Coeng)));
|
1238 |
+
}
|
1239 |
+
|
1240 |
+
// From hb-private.hh
|
1241 |
+
public static function in_range($u, $lo, $hi)
|
1242 |
+
{
|
1243 |
+
if ((($lo ^ $hi) & $lo) == 0 && (($lo ^ $hi) & $hi) == ($lo ^ $hi) && (($lo ^ $hi) & (($lo ^ $hi) + 1)) == 0)
|
1244 |
+
return ($u & ~($lo ^ $hi)) == $lo;
|
1245 |
+
else
|
1246 |
+
return $lo <= $u && $u <= $hi;
|
1247 |
+
}
|
1248 |
+
|
1249 |
+
// From hb-private.hh
|
1250 |
+
public static function FLAG($x)
|
1251 |
+
{
|
1252 |
+
return (1 << ($x));
|
1253 |
+
}
|
1254 |
+
|
1255 |
+
// BELOW from hb-ot-shape-complex-indic.cc
|
1256 |
+
|
1257 |
+
/*
|
1258 |
+
* Indic configurations.
|
1259 |
+
*/
|
1260 |
+
|
1261 |
+
// base_position
|
1262 |
+
const BASE_POS_FIRST = 0;
|
1263 |
+
const BASE_POS_LAST = 1;
|
1264 |
+
|
1265 |
+
// reph_position
|
1266 |
+
const REPH_POS_DEFAULT = 10; // POS_BEFORE_POST,
|
1267 |
+
|
1268 |
+
const REPH_POS_AFTER_MAIN = 5; // POS_AFTER_MAIN,
|
1269 |
+
|
1270 |
+
const REPH_POS_BEFORE_SUB = 7; // POS_BEFORE_SUB,
|
1271 |
+
const REPH_POS_AFTER_SUB = 9; // POS_AFTER_SUB,
|
1272 |
+
const REPH_POS_BEFORE_POST = 10; // POS_BEFORE_POST,
|
1273 |
+
const REPH_POS_AFTER_POST = 12; // POS_AFTER_POST
|
1274 |
+
|
1275 |
+
// reph_mode
|
1276 |
+
const REPH_MODE_IMPLICIT = 0; /* Reph formed out of initial Ra,H sequence. */
|
1277 |
+
const REPH_MODE_EXPLICIT = 1; /* Reph formed out of initial Ra,H,ZWJ sequence. */
|
1278 |
+
const REPH_MODE_VIS_REPHA = 2; /* Encoded Repha character, no reordering needed. */
|
1279 |
+
const REPH_MODE_LOG_REPHA = 3; /* Encoded Repha character, needs reordering. */
|
1280 |
+
|
1281 |
+
/*
|
1282 |
+
struct of indic_configs{
|
1283 |
+
KEY - script;
|
1284 |
+
0 - has_old_spec;
|
1285 |
+
1 - virama;
|
1286 |
+
2 - base_pos;
|
1287 |
+
3 - reph_pos;
|
1288 |
+
4 - reph_mode;
|
1289 |
+
};
|
1290 |
+
*/
|
1291 |
+
|
1292 |
+
public static $indic_configs = array(/* index is SCRIPT_number from UCDN */
|
1293 |
+
9 => array(true, 0x094D, 1, 10, 0),
|
1294 |
+
10 => array(true, 0x09CD, 1, 9, 0),
|
1295 |
+
11 => array(true, 0x0A4D, 1, 7, 0),
|
1296 |
+
12 => array(true, 0x0ACD, 1, 10, 0),
|
1297 |
+
13 => array(true, 0x0B4D, 1, 5, 0),
|
1298 |
+
14 => array(true, 0x0BCD, 1, 12, 0),
|
1299 |
+
15 => array(true, 0x0C4D, 1, 12, 1),
|
1300 |
+
16 => array(true, 0x0CCD, 1, 12, 0),
|
1301 |
+
17 => array(true, 0x0D4D, 1, 5, 3),
|
1302 |
+
18 => array(false, 0x0DCA, 0, 5, 1), /* Sinhala */
|
1303 |
+
30 => array(false, 0x17D2, 0, 10, 2), /* Khmer */
|
1304 |
+
84 => array(false, 0xA9C0, 1, 10, 0), /* Javanese */
|
1305 |
+
);
|
1306 |
+
|
1307 |
+
|
1308 |
+
|
1309 |
+
/*
|
1310 |
+
|
1311 |
+
// from "hb-ot-shape-complex-indic-table.cc"
|
1312 |
+
|
1313 |
+
|
1314 |
+
const ISC_A = 0; // INDIC_SYLLABIC_CATEGORY_AVAGRAHA Avagraha
|
1315 |
+
const ISC_Bi = 8; // INDIC_SYLLABIC_CATEGORY_BINDU Bindu
|
1316 |
+
const ISC_C = 1; // INDIC_SYLLABIC_CATEGORY_CONSONANT Consonant
|
1317 |
+
const ISC_CD = 1; // INDIC_SYLLABIC_CATEGORY_CONSONANT_DEAD Consonant_Dead
|
1318 |
+
const ISC_CF = 17; // INDIC_SYLLABIC_CATEGORY_CONSONANT_FINAL Consonant_Final
|
1319 |
+
const ISC_CHL = 1; // INDIC_SYLLABIC_CATEGORY_CONSONANT_HEAD_LETTER Consonant_Head_Letter
|
1320 |
+
const ISC_CM = 17; // INDIC_SYLLABIC_CATEGORY_CONSONANT_MEDIAL Consonant_Medial
|
1321 |
+
const ISC_CP = 11; // INDIC_SYLLABIC_CATEGORY_CONSONANT_PLACEHOLDER Consonant_Placeholder
|
1322 |
+
const ISC_CR = 15; // INDIC_SYLLABIC_CATEGORY_CONSONANT_REPHA Consonant_Repha
|
1323 |
+
const ISC_CS = 1; // INDIC_SYLLABIC_CATEGORY_CONSONANT_SUBJOINED Consonant_Subjoined
|
1324 |
+
const ISC_ML = 0; // INDIC_SYLLABIC_CATEGORY_MODIFYING_LETTER Modifying_Letter
|
1325 |
+
const ISC_N = 3; // INDIC_SYLLABIC_CATEGORY_NUKTA Nukta
|
1326 |
+
const ISC_x = 0; // INDIC_SYLLABIC_CATEGORY_OTHER Other
|
1327 |
+
const ISC_RS = 13; // INDIC_SYLLABIC_CATEGORY_REGISTER_SHIFTER Register_Shifter
|
1328 |
+
const ISC_TL = 0; // INDIC_SYLLABIC_CATEGORY_TONE_LETTER Tone_Letter
|
1329 |
+
const ISC_TM = 3; // INDIC_SYLLABIC_CATEGORY_TONE_MARK Tone_Mark
|
1330 |
+
const ISC_V = 4; // INDIC_SYLLABIC_CATEGORY_VIRAMA Virama
|
1331 |
+
const ISC_Vs = 8; // INDIC_SYLLABIC_CATEGORY_VISARGA Visarga
|
1332 |
+
const ISC_Vo = 2; // INDIC_SYLLABIC_CATEGORY_VOWEL Vowel
|
1333 |
+
const ISC_M = 7; // INDIC_SYLLABIC_CATEGORY_VOWEL_DEPENDENT Vowel_Dependent
|
1334 |
+
const ISC_VI = 2; // INDIC_SYLLABIC_CATEGORY_VOWEL_INDEPENDENT Vowel_Independent
|
1335 |
+
|
1336 |
+
const IMC_B = 8; // INDIC_MATRA_CATEGORY_BOTTOM Bottom
|
1337 |
+
const IMC_BR = 11; // INDIC_MATRA_CATEGORY_BOTTOM_AND_RIGHT Bottom_And_Right
|
1338 |
+
const IMC_I = 15; // INDIC_MATRA_CATEGORY_INVISIBLE Invisible
|
1339 |
+
const IMC_L = 3; // INDIC_MATRA_CATEGORY_LEFT Left
|
1340 |
+
const IMC_LR = 11; // INDIC_MATRA_CATEGORY_LEFT_AND_RIGHT Left_And_Right
|
1341 |
+
const IMC_x = 15; // INDIC_MATRA_CATEGORY_NOT_APPLICABLE Not_Applicable
|
1342 |
+
const IMC_O = 5; // INDIC_MATRA_CATEGORY_OVERSTRUCK Overstruck
|
1343 |
+
const IMC_R = 11; // INDIC_MATRA_CATEGORY_RIGHT Right
|
1344 |
+
const IMC_T = 6; // INDIC_MATRA_CATEGORY_TOP Top
|
1345 |
+
const IMC_TB = 8; // INDIC_MATRA_CATEGORY_TOP_AND_BOTTOM Top_And_Bottom
|
1346 |
+
const IMC_TBR = 11; // INDIC_MATRA_CATEGORY_TOP_AND_BOTTOM_AND_RIGHT Top_And_Bottom_And_Right
|
1347 |
+
const IMC_TL = 6; // INDIC_MATRA_CATEGORY_TOP_AND_LEFT Top_And_Left
|
1348 |
+
const IMC_TLR = 11; // INDIC_MATRA_CATEGORY_TOP_AND_LEFT_AND_RIGHT Top_And_Left_And_Right
|
1349 |
+
const IMC_TR = 11; // INDIC_MATRA_CATEGORY_TOP_AND_RIGHT Top_And_Right
|
1350 |
+
const IMC_VOL = 2; // INDIC_MATRA_CATEGORY_VISUAL_ORDER_LEFT Visual_Order_Left
|
1351 |
+
|
1352 |
+
If in original table = _(C,x), that = ISC_C,IMC_x
|
1353 |
+
Value is IMC_x << 8 (or IMC_x * 256) = 3840
|
1354 |
+
plus ISC_C = 1, so = 3841
|
1355 |
+
|
1356 |
+
*/
|
1357 |
+
|
1358 |
+
public static $indic_table = array(
|
1359 |
+
/* Devanagari (0900..097F) */
|
1360 |
+
|
1361 |
+
/* 0900 */ 3848, 3848, 3848, 3848, 3842, 3842, 3842, 3842,
|
1362 |
+
/* 0908 */ 3842, 3842, 3842, 3842, 3842, 3842, 3842, 3842,
|
1363 |
+
/* 0910 */ 3842, 3842, 3842, 3842, 3842, 3841, 3841, 3841,
|
1364 |
+
/* 0918 */ 3841, 3841, 3841, 3841, 3841, 3841, 3841, 3841,
|
1365 |
+
/* 0920 */ 3841, 3841, 3841, 3841, 3841, 3841, 3841, 3841,
|
1366 |
+
/* 0928 */ 3841, 3841, 3841, 3841, 3841, 3841, 3841, 3841,
|
1367 |
+
/* 0930 */ 3841, 3841, 3841, 3841, 3841, 3841, 3841, 3841,
|
1368 |
+
/* 0938 */ 3841, 3841, 1543, 2823, 3843, 3840, 2823, 775,
|
1369 |
+
/* 0940 */ 2823, 2055, 2055, 2055, 2055, 1543, 1543, 1543,
|
1370 |
+
/* 0948 */ 1543, 2823, 2823, 2823, 2823, 2052, 775, 2823,
|
1371 |
+
/* 0950 */ 3840, 3840, 3840, 3840, 3840, 1543, 2055, 2055,
|
1372 |
+
/* 0958 */ 3841, 3841, 3841, 3841, 3841, 3841, 3841, 3841,
|
1373 |
+
/* 0960 */ 3842, 3842, 2055, 2055, 3840, 3840, 3840, 3840,
|
1374 |
+
/* 0968 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1375 |
+
/* 0970 */ 3840, 3840, 3842, 3842, 3842, 3842, 3842, 3842,
|
1376 |
+
/* 0978 */ 3840, 3841, 3841, 3841, 3841, 3841, 3841, 3841,
|
1377 |
+
/* Bengali (0980..09FF) */
|
1378 |
+
|
1379 |
+
/* 0980 */ 3840, 3848, 3848, 3848, 3840, 3842, 3842, 3842,
|
1380 |
+
/* 0988 */ 3842, 3842, 3842, 3842, 3842, 3840, 3840, 3842,
|
1381 |
+
/* 0990 */ 3842, 3840, 3840, 3842, 3842, 3841, 3841, 3841,
|
1382 |
+
/* 0998 */ 3841, 3841, 3841, 3841, 3841, 3841, 3841, 3841,
|
1383 |
+
/* 09A0 */ 3841, 3841, 3841, 3841, 3841, 3841, 3841, 3841,
|
1384 |
+
/* 09A8 */ 3841, 3840, 3841, 3841, 3841, 3841, 3841, 3841,
|
1385 |
+
/* 09B0 */ 3841, 3840, 3841, 3840, 3840, 3840, 3841, 3841,
|
1386 |
+
/* 09B8 */ 3841, 3841, 3840, 3840, 3843, 3840, 2823, 775,
|
1387 |
+
/* 09C0 */ 2823, 2055, 2055, 2055, 2055, 3840, 3840, 775,
|
1388 |
+
/* 09C8 */ 775, 3840, 3840, 2823, 2823, 2052, 3841, 3840,
|
1389 |
+
/* 09D0 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 2823,
|
1390 |
+
/* 09D8 */ 3840, 3840, 3840, 3840, 3841, 3841, 3840, 3841,
|
1391 |
+
/* 09E0 */ 3842, 3842, 2055, 2055, 3840, 3840, 3840, 3840,
|
1392 |
+
/* 09E8 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1393 |
+
/* 09F0 */ 3841, 3841, 3840, 3840, 3840, 3840, 3840, 3840,
|
1394 |
+
/* 09F8 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1395 |
+
/* Gurmukhi (0A00..0A7F) */
|
1396 |
+
|
1397 |
+
/* 0A00 */ 3840, 3848, 3848, 3848, 3840, 3842, 3842, 3842,
|
1398 |
+
/* 0A08 */ 3842, 3842, 3842, 3840, 3840, 3840, 3840, 3842,
|
1399 |
+
/* 0A10 */ 3842, 3840, 3840, 3842, 3842, 3841, 3841, 3841,
|
1400 |
+
/* 0A18 */ 3841, 3841, 3841, 3841, 3841, 3841, 3841, 3841,
|
1401 |
+
/* 0A20 */ 3841, 3841, 3841, 3841, 3841, 3841, 3841, 3841,
|
1402 |
+
/* 0A28 */ 3841, 3840, 3841, 3841, 3841, 3841, 3841, 3841,
|
1403 |
+
/* 0A30 */ 3841, 3840, 3841, 3841, 3840, 3841, 3841, 3840,
|
1404 |
+
/* 0A38 */ 3841, 3841, 3840, 3840, 3843, 3840, 2823, 775,
|
1405 |
+
/* 0A40 */ 2823, 2055, 2055, 3840, 3840, 3840, 3840, 1543,
|
1406 |
+
/* 0A48 */ 1543, 3840, 3840, 1543, 1543, 2052, 3840, 3840,
|
1407 |
+
/* 0A50 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1408 |
+
/* 0A58 */ 3840, 3841, 3841, 3841, 3841, 3840, 3841, 3840,
|
1409 |
+
/* 0A60 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1410 |
+
/* 0A68 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1411 |
+
/* 0A70 */ 3848, 3840, 13841, 13841, 3840, 3857, 3840, 3840,
|
1412 |
+
/* 0A78 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1413 |
+
/* Gujarati (0A80..0AFF) */
|
1414 |
+
|
1415 |
+
/* 0A80 */ 3840, 3848, 3848, 3848, 3840, 3842, 3842, 3842,
|
1416 |
+
/* 0A88 */ 3842, 3842, 3842, 3842, 3842, 3842, 3840, 3842,
|
1417 |
+
/* 0A90 */ 3842, 3842, 3840, 3842, 3842, 3841, 3841, 3841,
|
1418 |
+
/* 0A98 */ 3841, 3841, 3841, 3841, 3841, 3841, 3841, 3841,
|
1419 |
+
/* 0AA0 */ 3841, 3841, 3841, 3841, 3841, 3841, 3841, 3841,
|
1420 |
+
/* 0AA8 */ 3841, 3840, 3841, 3841, 3841, 3841, 3841, 3841,
|
1421 |
+
/* 0AB0 */ 3841, 3840, 3841, 3841, 3840, 3841, 3841, 3841,
|
1422 |
+
/* 0AB8 */ 3841, 3841, 3840, 3840, 3843, 3840, 2823, 775,
|
1423 |
+
/* 0AC0 */ 2823, 2055, 2055, 2055, 2055, 1543, 3840, 1543,
|
1424 |
+
/* 0AC8 */ 1543, 2823, 3840, 2823, 2823, 2052, 3840, 3840,
|
1425 |
+
/* 0AD0 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1426 |
+
/* 0AD8 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1427 |
+
/* 0AE0 */ 3842, 3842, 2055, 2055, 3840, 3840, 3840, 3840,
|
1428 |
+
/* 0AE8 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1429 |
+
/* 0AF0 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1430 |
+
/* 0AF8 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1431 |
+
/* Oriya (0B00..0B7F) */
|
1432 |
+
|
1433 |
+
/* 0B00 */ 3840, 3848, 3848, 3848, 3840, 3842, 3842, 3842,
|
1434 |
+
/* 0B08 */ 3842, 3842, 3842, 3842, 3842, 3840, 3840, 3842,
|
1435 |
+
/* 0B10 */ 3842, 3840, 3840, 3842, 3842, 3841, 3841, 3841,
|
1436 |
+
/* 0B18 */ 3841, 3841, 3841, 3841, 3841, 3841, 3841, 3841,
|
1437 |
+
/* 0B20 */ 3841, 3841, 3841, 3841, 3841, 3841, 3841, 3841,
|
1438 |
+
/* 0B28 */ 3841, 3840, 3841, 3841, 3841, 3841, 3841, 3841,
|
1439 |
+
/* 0B30 */ 3841, 3840, 3841, 3841, 3840, 3841, 3841, 3841,
|
1440 |
+
/* 0B38 */ 3841, 3841, 3840, 3840, 3843, 3840, 2823, 1543,
|
1441 |
+
/* 0B40 */ 2823, 2055, 2055, 2055, 2055, 3840, 3840, 775,
|
1442 |
+
/* 0B48 */ 1543, 3840, 3840, 2823, 2823, 2052, 3840, 3840,
|
1443 |
+
/* 0B50 */ 3840, 3840, 3840, 3840, 3840, 3840, 1543, 2823,
|
1444 |
+
/* 0B58 */ 3840, 3840, 3840, 3840, 3841, 3841, 3840, 3841,
|
1445 |
+
/* 0B60 */ 3842, 3842, 2055, 2055, 3840, 3840, 3840, 3840,
|
1446 |
+
/* 0B68 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1447 |
+
/* 0B70 */ 3840, 3841, 3840, 3840, 3840, 3840, 3840, 3840,
|
1448 |
+
/* 0B78 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1449 |
+
/* Tamil (0B80..0BFF) */
|
1450 |
+
|
1451 |
+
/* 0B80 */ 3840, 3840, 3848, 3840, 3840, 3842, 3842, 3842,
|
1452 |
+
/* 0B88 */ 3842, 3842, 3842, 3840, 3840, 3840, 3842, 3842,
|
1453 |
+
/* 0B90 */ 3842, 3840, 3842, 3842, 3842, 3841, 3840, 3840,
|
1454 |
+
/* 0B98 */ 3840, 3841, 3841, 3840, 3841, 3840, 3841, 3841,
|
1455 |
+
/* 0BA0 */ 3840, 3840, 3840, 3841, 3841, 3840, 3840, 3840,
|
1456 |
+
/* 0BA8 */ 3841, 3841, 3841, 3840, 3840, 3840, 3841, 3841,
|
1457 |
+
/* 0BB0 */ 3841, 3841, 3841, 3841, 3841, 3841, 3841, 3841,
|
1458 |
+
/* 0BB8 */ 3841, 3841, 3840, 3840, 3840, 3840, 2823, 2823,
|
1459 |
+
/* 0BC0 */ 1543, 2055, 2055, 3840, 3840, 3840, 775, 775,
|
1460 |
+
/* 0BC8 */ 775, 3840, 2823, 2823, 2823, 1540, 3840, 3840,
|
1461 |
+
/* 0BD0 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 2823,
|
1462 |
+
/* 0BD8 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1463 |
+
/* 0BE0 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1464 |
+
/* 0BE8 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1465 |
+
/* 0BF0 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1466 |
+
/* 0BF8 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1467 |
+
/* Telugu (0C00..0C7F) */
|
1468 |
+
|
1469 |
+
/* 0C00 */ 3840, 3848, 3848, 3848, 3840, 3842, 3842, 3842,
|
1470 |
+
/* 0C08 */ 3842, 3842, 3842, 3842, 3842, 3840, 3842, 3842,
|
1471 |
+
/* 0C10 */ 3842, 3840, 3842, 3842, 3842, 3841, 3841, 3841,
|
1472 |
+
/* 0C18 */ 3841, 3841, 3841, 3841, 3841, 3841, 3841, 3841,
|
1473 |
+
/* 0C20 */ 3841, 3841, 3841, 3841, 3841, 3841, 3841, 3841,
|
1474 |
+
/* 0C28 */ 3841, 3840, 3841, 3841, 3841, 3841, 3841, 3841,
|
1475 |
+
/* 0C30 */ 3841, 3841, 3841, 3841, 3840, 3841, 3841, 3841,
|
1476 |
+
/* 0C38 */ 3841, 3841, 3840, 3840, 3840, 3840, 1543, 1543,
|
1477 |
+
/* 0C40 */ 1543, 2823, 2823, 2823, 2823, 3840, 1543, 1543,
|
1478 |
+
/* 0C48 */ 2055, 3840, 1543, 1543, 1543, 1540, 3840, 3840,
|
1479 |
+
/* 0C50 */ 3840, 3840, 3840, 3840, 3840, 1543, 2055, 3840,
|
1480 |
+
/* 0C58 */ 3841, 3841, 3840, 3840, 3840, 3840, 3840, 3840,
|
1481 |
+
/* 0C60 */ 3842, 3842, 2055, 2055, 3840, 3840, 3840, 3840,
|
1482 |
+
/* 0C68 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1483 |
+
/* 0C70 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1484 |
+
/* 0C78 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1485 |
+
/* Kannada (0C80..0CFF) */
|
1486 |
+
|
1487 |
+
/* 0C80 */ 3840, 3840, 3848, 3848, 3840, 3842, 3842, 3842,
|
1488 |
+
/* 0C88 */ 3842, 3842, 3842, 3842, 3842, 3840, 3842, 3842,
|
1489 |
+
/* 0C90 */ 3842, 3840, 3842, 3842, 3842, 3841, 3841, 3841,
|
1490 |
+
/* 0C98 */ 3841, 3841, 3841, 3841, 3841, 3841, 3841, 3841,
|
1491 |
+
/* 0CA0 */ 3841, 3841, 3841, 3841, 3841, 3841, 3841, 3841,
|
1492 |
+
/* 0CA8 */ 3841, 3840, 3841, 3841, 3841, 3841, 3841, 3841,
|
1493 |
+
/* 0CB0 */ 3841, 3841, 3841, 3841, 3840, 3841, 3841, 3841,
|
1494 |
+
/* 0CB8 */ 3841, 3841, 3840, 3840, 3843, 3840, 2823, 1543,
|
1495 |
+
/* 0CC0 */ 2823, 2823, 2823, 2823, 2823, 3840, 1543, 2823,
|
1496 |
+
/* 0CC8 */ 2823, 3840, 2823, 2823, 1543, 1540, 3840, 3840,
|
1497 |
+
/* 0CD0 */ 3840, 3840, 3840, 3840, 3840, 2823, 2823, 3840,
|
1498 |
+
/* 0CD8 */ 3840, 3840, 3840, 3840, 3840, 3840, 3841, 3840,
|
1499 |
+
/* 0CE0 */ 3842, 3842, 2055, 2055, 3840, 3840, 3840, 3840,
|
1500 |
+
/* 0CE8 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1501 |
+
/* 0CF0 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1502 |
+
/* 0CF8 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1503 |
+
/* Malayalam (0D00..0D7F) */
|
1504 |
+
|
1505 |
+
/* 0D00 */ 3840, 3840, 3848, 3848, 3840, 3842, 3842, 3842,
|
1506 |
+
/* 0D08 */ 3842, 3842, 3842, 3842, 3842, 3840, 3842, 3842,
|
1507 |
+
/* 0D10 */ 3842, 3840, 3842, 3842, 3842, 3841, 3841, 3841,
|
1508 |
+
/* 0D18 */ 3841, 3841, 3841, 3841, 3841, 3841, 3841, 3841,
|
1509 |
+
/* 0D20 */ 3841, 3841, 3841, 3841, 3841, 3841, 3841, 3841,
|
1510 |
+
/* 0D28 */ 3841, 3841, 3841, 3841, 3841, 3841, 3841, 3841,
|
1511 |
+
/* 0D30 */ 3841, 3841, 3841, 3841, 3841, 3841, 3841, 3841,
|
1512 |
+
/* 0D38 */ 3841, 3841, 3841, 3840, 3840, 3840, 2823, 2823,
|
1513 |
+
/* 0D40 */ 2823, 2823, 2823, 2055, 2055, 3840, 775, 775,
|
1514 |
+
/* 0D48 */ 775, 3840, 2823, 2823, 2823, 1540, 3855, 3840,
|
1515 |
+
/* 0D50 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 2823,
|
1516 |
+
/* 0D58 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1517 |
+
/* 0D60 */ 3842, 3842, 2055, 2055, 3840, 3840, 3840, 3840,
|
1518 |
+
/* 0D68 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1519 |
+
/* 0D70 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1520 |
+
/* 0D78 */ 3840, 3840, 3841, 3841, 3841, 3841, 3841, 3841,
|
1521 |
+
/* Sinhala (0D80..0DFF) */
|
1522 |
+
|
1523 |
+
/* 0D80 */ 3840, 3840, 3848, 3848, 3840, 3842, 3842, 3842,
|
1524 |
+
/* 0D88 */ 3842, 3842, 3842, 3842, 3842, 3842, 3842, 3842,
|
1525 |
+
/* 0D90 */ 3842, 3842, 3842, 3842, 3842, 3842, 3842, 3840,
|
1526 |
+
/* 0D98 */ 3840, 3840, 3841, 3841, 3841, 3841, 3841, 3841,
|
1527 |
+
/* 0DA0 */ 3841, 3841, 3841, 3841, 3841, 3841, 3841, 3841,
|
1528 |
+
/* 0DA8 */ 3841, 3841, 3841, 3841, 3841, 3841, 3841, 3841,
|
1529 |
+
/* 0DB0 */ 3841, 3841, 3840, 3841, 3841, 3841, 3841, 3841,
|
1530 |
+
/* 0DB8 */ 3841, 3841, 3841, 3841, 3840, 3841, 3840, 3840,
|
1531 |
+
/* 0DC0 */ 3841, 3841, 3841, 3841, 3841, 3841, 3841, 3840,
|
1532 |
+
/* 0DC8 */ 3840, 3840, 1540, 3840, 3840, 3840, 3840, 2823,
|
1533 |
+
/* 0DD0 */ 2823, 2823, 1543, 1543, 2055, 3840, 2055, 3840,
|
1534 |
+
/* 0DD8 */ 2823, 775, 1543, 775, 2823, 2823, 2823, 2823,
|
1535 |
+
/* 0DE0 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1536 |
+
/* 0DE8 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1537 |
+
/* 0DF0 */ 3840, 3840, 2823, 2823, 3840, 3840, 3840, 3840,
|
1538 |
+
/* 0DF8 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1539 |
+
/* Vedic Extensions (1CD0..1CFF) */
|
1540 |
+
|
1541 |
+
/* 1CD0 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1542 |
+
/* 1CD8 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1543 |
+
/* 1CE0 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1544 |
+
/* 1CE8 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1545 |
+
/* 1CF0 */ 3840, 3840, 3848, 3848, 3840, 3840, 3840, 3840,
|
1546 |
+
/* 1CF8 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1547 |
+
);
|
1548 |
+
|
1549 |
+
public static $khmer_table = array(
|
1550 |
+
/* Khmer (1780..17FF) */
|
1551 |
+
|
1552 |
+
/* 1780 */ 3841, 3841, 3841, 3841, 3841, 3841, 3841, 3841,
|
1553 |
+
/* 1788 */ 3841, 3841, 3841, 3841, 3841, 3841, 3841, 3841,
|
1554 |
+
/* 1790 */ 3841, 3841, 3841, 3841, 3841, 3841, 3841, 3841,
|
1555 |
+
/* 1798 */ 3841, 3841, 3841, 3841, 3841, 3841, 3841, 3841,
|
1556 |
+
/* 17A0 */ 3841, 3841, 3841, 3842, 3842, 3842, 3842, 3842,
|
1557 |
+
/* 17A8 */ 3842, 3842, 3842, 3842, 3842, 3842, 3842, 3842,
|
1558 |
+
/* 17B0 */ 3842, 3842, 3842, 3842, 3840, 3840, 2823, 1543,
|
1559 |
+
/* 17B8 */ 1543, 1543, 1543, 2055, 2055, 2055, 1543, 2823,
|
1560 |
+
/* 17C0 */ 2823, 775, 775, 775, 2823, 2823, 3848, 3848,
|
1561 |
+
/* 17C8 */ 2823, 3853, 3853, 3840, 3855, 3840, 3840, 3840,
|
1562 |
+
/* 17D0 */ 3840, 1540, 3844, 3840, 3840, 3840, 3840, 3840,
|
1563 |
+
/* 17D8 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1564 |
+
/* 17E0 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1565 |
+
/* 17E8 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1566 |
+
/* 17F0 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1567 |
+
/* 17F8 */ 3840, 3840, 3840, 3840, 3840, 3840, 3840, 3840,
|
1568 |
+
);
|
1569 |
+
|
1570 |
+
// from "hb-ot-shape-complex-indic-table.cc"
|
1571 |
+
public static function indic_get_categories($u)
|
1572 |
+
{
|
1573 |
+
if (0x0900 <= $u && $u <= 0x0DFF)
|
1574 |
+
return self::$indic_table[$u - 0x0900 + 0]; // offset 0 for Most "indic"
|
1575 |
+
if (0x1CD0 <= $u && $u <= 0x1D00)
|
1576 |
+
return self::$indic_table[$u - 0x1CD0 + 1152]; // offset for Vedic extensions
|
1577 |
+
if (0x1780 <= $u && $u <= 0x17FF)
|
1578 |
+
return self::$khmer_table[$u - 0x1780]; // Khmer
|
1579 |
+
if ($u == 0x00A0)
|
1580 |
+
return 3851; // (ISC_CP | (IMC_x << 8))
|
1581 |
+
if ($u == 0x25CC)
|
1582 |
+
return 3851; // (ISC_CP | (IMC_x << 8))
|
1583 |
+
return 3840; // (ISC_x | (IMC_x << 8))
|
1584 |
+
}
|
1585 |
+
|
1586 |
+
// BELOW from hb-ot-shape-complex-indic.cc
|
1587 |
+
/*
|
1588 |
+
* Indic shaper.
|
1589 |
+
*/
|
1590 |
+
|
1591 |
+
public static function IN_HALF_BLOCK($u, $Base)
|
1592 |
+
{
|
1593 |
+
return (($u & ~0x7F) == $Base);
|
1594 |
+
}
|
1595 |
+
|
1596 |
+
public static function IS_DEVA($u)
|
1597 |
+
{
|
1598 |
+
return self::IN_HALF_BLOCK($u, 0x0900);
|
1599 |
+
}
|
1600 |
+
|
1601 |
+
public static function IS_BENG($u)
|
1602 |
+
{
|
1603 |
+
return self::IN_HALF_BLOCK($u, 0x0980);
|
1604 |
+
}
|
1605 |
+
|
1606 |
+
public static function IS_GURU($u)
|
1607 |
+
{
|
1608 |
+
return self::IN_HALF_BLOCK($u, 0x0A00);
|
1609 |
+
}
|
1610 |
+
|
1611 |
+
public static function IS_GUJR($u)
|
1612 |
+
{
|
1613 |
+
return self::IN_HALF_BLOCK($u, 0x0A80);
|
1614 |
+
}
|
1615 |
+
|
1616 |
+
public static function IS_ORYA($u)
|
1617 |
+
{
|
1618 |
+
return self::IN_HALF_BLOCK($u, 0x0B00);
|
1619 |
+
}
|
1620 |
+
|
1621 |
+
public static function IS_TAML($u)
|
1622 |
+
{
|
1623 |
+
return self::IN_HALF_BLOCK($u, 0x0B80);
|
1624 |
+
}
|
1625 |
+
|
1626 |
+
public static function IS_TELU($u)
|
1627 |
+
{
|
1628 |
+
return self::IN_HALF_BLOCK($u, 0x0C00);
|
1629 |
+
}
|
1630 |
+
|
1631 |
+
public static function IS_KNDA($u)
|
1632 |
+
{
|
1633 |
+
return self::IN_HALF_BLOCK($u, 0x0C80);
|
1634 |
+
}
|
1635 |
+
|
1636 |
+
public static function IS_MLYM($u)
|
1637 |
+
{
|
1638 |
+
return self::IN_HALF_BLOCK($u, 0x0D00);
|
1639 |
+
}
|
1640 |
+
|
1641 |
+
public static function IS_SINH($u)
|
1642 |
+
{
|
1643 |
+
return self::IN_HALF_BLOCK($u, 0x0D80);
|
1644 |
+
}
|
1645 |
+
|
1646 |
+
public static function IS_KHMR($u)
|
1647 |
+
{
|
1648 |
+
return self::IN_HALF_BLOCK($u, 0x1780);
|
1649 |
+
}
|
1650 |
+
|
1651 |
+
public static function MATRA_POS_LEFT($u)
|
1652 |
+
{
|
1653 |
+
return self::POS_PRE_M;
|
1654 |
+
}
|
1655 |
+
|
1656 |
+
public static function MATRA_POS_RIGHT($u)
|
1657 |
+
{
|
1658 |
+
return
|
1659 |
+
(self::IS_DEVA($u) ? self::POS_AFTER_SUB :
|
1660 |
+
(self::IS_BENG($u) ? self::POS_AFTER_POST :
|
1661 |
+
(self::IS_GURU($u) ? self::POS_AFTER_POST :
|
1662 |
+
(self::IS_GUJR($u) ? self::POS_AFTER_POST :
|
1663 |
+
(self::IS_ORYA($u) ? self::POS_AFTER_POST :
|
1664 |
+
(self::IS_TAML($u) ? self::POS_AFTER_POST :
|
1665 |
+
(self::IS_TELU($u) ? ($u <= 0x0C42 ? self::POS_BEFORE_SUB : self::POS_AFTER_SUB) :
|
1666 |
+
(self::IS_KNDA($u) ? ($u < 0x0CC3 || $u > 0xCD6 ? self::POS_BEFORE_SUB : self::POS_AFTER_SUB) :
|
1667 |
+
(self::IS_MLYM($u) ? self::POS_AFTER_POST :
|
1668 |
+
(self::IS_SINH($u) ? self::POS_AFTER_SUB :
|
1669 |
+
(self::IS_KHMR($u) ? self::POS_AFTER_POST :
|
1670 |
+
self::POS_AFTER_SUB))))))))))); /* default */
|
1671 |
+
}
|
1672 |
+
|
1673 |
+
public static function MATRA_POS_TOP($u)
|
1674 |
+
{
|
1675 |
+
return /* BENG and MLYM don't have top matras. */
|
1676 |
+
(self::IS_DEVA($u) ? self::POS_AFTER_SUB :
|
1677 |
+
(self::IS_GURU($u) ? self::POS_AFTER_POST : /* Deviate from spec */
|
1678 |
+
(self::IS_GUJR($u) ? self::POS_AFTER_SUB :
|
1679 |
+
(self::IS_ORYA($u) ? self::POS_AFTER_MAIN :
|
1680 |
+
(self::IS_TAML($u) ? self::POS_AFTER_SUB :
|
1681 |
+
(self::IS_TELU($u) ? self::POS_BEFORE_SUB :
|
1682 |
+
(self::IS_KNDA($u) ? self::POS_BEFORE_SUB :
|
1683 |
+
(self::IS_SINH($u) ? self::POS_AFTER_SUB :
|
1684 |
+
(self::IS_KHMR($u) ? self::POS_AFTER_POST :
|
1685 |
+
self::POS_AFTER_SUB))))))))); /* default */
|
1686 |
+
}
|
1687 |
+
|
1688 |
+
public static function MATRA_POS_BOTTOM($u)
|
1689 |
+
{
|
1690 |
+
return
|
1691 |
+
(self::IS_DEVA($u) ? self::POS_AFTER_SUB :
|
1692 |
+
(self::IS_BENG($u) ? self::POS_AFTER_SUB :
|
1693 |
+
(self::IS_GURU($u) ? self::POS_AFTER_POST :
|
1694 |
+
(self::IS_GUJR($u) ? self::POS_AFTER_POST :
|
1695 |
+
(self::IS_ORYA($u) ? self::POS_AFTER_SUB :
|
1696 |
+
(self::IS_TAML($u) ? self::POS_AFTER_POST :
|
1697 |
+
(self::IS_TELU($u) ? self::POS_BEFORE_SUB :
|
1698 |
+
(self::IS_KNDA($u) ? self::POS_BEFORE_SUB :
|
1699 |
+
(self::IS_MLYM($u) ? self::POS_AFTER_POST :
|
1700 |
+
(self::IS_SINH($u) ? self::POS_AFTER_SUB :
|
1701 |
+
(self::IS_KHMR($u) ? self::POS_AFTER_POST :
|
1702 |
+
self::POS_AFTER_SUB))))))))))); /* default */
|
1703 |
+
}
|
1704 |
+
|
1705 |
+
public static function matra_position($u, $side)
|
1706 |
+
{
|
1707 |
+
switch ($side) {
|
1708 |
+
case self::POS_PRE_C: return self::MATRA_POS_LEFT($u);
|
1709 |
+
case self::POS_POST_C: return self::MATRA_POS_RIGHT($u);
|
1710 |
+
case self::POS_ABOVE_C: return self::MATRA_POS_TOP($u);
|
1711 |
+
case self::POS_BELOW_C: return self::MATRA_POS_BOTTOM($u);
|
1712 |
+
}
|
1713 |
+
return $side;
|
1714 |
+
}
|
1715 |
+
|
1716 |
+
// vowel matras that have to be split into two parts.
|
1717 |
+
// From Harfbuzz (old)
|
1718 |
+
// New HarfBuzz uses /src/hb-ucdn/ucdn.c and unicodedata_db.h for full method of decomposition for all characters
|
1719 |
+
// Should always fully decompose and then recompose back, but we will just do the split matras
|
1720 |
+
public static function decompose_indic($ab)
|
1721 |
+
{
|
1722 |
+
$sub = array();
|
1723 |
+
switch ($ab) {
|
1724 |
+
/*
|
1725 |
+
* Decompose split matras.
|
1726 |
+
*/
|
1727 |
+
/* bengali */
|
1728 |
+
case 0x9cb : $sub[0] = 0x9c7;
|
1729 |
+
$sub[1] = 0x9be;
|
1730 |
+
return $sub;
|
1731 |
+
case 0x9cc : $sub[0] = 0x9c7;
|
1732 |
+
$sub[1] = 0x9d7;
|
1733 |
+
return $sub;
|
1734 |
+
/* oriya */
|
1735 |
+
case 0xb48 : $sub[0] = 0xb47;
|
1736 |
+
$sub[1] = 0xb56;
|
1737 |
+
return $sub;
|
1738 |
+
case 0xb4b : $sub[0] = 0xb47;
|
1739 |
+
$sub[1] = 0xb3e;
|
1740 |
+
return $sub;
|
1741 |
+
case 0xb4c : $sub[0] = 0xb47;
|
1742 |
+
$sub[1] = 0xb57;
|
1743 |
+
return $sub;
|
1744 |
+
/* tamil */
|
1745 |
+
case 0xbca : $sub[0] = 0xbc6;
|
1746 |
+
$sub[1] = 0xbbe;
|
1747 |
+
return $sub;
|
1748 |
+
case 0xbcb : $sub[0] = 0xbc7;
|
1749 |
+
$sub[1] = 0xbbe;
|
1750 |
+
return $sub;
|
1751 |
+
case 0xbcc : $sub[0] = 0xbc6;
|
1752 |
+
$sub[1] = 0xbd7;
|
1753 |
+
return $sub;
|
1754 |
+
/* telugu */
|
1755 |
+
case 0xc48 : $sub[0] = 0xc46;
|
1756 |
+
$sub[1] = 0xc56;
|
1757 |
+
return $sub;
|
1758 |
+
/* kannada */
|
1759 |
+
case 0xcc0 : $sub[0] = 0xcbf;
|
1760 |
+
$sub[1] = 0xcd5;
|
1761 |
+
return $sub;
|
1762 |
+
case 0xcc7 : $sub[0] = 0xcc6;
|
1763 |
+
$sub[1] = 0xcd5;
|
1764 |
+
return $sub;
|
1765 |
+
case 0xcc8 : $sub[0] = 0xcc6;
|
1766 |
+
$sub[1] = 0xcd6;
|
1767 |
+
return $sub;
|
1768 |
+
case 0xcca : $sub[0] = 0xcc6;
|
1769 |
+
$sub[1] = 0xcc2;
|
1770 |
+
return $sub;
|
1771 |
+
case 0xccb : $sub[0] = 0xcc6;
|
1772 |
+
$sub[1] = 0xcc2;
|
1773 |
+
$sub[2] = 0xcd5;
|
1774 |
+
return $sub;
|
1775 |
+
/* malayalam */
|
1776 |
+
case 0xd4a : $sub[0] = 0xd46;
|
1777 |
+
$sub[1] = 0xd3e;
|
1778 |
+
return $sub;
|
1779 |
+
case 0xd4b : $sub[0] = 0xd47;
|
1780 |
+
$sub[1] = 0xd3e;
|
1781 |
+
return $sub;
|
1782 |
+
case 0xd4c : $sub[0] = 0xd46;
|
1783 |
+
$sub[1] = 0xd57;
|
1784 |
+
return $sub;
|
1785 |
+
/* sinhala */
|
1786 |
+
// NB Some fonts break with these Sinhala decomps (although this is Uniscribe spec)
|
1787 |
+
// Can check if character would be substituted by pstf and only decompose if true
|
1788 |
+
// e.g. if (isset($GSUBdata['pstf'][$ab])) - would need to pass $GSUBdata as parameter to this function
|
1789 |
+
case 0xdda : $sub[0] = 0xdd9;
|
1790 |
+
$sub[1] = 0xdca;
|
1791 |
+
return $sub;
|
1792 |
+
case 0xddc : $sub[0] = 0xdd9;
|
1793 |
+
$sub[1] = 0xdcf;
|
1794 |
+
return $sub;
|
1795 |
+
case 0xddd : $sub[0] = 0xdd9;
|
1796 |
+
$sub[1] = 0xdcf;
|
1797 |
+
$sub[2] = 0xdca;
|
1798 |
+
return $sub;
|
1799 |
+
case 0xdde : $sub[0] = 0xdd9;
|
1800 |
+
$sub[1] = 0xddf;
|
1801 |
+
return $sub;
|
1802 |
+
/* khmer */
|
1803 |
+
case 0x17be : $sub[0] = 0x17c1;
|
1804 |
+
$sub[1] = 0x17be;
|
1805 |
+
return $sub;
|
1806 |
+
case 0x17bf : $sub[0] = 0x17c1;
|
1807 |
+
$sub[1] = 0x17bf;
|
1808 |
+
return $sub;
|
1809 |
+
case 0x17c0 : $sub[0] = 0x17c1;
|
1810 |
+
$sub[1] = 0x17c0;
|
1811 |
+
return $sub;
|
1812 |
+
|
1813 |
+
case 0x17c4 : $sub[0] = 0x17c1;
|
1814 |
+
$sub[1] = 0x17c4;
|
1815 |
+
return $sub;
|
1816 |
+
case 0x17c5 : $sub[0] = 0x17c1;
|
1817 |
+
$sub[1] = 0x17c5;
|
1818 |
+
return $sub;
|
1819 |
+
/* tibetan - included here although does not use Inidc shaper in other ways */
|
1820 |
+
case 0xf73 : $sub[0] = 0xf71;
|
1821 |
+
$sub[1] = 0xf72;
|
1822 |
+
return $sub;
|
1823 |
+
case 0xf75 : $sub[0] = 0xf71;
|
1824 |
+
$sub[1] = 0xf74;
|
1825 |
+
return $sub;
|
1826 |
+
case 0xf76 : $sub[0] = 0xfb2;
|
1827 |
+
$sub[1] = 0xf80;
|
1828 |
+
return $sub;
|
1829 |
+
case 0xf77 : $sub[0] = 0xfb2;
|
1830 |
+
$sub[1] = 0xf81;
|
1831 |
+
return $sub;
|
1832 |
+
case 0xf78 : $sub[0] = 0xfb3;
|
1833 |
+
$sub[1] = 0xf80;
|
1834 |
+
return $sub;
|
1835 |
+
case 0xf79 : $sub[0] = 0xfb3;
|
1836 |
+
$sub[1] = 0xf71;
|
1837 |
+
$sub[2] = 0xf80;
|
1838 |
+
return $sub;
|
1839 |
+
case 0xf81 : $sub[0] = 0xf71;
|
1840 |
+
$sub[1] = 0xf80;
|
1841 |
+
return $sub;
|
1842 |
+
}
|
1843 |
+
return false;
|
1844 |
+
}
|
1845 |
+
|
1846 |
+
public static function bubble_sort(&$arr, $start, $len)
|
1847 |
+
{
|
1848 |
+
if ($len < 2) {
|
1849 |
+
return;
|
1850 |
+
}
|
1851 |
+
$k = $start + $len - 2;
|
1852 |
+
while ($k >= $start) {
|
1853 |
+
for ($j = $start; $j <= $k; $j++) {
|
1854 |
+
if ($arr[$j]['indic_position'] > $arr[$j + 1]['indic_position']) {
|
1855 |
+
$t = $arr[$j];
|
1856 |
+
$arr[$j] = $arr[$j + 1];
|
1857 |
+
$arr[$j + 1] = $t;
|
1858 |
+
}
|
1859 |
+
}
|
1860 |
+
$k--;
|
1861 |
+
}
|
1862 |
+
}
|
1863 |
+
|
1864 |
+
}
|
lib/mpdf/classes/meter.php
CHANGED
@@ -1,282 +1,292 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class meter
|
4 |
-
|
5 |
-
|
6 |
-
function __construct()
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
<
|
30 |
-
<
|
31 |
-
<stop offset="
|
32 |
-
<stop offset="
|
33 |
-
|
34 |
-
|
35 |
-
</
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
<
|
88 |
-
|
89 |
-
|
90 |
-
<
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
<
|
151 |
-
<
|
152 |
-
<stop offset="
|
153 |
-
<stop offset="
|
154 |
-
<stop offset="
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
<
|
159 |
-
<stop offset="
|
160 |
-
<stop offset="
|
161 |
-
<stop offset="
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
<
|
166 |
-
<stop offset="
|
167 |
-
<stop offset="
|
168 |
-
<stop offset="
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
<
|
173 |
-
<stop offset="
|
174 |
-
<stop offset="
|
175 |
-
<stop offset="
|
176 |
-
|
177 |
-
</
|
178 |
-
|
179 |
-
<
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
<
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class meter
|
4 |
+
{
|
5 |
+
|
6 |
+
function __construct()
|
7 |
+
{
|
8 |
+
|
9 |
+
}
|
10 |
+
|
11 |
+
function makeSVG($tag, $type, $value, $max, $min, $optimum, $low, $high)
|
12 |
+
{
|
13 |
+
$svg = '';
|
14 |
+
if ($tag == 'meter') {
|
15 |
+
|
16 |
+
if ($type == '2') {
|
17 |
+
/////////////////////////////////////////////////////////////////////////////////////
|
18 |
+
///////// CUSTOM <meter type="2">
|
19 |
+
/////////////////////////////////////////////////////////////////////////////////////
|
20 |
+
$h = 10;
|
21 |
+
$w = 160;
|
22 |
+
$border_radius = 0.143; // Factor of Height
|
23 |
+
|
24 |
+
$svg = '<?xml version="1.0" encoding="UTF-8"?>
|
25 |
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
26 |
+
<svg width="' . $w . 'px" height="' . $h . 'px" viewBox="0 0 ' . $w . ' ' . $h . '" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" ><g>
|
27 |
+
|
28 |
+
|
29 |
+
<defs>
|
30 |
+
<linearGradient id="GrGRAY" x1="0" y1="0" x2="0" y2="1" gradientUnits="boundingBox">
|
31 |
+
<stop offset="0%" stop-color="rgb(222, 222, 222)" />
|
32 |
+
<stop offset="20%" stop-color="rgb(232, 232, 232)" />
|
33 |
+
<stop offset="25%" stop-color="rgb(232, 232, 232)" />
|
34 |
+
<stop offset="100%" stop-color="rgb(182, 182, 182)" />
|
35 |
+
</linearGradient>
|
36 |
+
|
37 |
+
</defs>
|
38 |
+
';
|
39 |
+
$svg .= '<rect x="0" y="0" width="' . $w . '" height="' . $h . '" fill="#f4f4f4" stroke="none" />';
|
40 |
+
|
41 |
+
// LOW to HIGH region
|
42 |
+
//if ($low && $high && ($low != $min || $high != $max)) {
|
43 |
+
if ($low && $high) {
|
44 |
+
$barx = (($low - $min) / ($max - $min) ) * $w;
|
45 |
+
$barw = (($high - $low) / ($max - $min) ) * $w;
|
46 |
+
$svg .= '<rect x="' . $barx . '" y="0" width="' . $barw . '" height="' . $h . '" fill="url(#GrGRAY)" stroke="#888888" stroke-width="0.5px" />';
|
47 |
+
}
|
48 |
+
|
49 |
+
// OPTIMUM Marker (? AVERAGE)
|
50 |
+
if ($optimum) {
|
51 |
+
$barx = (($optimum - $min) / ($max - $min) ) * $w;
|
52 |
+
$barw = $h / 2;
|
53 |
+
$barcol = '#888888';
|
54 |
+
$svg .= '<rect x="' . $barx . '" y="0" rx="' . ($h * $border_radius) . 'px" ry="' . ($h * $border_radius) . 'px" width="' . $barw . '" height="' . $h . '" fill="' . $barcol . '" stroke="none" />';
|
55 |
+
}
|
56 |
+
|
57 |
+
// VALUE Marker
|
58 |
+
if ($value) {
|
59 |
+
if ($min != $low && $value < $low) {
|
60 |
+
$col = 'orange';
|
61 |
+
} else if ($max != $high && $value > $high) {
|
62 |
+
$col = 'orange';
|
63 |
+
} else {
|
64 |
+
$col = '#008800';
|
65 |
+
}
|
66 |
+
$cx = (($value - $min) / ($max - $min) ) * $w;
|
67 |
+
$cy = $h / 2;
|
68 |
+
$rx = $h / 3.5;
|
69 |
+
$ry = $h / 2.2;
|
70 |
+
$svg .= '<ellipse fill="' . $col . '" stroke="#000000" stroke-width="0.5px" cx="' . $cx . '" cy="' . $cy . '" rx="' . $rx . '" ry="' . $ry . '"/>';
|
71 |
+
}
|
72 |
+
|
73 |
+
// BoRDER
|
74 |
+
$svg .= '<rect x="0" y="0" width="' . $w . '" height="' . $h . '" fill="none" stroke="#888888" stroke-width="0.5px" />';
|
75 |
+
|
76 |
+
$svg .= '</g></svg>';
|
77 |
+
} else if ($type == '3') {
|
78 |
+
/////////////////////////////////////////////////////////////////////////////////////
|
79 |
+
///////// CUSTOM <meter type="2">
|
80 |
+
/////////////////////////////////////////////////////////////////////////////////////
|
81 |
+
$h = 10;
|
82 |
+
$w = 100;
|
83 |
+
$border_radius = 0.143; // Factor of Height
|
84 |
+
|
85 |
+
$svg = '<?xml version="1.0" encoding="UTF-8"?>
|
86 |
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
87 |
+
<svg width="' . $w . 'px" height="' . $h . 'px" viewBox="0 0 ' . $w . ' ' . $h . '" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" ><g>
|
88 |
+
|
89 |
+
|
90 |
+
<defs>
|
91 |
+
<linearGradient id="GrGRAY" x1="0" y1="0" x2="0" y2="1" gradientUnits="boundingBox">
|
92 |
+
<stop offset="0%" stop-color="rgb(222, 222, 222)" />
|
93 |
+
<stop offset="20%" stop-color="rgb(232, 232, 232)" />
|
94 |
+
<stop offset="25%" stop-color="rgb(232, 232, 232)" />
|
95 |
+
<stop offset="100%" stop-color="rgb(182, 182, 182)" />
|
96 |
+
</linearGradient>
|
97 |
+
|
98 |
+
</defs>
|
99 |
+
';
|
100 |
+
$svg .= '<rect x="0" y="0" width="' . $w . '" height="' . $h . '" fill="#f4f4f4" stroke="none" />';
|
101 |
+
|
102 |
+
// LOW to HIGH region
|
103 |
+
if ($low && $high && ($low != $min || $high != $max)) {
|
104 |
+
//if ($low && $high) {
|
105 |
+
$barx = (($low - $min) / ($max - $min) ) * $w;
|
106 |
+
$barw = (($high - $low) / ($max - $min) ) * $w;
|
107 |
+
$svg .= '<rect x="' . $barx . '" y="0" width="' . $barw . '" height="' . $h . '" fill="url(#GrGRAY)" stroke="#888888" stroke-width="0.5px" />';
|
108 |
+
}
|
109 |
+
|
110 |
+
// OPTIMUM Marker (? AVERAGE)
|
111 |
+
if ($optimum) {
|
112 |
+
$barx = (($optimum - $min) / ($max - $min) ) * $w;
|
113 |
+
$barw = $h / 2;
|
114 |
+
$barcol = '#888888';
|
115 |
+
$svg .= '<rect x="' . $barx . '" y="0" rx="' . ($h * $border_radius) . 'px" ry="' . ($h * $border_radius) . 'px" width="' . $barw . '" height="' . $h . '" fill="' . $barcol . '" stroke="none" />';
|
116 |
+
}
|
117 |
+
|
118 |
+
// VALUE Marker
|
119 |
+
if ($value) {
|
120 |
+
if ($min != $low && $value < $low) {
|
121 |
+
$col = 'orange';
|
122 |
+
} else if ($max != $high && $value > $high) {
|
123 |
+
$col = 'orange';
|
124 |
+
} else {
|
125 |
+
$col = 'orange';
|
126 |
+
}
|
127 |
+
$cx = (($value - $min) / ($max - $min) ) * $w;
|
128 |
+
$cy = $h / 2;
|
129 |
+
$rx = $h / 2.2;
|
130 |
+
$ry = $h / 2.2;
|
131 |
+
$svg .= '<ellipse fill="' . $col . '" stroke="#000000" stroke-width="0.5px" cx="' . $cx . '" cy="' . $cy . '" rx="' . $rx . '" ry="' . $ry . '"/>';
|
132 |
+
}
|
133 |
+
|
134 |
+
// BoRDER
|
135 |
+
$svg .= '<rect x="0" y="0" width="' . $w . '" height="' . $h . '" fill="none" stroke="#888888" stroke-width="0.5px" />';
|
136 |
+
|
137 |
+
$svg .= '</g></svg>';
|
138 |
+
} else {
|
139 |
+
/////////////////////////////////////////////////////////////////////////////////////
|
140 |
+
///////// DEFAULT <meter>
|
141 |
+
/////////////////////////////////////////////////////////////////////////////////////
|
142 |
+
$h = 10;
|
143 |
+
$w = 50;
|
144 |
+
$border_radius = 0.143; // Factor of Height
|
145 |
+
|
146 |
+
$svg = '<?xml version="1.0" encoding="UTF-8"?>
|
147 |
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
148 |
+
<svg width="' . $w . 'px" height="' . $h . 'px" viewBox="0 0 ' . $w . ' ' . $h . '" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" ><g>
|
149 |
+
|
150 |
+
<defs>
|
151 |
+
<linearGradient id="GrGRAY" x1="0" y1="0" x2="0" y2="1" gradientUnits="boundingBox">
|
152 |
+
<stop offset="0%" stop-color="rgb(222, 222, 222)" />
|
153 |
+
<stop offset="20%" stop-color="rgb(232, 232, 232)" />
|
154 |
+
<stop offset="25%" stop-color="rgb(232, 232, 232)" />
|
155 |
+
<stop offset="100%" stop-color="rgb(182, 182, 182)" />
|
156 |
+
</linearGradient>
|
157 |
+
|
158 |
+
<linearGradient id="GrRED" x1="0" y1="0" x2="0" y2="1" gradientUnits="boundingBox">
|
159 |
+
<stop offset="0%" stop-color="rgb(255, 162, 162)" />
|
160 |
+
<stop offset="20%" stop-color="rgb(255, 218, 218)" />
|
161 |
+
<stop offset="25%" stop-color="rgb(255, 218, 218)" />
|
162 |
+
<stop offset="100%" stop-color="rgb(255, 0, 0)" />
|
163 |
+
</linearGradient>
|
164 |
+
|
165 |
+
<linearGradient id="GrGREEN" x1="0" y1="0" x2="0" y2="1" gradientUnits="boundingBox">
|
166 |
+
<stop offset="0%" stop-color="rgb(102, 230, 102)" />
|
167 |
+
<stop offset="20%" stop-color="rgb(218, 255, 218)" />
|
168 |
+
<stop offset="25%" stop-color="rgb(218, 255, 218)" />
|
169 |
+
<stop offset="100%" stop-color="rgb(0, 148, 0)" />
|
170 |
+
</linearGradient>
|
171 |
+
|
172 |
+
<linearGradient id="GrBLUE" x1="0" y1="0" x2="0" y2="1" gradientUnits="boundingBox">
|
173 |
+
<stop offset="0%" stop-color="rgb(102, 102, 230)" />
|
174 |
+
<stop offset="20%" stop-color="rgb(238, 238, 238)" />
|
175 |
+
<stop offset="25%" stop-color="rgb(238, 238, 238)" />
|
176 |
+
<stop offset="100%" stop-color="rgb(0, 0, 128)" />
|
177 |
+
</linearGradient>
|
178 |
+
|
179 |
+
<linearGradient id="GrORANGE" x1="0" y1="0" x2="0" y2="1" gradientUnits="boundingBox">
|
180 |
+
<stop offset="0%" stop-color="rgb(255, 186, 0)" />
|
181 |
+
<stop offset="20%" stop-color="rgb(255, 238, 168)" />
|
182 |
+
<stop offset="25%" stop-color="rgb(255, 238, 168)" />
|
183 |
+
<stop offset="100%" stop-color="rgb(255, 155, 0)" />
|
184 |
+
</linearGradient>
|
185 |
+
</defs>
|
186 |
+
|
187 |
+
<rect x="0" y="0" rx="' . ($h * $border_radius) . 'px" ry="' . ($h * $border_radius) . 'px" width="' . $w . '" height="' . $h . '" fill="url(#GrGRAY)" stroke="none" />
|
188 |
+
';
|
189 |
+
|
190 |
+
if ($value) {
|
191 |
+
$barw = (($value - $min) / ($max - $min) ) * $w;
|
192 |
+
if ($optimum < $low) {
|
193 |
+
if ($value < $low) {
|
194 |
+
$barcol = 'url(#GrGREEN)';
|
195 |
+
} else if ($value > $high) {
|
196 |
+
$barcol = 'url(#GrRED)';
|
197 |
+
} else {
|
198 |
+
$barcol = 'url(#GrORANGE)';
|
199 |
+
}
|
200 |
+
} else if ($optimum > $high) {
|
201 |
+
if ($value < $low) {
|
202 |
+
$barcol = 'url(#GrRED)';
|
203 |
+
} else if ($value > $high) {
|
204 |
+
$barcol = 'url(#GrGREEN)';
|
205 |
+
} else {
|
206 |
+
$barcol = 'url(#GrORANGE)';
|
207 |
+
}
|
208 |
+
} else {
|
209 |
+
if ($value < $low) {
|
210 |
+
$barcol = 'url(#GrORANGE)';
|
211 |
+
} else if ($value > $high) {
|
212 |
+
$barcol = 'url(#GrORANGE)';
|
213 |
+
} else {
|
214 |
+
$barcol = 'url(#GrGREEN)';
|
215 |
+
}
|
216 |
+
}
|
217 |
+
$svg .= '<rect x="0" y="0" rx="' . ($h * $border_radius) . 'px" ry="' . ($h * $border_radius) . 'px" width="' . $barw . '" height="' . $h . '" fill="' . $barcol . '" stroke="none" />';
|
218 |
+
}
|
219 |
+
|
220 |
+
|
221 |
+
// Borders
|
222 |
+
//$svg .= '<rect x="0" y="0" rx="'.($h*$border_radius).'px" ry="'.($h*$border_radius).'px" width="'.$w.'" height="'.$h.'" fill="none" stroke="#888888" stroke-width="0.5px" />';
|
223 |
+
if ($value) {
|
224 |
+
// $svg .= '<rect x="0" y="0" rx="'.($h*$border_radius).'px" ry="'.($h*$border_radius).'px" width="'.$barw.'" height="'.$h.'" fill="none" stroke="#888888" stroke-width="0.5px" />';
|
225 |
+
}
|
226 |
+
|
227 |
+
|
228 |
+
$svg .= '</g></svg>';
|
229 |
+
}
|
230 |
+
} else { // $tag == 'progress'
|
231 |
+
if ($type == '2') {
|
232 |
+
/////////////////////////////////////////////////////////////////////////////////////
|
233 |
+
///////// CUSTOM <progress type="2">
|
234 |
+
/////////////////////////////////////////////////////////////////////////////////////
|
235 |
+
} else {
|
236 |
+
/////////////////////////////////////////////////////////////////////////////////////
|
237 |
+
///////// DEFAULT <progress>
|
238 |
+
/////////////////////////////////////////////////////////////////////////////////////
|
239 |
+
$h = 10;
|
240 |
+
$w = 100;
|
241 |
+
$border_radius = 0.143; // Factor of Height
|
242 |
+
|
243 |
+
if ($value or $value === '0') {
|
244 |
+
$fill = 'url(#GrGRAY)';
|
245 |
+
} else {
|
246 |
+
$fill = '#f8f8f8';
|
247 |
+
}
|
248 |
+
|
249 |
+
$svg = '<svg width="' . $w . 'px" height="' . $h . 'px" viewBox="0 0 ' . $w . ' ' . $h . '"><g>
|
250 |
+
|
251 |
+
<defs>
|
252 |
+
<linearGradient id="GrGRAY" x1="0" y1="0" x2="0" y2="1" gradientUnits="boundingBox">
|
253 |
+
<stop offset="0%" stop-color="rgb(222, 222, 222)" />
|
254 |
+
<stop offset="20%" stop-color="rgb(232, 232, 232)" />
|
255 |
+
<stop offset="25%" stop-color="rgb(232, 232, 232)" />
|
256 |
+
<stop offset="100%" stop-color="rgb(182, 182, 182)" />
|
257 |
+
</linearGradient>
|
258 |
+
|
259 |
+
<linearGradient id="GrGREEN" x1="0" y1="0" x2="0" y2="1" gradientUnits="boundingBox">
|
260 |
+
<stop offset="0%" stop-color="rgb(102, 230, 102)" />
|
261 |
+
<stop offset="20%" stop-color="rgb(218, 255, 218)" />
|
262 |
+
<stop offset="25%" stop-color="rgb(218, 255, 218)" />
|
263 |
+
<stop offset="100%" stop-color="rgb(0, 148, 0)" />
|
264 |
+
</linearGradient>
|
265 |
+
|
266 |
+
</defs>
|
267 |
+
|
268 |
+
<rect x="0" y="0" rx="' . ($h * $border_radius) . 'px" ry="' . ($h * $border_radius) . 'px" width="' . $w . '" height="' . $h . '" fill="' . $fill . '" stroke="none" />
|
269 |
+
';
|
270 |
+
|
271 |
+
if ($value) {
|
272 |
+
$barw = (($value - $min) / ($max - $min) ) * $w;
|
273 |
+
$barcol = 'url(#GrGREEN)';
|
274 |
+
$svg .= '<rect x="0" y="0" rx="' . ($h * $border_radius) . 'px" ry="' . ($h * $border_radius) . 'px" width="' . $barw . '" height="' . $h . '" fill="' . $barcol . '" stroke="none" />';
|
275 |
+
}
|
276 |
+
|
277 |
+
|
278 |
+
// Borders
|
279 |
+
$svg .= '<rect x="0" y="0" rx="' . ($h * $border_radius) . 'px" ry="' . ($h * $border_radius) . 'px" width="' . $w . '" height="' . $h . '" fill="none" stroke="#888888" stroke-width="0.5px" />';
|
280 |
+
if ($value) {
|
281 |
+
// $svg .= '<rect x="0" y="0" rx="'.($h*$border_radius).'px" ry="'.($h*$border_radius).'px" width="'.$barw.'" height="'.$h.'" fill="none" stroke="#888888" stroke-width="0.5px" />';
|
282 |
+
}
|
283 |
+
|
284 |
+
|
285 |
+
$svg .= '</g></svg>';
|
286 |
+
}
|
287 |
+
}
|
288 |
+
|
289 |
+
return $svg;
|
290 |
+
}
|
291 |
+
|
292 |
+
}
|
lib/mpdf/classes/mpdfform.php
CHANGED
@@ -1,1550 +1,1746 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class mpdfform {
|
4 |
-
|
5 |
-
var $mpdf = null;
|
6 |
-
|
7 |
-
var $forms;
|
8 |
-
var $formn;
|
9 |
-
|
10 |
-
//Active Forms
|
11 |
-
var $formSubmitNoValueFields;
|
12 |
-
var $formExportType;
|
13 |
-
var $formSelectDefaultOption;
|
14 |
-
var $formUseZapD;
|
15 |
-
/* Form Styles */
|
16 |
-
var $form_border_color;
|
17 |
-
var $form_background_color;
|
18 |
-
var $form_border_width;
|
19 |
-
var $form_border_style;
|
20 |
-
var $form_button_border_color;
|
21 |
-
var $form_button_background_color;
|
22 |
-
var $form_button_border_width;
|
23 |
-
var $form_button_border_style;
|
24 |
-
var $form_radio_color;
|
25 |
-
var $form_radio_background_color;
|
26 |
-
|
27 |
-
var $form_element_spacing;
|
28 |
-
|
29 |
-
// Active forms
|
30 |
-
var $formMethod;
|
31 |
-
var $formAction;
|
32 |
-
var $form_fonts;
|
33 |
-
var $form_radio_groups;
|
34 |
-
var $form_checkboxes;
|
35 |
-
var $pdf_acro_array;
|
36 |
-
|
37 |
-
var $pdf_array_co;
|
38 |
-
var $array_form_button_js;
|
39 |
-
var $array_form_choice_js;
|
40 |
-
var $array_form_text_js;
|
41 |
-
|
42 |
-
/* Button Text */
|
43 |
-
var $form_button_text;
|
44 |
-
var $form_button_text_over;
|
45 |
-
var $form_button_text_click;
|
46 |
-
var $form_button_icon;
|
47 |
-
|
48 |
-
|
49 |
-
// FORMS
|
50 |
-
var $textarea_lineheight;
|
51 |
-
|
52 |
-
function mpdfform(&$mpdf) {
|
53 |
-
$this->mpdf = $mpdf;
|
54 |
-
|
55 |
-
// ACTIVE FORMS
|
56 |
-
$this->formExportType = 'xfdf'; // 'xfdf' or 'html'
|
57 |
-
$this->formSubmitNoValueFields = true; // Whether to include blank fields when submitting data
|
58 |
-
$this->formSelectDefaultOption = true; // for Select drop down box; if no option is explicitly maked as selected,
|
59 |
-
// this determines whether to select 1st option (as per browser)
|
60 |
-
// - affects whether "required" attribute is relevant
|
61 |
-
$this->formUseZapD = true; // Determine whether to use ZapfDingbat icons for radio/checkboxes
|
62 |
-
|
63 |
-
// FORM STYLES
|
64 |
-
// These can alternatively use a 4 number string to represent CMYK colours
|
65 |
-
$this->form_border_color = '0.6 0.6 0.72'; // RGB
|
66 |
-
$this->form_background_color = '0.975 0.975 0.975'; // RGB
|
67 |
-
$this->form_border_width = '1'; // 0 doesn't seem to work as it should
|
68 |
-
$this->form_border_style = 'S'; // B - Bevelled; D - Double
|
69 |
-
$this->form_button_border_color = '0.2 0.2 0.55';
|
70 |
-
$this->form_button_background_color = '0.941 0.941 0.941';
|
71 |
-
$this->form_button_border_width = '1';
|
72 |
-
$this->form_button_border_style = 'S';
|
73 |
-
$this->form_radio_color = '0.0 0.0 0.4'; // radio and checkbox
|
74 |
-
$this->form_radio_background_color = '0.9 0.9 0.9';
|
75 |
-
|
76 |
-
// FORMS
|
77 |
-
$this->textarea_lineheight = 1.25;
|
78 |
-
|
79 |
-
// FORM ELEMENT SPACING
|
80 |
-
$this->form_element_spacing['select']['outer']['h'] = 0.5; // Horizontal spacing around SELECT
|
81 |
-
$this->form_element_spacing['select']['outer']['v'] = 0.5; // Vertical spacing around SELECT
|
82 |
-
$this->form_element_spacing['select']['inner']['h'] = 0.7; // Horizontal padding around SELECT
|
83 |
-
$this->form_element_spacing['select']['inner']['v'] = 0.7; // Vertical padding around SELECT
|
84 |
-
$this->form_element_spacing['input']['outer']['h'] = 0.5;
|
85 |
-
$this->form_element_spacing['input']['outer']['v'] = 0.5;
|
86 |
-
$this->form_element_spacing['input']['inner']['h'] = 0.7;
|
87 |
-
$this->form_element_spacing['input']['inner']['v'] = 0.7;
|
88 |
-
$this->form_element_spacing['textarea']['outer']['h'] = 0.5;
|
89 |
-
$this->form_element_spacing['textarea']['outer']['v'] = 0.5;
|
90 |
-
$this->form_element_spacing['textarea']['inner']['h'] = 1;
|
91 |
-
$this->form_element_spacing['textarea']['inner']['v'] = 0.5;
|
92 |
-
$this->form_element_spacing['butt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|