[PHPwestoz] PHP problem

Tim Carpenter Tim at gaiaresources.com.au
Sun Jul 13 01:36:00 EST 2008


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 3264 bytes
Desc: not available
Url : http://lists.linux.org.au/pipermail/phpwestoz/attachments/20080712/618128da/attachment.bin 


More information about the PHPwestoz mailing list