diff --git a/app/constants.php b/app/constants.php index c83c4afb65..74d43c68aa 100644 --- a/app/constants.php +++ b/app/constants.php @@ -44,6 +44,7 @@ define('VERSION_SUFFIX', (string) $vendorConfig['versionSuffix']); * @see https://github.com/phpmyadmin/phpmyadmin/issues/16709 */ define('K_PATH_IMAGES', ROOT_PATH); +define('K_PATH_FONTS', realpath(__DIR__ . '/../vendor/tecnickcom/tc-lib-pdf-font/target/fonts')); // phpcs:enable unset($vendorConfig); diff --git a/composer.json b/composer.json index 4a6b745805..608ae155b0 100644 --- a/composer.json +++ b/composer.json @@ -120,6 +120,7 @@ "pragmarx/google2fa-qrcode": "^3.0", "psalm/plugin-phpunit": "^0.19", "symfony/console": "^7.1", + "tecnickcom/tc-lib-pdf": "^8.20", "tecnickcom/tcpdf": "^6.4.4", "vimeo/psalm": "^6.0", "web-auth/webauthn-lib": "^4.9" @@ -145,7 +146,16 @@ "@php phpstan analyse --generate-baseline", "@php psalm --no-cache --threads=max --set-baseline=psalm-baseline.xml" ], - "twig-lint": "@php bin/console lint:twig --ansi --show-deprecations" + "twig-lint": "@php bin/console lint:twig --ansi --show-deprecations", + "tc-lib-pdf-fonts": [ + "[ -d vendor/tecnickcom/tc-lib-pdf-font ] && make -C vendor/tecnickcom/tc-lib-pdf-font deps fonts || true" + ], + "post-install-cmd": [ + "@tc-lib-pdf-fonts" + ], + "post-update-cmd": [ + "@tc-lib-pdf-fonts" + ] }, "config":{ "sort-packages": true, diff --git a/composer.lock b/composer.lock index ad2cb4890b..e5ce35c8bc 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "73186323ccc5039f8a832b45873d703f", + "content-hash": "5c2df82ccce7cbcdb08f3bd6eb228cb2", "packages": [ { "name": "composer/ca-bundle", @@ -8510,6 +8510,914 @@ ], "time": "2026-03-24T13:12:05+00:00" }, + { + "name": "tecnickcom/tc-lib-barcode", + "version": "2.4.39", + "source": { + "type": "git", + "url": "https://github.com/tecnickcom/tc-lib-barcode.git", + "reference": "11886fb5a44ec0f6e77302439e9ebf55034383fa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tecnickcom/tc-lib-barcode/zipball/11886fb5a44ec0f6e77302439e9ebf55034383fa", + "reference": "11886fb5a44ec0f6e77302439e9ebf55034383fa", + "shasum": "" + }, + "require": { + "ext-bcmath": "*", + "ext-date": "*", + "ext-gd": "*", + "ext-pcre": "*", + "php": ">=8.1", + "tecnickcom/tc-lib-color": "^2.5" + }, + "require-dev": { + "pdepend/pdepend": "^2.16", + "phpcompatibility/php-compatibility": "^10.0.0@dev", + "phpmd/phpmd": "^2.15", + "phpunit/phpunit": "^13.1 || ^12.5 || ^11.5 || ^10.5", + "squizlabs/php_codesniffer": "^4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Com\\Tecnick\\Barcode\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Nicola Asuni", + "email": "info@tecnick.com", + "role": "lead" + } + ], + "description": "PHP library to generate linear and bidimensional barcodes", + "homepage": "https://tcpdf.org", + "keywords": [ + "3 of 9", + "ANSI MH10.8M-1983", + "CBC", + "CODABAR", + "CODE 11", + "CODE 128 A B C", + "CODE 39", + "CODE 93", + "EAN 13", + "EAN 8", + "ECC200", + "ISO IEC 15438 2006", + "ISO IEC 16022", + "ISO IEC 24778 2008", + "Intelligent Mail Barcode", + "Interleaved 2 of 5", + "KIX", + "Klant", + "MSI", + "Onecode", + "PHARMACODE", + "PHARMACODE TWO-TRACKS", + "POSTNET", + "RMS4CC", + "Standard 2 of 5", + "UPC-A", + "UPC-E", + "USD-3", + "USPS-B-3200", + "USS-93", + "aztec", + "barcode", + "datamatrix", + "pdf417", + "planet", + "qr-code", + "royal mail", + "tc-lib-barcode", + "upc" + ], + "support": { + "issues": "https://github.com/tecnickcom/tc-lib-barcode/issues", + "source": "https://github.com/tecnickcom/tc-lib-barcode" + }, + "funding": [ + { + "url": "https://github.com/sponsors/tecnickcom", + "type": "github" + } + ], + "time": "2026-05-01T19:04:12+00:00" + }, + { + "name": "tecnickcom/tc-lib-color", + "version": "2.5.3", + "source": { + "type": "git", + "url": "https://github.com/tecnickcom/tc-lib-color.git", + "reference": "136d522f1640723e490b79171e910e647403d971" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tecnickcom/tc-lib-color/zipball/136d522f1640723e490b79171e910e647403d971", + "reference": "136d522f1640723e490b79171e910e647403d971", + "shasum": "" + }, + "require": { + "ext-pcre": "*", + "php": ">=8.1" + }, + "require-dev": { + "pdepend/pdepend": "^2.16", + "phpcompatibility/php-compatibility": "^10.0.0@dev", + "phpmd/phpmd": "^2.15", + "phpunit/phpunit": "^13.1 || ^12.5 || ^11.5 || ^10.5", + "squizlabs/php_codesniffer": "^4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Com\\Tecnick\\Color\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Nicola Asuni", + "email": "info@tecnick.com", + "role": "lead" + } + ], + "description": "PHP library to manipulate various color representations", + "homepage": "https://tcpdf.org", + "keywords": [ + "cmyk", + "color", + "colors", + "colour", + "colours", + "hsl", + "hsla", + "javascript", + "rgb", + "rgba", + "tc-lib-color", + "web" + ], + "support": { + "issues": "https://github.com/tecnickcom/tc-lib-color/issues", + "source": "https://github.com/tecnickcom/tc-lib-color" + }, + "funding": [ + { + "url": "https://github.com/sponsors/tecnickcom", + "type": "github" + } + ], + "time": "2026-05-01T19:02:25+00:00" + }, + { + "name": "tecnickcom/tc-lib-file", + "version": "2.5.2", + "source": { + "type": "git", + "url": "https://github.com/tecnickcom/tc-lib-file.git", + "reference": "5b8515d77dfb5e387b3070423b84b96981be060f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tecnickcom/tc-lib-file/zipball/5b8515d77dfb5e387b3070423b84b96981be060f", + "reference": "5b8515d77dfb5e387b3070423b84b96981be060f", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "ext-pcre": "*", + "php": ">=8.1" + }, + "require-dev": { + "pdepend/pdepend": "^2.16", + "phpcompatibility/php-compatibility": "^10.0.0@dev", + "phpmd/phpmd": "^2.15", + "phpunit/phpunit": "^13.1 || ^12.5 || ^11.5 || ^10.5", + "squizlabs/php_codesniffer": "^4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Com\\Tecnick\\File\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Nicola Asuni", + "email": "info@tecnick.com", + "role": "lead" + } + ], + "description": "PHP library to read byte-level data from files", + "homepage": "https://tcpdf.org", + "keywords": [ + "Double", + "bit", + "byte", + "file", + "long", + "read", + "short", + "tc-lib-file" + ], + "support": { + "issues": "https://github.com/tecnickcom/tc-lib-file/issues", + "source": "https://github.com/tecnickcom/tc-lib-file" + }, + "funding": [ + { + "url": "https://github.com/sponsors/tecnickcom", + "type": "github" + } + ], + "time": "2026-05-01T19:02:40+00:00" + }, + { + "name": "tecnickcom/tc-lib-pdf", + "version": "8.20.0", + "source": { + "type": "git", + "url": "https://github.com/tecnickcom/tc-lib-pdf.git", + "reference": "1848df4f74957dce5a14f3623082daf6429b3a9c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tecnickcom/tc-lib-pdf/zipball/1848df4f74957dce5a14f3623082daf6429b3a9c", + "reference": "1848df4f74957dce5a14f3623082daf6429b3a9c", + "shasum": "" + }, + "require": { + "ext-date": "*", + "ext-pcre": "*", + "php": ">=8.1", + "tecnickcom/tc-lib-barcode": "^2.4", + "tecnickcom/tc-lib-color": "^2.5", + "tecnickcom/tc-lib-file": "^2.5", + "tecnickcom/tc-lib-pdf-encrypt": "^2.2", + "tecnickcom/tc-lib-pdf-font": "^2.12", + "tecnickcom/tc-lib-pdf-graph": "^2.4", + "tecnickcom/tc-lib-pdf-image": "^2.2", + "tecnickcom/tc-lib-pdf-page": "^4.3", + "tecnickcom/tc-lib-pdf-parser": "^3.1", + "tecnickcom/tc-lib-unicode": "^2.1", + "tecnickcom/tc-lib-unicode-data": "^2.0" + }, + "require-dev": { + "pdepend/pdepend": "^2.16", + "phpcompatibility/php-compatibility": "^10.0.0@dev", + "phpmd/phpmd": "^2.15", + "phpunit/phpunit": "^13.1 || ^12.5 || ^11.5 || ^10.5", + "squizlabs/php_codesniffer": "^4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Com\\Tecnick\\Pdf\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Nicola Asuni", + "email": "info@tecnick.com", + "role": "lead" + } + ], + "description": "PHP PDF Library", + "homepage": "https://tcpdf.org", + "keywords": [ + "PDFD32000-2008", + "TCPDF", + "document", + "pdf", + "tc-lib-pdf" + ], + "support": { + "issues": "https://github.com/tecnickcom/tc-lib-pdf/issues", + "source": "https://github.com/tecnickcom/tc-lib-pdf" + }, + "funding": [ + { + "url": "https://github.com/sponsors/tecnickcom", + "type": "github" + } + ], + "time": "2026-05-10T21:44:55+00:00" + }, + { + "name": "tecnickcom/tc-lib-pdf-encrypt", + "version": "2.2.2", + "source": { + "type": "git", + "url": "https://github.com/tecnickcom/tc-lib-pdf-encrypt.git", + "reference": "59237c2ba96e3d2ded12ce3dafcebd666036a81a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tecnickcom/tc-lib-pdf-encrypt/zipball/59237c2ba96e3d2ded12ce3dafcebd666036a81a", + "reference": "59237c2ba96e3d2ded12ce3dafcebd666036a81a", + "shasum": "" + }, + "require": { + "ext-date": "*", + "ext-hash": "*", + "ext-openssl": "*", + "ext-pcre": "*", + "php": ">=8.1" + }, + "require-dev": { + "pdepend/pdepend": "^2.16", + "phpcompatibility/php-compatibility": "^10.0.0@dev", + "phpmd/phpmd": "^2.15", + "phpunit/phpunit": "^13.1 || ^12.5 || ^11.5 || ^10.5", + "squizlabs/php_codesniffer": "^4.0" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "autoload": { + "psr-4": { + "Com\\Tecnick\\Pdf\\Encrypt\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Nicola Asuni", + "email": "info@tecnick.com", + "role": "lead" + } + ], + "description": "PHP library to encrypt data for PDF", + "homepage": "https://tcpdf.org", + "keywords": [ + "aes", + "encrypt", + "encryption", + "pdf", + "rc4", + "tc-lib-pdf-encrypt" + ], + "support": { + "issues": "https://github.com/tecnickcom/tc-lib-pdf-encrypt/issues", + "source": "https://github.com/tecnickcom/tc-lib-pdf-encrypt" + }, + "funding": [ + { + "url": "https://github.com/sponsors/tecnickcom", + "type": "github" + } + ], + "time": "2026-05-01T19:02:57+00:00" + }, + { + "name": "tecnickcom/tc-lib-pdf-filter", + "version": "2.1.2", + "source": { + "type": "git", + "url": "https://github.com/tecnickcom/tc-lib-pdf-filter.git", + "reference": "547a3b05d15e623d0edbedab54d4332a823cd6e6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tecnickcom/tc-lib-pdf-filter/zipball/547a3b05d15e623d0edbedab54d4332a823cd6e6", + "reference": "547a3b05d15e623d0edbedab54d4332a823cd6e6", + "shasum": "" + }, + "require": { + "ext-pcre": "*", + "ext-zlib": "*", + "php": ">=8.1" + }, + "require-dev": { + "pdepend/pdepend": "^2.16", + "phpcompatibility/php-compatibility": "^10.0.0@dev", + "phpmd/phpmd": "^2.15", + "phpunit/phpunit": "^13.1 || ^12.5 || ^11.5 || ^10.5", + "squizlabs/php_codesniffer": "^4.0" + }, + "suggest": { + "ext-imagick": "Required for JPXDecode (JPEG 2000) filter support" + }, + "type": "library", + "autoload": { + "psr-4": { + "Com\\Tecnick\\Pdf\\Filter\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Nicola Asuni", + "email": "info@tecnick.com", + "role": "lead" + } + ], + "description": "PHP library to decode PDF compression and encryption filters", + "homepage": "https://tcpdf.org", + "keywords": [ + "compression", + "encryption", + "filter", + "pdf", + "tc-lib-pdf-filter" + ], + "support": { + "issues": "https://github.com/tecnickcom/tc-lib-pdf-filter/issues", + "source": "https://github.com/tecnickcom/tc-lib-pdf-filter" + }, + "funding": [ + { + "url": "https://github.com/sponsors/tecnickcom", + "type": "github" + } + ], + "time": "2026-05-01T19:03:10+00:00" + }, + { + "name": "tecnickcom/tc-lib-pdf-font", + "version": "2.12.0", + "source": { + "type": "git", + "url": "https://github.com/tecnickcom/tc-lib-pdf-font.git", + "reference": "b4c96f0556a42208bea02802c23cdbfea96f3d73" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tecnickcom/tc-lib-pdf-font/zipball/b4c96f0556a42208bea02802c23cdbfea96f3d73", + "reference": "b4c96f0556a42208bea02802c23cdbfea96f3d73", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-pcre": "*", + "ext-zlib": "*", + "php": ">=8.1", + "tecnickcom/tc-lib-file": "^2.5", + "tecnickcom/tc-lib-pdf-encrypt": "^2.2", + "tecnickcom/tc-lib-unicode-data": "^2.0" + }, + "require-dev": { + "pdepend/pdepend": "^2.16", + "phpcompatibility/php-compatibility": "^10.0.0@dev", + "phpmd/phpmd": "^2.15", + "phpunit/phpunit": "^13.1 || ^12.5 || ^11.5 || ^10.5", + "squizlabs/php_codesniffer": "^4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Com\\Tecnick\\Pdf\\Font\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Nicola Asuni", + "email": "info@tecnick.com", + "role": "lead" + } + ], + "description": "PHP library containing PDF page formats and definitions", + "homepage": "https://tcpdf.org", + "keywords": [ + "PFB", + "afm", + "font", + "import", + "pdf", + "tc-lib-pdf-font", + "ttf" + ], + "support": { + "issues": "https://github.com/tecnickcom/tc-lib-pdf-font/issues", + "source": "https://github.com/tecnickcom/tc-lib-pdf-font" + }, + "funding": [ + { + "url": "https://github.com/sponsors/tecnickcom", + "type": "github" + } + ], + "time": "2026-05-07T20:21:51+00:00" + }, + { + "name": "tecnickcom/tc-lib-pdf-graph", + "version": "2.4.24", + "source": { + "type": "git", + "url": "https://github.com/tecnickcom/tc-lib-pdf-graph.git", + "reference": "0d21ec87996292724498ea201b2a1d3d7fddbbb6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tecnickcom/tc-lib-pdf-graph/zipball/0d21ec87996292724498ea201b2a1d3d7fddbbb6", + "reference": "0d21ec87996292724498ea201b2a1d3d7fddbbb6", + "shasum": "" + }, + "require": { + "ext-zlib": "*", + "php": ">=8.1", + "tecnickcom/tc-lib-color": "^2.5", + "tecnickcom/tc-lib-pdf-encrypt": "^2.2" + }, + "require-dev": { + "pdepend/pdepend": "^2.16", + "phpcompatibility/php-compatibility": "^10.0.0@dev", + "phpmd/phpmd": "^2.15", + "phpunit/phpunit": "^13.1 || ^12.5 || ^11.5 || ^10.5", + "squizlabs/php_codesniffer": "^4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Com\\Tecnick\\Pdf\\Graph\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Nicola Asuni", + "email": "info@tecnick.com", + "role": "lead" + } + ], + "description": "PHP library containing PDF graphic and geometric methods", + "homepage": "https://tcpdf.org", + "keywords": [ + "geometry", + "graphic", + "pdf", + "tc-lib-pdf-graph", + "transformation" + ], + "support": { + "issues": "https://github.com/tecnickcom/tc-lib-pdf-graph/issues", + "source": "https://github.com/tecnickcom/tc-lib-pdf-graph" + }, + "funding": [ + { + "url": "https://github.com/sponsors/tecnickcom", + "type": "github" + } + ], + "time": "2026-05-05T18:15:43+00:00" + }, + { + "name": "tecnickcom/tc-lib-pdf-image", + "version": "2.2.2", + "source": { + "type": "git", + "url": "https://github.com/tecnickcom/tc-lib-pdf-image.git", + "reference": "043dd072c2a8620dc967a3dd73ee65240e270f6a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tecnickcom/tc-lib-pdf-image/zipball/043dd072c2a8620dc967a3dd73ee65240e270f6a", + "reference": "043dd072c2a8620dc967a3dd73ee65240e270f6a", + "shasum": "" + }, + "require": { + "ext-gd": "*", + "ext-zlib": "*", + "php": ">=8.1", + "tecnickcom/tc-lib-color": "^2.5", + "tecnickcom/tc-lib-file": "^2.5", + "tecnickcom/tc-lib-pdf-encrypt": "^2.2" + }, + "require-dev": { + "pdepend/pdepend": "^2.16", + "phpcompatibility/php-compatibility": "^10.0.0@dev", + "phpmd/phpmd": "^2.15", + "phpunit/phpunit": "^13.1 || ^12.5 || ^11.5 || ^10.5", + "squizlabs/php_codesniffer": "^4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Com\\Tecnick\\Pdf\\Image\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Nicola Asuni", + "email": "info@tecnick.com", + "role": "lead" + } + ], + "description": "PHP library containing PDF Image methods", + "homepage": "https://tcpdf.org", + "keywords": [ + "image", + "jpeg", + "jpg", + "pdf", + "png", + "tc-lib-pdf-image" + ], + "support": { + "issues": "https://github.com/tecnickcom/tc-lib-pdf-image/issues", + "source": "https://github.com/tecnickcom/tc-lib-pdf-image" + }, + "funding": [ + { + "url": "https://github.com/sponsors/tecnickcom", + "type": "github" + } + ], + "time": "2026-05-01T19:05:52+00:00" + }, + { + "name": "tecnickcom/tc-lib-pdf-page", + "version": "4.3.23", + "source": { + "type": "git", + "url": "https://github.com/tecnickcom/tc-lib-pdf-page.git", + "reference": "0f2207b9d0f16358fb6f5747d3c4f9fde88c5c34" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tecnickcom/tc-lib-pdf-page/zipball/0f2207b9d0f16358fb6f5747d3c4f9fde88c5c34", + "reference": "0f2207b9d0f16358fb6f5747d3c4f9fde88c5c34", + "shasum": "" + }, + "require": { + "ext-date": "*", + "ext-zlib": "*", + "php": ">=8.1", + "tecnickcom/tc-lib-color": "^2.5", + "tecnickcom/tc-lib-pdf-encrypt": "^2.2" + }, + "require-dev": { + "pdepend/pdepend": "^2.16", + "phpcompatibility/php-compatibility": "^10.0.0@dev", + "phpmd/phpmd": "^2.15", + "phpunit/phpunit": "^13.1 || ^12.5 || ^11.5 || ^10.5", + "squizlabs/php_codesniffer": "^4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Com\\Tecnick\\Pdf\\Page\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Nicola Asuni", + "email": "info@tecnick.com", + "role": "lead" + } + ], + "description": "PHP library containing PDF page formats and definitions", + "homepage": "https://tcpdf.org", + "keywords": [ + "format", + "page", + "pdf", + "tc-lib-pdf-page" + ], + "support": { + "issues": "https://github.com/tecnickcom/tc-lib-pdf-page/issues", + "source": "https://github.com/tecnickcom/tc-lib-pdf-page" + }, + "funding": [ + { + "url": "https://github.com/sponsors/tecnickcom", + "type": "github" + } + ], + "time": "2026-05-01T19:05:18+00:00" + }, + { + "name": "tecnickcom/tc-lib-pdf-parser", + "version": "3.1.2", + "source": { + "type": "git", + "url": "https://github.com/tecnickcom/tc-lib-pdf-parser.git", + "reference": "9f0c184eec9258c8671ad7a745e99608ea5515b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tecnickcom/tc-lib-pdf-parser/zipball/9f0c184eec9258c8671ad7a745e99608ea5515b6", + "reference": "9f0c184eec9258c8671ad7a745e99608ea5515b6", + "shasum": "" + }, + "require": { + "ext-pcre": "*", + "php": ">=8.1", + "tecnickcom/tc-lib-pdf-filter": "^2.1" + }, + "require-dev": { + "pdepend/pdepend": "^2.16", + "phpcompatibility/php-compatibility": "^10.0.0@dev", + "phpmd/phpmd": "^2.15", + "phpunit/phpunit": "^13.1 || ^12.5 || ^11.5 || ^10.5", + "squizlabs/php_codesniffer": "^4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Com\\Tecnick\\Pdf\\Parser\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Nicola Asuni", + "email": "info@tecnick.com", + "role": "lead" + } + ], + "description": "PHP library to parse PDF documents", + "homepage": "https://tcpdf.org", + "keywords": [ + "document", + "parser", + "pdf", + "tc-lib-pdf-parser" + ], + "support": { + "issues": "https://github.com/tecnickcom/tc-lib-pdf-parser/issues", + "source": "https://github.com/tecnickcom/tc-lib-pdf-parser" + }, + "funding": [ + { + "url": "https://github.com/sponsors/tecnickcom", + "type": "github" + } + ], + "time": "2026-05-01T19:04:32+00:00" + }, + { + "name": "tecnickcom/tc-lib-unicode", + "version": "2.1.2", + "source": { + "type": "git", + "url": "https://github.com/tecnickcom/tc-lib-unicode.git", + "reference": "b31d4b29708177fb1e67612fdbc85c05aec64431" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tecnickcom/tc-lib-unicode/zipball/b31d4b29708177fb1e67612fdbc85c05aec64431", + "reference": "b31d4b29708177fb1e67612fdbc85c05aec64431", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "ext-pcre": "*", + "php": ">=8.1", + "tecnickcom/tc-lib-unicode-data": "^2.0" + }, + "require-dev": { + "pdepend/pdepend": "^2.16", + "phpcompatibility/php-compatibility": "^10.0.0@dev", + "phpmd/phpmd": "^2.15", + "phpunit/phpunit": "^13.1 || ^12.5 || ^11.5 || ^10.5", + "squizlabs/php_codesniffer": "^4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Com\\Tecnick\\Unicode\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Nicola Asuni", + "email": "info@tecnick.com", + "role": "lead" + } + ], + "description": "PHP library containing Unicode methods", + "homepage": "https://tcpdf.org", + "keywords": [ + "font", + "pdf", + "tc-lib-unicode", + "unicode", + "utf-8" + ], + "support": { + "issues": "https://github.com/tecnickcom/tc-lib-unicode/issues", + "source": "https://github.com/tecnickcom/tc-lib-unicode" + }, + "funding": [ + { + "url": "https://github.com/sponsors/tecnickcom", + "type": "github" + } + ], + "time": "2026-05-01T19:05:00+00:00" + }, + { + "name": "tecnickcom/tc-lib-unicode-data", + "version": "2.0.53", + "source": { + "type": "git", + "url": "https://github.com/tecnickcom/tc-lib-unicode-data.git", + "reference": "c0e5ca58418eb8ca3f4aad220e45a71d9ab14eea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tecnickcom/tc-lib-unicode-data/zipball/c0e5ca58418eb8ca3f4aad220e45a71d9ab14eea", + "reference": "c0e5ca58418eb8ca3f4aad220e45a71d9ab14eea", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "pdepend/pdepend": "^2.16", + "phpcompatibility/php-compatibility": "^10.0.0@dev", + "phpmd/phpmd": "^2.15", + "phpunit/phpunit": "^13.1 || ^12.5 || ^11.5 || ^10.5", + "squizlabs/php_codesniffer": "^4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Com\\Tecnick\\Unicode\\Data\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Nicola Asuni", + "email": "info@tecnick.com", + "role": "lead" + } + ], + "description": "PHP library containing Unicode definitions", + "homepage": "https://tcpdf.org", + "keywords": [ + "font", + "pdf", + "tc-lib-unicode-data", + "unicode", + "utf-8" + ], + "support": { + "issues": "https://github.com/tecnickcom/tc-lib-unicode-data/issues", + "source": "https://github.com/tecnickcom/tc-lib-unicode-data" + }, + "funding": [ + { + "url": "https://github.com/sponsors/tecnickcom", + "type": "github" + } + ], + "time": "2026-05-01T19:03:32+00:00" + }, { "name": "tecnickcom/tcpdf", "version": "6.11.3", diff --git a/src/Gis/GisGeometry.php b/src/Gis/GisGeometry.php index 69fac586fc..c5b6670d4a 100644 --- a/src/Gis/GisGeometry.php +++ b/src/Gis/GisGeometry.php @@ -7,10 +7,10 @@ declare(strict_types=1); namespace PhpMyAdmin\Gis; +use Com\Tecnick\Pdf\Tcpdf; use PhpMyAdmin\Gis\Ds\Extent; use PhpMyAdmin\Gis\Ds\ScaleData; use PhpMyAdmin\Image\ImageWrapper; -use TCPDF; use function explode; use function mb_strripos; @@ -72,7 +72,7 @@ abstract class GisGeometry string $label, array $color, ScaleData $scaleData, - TCPDF $pdf, + Tcpdf $pdf, ): void; /** diff --git a/src/Gis/GisGeometryCollection.php b/src/Gis/GisGeometryCollection.php index 5bc740a6b0..53f73b6ef1 100644 --- a/src/Gis/GisGeometryCollection.php +++ b/src/Gis/GisGeometryCollection.php @@ -7,11 +7,11 @@ declare(strict_types=1); namespace PhpMyAdmin\Gis; +use Com\Tecnick\Pdf\Tcpdf; use ErrorException; use PhpMyAdmin\Gis\Ds\Extent; use PhpMyAdmin\Gis\Ds\ScaleData; use PhpMyAdmin\Image\ImageWrapper; -use TCPDF; use function count; use function implode; @@ -94,7 +94,7 @@ class GisGeometryCollection extends GisGeometry string $label, array $color, ScaleData $scaleData, - TCPDF $pdf, + Tcpdf $pdf, ): void { // Trim to remove leading 'GEOMETRYCOLLECTION(' and trailing ')' $geomCol = mb_substr($spatial, 19, -1); diff --git a/src/Gis/GisLineString.php b/src/Gis/GisLineString.php index 41e8149230..55193a891f 100644 --- a/src/Gis/GisLineString.php +++ b/src/Gis/GisLineString.php @@ -7,10 +7,10 @@ declare(strict_types=1); namespace PhpMyAdmin\Gis; +use Com\Tecnick\Pdf\Tcpdf; use PhpMyAdmin\Gis\Ds\Extent; use PhpMyAdmin\Gis\Ds\ScaleData; use PhpMyAdmin\Image\ImageWrapper; -use TCPDF; use function count; use function implode; @@ -104,23 +104,24 @@ class GisLineString extends GisGeometry string $label, array $color, ScaleData $scaleData, - TCPDF $pdf, + Tcpdf $pdf, ): void { - $lineStyle = ['all' => ['width' => 1.5, 'color' => $color]]; + $lineStyle = ['lineWidth' => 1.5, 'lineColor' => sprintf('rgb(%d,%d,%d)', $color[0], $color[1], $color[2])]; // Trim to remove leading 'LINESTRING(' and trailing ')' $linestring = mb_substr($spatial, 11, -1); $pointsArr = $this->extractPoints1dLinear($linestring, $scaleData); - $pdf->PolyLine($pointsArr, 'S', $lineStyle); + $pdf->page->addContent($pdf->graph->getPolygon($pointsArr, 'S', ['all' => $lineStyle])); if ($label === '') { return; } // print label - $pdf->setXY($pointsArr[2], $pointsArr[3]); - $pdf->setFontSize(5); - $pdf->Cell(0, 0, $label); + $font = $pdf->font->getCurrentFont(); + $labelFont = $pdf->font->insert($pdf->pon, $font['key'], $font['style'], 5); + $pdf->page->addContent($labelFont['out']); + $pdf->page->addContent($pdf->getTextCell($label, $pointsArr[2], $pointsArr[3])); } /** diff --git a/src/Gis/GisMultiLineString.php b/src/Gis/GisMultiLineString.php index 54cae0d260..f89c0280b6 100644 --- a/src/Gis/GisMultiLineString.php +++ b/src/Gis/GisMultiLineString.php @@ -7,10 +7,10 @@ declare(strict_types=1); namespace PhpMyAdmin\Gis; +use Com\Tecnick\Pdf\Tcpdf; use PhpMyAdmin\Gis\Ds\Extent; use PhpMyAdmin\Gis\Ds\ScaleData; use PhpMyAdmin\Image\ImageWrapper; -use TCPDF; use function count; use function explode; @@ -119,9 +119,9 @@ class GisMultiLineString extends GisGeometry string $label, array $color, ScaleData $scaleData, - TCPDF $pdf, + Tcpdf $pdf, ): void { - $lineStyle = ['all' => ['width' => 1.5, 'color' => $color]]; + $lineStyle = ['lineWidth' => 1.5, 'lineColor' => sprintf('rgb(%d,%d,%d)', $color[0], $color[1], $color[2])]; // Trim to remove leading 'MULTILINESTRING((' and trailing '))' $multilineString = mb_substr($spatial, 17, -2); @@ -131,13 +131,14 @@ class GisMultiLineString extends GisGeometry $firstLine = true; foreach ($linestrings as $linestring) { $pointsArr = $this->extractPoints1dLinear($linestring, $scaleData); - $pdf->PolyLine($pointsArr, 'S', $lineStyle); + $pdf->page->addContent($pdf->graph->getPolygon($pointsArr, 'S', ['all' => $lineStyle])); // print label if ($label !== '' && $firstLine) { - $pdf->setXY($pointsArr[2], $pointsArr[3]); - $pdf->setFontSize(5); - $pdf->Cell(0, 0, $label); + $font = $pdf->font->getCurrentFont(); + $labelFont = $pdf->font->insert($pdf->pon, $font['key'], $font['style'], 5); + $pdf->page->addContent($labelFont['out']); + $pdf->page->addContent($pdf->getTextCell($label, $pointsArr[2], $pointsArr[3])); } $firstLine = false; diff --git a/src/Gis/GisMultiPoint.php b/src/Gis/GisMultiPoint.php index 96cdada33c..436f219002 100644 --- a/src/Gis/GisMultiPoint.php +++ b/src/Gis/GisMultiPoint.php @@ -7,10 +7,10 @@ declare(strict_types=1); namespace PhpMyAdmin\Gis; +use Com\Tecnick\Pdf\Tcpdf; use PhpMyAdmin\Gis\Ds\Extent; use PhpMyAdmin\Gis\Ds\ScaleData; use PhpMyAdmin\Image\ImageWrapper; -use TCPDF; use function count; use function implode; @@ -102,9 +102,9 @@ class GisMultiPoint extends GisGeometry string $label, array $color, ScaleData $scaleData, - TCPDF $pdf, + Tcpdf $pdf, ): void { - $line = ['width' => 1.25, 'color' => $color]; + $style = ['lineWidth' => 1.25, 'lineColor' => sprintf('rgb(%d,%d,%d)', $color[0], $color[1], $color[2])]; // Trim to remove leading 'MULTIPOINT(' and trailing ')' $multipoint = mb_substr($spatial, 11, -1); @@ -112,7 +112,7 @@ class GisMultiPoint extends GisGeometry foreach ($pointsArr as $point) { // draw a small circle to mark the point - $pdf->Circle($point[0], $point[1], 2, 0, 360, 'D', $line); + $pdf->page->addContent($pdf->graph->getCircle($point[0], $point[1], 2, style: $style)); } if ($label === '' || ! isset($pointsArr[0])) { @@ -120,9 +120,10 @@ class GisMultiPoint extends GisGeometry } // print label for each point - $pdf->setXY($pointsArr[0][0], $pointsArr[0][1]); - $pdf->setFontSize(5); - $pdf->Cell(0, 0, $label); + $font = $pdf->font->getCurrentFont(); + $labelFont = $pdf->font->insert($pdf->pon, $font['key'], $font['style'], 5); + $pdf->page->addContent($labelFont['out']); + $pdf->page->addContent($pdf->getTextCell($label, $pointsArr[0][0], $pointsArr[0][1])); } /** diff --git a/src/Gis/GisMultiPolygon.php b/src/Gis/GisMultiPolygon.php index 9503df0697..c68e8755ca 100644 --- a/src/Gis/GisMultiPolygon.php +++ b/src/Gis/GisMultiPolygon.php @@ -7,11 +7,11 @@ declare(strict_types=1); namespace PhpMyAdmin\Gis; +use Com\Tecnick\Pdf\Tcpdf; use PhpMyAdmin\Gis\Ds\Extent; use PhpMyAdmin\Gis\Ds\Polygon; use PhpMyAdmin\Gis\Ds\ScaleData; use PhpMyAdmin\Image\ImageWrapper; -use TCPDF; use function array_merge; use function array_slice; @@ -122,12 +122,13 @@ class GisMultiPolygon extends GisGeometry string $label, array $color, ScaleData $scaleData, - TCPDF $pdf, + Tcpdf $pdf, ): void { // Trim to remove leading 'MULTIPOLYGON(((' and trailing ')))' $multipolygon = mb_substr($spatial, 15, -3); // Separate each polygon $wktPolygons = explode(')),((', $multipolygon); + $style = ['fillColor' => sprintf('rgb(%d,%d,%d)', $color[0], $color[1], $color[2])]; foreach ($wktPolygons as $wktPolygon) { $wktRings = explode('),(', $wktPolygon); @@ -139,7 +140,7 @@ class GisMultiPolygon extends GisGeometry } // draw polygon - $pdf->Polygon($pointsArr, 'F*', [], $color); + $pdf->page->addContent($pdf->graph->getBasicPolygon($pointsArr, 'F*', $style)); // mark label point if applicable if (isset($labelPoint)) { continue; @@ -153,9 +154,11 @@ class GisMultiPolygon extends GisGeometry } // print label if applicable - $pdf->setXY($labelPoint[0], $labelPoint[1]); - $pdf->setFontSize(5); - $pdf->Cell(0, 0, $label); + $font = $pdf->font->getCurrentFont(); + $labelFont = $pdf->font->insert($pdf->pon, $font['key'], $font['style'], 5); + $pdf->page->addContent($labelFont['out']); + $pdf->page->addContent($pdf->color->getPdfColor('black')); + $pdf->page->addContent($pdf->getTextCell($label, $labelPoint[0], $labelPoint[1])); } /** diff --git a/src/Gis/GisPoint.php b/src/Gis/GisPoint.php index dabcc40758..2b5e03de5b 100644 --- a/src/Gis/GisPoint.php +++ b/src/Gis/GisPoint.php @@ -7,10 +7,10 @@ declare(strict_types=1); namespace PhpMyAdmin\Gis; +use Com\Tecnick\Pdf\Tcpdf; use PhpMyAdmin\Gis\Ds\Extent; use PhpMyAdmin\Gis\Ds\ScaleData; use PhpMyAdmin\Image\ImageWrapper; -use TCPDF; use function mb_substr; use function round; @@ -100,9 +100,9 @@ class GisPoint extends GisGeometry string $label, array $color, ScaleData $scaleData, - TCPDF $pdf, + Tcpdf $pdf, ): void { - $line = ['width' => 1.25, 'color' => $color]; + $style = ['lineWidth' => 1.25, 'lineColor' => sprintf('rgb(%d,%d,%d)', $color[0], $color[1], $color[2])]; // Trim to remove leading 'POINT(' and trailing ')' $point = mb_substr($spatial, 6, -1); @@ -113,15 +113,16 @@ class GisPoint extends GisGeometry } // draw a small circle to mark the point - $pdf->Circle($pointsArr[0], $pointsArr[1], 2, 0, 360, 'D', $line); + $pdf->page->addContent($pdf->graph->getCircle($pointsArr[0], $pointsArr[1], 2, style: $style)); if ($label === '') { return; } // print label if applicable - $pdf->setXY($pointsArr[0], $pointsArr[1]); - $pdf->setFontSize(5); - $pdf->Cell(0, 0, $label); + $font = $pdf->font->getCurrentFont(); + $labelFont = $pdf->font->insert($pdf->pon, $font['key'], $font['style'], 5); + $pdf->page->addContent($labelFont['out']); + $pdf->page->addContent($pdf->getTextCell($label, $pointsArr[0], $pointsArr[1])); } /** diff --git a/src/Gis/GisPolygon.php b/src/Gis/GisPolygon.php index aad8bd5be5..e038924b95 100644 --- a/src/Gis/GisPolygon.php +++ b/src/Gis/GisPolygon.php @@ -7,10 +7,10 @@ declare(strict_types=1); namespace PhpMyAdmin\Gis; +use Com\Tecnick\Pdf\Tcpdf; use PhpMyAdmin\Gis\Ds\Extent; use PhpMyAdmin\Gis\Ds\ScaleData; use PhpMyAdmin\Image\ImageWrapper; -use TCPDF; use function array_merge; use function array_slice; @@ -101,7 +101,7 @@ class GisPolygon extends GisGeometry string $label, array $color, ScaleData $scaleData, - TCPDF $pdf, + Tcpdf $pdf, ): void { // Trim to remove leading 'POLYGON((' and trailing '))' $polygon = mb_substr($spatial, 9, -2); @@ -115,16 +115,20 @@ class GisPolygon extends GisGeometry $pointsArr = array_merge($pointsArr, $ring); } + $style = ['fillColor' => sprintf('rgb(%d,%d,%d)', $color[0], $color[1], $color[2])]; + // draw polygon - $pdf->Polygon($pointsArr, 'F*', [], $color); + $pdf->page->addContent($pdf->graph->getBasicPolygon($pointsArr, 'F*', $style)); if ($label === '') { return; } // print label if applicable - $pdf->setXY($pointsArr[2], $pointsArr[3]); - $pdf->setFontSize(5); - $pdf->Cell(0, 0, $label); + $font = $pdf->font->getCurrentFont(); + $labelFont = $pdf->font->insert($pdf->pon, $font['key'], $font['style'], 5); + $pdf->page->addContent($labelFont['out']); + $pdf->page->addContent($pdf->color->getPdfColor('black')); + $pdf->page->addContent($pdf->getTextCell($label, $pointsArr[2], $pointsArr[3])); } /** diff --git a/src/Gis/GisVisualization.php b/src/Gis/GisVisualization.php index 937afab656..c0190c09c6 100644 --- a/src/Gis/GisVisualization.php +++ b/src/Gis/GisVisualization.php @@ -7,6 +7,7 @@ declare(strict_types=1); namespace PhpMyAdmin\Gis; +use Com\Tecnick\Pdf\Tcpdf; use PhpMyAdmin\Config; use PhpMyAdmin\Dbal\DatabaseInterface; use PhpMyAdmin\Gis\Ds\Extent; @@ -14,7 +15,7 @@ use PhpMyAdmin\Gis\Ds\FileDownload; use PhpMyAdmin\Gis\Ds\ScaleData; use PhpMyAdmin\Image\ImageWrapper; use PhpMyAdmin\Util; -use TCPDF; +use PhpMyAdmin\Version; use function assert; use function count; @@ -340,25 +341,19 @@ class GisVisualization $pdf = $this->createEmptyPdf(Config::getInstance()->config->PDFDefaultPageSize ?? 'A4'); $this->prepareDataSet($this->data, 'pdf', $pdf); - $blob = $pdf->Output('', 'S'); + $blob = $pdf->getOutPDFString(); return new FileDownload(mime: 'application/pdf', extension: 'pdf', blob: $blob); } - private function createEmptyPdf(string $format): TCPDF + private function createEmptyPdf(string $format): Tcpdf { - $pdf = new TCPDF( - orientation: 'P', - unit: 'pt', - format: $format, - unicode: true, - encoding: 'UTF-8', - diskcache: false, - ); - $pdf->setPrintHeader(false); - $pdf->setPrintFooter(false); - $pdf->setAutoPageBreak(false); - $pdf->AddPage(); + $pdf = new Tcpdf('pt', compress: false); + $pdf->setCreator('phpMyAdmin ' . Version::VERSION); + $fontRegular = $pdf->font->insert($pdf->pon, 'helvetica', '', 14); + $pdf->addPage(['format' => $format, 'orientation' => 'P']); + $pdf->page->enableAutoPageBreak(false); + $pdf->page->addContent($fontRegular['out']); return $pdf; } @@ -438,7 +433,7 @@ class GisVisualization * * @param mixed[][] $data Raw data * @param string $format Format of the visualization - * @param ImageWrapper|TCPDF|null $renderer Image object in the case of png, TCPDF object in the case of pdf + * @param ImageWrapper|Tcpdf|null $renderer Image object in the case of png, TCPDF object in the case of pdf * @psalm-param T $format * * @psalm-return (T is 'svg' ? string : (T is 'ol' ? list : null)) @@ -449,7 +444,7 @@ class GisVisualization private function prepareDataSet( array $data, string $format, - ImageWrapper|TCPDF|null $renderer = null, + ImageWrapper|Tcpdf|null $renderer = null, ): array|string|null { $svg = ''; $olDataset = []; @@ -478,7 +473,7 @@ class GisVisualization assert($renderer instanceof ImageWrapper); $gisObj->prepareRowAsPng($wkt, $label, $color, $scaleData, $renderer); } elseif ($format === 'pdf') { - assert($renderer instanceof TCPDF); + assert($renderer instanceof Tcpdf); $gisObj->prepareRowAsPdf($wkt, $label, $color, $scaleData, $renderer); } elseif ($format === 'ol') { $olDataset[] = $gisObj->prepareRowAsOl($wkt, (int) $row['srid'], $label); diff --git a/tests/test_data/gis/empty-expected.pdf b/tests/test_data/gis/empty-expected.pdf index bc59d69f6e..febe7b9c5d 100644 Binary files a/tests/test_data/gis/empty-expected.pdf and b/tests/test_data/gis/empty-expected.pdf differ diff --git a/tests/test_data/gis/geometries-expected.pdf b/tests/test_data/gis/geometries-expected.pdf index 9a2cb113df..80ab0a8301 100644 Binary files a/tests/test_data/gis/geometries-expected.pdf and b/tests/test_data/gis/geometries-expected.pdf differ diff --git a/tests/test_data/gis/geometrycollection-expected.pdf b/tests/test_data/gis/geometrycollection-expected.pdf index 1e4b2460ff..62daada6be 100644 Binary files a/tests/test_data/gis/geometrycollection-expected.pdf and b/tests/test_data/gis/geometrycollection-expected.pdf differ diff --git a/tests/unit/Gis/GisVisualizationTest.php b/tests/unit/Gis/GisVisualizationTest.php index 78202f8fad..4de0cca0fc 100644 --- a/tests/unit/Gis/GisVisualizationTest.php +++ b/tests/unit/Gis/GisVisualizationTest.php @@ -4,9 +4,17 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Gis; +use Com\Tecnick\Pdf\Tcpdf; use Generator; use PhpMyAdmin\Dbal\DatabaseInterface; use PhpMyAdmin\Gis\Ds\ScaleData; +use PhpMyAdmin\Gis\GisGeometryCollection; +use PhpMyAdmin\Gis\GisLineString; +use PhpMyAdmin\Gis\GisMultiLineString; +use PhpMyAdmin\Gis\GisMultiPoint; +use PhpMyAdmin\Gis\GisMultiPolygon; +use PhpMyAdmin\Gis\GisPoint; +use PhpMyAdmin\Gis\GisPolygon; use PhpMyAdmin\Gis\GisVisualization; use PhpMyAdmin\Gis\GisVisualizationSettings; use PhpMyAdmin\Image\ImageWrapper; @@ -17,8 +25,6 @@ use PHPUnit\Framework\Attributes\RequiresPhpExtension; use ReflectionClass; use ReflectionMethod; use ReflectionProperty; -use TCPDF; -use TCPDF_STATIC; use Throwable; use function array_map; @@ -41,25 +47,21 @@ use const PHP_INT_MAX; use const PNG_ALL_FILTERS; #[CoversClass(GisVisualization::class)] -class GisVisualizationTest extends AbstractTestCase +#[CoversClass(GisGeometryCollection::class)] +#[CoversClass(GisLineString::class)] +#[CoversClass(GisMultiLineString::class)] +#[CoversClass(GisMultiPoint::class)] +#[CoversClass(GisMultiPolygon::class)] +#[CoversClass(GisPoint::class)] +#[CoversClass(GisPolygon::class)] +#[CoversClass(GisVisualizationSettings::class)] +final class GisVisualizationTest extends AbstractTestCase { - private static string $testDataDir = ''; + private static string $testDataDir = __DIR__ . '/../../test_data/gis'; /** @psalm-suppress PropertyNotSetInConstructor */ private DatabaseInterface $dbi; - public static function setUpBeforeClass(): void - { - self::$testDataDir = __DIR__ . '/../../test_data/gis'; - (new ReflectionProperty(TCPDF_STATIC::class, 'tcpdf_version'))->setValue(null, '6.6.2'); - } - - public static function tearDownAfterClass(): void - { - $property = new ReflectionProperty(TCPDF_STATIC::class, 'tcpdf_version'); - $property->setValue(null, $property->getDefaultValue()); - } - protected function setUp(): void { parent::setUp(); @@ -392,15 +394,18 @@ class GisVisualizationTest extends AbstractTestCase new GisVisualizationSettings(width: 560, height: 420, spatialColumn: 'wkt', labelColumn: 'label'), ); $vis = new ReflectionClass($visualization); - /** @var TCPDF $pdf */ - $pdf = $vis->getMethod('createEmptyPdf')->invoke($visualization, 'A4'); - $pdf->setDocCreationTimestamp(1700000000); - $pdf->setDocModificationTimestamp(1700000000); - $pdf->setCompression(false); - (new ReflectionProperty($pdf, 'file_id'))->setValue($pdf, md5($name)); + + $pdf = new Tcpdf('pt', compress: false); + $fontRegular = $pdf->font->insert($pdf->pon, 'helvetica', '', 14); + $pdf->addPage(['format' => 'A4', 'orientation' => 'P', 'time' => 1700000000]); + $pdf->page->addContent($fontRegular['out']); + (new ReflectionProperty($pdf, 'version'))->setValue($pdf, '8.20.0'); + (new ReflectionProperty($pdf, 'doctime'))->setValue($pdf, 1700000000); + (new ReflectionProperty($pdf, 'docmodtime'))->setValue($pdf, 1700000000); + (new ReflectionProperty($pdf, 'fileid'))->setValue($pdf, md5($name)); $vis->getMethod('prepareDataSet')->invoke($visualization, $data, 'pdf', $pdf); - $pdfBlob = $pdf->Output(dest: 'S'); + $pdfBlob = $pdf->getOutPDFString(); $this->assertSameOrSaveNewVersion($name, 'pdf', $pdfBlob); }