mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-10-10 13:56:46 +00:00
43b3151526
Tcpdf is an optional package, but we do make a number of tests of it in our unit test suite. We will continue to support it for now. We are considering dropping support for it at the next PhpSpreadsheet major release. As an early assessment, there is much too much work involved supporting `tc-lib-pdf` directly; we are not likely ever to move in that direction. Tcpdf V7 is a bridge version. It is not deprecated (yet), and does not require much in the way of coding changes, but it requires users to supply their own font files; this is relatively easily done in Unix, but it is much harder in Windows. In addition, our test suite can't test satisfactorily with both V6 and V7. We may at some point consider supporting V7, but it is likely that the Windows difficulties will have to be dealt with before we can do so. This PR includes some very minor coding changes which will not harm V6 and will help in migrating to V7 if we choose that route.
38 lines
968 B
PHP
38 lines
968 B
PHP
<?php
|
|
|
|
// Bootstrap for PhpSpreadsheet samples.
|
|
|
|
if (!defined('K_PATH_FONTS')) {
|
|
$path1 = __DIR__ . '/..'
|
|
. '/vendor/tecnickcom/tc-lib-pdf-font';
|
|
$realpath1 = realpath($path1);
|
|
if ($realpath1 !== false) {
|
|
$path = __DIR__ . '/..'
|
|
. '/tclibpdffonts/fonts/';
|
|
$path = realpath($path);
|
|
if ($path !== false) {
|
|
define(
|
|
'K_PATH_FONTS',
|
|
$path
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
// This is a pain, but we have to try to find the composer autoloader
|
|
|
|
$paths = [
|
|
__DIR__ . '/../vendor/autoload.php', // In case PhpSpreadsheet is cloned directly
|
|
__DIR__ . '/../../../autoload.php', // In case PhpSpreadsheet is a composer dependency.
|
|
];
|
|
|
|
foreach ($paths as $path) {
|
|
if (file_exists($path)) {
|
|
require_once $path;
|
|
|
|
return;
|
|
}
|
|
}
|
|
|
|
throw new Exception('Composer autoloader could not be found. Install dependencies with `composer install` and try again.');
|