How to get page number on dompdf PDF when using “view”

前端 未结 5 1479
南笙
南笙 2020-11-30 11:49

Ok, so I use the following snippet to get \"views\" of HTML with PHP variables loaded in as $data so that I can do things like fill in tr\'s of dat

5条回答
  •  时光取名叫无心
    2020-11-30 12:19

    Improved version of Dennis Ameling's answer to take into account…

    Translation and text centering

    Do not forget to enable PHP support like this $dompdf->set_option("isPhpEnabled", true); (or, if you're using laravel-dompdf PDF::setOptions(['isPhpEnabled' => true]);).

    
    

    But

    If you only need $pageNum, using a CSS counter is a way simpler approach!

提交回复
热议问题