vendredi 27 mars 2020

Group pages in DOMPDF

I'm looking for an idea to group pages, or to put pages numbering into sets.

So, for example, if I have 15 pages, I want to group them as follows: first set of pages to be displayed as 1/7, 2/7... 7/7; second set to be displayed like 1/2, 2/2; third 1/3, 2/3, 3/3 and final set to be like 1/3, 2/3, 3/3. I have dynamic data, so the sets and number of pages may vary. Is this possible to do with DOMPDF?

So far, here's what I have in Laravel controller:

    $pdf = PDF::loadView('template', ["buzz" => $buzz, "foo" => $foo]);
    $dom_pdf = $pdf->getDomPDF();
    $canvas = $dom_pdf->get_canvas();
    $canvas->page_text(260, 800, "Page {PAGE_NUM} of {PAGE_COUNT}", null, 10, array(0, 0, 0));
    return $pdf->stream('document.pdf');

Thanks in advance



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire