stockton Posted October 13, 2007 Share Posted October 13, 2007 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? Quote Link to comment https://forums.phpfreaks.com/topic/73082-solved-printing-receipt-in-htmlphpjavascriptajax-application/ Share on other sites More sharing options...
R_P Posted October 18, 2007 Share Posted October 18, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/73082-solved-printing-receipt-in-htmlphpjavascriptajax-application/#findComment-372505 Share on other sites More sharing options...
ToonMariner Posted October 19, 2007 Share Posted October 19, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/73082-solved-printing-receipt-in-htmlphpjavascriptajax-application/#findComment-373097 Share on other sites More sharing options...
R_P Posted October 19, 2007 Share Posted October 19, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/73082-solved-printing-receipt-in-htmlphpjavascriptajax-application/#findComment-373453 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.