aspose file tools*
The moose likes JSF and the fly likes How to print a image file into the printer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "How to print a image file into the printer " Watch "How to print a image file into the printer " New topic
Author

How to print a image file into the printer

Robert Jack
Ranch Hand

Joined: Apr 13, 2010
Posts: 49

Hi, I have one image (sampleImage.png).. Already i connected my system to printer....

Manually i open the image and select print option , then i got image from printer....

Now i want print image using JavaScript....


i also write the code for print the text are content, the code is :

The script is :

The above script work for print the text area content into the printer....
So i reed to print the image into the printer...
help me about this..
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42929
    
  68
In the future, please UseCodeTags. It's unnecessarily hard to read the code as it is, making it less likely that people will bother to do so. I have added those for you here.

Since you're successful printing arbitrary HTML, it should be possible to add an <img> tag instead of the contents of "textElem", no?
Robert Jack
Ranch Hand

Joined: Apr 13, 2010
Posts: 49
Thanks for your response.
But i don't need html tag.
i must use jsf tags only.
Also i want to write a javascript for support to jsf tags.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42929
    
  68
But i don't need html tag.

I don't think I understand what you mean by this, but in any case it's much better to work with well-formed HTML (which contains all required tags) than with HTML that is not.

Also i want to write a javascript for support to jsf tags.

What do you mean by that? JSF is a server-side technology -while JavaScript works on the client- so how can JavaScript support JSF?
Robert Jack
Ranch Hand

Joined: Apr 13, 2010
Posts: 49
I used <img> tag, i can receive image by JavaScript. i can get image location and image object...
The code is :

The Java script is :


And i also apply the same way in JSF tag, but i can't receive

The tag is :

And Java script is :


i used the following combination, but no response




Eswar Nec
Ranch Hand

Joined: May 02, 2010
Posts: 105
Hi jack ,
This script perfectly worked in Firefox 3.0.18

Here no need to pass id.
But, i received image id using both h:form and h:graphicImage tag id's

The Java script is :


JSF code is :



Wake up! Don't let your smile be snatched away by anybody!
Regards, Eswar
Robert Jack
Ranch Hand

Joined: Apr 13, 2010
Posts: 49
Its worked.
Thanks Eswar.
Robert Jack
Ranch Hand

Joined: Apr 13, 2010
Posts: 49
I check it, and successfully printed.

But, the content is also open in pop winwow.

Because i use the script

Is there any possible to print the image, without open the popup winwow, and print the image.

Thanks in advance.
Muneeswaran Balasubramanian
Ranch Hand

Joined: Mar 19, 2010
Posts: 138
Hi Jack,

Please try this instead of yours,I thinks its work fine.





Cheers Munees
My Blog
Muneeswaran Balasubramanian
Ranch Hand

Joined: Mar 19, 2010
Posts: 138
Hi Jack,
Sorry.Thats not works well.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to print a image file into the printer