Php dompdf-仅在第一页之后设置页边距

Php dompdf-仅在第一页之后设置页边距,php,html,css,dompdf,Php,Html,Css,Dompdf,我正在使用dompdf将HTML转换为pdf文件。它工作得很好。但问题是,除了第一页之外,我需要为所有页面设置页边距。第一页应该有一个覆盖整个页面的图像。但现在所有页面的页边空白都来了,包括第一页 我无法禁用第一页的页边距。非常感谢您的帮助。提前谢谢 下面是我的css <style type="text/css"> body { margin: 0px; } @page { margin: 50px; } #header { position

我正在使用
dompdf
HTML
转换为
pdf
文件。它工作得很好。但问题是,除了第一页之外,我需要为所有页面设置页边距。第一页应该有一个覆盖整个页面的图像。但现在所有页面的页边空白都来了,包括第一页

我无法禁用第一页的页边距。非常感谢您的帮助。提前谢谢

下面是我的css

  <style type="text/css">
    body { margin: 0px; }
    @page { margin: 50px; }
    #header { 
      position: fixed; 
      left: 0px; 
      top: -52px;
      height: 50px; 
      border-bottom: 2px solid #797979;
      margin: 0; 
    }
    #footer { 
      position: fixed; 
      left: 0px; 
      bottom: -52px;
      height: 50px; 
      border-top: 2px solid #797979;
      margin: 0; 
    }
    #footer .page:after { content: counter(page); }
    .firstpage { 
      position: absolute;
      page-break-after: always; 
      top: -50px;
      width: 100%;
      margin: 0;
    }
    .otherpages{ margin: 0; }
  </style>

正文{margin:0px;}
@第{页边距:50px;}
#标题{
位置:固定;
左:0px;
顶部:-52px;
高度:50px;
边框底部:2个实心#7979;
保证金:0;
}
#页脚{
位置:固定;
左:0px;
底部:-52px;
高度:50px;
边框顶部:2个实心#7979;
保证金:0;
}
#页脚:在{content:counter(page);}之后
.第一页{
位置:绝对位置;
分页符后:始终;
顶部:-50px;
宽度:100%;
保证金:0;
}
.otherpages{页边距:0;}
这是我的html

  <div class="firstpage">
     <img src="pdf-bg.jpg" style="width:100%; height:auto;/>
  </div>

  <div id="header">
    <p><?php echo date("F j, Y"); ?></p>
  </div>

  <div id="footer">
    <p class="page">Page <?php $PAGE_NUM ?></p>
  </div>    

  <div class="otherpages">
      some content
  </div>

第页

一些内容
试试这个

    @page { margin: 50px 0; }
    .firstpage { 
      position: absolute;
      page-break-after: always; 
      top: -50px; // compensating for @page top margin
      width: 100%;
      margin: 0;
    }
    .otherpages{ margin: 0 50px; }