Description

The PRINT message is used to send plain text or embedded escape codes to control the output of the printer.

A CRLF is appended to each string that is printed when Parm2 is Null or 1. If Parm2 is 0 then no CRLF is appended and the next line will be appended to the last line.

ParametersDescription of FieldsCommentsDefault
Parm1Text and/or escape codes ""
Parm 2Append Carriage return/line feedA boolean field. If true then a carriage return/line feed is appended to the first parameter.1

See also

START Direct_Print() message

STOP Direct_Print() message

PAGE Direct_Print() message

ABORT Direct_Print() message

PRINTBIN Direct_Print() message

Direct_Print Error Codes

Direct Print() function

Example

Subroutine Direct_Print_Example(startValue)
 
Declare Function Direct_Print, Unassigned
 
If Unassigned(startValue) Then startValue = ''
 
Equ HP_Bold$ To char(27):'(s3B'
 
Equ HP_Norm$ To char(27):'(s-5B'
 
* This case statement contains the various START options
 
Begin Case
 
  Case startValue = ''
 
    retval = Direct_Print('START','','','') ; * print to default printer
 
  Case startValue = 'ToFile'
 
    retval = Direct_Print('START','','C:\TEMP\DIRECT_PRINT_EXAMPLE.TXT',1) ; * Print To file
 
  Case startValue = 'Different_Printer'
 
    retval = Direct_Print('START','HP LaserJet 2200 Series PCL 6','','') ; * print to a specific printer
 
End case
 
If retval < 1 then Goto ErrorHandler
 
* Print 30 lines of bold text
 
For i = 1 To 30
 
  retval = Direct_Print('PRINT',HP_Bold$:'This first page contains bold text.')
 
  If retval < 1 then Goto ErrorHandler
 
Next i
 
retval = Direct_Print('PAGE') ; * Force page break
 
If retval < 1 then Goto ErrorHandler
 
For i = 1 To 30
 
  retval = Direct_Print('PRINT',HP_Norm$:'This page contains plain text.')
 
  If retval < 1 then Goto ErrorHandler
 
Next i
 
retval = Direct_Print('PAGE') ; * Force page break
 
If retval < 1 then Goto ErrorHandler
 
retval = Direct_Print('PRINT','This page contains concatenated text.',0)
 
If retval < 1 then Goto ErrorHandler
 
retval = Direct_Print('PRINT','This page contains concatenated text with a carriage return/line feed.',1)
 
If retval < 1 then Goto ErrorHandler
 
* End the Print Job
 
retval = Direct_Print('STOP')
 
ErrorHandler:
 
If retval < 1 Then
 
  Swap @fm With  @vm In retval
 
  call Msg(@Window,'ERROR':retval)
 
  retval = Direct_Print('ABORT')
 
End
 
Return
  • No labels