dimanche 25 août 2019

Laravel 5: DOMPDF(0.8.3) set margin-top in each page and skip 1st page

I am using dompdf version 0.8.3 in all our reports, we have done the adding header and footer in each page. Now we want to have margin-top in each page of our header because our header overlapped to our table.

PDF

<script type="text/php">
        if (isset($pdf)) {
            $x = 550;
            $y = 800;
            $text = "{PAGE_NUM} of {PAGE_COUNT}";
            $font = null;
            $size = 12;
            $color = array(255,0,0);
            $word_space = 0.0;  //  default
            $char_space = 0.0;  //  default
            $angle = 0.0;   //  default
            // header
            $pdf->page_text(550,10,'P O #: <?= $purchase_order->number ?>',$font,$size,$color,$word_space,$char_space,$angle);
            // footer
            $pdf->page_text($x, $y, $text, $font, $size, $color, $word_space, $char_space, $angle);
        }
    </script>

Controller

<!-- My other function/data -->
$pdf = PDF::loadView('purchase-order.export.export-pdf', $data)->setPaper('a4');
$pdf->getDomPDF()->set_option("enable_php", true);
return $pdf->stream('purchase-order-'.$purchase_order->number.'.pdf');

Question: Is it possible to have a margins(margin-top to be specific in each page) and to skip the 1st page to have header and page number?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire