PDA

View Full Version : Printing an Image


TJ_Tigger
06-30-2003, 10:24 AM
I have a project I am working on that includes pictures contained in a web page from my customers events. They want to have the ability to print the pictures if the person so chooses. I don't want to print the web page, just the picture from the page. I am able to parse the name of the image from the page they are viewing but I can't get it to print the image itself. The images are .JPG.

I have tried File.Open with the verb set to print and all it did was open the image in a viewer. I also had it set to minimized and it opened maximized.

I then tried to load the image into the web broswer object and print from the web browser object and it will only print the web page, not the image alone.

Any suggestions on what to try next?

Tigg

Corey
06-30-2003, 11:54 AM
Flash can do that easily. It can even do it dynamically, i.e. you don't need to make a 100% flash project. A simple Flash object can load .jpgs at runtime and it can print them. Let me know if you're lost on building the Flash thing and I'll whip something up for you.

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

TJ_Tigger
06-30-2003, 12:09 PM
That would be good since I am not a flash person.

Thanks for the help.

I guess I am just curious why a .jpg wont print using the file.open action with the print verb. Also why, when you load a .jpg into a web browser will it not print the .jpg.

Corey
06-30-2003, 12:13 PM
Maybe it does, Im not sure. How about this. Let's give this thread a day to collect answers, there might be a better solution. And if nothing appears by tomorrow I'll build you a little insertable utility to do what you need.

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

TJ_Tigger
06-30-2003, 12:31 PM
Thanks Corey,

No rush at all. It will be a couple weeks before the next CDs need to go out. I just way playing around at the request of the customer.

Corey
06-30-2003, 12:35 PM
OK just PM me when we're a week from deadline if you haven't picked up anything else. As to the issue itself, I'm no authority on printing but I bet there's a way somehow using a javascript pop-up window too, i.e. set it up so that a browser object containing your image opens in kiosk mode at proper size, then print it...

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

Colin
06-30-2003, 01:05 PM
The "print" verb is handled at the discretion of the application you are sending it to. There's no doubt that some people will have an image viewer than responds to the "print" verb, while others will ignore it completely. It's a quick solution if you can control what software is on the user's system, otherwise the results are a bit "undefined".

Corey
06-30-2003, 01:14 PM
BTW Tigger take a look at this:

http://www.faqts.com/knowledge_base/view.phtml/aid/1435/fid/122

That's a javascript which prints an image when it get's clicked on. Not sure if it works the way you want but it's one more simple option...

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

TJ_Tigger
06-30-2003, 03:41 PM
I was wondering if that was it Colin. I will change my default viewer, which is currently set to Image Viewer Expert, it was the default load on this machine.

TJ_Tigger
07-01-2003, 08:32 AM
Could it be done with a .bat file? Have the .bat file ready to go and replace the file to be printed by the variable within AMS and then execute it?

kpsmith
07-01-2003, 09:34 AM
Not sure if you could do this but...

You could investigate printing image.jpg with explorer through a File execute with a command line switches pointing to the jpg and issueing a print command?

Worm
07-01-2003, 12:20 PM
Tig,

Try this:

Put another Web Browser Object on your page and set it to 1x1 pixels.

Create a HTML file with the following content:
<html>
<body OnLoad=window.print()>
<img src="http://www.yourclient.com/image.jpg">
</body>
</html>


From there simply do a Navigate To on the 1x1 Web Browser to the HTML file you created. You should get a Print Dialog to select the printer, and then print the image.

You're going to have to copy the HTML file to the %TEMP% directory so you can manipulate the image line to display the correct image, but that shouldn't be a biggie.

Anyhow, it worked here for me.

Corey
07-01-2003, 12:30 PM
Sure or you could just point your browser to your image and then pass the same command to the browser object in the URL bar using the URL

javascript:window.print()

Saves you from having to create/manage any .HTML files. /ubbthreads/images/icons/smile.gif

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

Worm
07-01-2003, 12:58 PM
Uh, yup! that'd be a whole lot easier.

Now, why didn't I think of that!? /ubbthreads/images/icons/crazy.gif

TJ_Tigger
07-01-2003, 04:24 PM
Corey and Worm,

If I am understanding correctly, I load the image into the browser and then tell the browser to load the url

javascript:window.print()

Is that all I have to do.

Worm
07-01-2003, 05:06 PM
yep

thesven
08-20-2003, 10:13 PM
I read thread hoping to find the answer but I don't see one. Is there a way to do a print screen or better yet pass a command to print the image you click on? I just need to get it printed but I don't see how. Any help is appreciated as always.

Thanks

Worm
08-20-2003, 11:07 PM
load the image into a Web Browser object, then do a navigate: javascript:window.print()

thesven
08-22-2003, 11:44 AM
Thaks Worm, I will give that a try!

TJ_Tigger
08-23-2003, 03:14 PM
It works great BTW. I have implemented in a project for a local Equine Center. Very small run for students in their summer riding programs. This worked great to allow them to print the pictures directly from the CD.