Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > printing on network printer

Reply
Thread Tools

printing on network printer

 
 
Maileen
Guest
Posts: n/a
 
      07-07-2004
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
'---------------------------------------------------



 
Reply With Quote
 
 
 
 
Stu Lock
Guest
Posts: n/a
 
      07-07-2004
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.InstalledP rinters.Count > 0 Then
'Printers installed....
Else
'No printers installed
End If

Hope this points you in the right direction.

Stu


"Maileen" <> wrote in message
news:...
> 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
> '---------------------------------------------------
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wireless Network Printing Without Network Printer =?Utf-8?B?RG91Zw==?= Wireless Networking 5 12-27-2012 02:14 AM
brochure printing,online yearbook,printing,books printing,publishing elie Computer Support 0 08-21-2007 05:50 AM
brochure printing,online yearbook,printing,books printing,publishing elie Computer Support 0 08-21-2007 05:28 AM
brochure printing,online yearbook,printing,books printing,publishing elie Computer Support 0 08-18-2007 10:11 AM
Network printer: printer server vs direct network connection? alamoaudio@gmail.com Computer Support 3 09-20-2005 12:24 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57