i have finally got it working. Should anyone else need to enable it, here is how i did it first in vendor/dompdf/dompdf/src/Options.php set
Then, create a template helper with the following code
i don't think the $font does anything
Footer class is set in my stylesheet
.footer {
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding: 0.2em 2em;
font-size: 8px;
display: flex;
justify-content: space-between;
align-items: center;
background-color: #ececec;
color: #000;
z-index: -1;
}
-----
Warning. Read the comment below.
PHP Code:
private $isPhpEnabled = true;
PHP Code:
<?php
namespace Espo\Custom\TemplateHelpers;
use Espo\Core\Htmlizer\Helper;
use Espo\Core\Htmlizer\Helper\Data;
use Espo\Core\Htmlizer\Helper\Result;
class pdfPageNumbers implements Helper
{
public function __construct() {}
public function render(Data $data): Result
{
$html = '
<div class="footer" style="position: fixed; bottom: 10px; width: 100%; text-align: right; font-size: 6px;">
<script type="text/php">
if (isset($pdf)) {
// Set position on page (x = right margin, y = distance from top)
$x = 560;
$y = 825;
$text = "{PAGE_NUM} / {PAGE_COUNT}";
$font = $fontMetrics->get_font("Open Sans", "normal");
// Render page numbers on every page
$pdf->page_text($x, $y, $text, $font, 6, [0,0,0], null, "right");
}
</script>
</div>
';
return Result::createSafeString($html);
}
}
Footer class is set in my stylesheet
.footer {
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding: 0.2em 2em;
font-size: 8px;
display: flex;
justify-content: space-between;
align-items: center;
background-color: #ececec;
color: #000;
z-index: -1;
}
-----
Warning. Read the comment below.

Comment