Mike Volmar
Mike Volmar

Reputation: 2093

How can you determine remaining space on page with 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();
}

Upvotes: 0

Views: 515

Answers (1)

STE
STE

Reputation: 26

You can try the following:

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

Upvotes: 1

Related Questions