Re: PDF - Coords
| From: | Jyry Kuukkanen | Date: | Thu, 19 Feb 2004 09:02:48 +0000 |
| Subject: | Re: PDF - Coords | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-178222@lists.php.net to get a copy of this message | ||
On Thu, 19 Feb 2004, Juan Torres wrote:
> ¡Hola!
>
> Excuse me, but my english is bad :(.
>
> My problem is: When I'm writting text in a PDF document, I want to know the
> current position, or next position of next text to insert.
>
> I want to know when I'm near the finish page.
¡Hola!
There is no need nor a reason to find out current position using PDF
functions.
If you are outputting lines after lines, you need to keep track of the
y-position by yourself. The following simple and ugly piece of code should
demostrate the logic:
define(MAX_Y_POS, 300);
define(ROW_HEIGHT, 4);
$y_pos = 0;
foreach ($many_rows as $row) {
if ($y_pos > MAX_Y_POS) {
makePageChange();
$y_pos = 0;
}; // if
$y_pos += ROW_HEIGHT;
printRow($row);
}; // foreach
If you use pdflib, you might want to take a look at sopdf.php - it's
available from dataxi.sourceforge.net. Get the latest version of
solib.tar.gz - that includes sopdf.php
> PD: Do you know Spain or spanish language? ;)
¡Si! Estudio español - este es segundo año, bastante listo :-)
Ahora leo un libro de Montalbán, de Pepe Carvalho :-)))
--
Regards,
--Jyry
C|:-( C|:-/ C|========8-O C|8-/ C|:-(