* :--------------------------------------- * ------------------------: Print File API - Function * :--------------------------------------- * : * : This copybook is used to print a file * : from disk to any windows printer. * : * : This API expects the file to be a * : simple text, or text with printer * : control codes embeded. * : However, this API does not care what * : it prints and will be perfectly happy * : to waste reams of paper printing DLLs * : or what ever you tell it to print. * : * : Normal useage would be to print to a * : disk file and then call this dll to * : send the file to print. * : * : You may either supply the Printer name * : or let the API prompt for it with the * : standard windows Print Dialog box. * : (If forcing this API to run on the * : server you MUST supply printer name). * : * : Optionally, you can ask the API to * : paginate reports by breaking print * : jobs at the occurance of every page- * : feed character found in the file. * : This will let the windows spooler * : start printing the pages prior to * : the competion of transmission. * : For short reports, this will yield * : no benefit, but for long print jobs * : it allows printing to start after the * : first page is transmitted. * : * : You can supply printer setup via THREE * : means. * : 1) By setting 88s in GS-DEVMODE-DATA * : (or supplying GS-DEVMODE-DATA from * : a previous PrintDlg API, * : OR * : 2) You can supply up to 300 bytes of * : printer setup escape sequences * : to the printer and 200 bytes * : of printer reset information which * : will be transmitted to the printer * : before and after the file data. This * : may be used to put the printer in a * : mode needed for your report, as well * : as font selection, etc.) * : (You may do both methods in the same * : call if needed.) * : OR * : 3) Leave GS-DEVMODE-DATA as low values * : and also leave the printer name * : low-values and user choices will be * : use from printer selection dialog. * : (not for printing on server side). * To use: * * COPY WIN32API. * COPY PRTFILE. * COPY GSPRTDEF. * * : Typical call * : (Using printer name derived from * : PRINTDLG api. * SET PRTFILE-PARMS-INITIALIZE TO TRUE. * MOVE PRTDLG-PRINTER-NAME TO PRTFILE-PRINTER-NAME * * MOVE "C:\MY-REPORT.TXT" TO PRTFILE-SOURCE-FILE-NAME * SET PRTFILE-DATA-RAW TO TRUE * SET DMORIENT-PORTRAIT DMPAPER-LETTER TO TRUE * STRING MY-PRINTER-SETUP-DATA DELIMITED LOW-VALUES INTO * PRTFILE-PREPEND-BUFFER * MOVE "System Status Report" TO PRTFILE-DOCUMENT-NAME * SET FUNC-PRINTFILE TO TRUE * CALL 'GSWINAPI' USING WIN32API-PARMS * PRTFILE-PARMS * GS-DEVMODE-DATA * WIN32API-C * WIN32API-D * WIN32API-E * WIN32API-F. * * IF WIN32API-FAILED * do print-not-possible-or-canceled * ELSE * continue printing report * * ---------------------------------------------------------------- * : If you leave the printer name blank * : and put in a panel-HWND the print file * : api will prompt the user for the * : printer name. 01 PRTFILE-PARMS. 88 PRTFILE-PARMS-INITIALIZE VALUE LOW-VALUES. 05 PRTFILE-PRINTER-NAME PIC X(100). 05 PRTFILE-DIALOG-HWND PIC X(4). * : Your Report Name (For print spooler * : display in windows. 05 PRTFILE-DOCUMENT-NAME PIC X(50). * : Input file name 05 PRTFILE-SOURCE-FILE-NAME PIC X(250). * : When running on Client/Server Layer * : the source file can be either on the * : Client or on the Server. If on the * : Server, the API will first transfer * : this file and then print it. It will * : then delete the transfered copy. * : Ignored if not running Client/Server 05 PRTFILE-SOURCE-LOCATION PIC X. 88 PRTFILE-SOURCE-ON-SERVER VALUES LOW-VALUE SPACE. 88 PRTFILE-SOURCE-ON-CLIENT VALUES 'C'. * : Specify the type of data you will be * : sending. Use Raw for printing data * : that is pre-formatted and contains * : contains all necessary printer driver * : commands (HPCL, Postscript,etc). * : See Settings in CtrlPanel Printers. 05 PRTFILE-DATA-TYPE PIC X(10). 88 PRTFILE-DATA-RAW VALUES 'RAW' SPACE. 88 PRTFILE-DATA-EMF VALUE 'EMF'. * : If these areas are other than * : low-values they will be pre-pended and * : post-pended (respectivly) to the * : data in the print file. You might * : use this area for printer initial- * : ialization and reset escape sequences * : rather than putting them into the file * : you want to print. * : Move Low-values into these areas and * : then string your settings in. Unused * : trailing low-values will be stripped * : by the API. 05 PRTFILE-PREPEND-BUFFER PIC X(300). 05 PRTFILE-POSTPEND-BUFFER PIC X(200). * : See comments at top of copybook. 05 PRTFILE-PAGINATE PIC X. 88 PRTFILE-PAGINATE-NO VALUES LOW-VALUE SPACE. 88 PRTFILE-PAGINATE-YES VALUES 'Y'. * : Some print files do not contain normal * : end of page ejects at the end, and * : may leave the page in an un-ejected * : state, or missing (in laser printers) * : until next print job. Setting check * : or force will make sure there is a * : final eject. Check looks in the last * : 5 characters for an eject, and adds * : one if not found. Force just adds one. 05 PRTFILE-FINAL-EJECT PIC X. 88 PRTFILE-NO-FINAL-EJECT VALUE LOW-VALUE SPACE. 88 PRTFILE-CHECK-FINAL-EJECT VALUE 'C'. 88 PRTFILE-FORCE-FINAL-EJECT VALUE 'F'. 05 FRTFILE-VERSION PIC X. 88 PRTFILE-VERSION-INITIAL VALUES LOW-VALUES SPACE.