Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

printing across network from a script?

Status
Not open for further replies.

nicklieb

Programmer
Oct 17, 2002
383
GB
Hi,

I don't think this is really possible, but I'll ask the anyway, maybe some one knows if it can or can't!

I have an external facing application that hooks up with UPS via XML and the outside user has the ability to have the transportation stick for the box to appear on screen for them to print out.

So if for some reason that the user cannot print the sticker out I want to be printed there and then on a printer some where on our internal network, so that it can be sent through by snail mail.

Can this be done using only asp and maybe a plugin/dll?

thanks in advance
 
ok it is possible using Wscript.Network.

I have never come across this, anyone had any experience?
 
Code:
 I haven't tested this code and am not even sure it will work, but it's worth a shot.

thats at the bottom of the page !! lol
 
ok been playing around with the following code
Code:
Set objFS = Server.CreateObject("Scripting.FileSystemObject")
Set objWSHNet = Server.CreateObject("WScript.Network")

'The AddPrinterConnection method maps the remote printer specified by strPrinterPath to the local resource name. In this example, we use LPT1. 'We populate this connection with the values previously retrieved from our form collection.

' Connect to Network Printer from Windows Scripting Host
'
'objWSHNet.AddPrinterConnection "WebCon:", printer, True, "", ""
 Set objPrinter = objFS.CreateTextFile("WebCon", True)
objPrinter.Write("this is a test")


If Err Then
Response.Write ("Error # " & CStr(Err.Number) & " " & Err.Description)
Err.Clear
Else
'objWSHNet.RemovePrinterConnection "WebCon:"
Set objWSHNet = Nothing
Set objFS = Nothing
Set objPrinter = Nothing

now the thing with this script is that it creates an open port, but I already have a printer mapped to the server, and I want to print server side to that.

However I get a permission denied, and I have added in most users that I can think on Iusr, Iwam etc.

has anyone had any success printing server side, if so, did you use this method above or an altered version of this?


thanks in advance
 
I tested it and it did not work for me. Sorry i should have tried it first hehe. Anyway i am still looking.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top