How to set a bottom margin in FPDF

Deadly 提交于 2019-12-20 17:55:50

问题


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.

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.

So to cut it down:

Is it possible to define a fixed bottom margin in FPDF?


回答1:


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])



回答2:


+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.

$fpdf->SetAutoPageBreak(false);

Just make sure that you're manually breaking pages where appropriate for your PDF.

$fpdf->AddPage();


来源:https://stackoverflow.com/questions/12567484/how-to-set-a-bottom-margin-in-fpdf

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!