Answer the question
In order to leave comments, you need to log in
Modx PDFResource your font?
Tell me how to still set up your customFont in PDFResource ??
I did everything according to the instructions from Jako and mPDF, not only did I have to prescribe inline styles for the template, but no fonts work! ALWAYS 'dejavusanscondensed' font
jako.github.io/PDFResource/usage/#custom-fonts
or bug github.com/Jako/PDFResource/issues/15 ?
my Snippet: PdfCreate
<?php
$date = date('Y-m-d_H-i-s', time()) . '_' .rand(1, 100);
$corePath = $modx->getOption('pdfresource.core_path', null, $modx->getOption('core_path') . 'components/pdfresource/');
$pdfresource = $modx->getService('pdfresource', 'PDFResource', $corePath . 'model/pdfresource/', array(
'core_path' => $corePath
));
$content = $modx->getOption('content', $scriptProperties, '', true);
$title = $modx->getOption('title', $scriptProperties, '', true);
$author = $modx->getOption('author', $scriptProperties, '', true);
$aliasPath = MODX_ASSETS_PATH . 'pdf/';
$site_url = $modx->getOption('site_url');
// настройки PDFResource (подробнее почитать здесь: http://jako.github.io/PDFResource/usage/)
$pdfresource->initPDF(array(
'mode' => 'utf-8',
'format' => 'A4',
'defaultFont' => 'times',
'defaultFontSize' => intval(8),
'mgl' => intval(5), // margin left
'mgr' => intval(5), // margin right
'mgt' => intval(6), // margin top
'mgb' => intval(7), // margin bottom
'mgh' => intval(5), // margin header
'mgf' => intval(5), // margin footer
'orientation' => 'P', // ориентация PDF
'customFonts' => '[times]',
));
$pdfresource->pdf->SetTitle($title);
$pdfresource->pdf->SetAuthor($author);
$pdfresource->pdf->SetCreator($modx->getOption('site_url'));
$pdfresource->pdf->WriteHTML($content, 2);
$file_name = $date;
$pdfresource->pdf->Output($aliasPath . $file_name . '.pdf', 'F');
return $site_url . ltrim($modx->getOption('assets_url'), '/') . 'pdf/' .$file_name. '.pdf';
"times" => array(
'R' => "times.ttf",
'B' => "timesbd.ttf",
),
<h5 style=" font-family: times !important;">ТЕКСТ текст ТЕКСТ текст ТЕКСТ текст</h5>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question