广告

可选:点击以支持我们的网站

免费文章
Technical discuss

Display Total pages in dompdf

更多
2024-10-09 20:39 - 2024-10-09 20:40 #202 by bluetooth
新帖
Request: DomPDF update to latest version | Fabrik Forum
  • Joomla! 5.4

    You must update to Fabrik4.5.6 (available since August) if you are running Joomla!5.4

    See Announcements

  • Fabrik 4.6.2 for J!4 and J!5 is out

    For details (especially if you already updated to F4.6 or F4.6.1) see Announcements

Request: DomPDF update to latest version

  • Thread starter Thread starter sunnyjey
  • Start date
    Ha, I managed to display the total pages.
    1. You must hack libraries\fabrik\fabrik\Helpers\Pdf.php - function iniDomPdf: around line 140 add $options->set("isPhpEnabled", true);

    2. In your custom PDF list template's default.php (with some fixed header/footer) add e.g.
    Code:
    Code:
    <div id="footdompdf"> <script type="text/php"> if ( isset($pdf) ) { $font = $fontMetrics->get_font("Arial, Helvetica, sans-serif", "normal"); $size = 12; $pageText = $PAGE_NUM . "of" . $PAGE_COUNT; $y = $pdf->get_height() - 24; $x = $pdf->get_width() - 15 - $fontMetrics->get_text_width($pageText, $font, $size); $pdf->text($x,$y, $pageText, $font, $size); } </script>
    This will output "2 of 10" at the absolute position set by $x, $y.
    It doesn't matter if you put it in the header or footer, as far as I understand it must be only inside a div that is displayed on every page.

    Maybe we can add a textfield for additional PDF options in list layout settings.
    Last edit: 2024-10-09 20:40 by bluetooth.

    登录注册一个帐号 参加讨论

    微信

    rafavi01 rafavi 18519213808

    登陆