php 如何在 FPDF 中设置下边距
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12567484/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to set a bottom margin in FPDF
提问by SquareCat
I've taken a dive into FPDF lately and something that i don't seem to understand is - why is there no way to set a bottom margin? There are functions for setting margins from the top, left and right, but not from the bottom.
我最近深入研究了 FPDF,我似乎不明白的是 - 为什么没有办法设置底部边距?有从顶部、左侧和右侧设置边距的功能,但没有从底部设置边距的功能。
I assume now that i misunderstand something basic and conceptual about how FPDF works yet i got no clue on what that could possibly be.
我现在假设我误解了关于 FPDF 如何工作的一些基本和概念性的东西,但我不知道这可能是什么。
So to cut it down:
所以要减少它:
Is it possible to define a fixed bottom margin in FPDF?
是否可以在 FPDF 中定义固定的底部边距?
回答by SquareCat
I just found the solution - the bottom margin is simply left out of predefinition because it is part of the page break calculation process. Therefore, setting a bottom margin in itself is not possible, but it can be done using
我刚刚找到了解决方案 - 底部边距被简单地排除在预定义之外,因为它是分页计算过程的一部分。因此,设置底部边距本身是不可能的,但可以使用
SetAutoPageBreak(boolean auto, [float margin])
回答by LAROmega
+1 to SquareCat's answer. To expand on this a little more, if you're having trouble with text going a little bit over the auto page break, just setting SetAutoPageBreak(false) will probably be sufficient to solve the problem. For me personally this was causing trouble when creating mailing labels.
+1 对 SquareCat 的回答。为了进一步扩展这一点,如果您在自动分页符上遇到文本有点问题,只需设置 SetAutoPageBreak(false) 可能就足以解决问题。就我个人而言,这在创建邮寄标签时造成了麻烦。
$fpdf->SetAutoPageBreak(false);
Just make sure that you're manually breaking pages where appropriate for your PDF.
只需确保您在适合您的 PDF 的地方手动分页。
$fpdf->AddPage();

