PMCORE-2102

This commit is contained in:
Julio Cesar Laura Avendaño
2020-08-27 20:16:11 +00:00
parent ea071649d8
commit b2afc88252

View File

@@ -1,5 +1,6 @@
<?php <?php
use Illuminate\Filesystem\Filesystem;
use ProcessMaker\Core\System; use ProcessMaker\Core\System;
class OutputDocument extends BaseOutputDocument class OutputDocument extends BaseOutputDocument
@@ -1200,4 +1201,25 @@ class OutputDocument extends BaseOutputDocument
throw ($oError); throw ($oError);
} }
} }
/**
* Check and prepare the fonts path used by TCPDF library
*/
public static function checkTcpdfFontsPath()
{
// Define the path of the fonts, "K_PATH_FONTS" is a constant used by "TCPDF" library
define('K_PATH_FONTS', PATH_DATA . 'fonts' . PATH_SEP . 'tcpdf' . PATH_SEP);
// Check if already exists the path, if not exist we need to prepare the same
if (!file_exists(K_PATH_FONTS)) {
// Instance Filesystem class
$filesystem = new Filesystem();
// Create the missing folder(s)
$filesystem->makeDirectory(K_PATH_FONTS, 0755, true, true);
// Copy files related to the fonts
$filesystem->copyDirectory(PATH_TRUNK . 'vendor' . PATH_SEP . 'tecnickcom' . PATH_SEP . 'tcpdf' . PATH_SEP . 'fonts' . PATH_SEP, K_PATH_FONTS);
}
}
} }