printing on network printer

  • Thread starter Thread starter Maileen
  • Start date Start date
M

Maileen

Hi,

I want to print from my ASP page directly to my network printer. For this i
use the following code, but everytime, my document to print is sent to local
and physical port LPT1 :(
could you help me please ? thx,
Maileen.

'---- to print report on network printer ---
' RSP = stored procedure
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objWSHNet = CreateObject("WScript.Network")
if trim(RSP("p_login"))<>"" then
login=""&trim(RSP("p_login"))&""
heslo=""&trim(RSP("p_heslo"))&""
objWSHNet.AddPrinterConnection "LPT1:", trim(RSP("cesta")), False,login,
heslo
else
objWSHNet.AddPrinterConnection "LPT1:", trim(RSP("cesta")), False
end if
Set objPrinter = objFS.CreateTextFile("LPT1:", True)
....
objPrinter.Write("simple printing test")
objPrinter.Close
'---------------------------------------------------
 
Hi,

Looks like you are using the old objects to print. Try using the new print
classes from .Net to enumerate the printers installed on the machine running
the code:

If System.Drawing.Printing.PrinterSettings.InstalledPrinters.Count > 0 Then
'Printers installed....
Else
'No printers installed
End If

Hope this points you in the right direction.

Stu
 
Back
Top