Main Page
 The gatekeeper of reality is
 quantified imagination.

Stay notified when site changes by adding your email address:

Your Email:

Bookmark and Share
Email Notification
Project "Print Job"
Purpose
The purpose of this project is to demonstrate how to print a PDF document via a webpage using traditional ASP. There could be several reasons why this type of capability could be useful in ASP application code, but I'll leave that up to you.

How I Approach This Project
The printJob.asp file is set-up so that you can call a function "docPrint" to print a PDF document to a printer on your network (through your print server). You can pass that function a variety of arguments which are defined at the top of the code page. In your case, those may be used as defaults that you could assign new values to dynamically (let's say you don't always want the same printer to be used in all cases...so you could assign new values dynamically).

The codepage has already been setup so that you can not only query the print server for a list of available printers, but you can also specify a primary and secondary printer; this is useful if the primary printer is not reachable so the secondary printer will be used. The application uses AdobeRd32.exe (to print a PDF), as well as the DOS applications "net.exe" and "ping.exe"; those DOS applications are usually located in the windows\system32 directory.

It should be so simple to use that the only things you will need to change are what is indicated below (in the printJob.asp code).

Dim ptList : ptList = "" ' Dynamically Generated List Of Printers
Dim ptServer : ptServer = "10.100.10.10" ' IP Address of Print Server
Dim papp_Path : pApp_Path = "C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe" ' Adobe Reader Location On Server
Dim pfile_Path : pfile_Path = "F:\docs\pdf\report.pdf" ' Document To Print On Server
Dim pprimary_IP : pprimary_IP = "200.100.80.100" ' IP Address of Primary Printer
Dim pprimary_Name : pprimary_Name = "MAINPNT" ' Name of Primary Printer
Dim psecondary_IP : psecondary_IP = "200.100.80.104" ' IP Address of Secondary Printer
Dim pSecondary_Name : pSecondary_Name = "SECPNT" ' Name of Secondary Printer


Download printJob.asp (4kb Zip) HERE.
About Joe