PMCORE-2099

This commit is contained in:
Julio Cesar Laura Avendaño
2020-08-31 22:55:44 +00:00
parent 161d61822a
commit 12dfd1035e
3 changed files with 17 additions and 9 deletions

View File

@@ -144,6 +144,15 @@ class Designer extends Controller
}
}
// Load additional fonts registered by TCPDF library
$tcPdfFonts = [];
OutputDocument::checkTcPdfFontsPath();
foreach (OutputDocument::loadTcPdfFontsList() as $font) {
$font['friendlyName'] = !empty($font['friendlyName']) ? $font['friendlyName'] : $font['familyName'];
$tcPdfFonts[] = "{$font['friendlyName']}={$font['familyName']}";
}
$this->setVar('tcPdfFonts', implode(';', $tcPdfFonts));
//plugin set source path
$sourceCss = array();
$sourceJs = array();

View File

@@ -17,6 +17,7 @@
<link rel="stylesheet" type="text/css" href="/lib-dev/css/jquery.layout.css" />
<link rel="stylesheet" type="text/css" href="/lib-dev/css/jquery-ui-1.10.3.custom.min.css" />
<!--<link rel="stylesheet" type="text/css" href="/lib/css/jquery.dataTables.css">-->
<link rel="stylesheet" type="text/css" href="/fonts/styles.php" />
<script type="text/javascript">
var prj_uid = "{$prj_uid}";
@@ -32,6 +33,7 @@
var HTTP_SERVER_HOSTNAME = "{$HTTP_SERVER_HOSTNAME}";
var PMDYNAFORM_FIRST_TIME = "{$PMDYNAFORM_FIRST_TIME}" === "1";
var maxFileSizeInformation = {$maxFileSizeInformation};
var tcPdfFonts = "{$tcPdfFonts}";
</script>
<script type="text/javascript" src="/lib-dev/js/wz_jsgraphics.js"></script>
<script type="text/javascript" src="/lib-dev/js/jquery-1.10.2.min.js"></script>
@@ -77,6 +79,7 @@
{foreach from=$sourceCss item=pathFile}
<link rel="stylesheet" type="text/css" href="{$pathFile}" />
{/foreach}
<link rel="stylesheet" type="text/css" href="/fonts/styles.php" />
<script type="text/javascript">
var prj_uid = "{$prj_uid}";
var app_uid = "{$app_uid}";
@@ -91,6 +94,7 @@
var HTTP_SERVER_HOSTNAME = "{$HTTP_SERVER_HOSTNAME}";
var PMDYNAFORM_FIRST_TIME = "{$PMDYNAFORM_FIRST_TIME}" === "1";
var maxFileSizeInformation = {$maxFileSizeInformation};
var tcPdfFonts = "{$tcPdfFonts}";
</script>
<script type="text/javascript" src="/lib/js/mafe-{$buildhash}.js"></script>
{foreach from=$sourceJs item=pathFile}

View File

@@ -9,16 +9,11 @@ $pathHome = implode('/', $sections) . '/';
// Include the "paths_installed.php" file
require_once $pathHome . 'engine/config/paths_installed.php';
// Set the fonts styles file
// Set the fonts styles file, for now the value is fixed (Maybe later we have another PDF engine)
$fileName = 'fonts.css';
// Check if the requested css file exists and if is accessible
if (!file_exists(PATH_DATA . 'fonts/tcpdf/' . $fileName)) {
// Redirect to error page 404
header('Location: /errors/error404.php');
die();
} else {
// Stream the font file
// Stream the requested css file if exists and if is accessible
header('Content-Type: text/css');
if (file_exists(PATH_DATA . 'fonts/tcpdf/' . $fileName)) {
readfile(PATH_DATA . 'fonts/tcpdf/' . $fileName);
}