Page 1 of 1

How to print an image at a certain resolution

Posted: Mon Apr 21, 2008 9:18 pm
by terryb
Hi everyone,

Here's the scenario. I have a scanned image of a letter size form and I'm writing a PHP script that fills in this form. My problem is this, I scanned the image in at 300 dpi and saved it as a PNG file. I've finished the programming to fill in the form and display the filled in form. My problem now is printing the form. The image is 2892 x 2358 (H x W) which should print out as 9.64" x 7.86" however I'm unable to get Windows or any of the browsers i've tried (IE 6, IE 7, Firefox, Opera) to print it out properly. I think they all assume the image is 72dpi and attempt to print it out as such, resulting in an oversized printout.

I'm stuck. Any ideas?

Re: How to print an image at a certain resolution

Posted: Wed Oct 22, 2008 11:45 pm
by novice4eva
you might want to check out image manipulation functions provided by PHP. Here is where you can start, i think there is example there giving the right solution too :wink:
http://www.php.net/imagecopyresampled

Re: How to print an image at a certain resolution

Posted: Thu Oct 23, 2008 3:16 am
by onion2k
novice4eva is wrong. You don't need to resize the image itself. You need to set the print resolution, which is different to the image resolution. As far as I know that can't be done in PHP or in HTML or Javascript. The only solution I know works is to embed the image in a PDF file using a library like FPDF.

Re: How to print an image at a certain resolution

Posted: Thu Oct 23, 2008 4:20 am
by novice4eva
OUCH!! hurts to be wrong, sorry.... :wink: