We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

select printer and print without prompt

justaphase
justaphase asked
on
Medium Priority
368 Views
Last Modified: 2010-03-31
Hello everybody,

I have a big dificulty with printing issue. I allready search the net but the answers i saw can't seem to get it right.. i'm posting here because i know that java can interact more with windows than a ie browser..
This is for an intranet made in php(html and javascript of course) and works with MsSql. Its not for outside www. I need to print directly to the printer an html page without the prompt window, and i need to select to wich printer i send the web page from the "html" code(or something else).
I know that its impossible with javascript, but i know that with java is possible.
The language i use to code is php, but i don't think that the php printer functions can resolve this...
Comment
Watch Question

Java Developer
CERTIFIED EXPERT
Top Expert 2010
Commented:
what make u think its possible with java.
you can certainly print directly to the printer, but aren't you talking about a page displayed in IE?  Java can't easily get at that.
activex would seem a better tool for that job.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
objects,
i'm thinking about an java aplet inside a web page, or a webpage calling java to print an html page, something like that. I allready saw some articles talking about this issue and showing some near examples, but i'm very very green at this language. I could use some good help from u guys, with an example, if its possible.

i allready searched for ActiveX to do this kind of job but it seems impossible. The nearest i found was using the TEMPLATEPRINTER that microsoft made it available to users(using javascript and vbscript i think), that could select the printer and print directly without prompt, but a year after they saw it as lak of security and explained it here: http://support.microsoft.com/default.aspx?scid=kb;en-us;308649

What should i do? If its possible with an ActiveX language it sure be better i know, but i dont think its possible.. if it add to break some security in the browser, that wouldn't be a problem because this is an intranet, it doesn't go outside for Wide World Web.

thx for the attention
Mayank SPrincipal Technologist
CERTIFIED EXPERT

Commented:
>>  and i need to select to wich printer i send the web page from the "html" code(or something else)

It looks like you will need an Applet to do that at the client, and for communicating with the printer it might need to be signed.

Author

Commented:
>> It looks like you will need an Applet to do that at the client, and for communicating with the printer it might need to be signed.

any sugestions how mayankeagle? :)
Mayank SPrincipal Technologist
CERTIFIED EXPERT
Commented:
I hope you know how to write a basic applet. So you need to write one and include an <applet> tag in your HTML so that it gets downloaded to the client-side. The applet can print using the normal print API:

For printing, you can use this:

http://www.java2s.com/Code/Java/Swing-JFC/AppletPrint.htm

Author

Commented:
i'm really dumb using pure java...
here's the example i'm doing: http://193.126.106.9/print/testeprintjava3.htm

but... doesn't work... how do i use that? i thought i was going to find some kind of function so i could declare the file to print or something... help me plz..
Mayank SPrincipal Technologist
CERTIFIED EXPERT

Commented:
I get an exception: NullPointerException and so the applet does not get initialized.
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
applet would certainly need to be signed, but the problem is accessing the browser, not the printer.

Author

Commented:
needs to signed? how can i do that?

Author

Commented:
sentence correction: *needs to be signed? how can i do that?
Mayank SPrincipal Technologist
CERTIFIED EXPERT

Commented:
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.