我在所有报告中都使用dompdf版本0.8.3,我们已经在每个页面中添加了页眉和页脚。现在,我们希望在标题的每一页中都保留页边距,因为标题与表重叠了。
<script type="text/php">
if (isset($pdf)) {
$x = 550;
$y = 800;
$text = "{PAGE_NUM} of {PAGE_COUNT}";
$font = null;
$size = 12;
$color = array(255,0,0);
$word_space = 0.0; // default
$char_space = 0.0; // default
$angle = 0.0; // default
// header
$pdf->page_text(550,10,'P O #: <?= $purchase_order->number ?>',$font,$size,$color,$word_space,$char_space,$angle);
// footer
$pdf->page_text($x, $y, $text, $font, $size, $color, $word_space, $char_space, $angle);
}
</script>
控制器
<!-- My other function/data -->
$pdf = PDF::loadView('purchase-order.export.export-pdf', $data)->setPaper('a4');
$pdf->getDomPDF()->set_option("enable_php", true);
return $pdf->stream('purchase-order-'.$purchase_order->number.'.pdf');
问题:是否可以有页边距(每页上都有特定的页边距)并跳过第一页以具有页眉和页码?
答案 0 :(得分:1)
在pdf刀片文件中,您可以使用CSS样式。为了获得利润,请尝试以下操作,然后根据自己的喜好编辑数字:
<style>
@page {
margin: 2cm 2cm 1.5cm 1.5cm;
}
</style>
对于页面刹车,我不确定您到底想实现什么,但是您可以在同一pdf刀片中添加分页符,如下所示:
<div class="page-break"></div>
希望这可以引导您走向正确的方向。