[PHPwestoz] PHP problem

Daniel Antonic daniel at dcnsolutions.net
Mon Jul 14 10:44:25 EST 2008


Ok, tried that, here is the code that I used:

    $certLogo = "logo.gif";


    $pdf = pdf_new();
    pdf_open_file($pdf, $filename);
    $font = pdf_findfont($pdf, "Helvetica", "host", 0);

    pdf_begin_page($pdf, 595, 842);


    $image = $pdf->load_image("auto", $certLogo, ""); 
    $pdf->fit_image($image, 390,575, "");
    $pdf->close_image($image);


    pdf_setfont($pdf, $font, 10);

    pdf_show_xy($pdf, "Invoice: " . $invoice, 350, 750);

//more lines of text


    pdf_end_page($pdf);
    pdf_close($pdf);   
 

Here is the error message I got:

PHP Fatal error:  Call to a member function load_image() on a non-object

The gif file is in the same directory as the php script file. Any ideas?

Daniel

----- Original Message ----- 
From: "Tim Carpenter" <Tim at gaiaresources.com.au>
To: "PHP users in Western Australia (or nearby)" <phpwestoz at lists.linux.org.au>
Sent: Saturday, July 12, 2008 11:36 PM
Subject: Re: [PHPwestoz] PHP problem


Hi, 

You have to open the image using pdf_load_image first, pass the result of that as the second parameter of pdf_fit_image.

http://au.php.net/manual/en/function.pdf-load-image.php

Tim


-----Original Message-----
From: phpwestoz-bounces at lists.linux.org.au on behalf of Daniel Antonic
Sent: Sat 12/07/2008 10:48 PM
To: phpwestoz at lists.linux.org.au
Subject: [PHPwestoz] PHP problem
 
Ok guys, here is the problem I have.

I'm Using Apache 1.3 and PHP 5.2. I'm writing my own invoicing program, and it needs to generate PDF invoices, and save them to a file. I've got it inserting text fine, but I've got all sorts of trouble inserting pictures.

The code that I'm using is as follows:


    $pdf = pdf_new();
    pdf_open_file($pdf, $filename);
    $font = pdf_findfont($pdf, "Helvetica", "host", 0);

    pdf_begin_page($pdf, 595, 842);

//PDF_fit_image ( $pdf, "logo.gif", 10, 10, "scale 0.5" ) removed this line for script to run

    pdf_setfont($pdf, $font, 10);

    pdf_show_xy($pdf, "Invoice: " . $invoice, 350, 750);

//extra lines go in here

    pdf_end_page($pdf);
    pdf_close($pdf);   

I've used pdf_fit_image() and gotten the following error: pdf_fit_image() expects parameter 2 to be long, string given, had to remove the line for the script to run.

I'm not sure what is going wrong, any help would be great.

Kind regards, 
Daniel Antonic 
Proprietor DCN Solutions 

Mob: 0438 303 429 
Web: dcnsolutions.net



No virus found in this incoming message.
Checked by AVG - http://www.avg.com 
Version: 8.0.138 / Virus Database: 270.4.9/1548 - Release Date: 12/07/2008 7:40 AM




--------------------------------------------------------------------------------


> _______________________________________________
> PHPwestoz mailing list
> PHPwestoz at lists.linux.org.au
> http://lists.linux.org.au/listinfo/phpwestoz
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.linux.org.au/pipermail/phpwestoz/attachments/20080714/d69ace31/attachment.htm 


More information about the PHPwestoz mailing list