		** Print On Page VB Routine **


Problem:	VB does not support printing text (string) data 
		directly to the printer.  Page boundries (right 
		and bottom) are ignored.  Data to the right of
		the margin is lost.  No page eject is performed.
		Printing continues over the end of page.  Some 
		data may be lost.

Solution:	This module is one solution.  Rather than a 
		completely finished solution, it is intended as
		an educational tool or a starting point for 
		better routines.  It handles several common 
		problems.  All margins are set to one inch.  Text 
		is broken at a "natural" point such as a CRLF or
		a space.

Use:		Use VB to add "Printer.BAS" to your project.

		Before calling the routine, set the Font Information.

		FI.FontName = Text1.FontName
		FI.FontSize = Text1.FontSize
		FI.FontBold = Text1.FontBold
		FI.FontItalic = Text1.FontItalic
		FI.FontUnderLine = Text1.FontUnderLine

		Then, call the routine.
    
		Dim TestData as String
		TextData = Text1.Text
		PrintOnPage (TextData)

		This example assumes that Text1 is a Text Box and that
		this code is contained within the Form containing Text1.

How it works:

There are two key VB functions that make this routine work.

	Printer.TextWidth(TempStr) and Printer.TextHeight(HighStr)

Before using them, we set the printer font characteristics.

    Printer.FontName = FI.FontName
    Printer.FontSize = FI.FontSize
    Printer.FontBold = FI.FontBold
    Printer.FontItalic = FI.FontItalic
    Printer.FontUnderline = FI.FontUnderline

And we set the Printer's ScaleMode to Inches

    Printer.ScaleMode = 5           ' set scale mode to inches

Now when we call Printer.TextWidth(TempStr), we get the width of 
TempStr IN INCHES.  So then we can check to see if it's 6.5 inches
wide - and we get we inch margins.  Whenever we print a line, add the 
line just printed to HighStr (HighStr = HighStr + TempStr).  Now, 
check the Height of HighStr and if it's over 9 inches, do a 
Printer.NewPage.

Here's the basic flow of the routine:

1) Set the Printer's Font Characteristics.
2) Initialize TempStr with the next two characters of the text passed.
3) Keep adding the next character of the passed text to TempStr until:
	- TextWidth = 6.5
	- We run into a CRLF
	- We run out of data
4) If we've hit 6.5 inches without a CRLF, chaeck and make sure we 
   haven't split in mid-word.  Keep backing up until we hit a space.
5) Print a line of TempStr
6) Check height of text printed and eject page if we've printed 9 inches.
7) Go back to step 2 UNTIL we run out of text.

I've run into one anomaly.  For some reason, my printer automatically 
gives me about .25 inch margin no matter what we do.  Therefore I set 
CurrentX to .75 to get a 1 inch left margin.
	
If you have any questions, feel free to write me at BrantleyL@AOL.COM.

I'm distributing this as FREEWARE.  I hope this routine proves helpful.
