PrintText Method
Top  Previous  Next

Prints text data (string) using the settings specified in the function arguments.


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

Where object evaluates to an ASP Printer object.

The PrintText method has these arguments:


TextStringString expression specifying the text data to print.  

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).  


This method enables you to print text data using just a single line of code. There is no need to set or use any of the ASP Printer object properties.

The following code line shows how to use this method to print text data using specified font settings and default values for all other method arguments:

   ASPPrinter.PrintText "Hello World!","Times New Roman, 16, 1, 0, 0"

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.

See also the PrintTextFile method.