xHarbour has a function PrintFileRaw(). Maybe that could help you
PrintFileRaw()Prints a file to a Windows printer in RAW mode.
SyntaxPrintFileRaw( <cPrinterName>, ;
<cFileName> , ;
[<cJobTitle>] ) --> nErrorCode
Arguments<cPrinter> This is a character string holding the name of the printer to use for printing.
<cFileName> The file to print must be specified as a character string, including path and extension. If the path is omitted, the file is searched in the current directory.
<cJobTitle> This is an optional character string which appears as print job description in the spooler. It defaults to <cFileName>. Return
The function returns 1 on success or a value less than zero on error. See the example for error codes.
DescriptionFunction PrintFileRaw() prints a file to a Windows printer in RAW mode. This restricts file types for printing to enhanced metafiles (EMF), ASCII text, and raw data, which includes all printer specific file types such as PostScript and PCL. The file is sent to the Windows spooler which processes the print job. The function returns zero when the file is successfully transferred to the spooler. Note that this is no guarantee for a printout. If the physical printer is out of paper, for example, the spooler reports an error to the user. This type of failure cannot be detected by PrintFileRaw().
Example- Code: Select all Expand view
// The example prints a file in RAW mode and demonstrates
// the possible return values of PrintFileRaw().
PROCEDURE Main()
LOCAL cPrinter := GetDefaultPrinter()
LOCAL cFile := "MyFile.Txt"
LOCAL nResult := -1
LOCAL cMsg := "PrintFileRaw(): "
CLS
IF Empty( cPrinter )
? "No default printer found"
QUIT
ENDIF
nResult := PrintFileRaw( cPrinter, cFile, "Test for PrintFileRaw()" )
SWITCH nResult
CASE -1
cMsg += "Invalid parameters passed to function" ; EXIT
CASE -2
cMsg += "WinAPI OpenPrinter() call failed" ; EXIT
CASE -3
cMsg += "WinAPI StartDocPrinter() call failed" ; EXIT
CASE -4
cMsg += "WinAPI StartPagePrinter() call failed" ; EXIT
CASE -5
cMsg += "WinAPI malloc() of memory failed" ; EXIT
CASE -6
cMsg += "File " + cFile + " not found" ; EXIT
DEFAULT
cMsg += cFile + " PRINTED OK!!!"
END
? cMsg
RETURN