PrintTextFile Method
Top  Previous  Next


Prints the text file specified in the FileName argument.


Syntax

object.PrintTextFile(TextFileName, [FontSettings], [DocMarginLeft], [DocMarginTop], [DocMarginRight], [DocMarginBottom], [PrnPaperOrientation], [PrnPaperSize], [PrnPaperBin], [PrnPrintQuality], [PrnCopies])

Where object evaluates to an ASP Printer object.


The PrintTextFile method has these arguments:


PartDescription  


TextFileNameString expression specifying the name of the text file to print. The text file can have any extension (except "rtf", "htm" and "html") but must be a valid text file.  
 
FontSettingsString expression specifying the font settings to be used. The font settings has the following format: Font Name, Font Size, Bold, Italics, Underline. Example: "Arial,12,0,1,0"  
 
DocMarginLeft(Optional). A number specifying the left margin (in twips) of the document (default is 1440).  
 
DocMarginTop(Optional). A number specifying the top margin (in twips) of the document(default is 1440).  
 
DocMarginRight(Optional). A number specifying the right margin (in twips) of the document (default is 1440).  
 
DocMarginBottom(Optional). A number specifying the bottom margin (in twips) of the document (default is 1440).  
 
PrnPaperOrientation(Optional). A constant (number) specifying the paper orientation of the printer. See PaperOrientation Property for details.  
 
PrnPaperSize(Optional). A constant (number) specifying the paper size of the printer. See PaperSize Property for details.  
 
PrnPaperBin(Optional). A constant (number) specifying the printer paper bin to use when printing. See PaperBin Property for details.  
 
PrnPrintQuality(Optional). A constant (number) specifying the print quality to use when printing. See PrintQuality Property for details.  
 
PrnCopies(Optional). A number specifying howmany copies to print (default is 1).  
 
 



Remarks

This method enables you to print a text file using just a single line of code. The method prints the file immediately using the values specified in its arguments. There is no need to use any of the object properties.

The following code line shows how to use this method to print a text file, using custom settings for the font and print margins:

   ASPPrinter.PrintTextFile "C:\MyTextFile.TXT", "Arial, 18, 0, 0, 0", 2000, 2500, 2000, 2500

Note that by using this method, all object properties are ignored, whether (or not) set before calling this method. However, you can choose the printer to send the document to, by using the SetPrinter method before calling this method.

An alternative method to printing text files is by specifying the FileName property and then calling the PrintDoc method.