I am using Zend_PDF to load in a PDF and then overlay some text ontop
of it. It's been working fine, but when I tried to create a test
document on my mac by doing a Print -> Save AS PDF I get the following
error:

Exception: Undefined property: Zend_Pdf_Element_Array::$value in
/Users/msteudel/Documents/wwwroot/rainbows/Zend/library/Zend/Pdf/Element/Array.php
on line 84

Does this have to do how macs generate a pdf?

Here's the code I'm using which I know works, I can just change the
$this->templateFile property to a different pdf and it works.

        $strOffset = 220;

        if( strlen( $data['name'] ) > 12 ) {
            $strOffset = $strOffset - ( ( strlen( $data['name'] ) - 12 ) * 6 );
        }
        // Create new Style
        $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES);

        // Load PDF document from a file.
        $pdf = Zend_Pdf::load(WWWROOT_PATH . $this->templateDir .
$this->templateFile );

        foreach( $pdf->pages as $page ) {
            $page->setFont($font, 32);

            // membership number
            //$page->drawText( $data['name'], $strOffset, 645);
            $page->setFont( $font, 14 );

            $page->drawText( 'July', 287, 580 );
        }

        // Save document as a new file
        $pdf->save( WWWROOT_PATH . $this->user->userDir . $newFileName);

        // Return PDF document as a string.
        $pdfString = $pdf->render();

--

-----------------------------------------
Mark Steudel
P: 206.375.7244
[email protected]

. : Work : .
http://www.mindfulinteractive.com

. : Play : .
http://www.steudel.org/blog

Attachment: test.pdf
Description: Adobe PDF document

Reply via email to