DomPDF {PAGE_NUM} not on first page

ε祈祈猫儿з 提交于 2019-12-12 21:27:45

问题


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


回答1:


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 !



来源:https://stackoverflow.com/questions/30193587/dompdf-page-num-not-on-first-page

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!