Print margins in DOMPDF

前端 未结 2 378
后悔当初
后悔当初 2021-01-03 18:29

I\'m trying to generate a PDF using DOMPDF. I have some HTML which is then converted into a PDF.

But I have a problem. When I put an object at the top of the page (e

相关标签:
2条回答
  • 2021-01-03 18:34

    sometimes you also need to set

    html { margin: 0px}
    
    0 讨论(0)
  • 2021-01-03 18:50

    The following style will effectively set the margins of your document to 0:

    @page { margin: 0px; }
    body { margin: 0px; }
    

    @page is used by dompdf 0.6.0, body by dompdf 0.5.1. You can modify the margin of the page and body independently, though right now the margin of the two together acts as your content bounds.

    0 讨论(0)
提交回复
热议问题