Jump to content

[SOLVED] Printing receipt in HTML/PHP/Javascript/Ajax application


stockton

Recommended Posts

I have an intranet system running on Windows under IIS and the client's browser is IE.

To this HTML/PHP/Javascript/Ajax application I need to add a program driven(ie Not a user option) printing of a receipt, on a printer attached to the client machine.

The only solution I have come up with so far is to create the receipt on an intranet web page and then call javascript to print that screen.

Are there any other possible solutions?

Link to comment
Share on other sites

Using Javascript to open the print dialog for a page is as about as far as you can go with JS or any client side program. One possibility might be to create a java applet and implement the PrintObject class which would have the capability of automating a print job. It would still require the user to choose to trust the java applet.

 

If you're familiar with Java, here is a great code reference:

http://www.javacommerce.com/displaypage.jsp?name=printcode.sql&id=18252

Link to comment
Share on other sites

You should NEVER force a user to do anything like this - it shouldn't be automated evn in an intranet environment.

 

OK make is easier by using the javascript but don't do anything that takes control away from the user. One nice touch maybe to save the receipt as a pdf and allow them to save it then print - or just print immediately.

Link to comment
Share on other sites

You should NEVER force a user to do anything like this - it shouldn't be automated evn in an intranet environment.

 

OK make is easier by using the javascript but don't do anything that takes control away from the user. One nice touch maybe to save the receipt as a pdf and allow them to save it then print - or just print immediately.

 

While I completely agree with the sentiment, when working in a big-company environment you might not have the choice. If Mr. Big Executive wants his employees to be printing a page when they come to it, then Mr. programmer makes the site print the page. There still could be options/control of the function within the page/applet. Trust me, I've had my share of (and battles against) those kinds of requests too. Although, I'd probably take this one just for the challenge. ;)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.