Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Server Side Printing?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Server Side Printing?

 Post Reply Post Reply
Author
kennywhite View Drop Down
Groupie
Groupie


Joined: 26 February 2009
Location: Indy
Status: Offline
Points: 106
Post Options Post Options   Thanks (0) Thanks(0)   Quote kennywhite Quote  Post ReplyReply Direct Link To This Post Topic: Server Side Printing?
    Posted: 17 September 2010 at 7:04pm
Hello,

I have a page that I need to be able to print on the web server. This is a network printer, that I would like to be able to print to via IP address. If need be, I can set it up on an LPT port.

I've found a few examples online, but I haven't had any luck with those. 

Anyone able to help?

Thanks a bunch!
Back to Top
kennywhite View Drop Down
Groupie
Groupie


Joined: 26 February 2009
Location: Indy
Status: Offline
Points: 106
Post Options Post Options   Thanks (0) Thanks(0)   Quote kennywhite Quote  Post ReplyReply Direct Link To This Post Posted: 20 September 2010 at 8:22pm
I found this article and tried this out. 

http://www.asp101.com/articles/john/serversideprint/network.asp

When entering the proper credentials I get this error message:

Error Type:
WSHNetwork.AddPrinterConnection (0x80070005)
Access is denied.

Does anyone else have better results?

Is there another method of doing this? 
Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post Posted: 20 September 2010 at 9:45pm
IUSER_ASP needs permissions for the printer.

Lead me not into temptation... I know the short cut, follow me.
Back to Top
kennywhite View Drop Down
Groupie
Groupie


Joined: 26 February 2009
Location: Indy
Status: Offline
Points: 106
Post Options Post Options   Thanks (0) Thanks(0)   Quote kennywhite Quote  Post ReplyReply Direct Link To This Post Posted: 22 September 2010 at 5:34pm
I have done that and I am able to print the text in the message box. 

With this method will it be possible to print a pre-formatted webpage or is this limited to text only? If I can, is there any advice on how I can go about it?

Thanks.


Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post Posted: 22 September 2010 at 9:55pm
Depends what you mean by pre-formatted.

You can use the common VB escape sequences like carriage return, line feeds, tabs, etc within the string you send to the printer. You can also encode the specific printer escape sequences to send machine level commands to the printer which uses some version of PCL (Printer Control Language).

Web pages are actually printed by the browser which takes the html it receives and converts it to PCL to retain the html formatting. That conversion is not something you'd want to script within an asp page.

EDIT: Be aware that you have no way to interface with messages from the printer which is why people seldom use server-side printing. It's possible for an out-of-paper, offline or some other error message that you have to respond to (e.g. click OK) to hang the printer and/or the server.




Edited by dpyers - 22 September 2010 at 10:04pm

Lead me not into temptation... I know the short cut, follow me.
Back to Top
kennywhite View Drop Down
Groupie
Groupie


Joined: 26 February 2009
Location: Indy
Status: Offline
Points: 106
Post Options Post Options   Thanks (0) Thanks(0)   Quote kennywhite Quote  Post ReplyReply Direct Link To This Post Posted: 23 September 2010 at 2:40pm
The page that would need to be printed would contain bar code fonts, a table with a list of part numbers, names, locations, and so on. All of this data will be pulled from an Access database. Do you think this is possible?

The document would always go to the same printer and the person in charge wants the user to be blind to the printing. Also, the primary user interface will be accessed on a PDA that does not have printing capabilities. 

Should I look to another language to do this? Do you have any suggestions?

Thanks so much for your input.
Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post Posted: 23 September 2010 at 5:45pm
Web servers just return raw data (usually text). When the server is returning data to the browser, part of that data includes formatting instructions for the browser (html).

When returning data to a printer, that html would need to be replaced with formatting instructions the printer can recognize (PCL, XPS, or Postscript). PCL instructions are binary and require escape sequences. Postscript instructions are text (like html - but for printers instead of browsers) and require a postscript compatible printer.
XPS is XML Paper Specification and can be used to send the data+Format to either the Printer or the spooler on Vista and Win7 systems. Some printers support XPS directly but they're few and far between.

Other than sending data directly to the printer, you can send data to the windows spooler or to the printer driver (maybe) but it is a bit more complicated.


Ultimately, it sounds like you have a workflow issue. If I understand the situation correctly, you want to store info and print a piece of paper when the user submits the form. The paper is printed somewhere the user isn't for the system administrator to use.

I'd question the need to print the paper in real time. The cost/benefit just isn't good. I would either use MS Access, Excel, or an asp based browser script to suck data off the DB and return it all formatted for printing. The admin could do that whenever they're ready to handle the paper or you could use windows scheduler/script to do it automagically.


Lead me not into temptation... I know the short cut, follow me.
Back to Top
kennywhite View Drop Down
Groupie
Groupie


Joined: 26 February 2009
Location: Indy
Status: Offline
Points: 106
Post Options Post Options   Thanks (0) Thanks(0)   Quote kennywhite Quote  Post ReplyReply Direct Link To This Post Posted: 23 September 2010 at 9:15pm
Yes, that pretty much is the situation. I'm going to try to talk them into just having Crystal Reports run every hour and print out the information, I think that application uses too many resources to run more frequently than that.

If need be, I'll try to implement another solution at some other point, but hopefully that will do for now.

Thanks a lot for your help, dpyers! 
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.