Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > ASP Pro Code Clinic
|
ASP Pro Code Clinic As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Pro Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 26th, 2003, 10:10 AM
Registered User
 
Join Date: Aug 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default How do we use a network printer from an ASP script

We have an intranet problem - we have 'special' printers (bar codes and other unique text). We have to write very specific codes to use the printers. Management decided to move groups of people to new and improved office space.

The printer went with them. Since we are now a distrubuted environment, we are using IP addresses for the printers. How do we send a print job to the printer using classic ASP?

I know ASP.NET will probably be a better solution but we can not go that route - yet.

Thanks for any help!
 
Old August 27th, 2003, 03:27 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 231
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am afraid I do not understand your problem. ASP can not send anything to any type of printer, it is a server side language that produces a web page which a client browser can view.

If that client wants to print the page, then you must set up the printer on that machine. A client computer can print any document to any printer over a network (even a WAN) as long as they have the appropriate permissions and they know enough about the printer (Model, Driver, IP Address etc.)

Regards
Owain Williams
 
Old August 27th, 2003, 10:26 AM
Registered User
 
Join Date: Aug 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I guess I did not describe my problem well enough. Sorry ...

Yes, we are well aware that it is not typical to have ASP send a print job to a print queue. I suggested that to our admins when they told us about the application that we are charged with writing.

A specific example of our situation deals with a unique bar code printer. It takes specific language (text mind you) that tells the printer how to print the bar code. We have a DLL running on a transaction server that gives us the specific codes - no problem.

Our problem: the labs consist of PC, MAC & Linux users so writing a VB application will not work to provide label printing to each member. We are charged with writing an ASP based intranet application that will send the printers the specific codes. We simply need to know how to use classic ASP to instantiate a printer object and actually send the print job.

Any help would be greatly appreciated!

THANKS!


 
Old August 27th, 2003, 10:59 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 231
Thanks: 0
Thanked 0 Times in 0 Posts
Default

As far as I know you can not send a job to the printer using only ASP. You will probably have to write an application (an ActiveX DLL for example) in VB that actually sends the job to the printer and call this application from within your ASP page.

Code:
Dim objPrinter
Set objPrinter = Server.CreateObject("YourDLL.Printer")
objPrinter.Print = "YourParamater"
Set objPrinter = Nothing
In this example YourDLL is your VB AvtiveX DLL, Printer is the class object in your DLL and objPrinter is the reference to that class object. You will need to decide what parameters need to be passed in and what methods need to be called depending on how you code your app.

I am sure there are other ways of doing this however this was the first one that popped to mind.

Regards
Owain Williams
 
Old August 27th, 2003, 03:47 PM
Registered User
 
Join Date: Aug 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the idea!

I believe we will be creating our own print queue of sorts. We will use ASP to write a text file to some folder on the network. We will have an app running watching the folder for anything new (like the SMTP pickup folder). Once the file is found the app will submit the print job for us based on the file name or contents of the file. We are still working out those details.

Same concept - different approach. Thanks for the idea!



 
Old November 18th, 2004, 06:02 AM
Registered User
 
Join Date: Nov 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

a little late I know..

The way in which I have this working is to use ActiveX DLL on the
server that uses the VB Printer object. The DLL is written to allow
any printer installed on the Server for the currently logged in
user to print to. ASP usually uses SYSTEM or IUSR_Interactive
accounts as default or something similiar, this can also be set to a
specific user account through IIS Manager. By setting a specific
user account to be used when the ASP page is run will allow any
printers setup on the server for that user account to be available.

The SYSTEM or IUSR_Interactive accounts are not accounts you can
normally use to sign on with, hence you can't setup any printers.
There is a registry edit you can do though its probably best to
set up an existing or new account with the printers and set the ASP
page to use that account.

Setting up a printer on the Server requires you to add a new Local
printer by creating a new TCP/IP printer port and supplying the IP
address. This will map the network printer to the Server as local
and thus available to install on all user accounts.









Similar Threads
Thread Thread Starter Forum Replies Last Post
Access Printer on different Network ayazhoda Windows Server 1 November 18th, 2007 01:34 PM
Finding Printer Status in ASP.NET param99 ASP.NET 1.0 and 1.1 Professional 1 September 20th, 2006 06:21 AM
Get the username connected to the network from asp Timbo Classic ASP Basics 2 October 31st, 2005 09:28 AM
Network printer addresses interrupt Javascript How-To 6 September 2nd, 2004 10:37 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.