xHarbour Reference Documentation > Function Reference |
Prints a file to a Windows printer in RAW mode.
PrintFileRaw( <cPrinterName>, ; <cFileName> , ; [<cJobTitle>] ) --> nErrorCode
The function returns 1 on success or a value less than zero on error. See the example for error codes.
Function 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().
See also: | GetPrinters(), GetDefaultPrinter(), PrinterExists(), PrinterPortToName() |
Category: | Printer functions , xHarbour extensions |
Source: | rtl\tprinter.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// 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
http://www.xHarbour.com