PHP FPDF - 使单元格填充PDF页面的整个宽度

时间:2018-03-29 09:10:54

标签: php fpdf

我的PFDF中有这个页脚:

// Page footer
function Footer(){
    // Position at 1 cm from bottom
    $this->SetY(-10);

    // Arial italic 8
    $this->SetFont('Arial','I',8);


    $this->SetFillColor(0,179,186); // bg
    $this->SetTextColor(255,255,255);

    // Page number
    $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C',true);
}

但是此代码不会填满整个页面。它在左侧和右侧留下一个空白区域。我在这张图纸上用红色表示:

enter image description here

如何填充整个宽度?

1 个答案:

答案 0 :(得分:0)

这些是页边距,相应地记录了“w”参数:

  

[...]如果为0,则单元格向上延伸到右边距。

先前调用的SetY()方法记录为simliar:

  

设置纵坐标,并可选择将当前横坐标移回左边距。[...]

因此,您可以更改页脚方法中的页边距,或执行以下操作:

and