473,781 Members | 2,413 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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("S cripting.FileSy stemObject")
Set objWSHNet = CreateObject("W Script.Network" )
if trim(RSP("p_log in"))<>"" then
login=""&trim(R SP("p_login"))& ""
heslo=""&trim(R SP("p_heslo"))& ""
objWSHNet.AddPr interConnection "LPT1:", trim(RSP("cesta ")), False,login,
heslo
else
objWSHNet.AddPr interConnection "LPT1:", trim(RSP("cesta ")), False
end if
Set objPrinter = objFS.CreateTex tFile("LPT1:", True)
....
objPrinter.Writ e("simple printing test")
objPrinter.Clos e
'---------------------------------------------------

Nov 18 '05 #1
1 3143
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.Printe rSettings.Insta lledPrinters.Co unt > 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******** ******@TK2MSFTN GP09.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("S cripting.FileSy stemObject")
Set objWSHNet = CreateObject("W Script.Network" )
if trim(RSP("p_log in"))<>"" then
login=""&trim(R SP("p_login"))& ""
heslo=""&trim(R SP("p_heslo"))& ""
objWSHNet.AddPr interConnection "LPT1:", trim(RSP("cesta ")), False,login,
heslo
else
objWSHNet.AddPr interConnection "LPT1:", trim(RSP("cesta ")), False
end if
Set objPrinter = objFS.CreateTex tFile("LPT1:", True)
...
objPrinter.Writ e("simple printing test")
objPrinter.Clos e
'---------------------------------------------------

Nov 18 '05 #2

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

Similar topics

1
4722
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 physical port LPT1 not to network printer :( '---- to print report on network printer ---
3
705
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 is DefaultPrinter, it is set to false when I know that I have that printer set as default (I verify via the "Printers and Fax" applet Can anyone confirm or explain TIA
16
48887
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 a commercial program such as Adobe Acrobat and its associated API. The technique uses Ghostscript and Redirection Port Monitor - two free programs for creating PDF documents provided free by Russell Lang. The actual automation requires VBA...
2
3041
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. I've previously had this working well in a serial communication method where I talk directly to the printer using control codes and what not. However, it seems that the higher ups want to be able to use a network printer or other Windows-configured...
0
1501
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 specific tray and some more settings too. since I'm trying with the network printer I've installed a local driver using the local port as suggested by one of the MS support site. The definition of the Printer & Tray is happening from the code...
1
2602
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 completing my work. Basic problem is that when I select to print many copies or collate printout then nothing happence. It prints the first page and stops. Also I get different information regarding printer's capacity (please see below). Example...
5
12823
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 then using PRINT # to print directly to the printer device. Obviously, this is not going to work under VB.NET - StreamWriter won't let you open a device like LPT1: and such. I assume I am going to have to switch to the System.Drawing.Printing...
3
6319
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 computer has drivers installed for this printer, and this printer is shared for the network. Question 1:
18
11316
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 classes, for each of the checked rows in the GridView. This works fine in the Visual Studio 2005 development environment on localhost. But, when I move the page to the web server, I get the error "Settings to access printer...
0
9639
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9474
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10308
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10076
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6729
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5507
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4040
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3633
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2870
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.