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

前端 未结 5 1489
南笙
南笙 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:35

    If you're using DOMPDF >= 0.7.0, the dompdf_config.inc.php file has been removed and adding a page number now requires a slightly different approach:

    Because the dompdf_config.inc.php file has been removed from this release (and is no longer referenced) all dompdf options should be set at run time.

    To enable PHP code to be executed by DOMPDF, use:

    $dompdf->set_option("isPhpEnabled", true);
    

    Also, FontMetrics should now be called by using $fontMetrics instead of Font_Metrics, so the code mentioned by @user1231342435346354 changes slightly:

    
    

提交回复
热议问题