				LPR.VBX
Overview.
LPR.VBX will allow you to submit printed output held in a file 
to remote printer over a TCP\IP network that is running LPD. 
This VBX is written using the information documented in RFC1179.
It is important to note that  the VBX expects the data to be routed 
to a remote printer to have been already processed by a print driver 
and for it to be in a format that is ready to be printed by a printer. 
I.e. in the case of printing a Microsoft Word document the actual 
document must have already been printed to a file. 
It is the contents of this file that the LPR.VBX will route to 
the remote printer. 
The VBX carries out all it's TCP\IP request asynchronously. 
I.e. control will return to your VB code before any event 
corresponding to the action you choose is carried out. 
It is your responsibility to make sure that other requests 
are not made while a request is outstanding.

Zip File Contents

The Self extracting ZIP contains.

LPR.TXT	-	This document which details the properties and events of the
		VBX.
LPR.VBX	-	The VBX
VBLPR.MAK -	A VB 3.0 project that demos the .VBX
LPR.FRM -	Part of the VB Demo	



Control Properties.

Host.
Type.
String
Access.
Read\Write
Description.
The IP Address of where the LPD is running. This can either be a name which 
will be resolved or an IP Address in dotted decimal notation.
Example.
lpr1.Host = "3.100.32.6"


Port
Type.
Integer
Access.
Read\Write
Description.
The port number that the remote LPD is listening on. 
RFC1179 specifies 515 and this is what the control defaults to. 
If your LPD listens at a different port change this value.
Example.
Lpr1.Port = 9000

Action
Type.
Integer
Access.
Read\Write. Not available at design time.
Description.
Set this property to have the VBX carry out some action. The allowable values and the action they take are:
0	- Print waiting Jobs. Causes any jobs waiting to print at the printer specified in the 
	  printer property to begin printing.
1	- Send Print Job. Submits the data in the file specified in the datafile property to the 
	  LPD for printing.
2	- Get Queue State Short. Returns the status of the printer queue specified in the printer
	  property. The List property can be used to filter jobs by jobnumber or user.
3	- Get Queue State Long. This is a more verbose version of the above.
4	- Remove Jobs. Deletes jobs from the printer queue. The list property can be used to 
	  specify which jobs are to be deleted.  Unless the user property is set to "root" only jobs 
	  that are owned by the user can be deleted.

Example.
Lpr1.Action = 4


DataFile
Type.
String.
Access.
Read\Write.
Description.
The name and path of a file whose contents are to passed to the LPD.
Example.
Lpr1.Datafile = "C:\MYPRINT.OUT"

Printer
Type.
String
Access.
Read\Write
Description.
The name of the printer that the remote LPD is to process against. 
If there are multiple printers attached to the remote machine 
then set this property to the name of the printer that you want to query 
or print at. The default is lp.
Example.
Lpr1.printer = "admin_printer"

User
Type.
String
Access.
Read\Write
Description.
The name of the user who is making the request. The value of this 
property will be used as a filter for certain actions.
Example.
Lpr.User = "SBRIDGES"

List
Type.
String
Access.
Read\Write
Description.
This is a list of either users or job numbers. It is used as a filter
for some of the actions
Example.
Lpr.List = "123 321 444"

JobName
Type.
String
Access.
Read|Write
Description.
The name of the job when submitting a file to print. 
The value assigned here will be returned by the queue status requests.
Example.
Lpr.JobName = "PRINT1"

PrintType
Type.
Integer
Access.
Read|write
Description.
This property determines how a file is to be printed. Acceptable values are:
0	- PostScript. The contents of datafile are treated as standard postscript input.
1	- Text. The datafile contains plain ASCII Text only.
2	- Text with pr. The text is printed with a heading and page numbers
3	- No filtering. The contents of Datafile are printed with no filtering.
Example.
Lpr.PrintType = 3

DebugMode
Type.
Integer
Access.
Read\Write
Description.
When set to non zero the .VBX executes OutputDebugString API calls 
detailing what it is doing. You will need an application 
capable of intercepting and displaying the results of this API 
in order to view them e.g DBWIN from the Microsoft SDK.
Example.
Lpr.debugmode = 1

JobNum
Type.
Integer
Access.
Read\Write
Description.
The job number assigned to the remote print job. 
The control will assign a value if you do not supply one.
Example.
Lpr.jobnum = 123

Control Events
QueueStateShort
Parameters.
NoMore:	Integer. Set to true (-1) if the LPD has finished sending 
the response
Msg:		A line of text as returned by the LPD.
ErrCode:	Any return code sent by the LPD
Description.
This event is fired in response to the Get Queue State Short action. 
The event is fired once for every line returned by the LPD. 
After all the returned lines have been sent the control will 
fire the event with NoMore set to -1 and Msg set to an empty string

QueueStateLong
Parameters.
NoMore:	Integer. Set to true (-1) if the LPD has finished sending the 
response
Msg:		A line of text as returned by the LPD.
ErrCode:	Any return code sent by the LPD
Description.
This event is fired in response to the Get Queue State Long action. The event is fired once for every line returned by the LPD. After all the returned lines have been sent the control will fire the event with NoMore set to -1 and Msg set to an empty string

PrintAnyWaitingJobs
Parameters.
ReturnCode:	Integer. Set to the value returned by the LPD.
Description.
This event is fired in response to the print any waiting jobs action.

RemoveJobs
Parameters.
ReturnCode:	Integer. Set to the value returned by the LPD.
Description.
This event is fired in response to the remove jobs action.

PrintFile
Parameters.
PrtType:	Integer. Indicates where in the printing process we are.
ReturnCode:	Integer. Set to the value returned by the LPD.
Description.
This event is fired multiple times during the printing of a file to a 
remote printer. The values of PrtType will change for each event. 
The possible values are:
1	The LPD has acknowledged are request to submit a print job.
2	The LPD has received the control file header record.
3	The LPD has received the contents of the control file.
4	The LPD has received the Data File Header/
5	The LPD has received the contents of the data file.

AsyncError
Parameters.
LprCmd:	Integer. The command the VBX was carrying out. The values are:
		PRINT_ANY_WAITING_JOBS	=	1
		RECEIVE_A_PRINTER_JOB	=	2                               
		GET_QUEUE_STATE_SHORT	=	3
		GET_QUEUE_STATE_LONG	=	4                   
		REMOVE_JOBS			=	5
WinsockErr:	Integer. The Error number returned by WINSOCK.DLL
Description.
The control carries out all of it's actions asynchronously. This means that control is returned to your VB code before the actual action is carried out. If the control receives a WINSOCK error as a result of the asynchronous request it will fire this event to notify you.

Problems + Support.
My compuserve id is 71507,1033. You can email from outside of compuserve 
as 71507.1033@compuserve.com.
My AOL ID is STEVEB3091. You can email me from outside of AOL as 
STEVEB3091@AOL.COM.
You can fax me at 203-865-2250.

Registration.
LPR.VBX is shareware. To receive the latest version plus the 
source code send $10 + $2 
Postage and handling to :

Steve Bridges.
76 Nash St
New Haven CT 06511.

Or you may register on Compuserve by going SWREG.


