Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why can't I overlay text on the bottom part of the page using fpdfi?

Background: I'm developing an application that involves taking an existing pdf form and overlaying text on top of it. The pdf is version 1.3. I'm using the fpdfi class (written in php) that can be found here:

http://www.setasign.de/support/manuals/fpdi/

I am using fpdfi as an extension of the tcpdf class found here:

http://www.tcpdf.org/index.php

I use a line of (php) code that looks like this:

$this->SetXY(25, 250);$this->Cell(0, 8.6, $data['my_data_to_overlay']);

where $this refers to the instance of the fpdfi class, the SetXY function tells it the coordinates I wish to place the text (x,y), and the Cell function tells it what text I want displayed and how large and such. The page height is 279.4 (all units here will be in mm)

The problem:

If I set my y coordinate higher than 250 (even at 251), the text will be placed on the next page instead of near the bottom of the current page as expected. All other coordinates above that line at 250 will display properly, even at the top edge of the page.

Why can I not overlay the text near the bottom of the page? What am I doing wrong?

Also of note: all margins for the page are set to 0 and headers and footers are disabled.

like image 735
starshine531 Avatar asked Jul 06 '12 23:07

starshine531


1 Answers

Disable auto page break by calling FPDF::SetAutoPageBreak with false, or true but with 0 margin.

EDIT: Using FPDF::SetMargins you can only set left, top and right margins, but not the bottom one. This is the proper way to specify a bottom margin.

like image 127
Máthé Endre-Botond Avatar answered Sep 21 '22 00:09

Máthé Endre-Botond