Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to print a image file into the printer

 
Robert Jack
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 :


 
Robert Jack
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its worked.
Thanks Eswar.
 
Robert Jack
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jack,

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




 
Muneeswaran Balasubramanian
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jack,
Sorry.Thats not works well.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic