473,395 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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
'---------------------------------------------------

Nov 18 '05 #1
1 3069
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" <no*****@email.com> wrote in message
news:uB**************@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
'---------------------------------------------------

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Maileen | last post by:
Hi, I have 2 questions : 1. - 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...
3
by: RBisch | last post by:
I am finding that some of the properties off of the PrinterSettings object are misleading For example, When I test the CanDuplex on a printer I know duplexes, the property is false. Another one...
16
by: cyranoVR | last post by:
This is the approach I used to automate printing of Microsoft Access reports to PDF format i.e. unattended and without annoying "Save As..." dialogs, and - more importantly - without having to use...
2
by: Ryan Gregg | last post by:
I've got a dot matrix printer that I need to print a line at a time to. This is being used for an audit log on an application and every event that occurs needs to print out right as it occurs. ...
0
by: Karthik | last post by:
Well I am coding an application using C# for my company which requires multiple printing of Crystal Report Docs & Word Docs, at a specific Printer of the installed Printers in the network, at a...
1
by: Pohihihi | last post by:
Hello NG. I am using System.Drawing.Printing NS to print few label style printouts. I figured out how the basics goes in that namespace but there are still few things that is holding me up from...
5
by: Tom | last post by:
I am converting an old application that was printing directly to a specialized printer device (i.e. a special label printer). It was doing this by opening a file with the file path of 'LPT1:' and...
3
by: Mika M | last post by:
Hi all! I have made an application for printing simple barcode labels using PrintDocument object, and it's working fine. Barcode printer that I use is attached to the computer, and this...
18
by: Brett | last post by:
I have an ASP.NET page that displays work orders in a GridView. In that GridView is a checkbox column. When the user clicks a "Print" button, I create a report, using the .NET Framework printing...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.