Zend Pdf load Template and set Horizontal

1.7k views Asked by At

I'm having problems to fill pdf template when using Zend_Pdf.

The problem is that i have to fill a existing pdf and i don't know how to say to Zend that this template is horizontal and not vertical.

If i make a new page with:

Zend_Pdf_Page::SIZE_A4_LANDSCAPE 

everything ok, but the problem is that i have to use the template like:

$certificado = Zend_Pdf::load( dirname(__FILE__) . '/../../../docs/x.pdf');
$page = $certificado->pages[0];

How can i set the page to A4-Landscape?

1

There are 1 answers

0
Arkiller On

After searching into Zend_Pdf_Page class, i figured out how to fix my problem:

Load the template i need to use(that is in landscape format)

$certificado = Zend_Pdf::load( dirname(__FILE__) . '/../../../docs/x.pdf');
$page = $certificado->pages[0];

And now rotate the document:

$page->rotate(0, 0, deg2rad(90));

I tried different posibilities to insert the rotation angle, but deg2rad was the best solution.

After that the X and Y coords change, so only have to find out where you are drawing.