TCPDF - 隐藏标题时删除空白 [英] TCPDF - remove empty gap when header is hidden
本文介绍了TCPDF - 隐藏标题时删除空白的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我用
$this->setPrintHeader(false);
它仍然从顶部留下一个空白的间隙(空间).如何去除间隙使正文从页面开头出现?
it still leaves an empty gap (space) from the top. How to remove the gap so the body would appear from the beginning of page?
这是我使用的 prestashop 功能
public function writePage()
{
$this->SetTopMargin(-50);
$this->SetHeaderMargin(-55);
$this->setPrintHeader(false);
$this->SetFooterMargin(21);
$this->setMargins(10, 50, 10);
$this->SetAutoPageBreak(true, 40);
$this->AddPage();
$this->writeHTML($this->content, true, false, true, false, '');
}
编辑 2:这个组合对我有用
$this->setPrintHeader(false);
$this->SetTopMargin(0);
$this->setMargins(10, 20, 10); <- Now I can set margins as I want
推荐答案
除了不打印标题外,您还需要将边距设置为 0,因此在这种情况下:
Apart from not printing the header you also need to set margins to 0, so in this case:
$this->SetTopMargin(0);
请注意,您也可以使用 $this->SetHeaderMargin();
Note that you can manipulate the margin of the header too with $this->SetHeaderMargin();
您也可以使用负值.
这篇关于TCPDF - 隐藏标题时删除空白的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文