Image of real life object printing at actual size?

I have a client who wants users to be able to print something out, let’s say a picture of a glove, at it’s actual real-life dimensions. Lets say when it’s laid flat, the length of the glove is 6inches and the width is 4 inches. He would want any user on any browser with any printer to be able to print the image out, and it be guaranteed at those dimensions (so the user can lay the paper on their hand to get a feel for what the glove would when they put it on).

My first instinct is that it is not possible. Even with css styles optimized for print media, not everyone’s printer prints with the same settings. And different browsers have different behaviors in that regard as well.

I have searched for hours and understand the difference between image dimensions and dpi, as well as how to convert dimensions back and forth from pixels to inches given a dpi. But I could NOT find a definitive answer. Is it possible?

Yes that’s true, I got distracted mid-post. I meant to say that it should be pointed out to the user that the file should be printed at 100% to ensure accuracy. These instructions don’t need to be exhaustive but can be covered by good client-centred copy.

eg. We love our garments and we want you to love them too. To ensure that your measurements are as accurate as they can be, please print this PDF of glove/hand sizes. In the Print dialogue box please make sure the “Page Scaling” option is set to ‘None’. If you are unsure we have included a standard 15cm rule underneath the hand sizes so you can check (print a 15cm ruler scale on bottom of the diagram).

I don’t really remember exactly how web pages or graphics files print from a browser so my first thought would be to bypass all that and just create a fixed-size document like a PDF that could be downloaded and printed. Not sure if your client has specified how the image/file be printed, though. Just a thought.

Yeah, it would be a better idea to have a picture of the item link to a file containing the actual sized picture. This will also save you the trouble of having to load larger sized pictures on your pages.

But still, PDF would be the best way to go? I’ll just need to add a message to the user that certain conditions must be met for best chances of accuracy.

Now to just find the best PHP PDF library that DOESN’T require installation server side…

Thanks

yep felgall is correct, and page size standards can differ in countries too which affects the amount of resizing too (eg. A4 is standard here not US Letter).

Still PDF would be my first port of call, you can always include a US letter version and an A4 version (for arguments sake). If you ensure that the content used for the measurement is safely within printable margins (ie put the glove/hand outlines in the centre of the page) then Acrobat won’t need to resize anything even if “Shrink to Printable Area” is selected as it will already fit.

if a separate file needs to be created, so be it, though an img element in an html document in a separate window is preferred.

Of course with a PDF you still have no guarantees that it will print out the right size as many people have it resize to fit the print area of their printer.

That’s a contradiction. You can’t run PHP unless it is installed on the server and so any PHP that generates a PDF also has to run on the server so there’s no way to avoid uploading the PHP to the server.

Even doing that doesn’t ensure accuracy as it is still possible for the printer to be slightly out even when you specify 100%. The difference should be very small though in almost all cases and there isn’t any way of getting any closer than that without incorporating adjustments for the specific printer and that’s only worth doing when you know that one printer is the only place that the file will ever be printed (which certainly doesn’t apply when you give the image to someone else to print).

It still doesn’t stop the person or their printer resizing it anyway but it is as close as you can get to printing “Full Size”.

Potentially a logic inch of 72 dpi would possibly come close. Though with CSS you could actually use a separate Print Style sheet and use Absolute length units, i.e. (in: inches - 1 inch is equal to 2.54 centimetres) - h1 { margin: 1.5in; } if you get the gist - but like you’ve said a lot of browsers don’t honour print style sheets correctly, etc.

Like agarcia831 I’d probably opt for something like a PDF if it were so “absolutely critical”.

Great advice! Thanks guys!

Sorry, I realized several hours after that post that I wasn’t very clear. I’m not looking for a library that needs to be loaded as the PHP Core is loaded. What I’m looking for is essentially a class (or collection of classes) that provides PDF functionality.

For instance, the last library I worked with was FPDF. It was a folder full of PHP files that I uploaded to my web directory and then I included those files as I needed them. The version I had, however, contained a handful of deprecated functions and it has not been updated since early 2008. Since I am working on servers with PHP 5.1+, I am on a search for a new alternative.