Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   printing on network printer (http://www.velocityreviews.com/forums/t82195-printing-on-network-printer.html)

Maileen 07-07-2004 12:35 PM

printing on network printer
 
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
'---------------------------------------------------




Stu Lock 07-07-2004 02:32 PM

Re: printing on network printer
 
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" <novalid@email.com> wrote in message
news:uBx6x7BZEHA.1152@TK2MSFTNGP09.phx.gbl...
> 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
> '---------------------------------------------------
>
>
>





All times are GMT. The time now is 09:20 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.