Joomla 5 / Fabrik 4 DOMPDF performance

Trembowiecki

Active Member
Hi, the main goal for one of my projects is creating very complex PDFs containing big registers. You kow, tables, thousands of items to loop etc. And here's a thing you may find interesting.

PDF to be generated: 100 pages A4, one table on each page, each table consisting of table header and 10 rows (so 1000 items to loop), all document based on 'do... while' loop which has a few other loops inside. And check the performance difference:

- Joomla 3.10.12, Fabrik 3.10, PHP 8.0 - execution time: 63s,
- Joomla 5, Fabrik 4Zeta, PHP 8.2 - execution time: 7 s.

The same OS, the same host and the difference is stunning.

I hope this convinces some people who still can't decide wether to migrate from J3/F3.
 
Hi, thanks for the feedback. Could you share example code that you used to generate the pdf of the tables? Or Did you simply use the integrated PDF button printing integrated into Fabrik lists? Thank you in advance
 
Oh, I use heavily customised PDF template. Here's the table generating part (cleaned):

PHP:
do {
    $buildtable = '<table class="tableclass">';
    $buildtable .= '<tr>';
    $buildtable .= '<th >...</th>';
    //Table header columns
    $buildtable .= '</tr>';
    
    $licznik = 1;
    foreach (array_slice($zbiory, $prefix) AS $row) {
        if ($licznik <= 10) {
            $buildtable .= '<tr>';
            $buildtable .= '<td class="someclass"><div class="fixedheight">'.$row->columnvalue.'</div></td>';
            //Rest of the columns
            $buildtable .= '</tr>';
            $licznik++;
            $licznikpozycji++;
            $licznikpozycjilokal++;
            $mainsuma += $wartosc;
        }
    }
    $buildtable .= '<tr style="border: none !important;">';
    $buildtable .= '<td class="fixedfont13">'.number_format($mainsuma, 2, ',','.').'</td>';
    $buildtable .= '<td></td>';
    $buildtable .= '</tr>';
    $buildtable .= '</table>';
    $buildtable .= '<div id="footdompdf"><span class="pagenum">Strona '.$strona.'</span></div>';
    $strona++;

    $prefix = $licznikpozycjilokal-1;

    if ($licznikpozycji-1 != $liczbazbiorow) {
        $buildtable .= '<div class="newpage"></div>';
    }
    print $buildtable;
} while ($licznikpozycji <= $liczbazbiorow);

The whole code is much longer, and you spot many uninitiated vars here because of that.
 
Yes, Fabrik's DOMPDF. I use calc element in list view with link 'index.php?option=com_fabrik&view=details&formid=[dynamicid]&rowid={rowid}&format=pdf. I have a few copies of the form with different PDF template settings and different PDF templates and - depending on user's preferences (taken from another list), the calc element changes [dynamicid] to proper form id.
 
BTW: You can also add the template and PDF params to the URL with e.g.
&format=pdf&layout=your-pdf-template1&pdf_orientation=landscape

So you can avoid multiple forms.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top