如何使用ezpdf确定页面上的剩余空间?

如何使用ezpdf确定页面上的剩余空间?

问题描述:

I'm using rospdf/php-pdf - the middle of the pdf is a table of variable length. I want to make sure there is enough space to print the final section on the page, if not I want to add a new page. I'd like to do something like this but $position has no value. How can I find out the current position?

$position = $pdf->ezSetDy;

if($position < 100){
    $pdf->ezNewPage();
}

我正在使用rospdf / php-pdf - pdf的中间是一个可变长度的表。 我想确保有足够的空间在页面上打印最后一部分,如果不是我想添加新页面。 我想做这样的事情但是$ position没有价值。 如何查找当前位置? p>

  $ position = $ pdf-&gt; ezSetDy; 
 
if($ position&lt; 100){
 $ pdf-  &gt; ezNewPage(); 
} 
  code>  pre> 
  div>

You can try the following:

$yPos = $pdf->y - $pdf->ez['bottomMargin'];
if ($yPos < 100) {
    $pdf->ezNewPage();
}