DomPDF {PAGE_NUM} not on first page

2019-07-20 12:37发布

I'm using domPDF to generate a PDF-Documentation. After activating the inline PHP in the dompdf_config.inc.php and dompdf_config.custom.inc.php I've added the following code to display the page Numbers:

<script type="text/php">
    $pdf->page_text(50, 20, "Seite {PAGE_NUM}", Font_Metrics::get_font("sans-serif"), 10, array(0,0,0));
</script>

Now this works quite well, but sady, I'm not able to somehow declare, that this should not be done on the first page.

Are there any options to do so?

Thank you for your help and time

标签: php html dompdf
1条回答
老娘就宠你
2楼-- · 2019-07-20 13:08

I had this problem too.

I managed to solve it by adding a white rectangle above the pagination of the first page.

Using the position: absolute CSS property allows you to place stuff on the first page only.

Create a white rectangle div, add the absolute property and position it above what you want to hide. This will hide the pagination and as the rectangle is white, it will be invisible too.

If someone has a better solution, I'll take it too !

查看更多
登录 后发表回答