Changes between Version 5 and Version 6 of GhostScriptRasterPrinting
- Timestamp:
- Nov 22, 2011, 3:33:20 PM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
GhostScriptRasterPrinting
v5 v6 12 12 == Basic Procedure == 13 13 14 The Epson Ghostscript drivers discussed by Dmitry (below) are now included in Paul Smedley's distribution of Ghostscript, as of version 9.00, and also as an update to version 8.71 (included in theWPI distribution).14 The Epson Ghostscript drivers discussed by Dmitry (below) are now included in Paul Smedley's distribution of Ghostscript, as of version 9.00, and also as an [http://download.smedley.info/gsdll2.zip update to version 8.71] (this is included in the latest WPI distribution). 15 15 16 16 This technique describes how to send the print job directly from the application --> Ghostscript --> printer without having to go through the intermediate stage of running GSView. Basically, this is made possible using the new [http://svn.netlabs.org/unipdr UNI.PDR] universal port driver: 17 17 18 * Install UNI.PDR (to \OS2\DLL)18 * Install UNI.PDR (to `\OS2\DLL`) 19 19 * Create a new port of type UNI. 20 20 * Edit the port properties. We need to send the print job through two programs: Ghostscript, followed by whatever command actually sends the job to the printer. Unfortunately, UNI.PDR doesn't currently support piping the job through multiple programs, so you have to use a REXX script or similar to link the programs together. 21 21 22 The details of this REXX script depend on what kind of printer connection you have. The program that actually sends the data to the printer is going to be different for network printers, for parallel/serial ports, and for USB connections. 22 The details of this REXX script depend on what kind of printer connection you have. The program that actually sends the data to the printer is going to be different for LPD vs. SMB network printers, and different again for local USB connections. 23 23 24 [[br]][[br]] 24 25 … … 45 46 tmpdir = VALUE('TMP',,'OS2ENVIRONMENT') 46 47 gspath = VALUE('GHOSTSCRIPT',,'OS2ENVIRONMENT') 47 IF gspath == '' THEN gspath = 'f:\gs\gs9.00' 48 49 /* Change the fallback path to Ghostscript as appropriate for your own system. */ 50 IF gspath == '' THEN gspath = 'f:\gs\gs8.71' 48 51 49 52 IF logdir == '' THEN logdir = tmpdir … … 81 84 82 85 (''Don't'' try to print through CUPS -- i.e. with {{{cupslpr}}} -- using this technique, because the job will already be in printer-specific format at that point; CUPS expects to receive Postscript input, and will choke as a result. In any case, you're presumably using this technique because printing via CUPS doesn't work in the first place.) 86 83 87 [[br]][[br]] 84 88 85 89 === Printing to a Local Parallel or Serial Attached Printer === 86 90 87 It's presumably possible to print to a local (LPT/COM) printer using the OS/2 'print' command via the following script, but this has ''not'' been tested. 88 {{{ 89 /* GS2PORT.CMD - print to a parallel/serial attached printer through 90 * GhostScript, using PRINT. 91 * 92 * The top-level GhostScript directory should be set in the environment 93 * variable GHOSTSCRIPT (or just edit the path directly in the file, below). 94 * 95 * Syntax: GS2PORT <model> <port> %file% 96 */ 97 PARSE ARG model port jobfile 98 IF jobfile == '' THEN RETURN 1 91 According to the Ghostscript documentation, it should be possible to print to a parallel or serial port directly from the port driver, without need of a REXX script. This is because the Ghostscript '''-o''' parameter supports these port types. This has ''not'' been tested, but the following options (assuming a printer on LPT1 and Ghostscript installed in `f:\gs\gs8.71`) for the UNI''x'' port may work in this case: 92 ||=''Path and file '' =|| {{{f:\gs\gs8.71\bin\gsos2.exe}}} || 93 ||=''Parameters '' =|| {{{-sDEVICE=lp9400 -o lpt1 -q %file%}}} || 94 (Note that '`-o lpt1`' is equivalent to '`-dNOPAUSE -dBATCH -sOUTPUTFILE=lpt1`', at least according to the documentation.) 99 95 100 logdir = VALUE('LOGFILES',,'OS2ENVIRONMENT') 101 tmpdir = VALUE('TMP',,'OS2ENVIRONMENT') 102 gspath = VALUE('GHOSTSCRIPT',,'OS2ENVIRONMENT') 103 IF gspath == '' THEN gspath = 'f:\gs\gs8.71' 96 Alternatively, it's presumably possible to achieve the same effect by using the OS/2 `PRINT` command (with `/D:`''portname'') in place of `lpr.exe` in a REXX script similar to the one above; this has not been tested either. 104 97 105 IF logdir == '' THEN logdir = tmpdir106 logfile = logdir'\gs2port.log'107 tmpfile = SysTempFileName( tmpdir'\GS_?????.TMP', '?')108 109 gscmd = gspath'\bin\gsos2.exe -sDEVICE='model '-dBATCH -dNOPAUSE -sOUTPUTFILE='tmpfile' -q' jobfile110 lprcmd = 'print' tmpfile '/D:'port111 112 '@echo off'113 IF STREAM( logfile, 'C', 'QUERY EXISTS') <> '' THEN CALL SysFileDelete logfile114 CALL LINEOUT logfile, 'Running GhostScript with command line' gscmd115 CALL LINEOUT logfile116 ADDRESS CMD gscmd '2>&1 >>'logfile117 CALL LINEOUT logfile, 'Return code:' rc118 CALL LINEOUT logfile, ''119 120 CALL LINEOUT logfile, 'Printing job with command line' lprcmd121 CALL LINEOUT logfile122 ADDRESS CMD lprcmd '2>&1 >>' logfile123 CALL LINEOUT logfile, 'Return code:' rc124 CALL LINEOUT logfile, ''125 126 CALL SysFileDelete tmpfile127 128 RETURN 0129 }}}130 131 In this case the UNI port settings for a printer on LPT1 would be:132 ||=''Path and file '' =|| {{{cmd.exe}}} ||133 ||=''Parameters '' =|| {{{/c c:\os2\gs2port.cmd lp9400 lpt1 %file%}}} ||134 98 [[br]][[br]] 135 99 136 100 === Printing to a Local USB Attached Printer === 137 101 138 Unfortunately, the OS/2 "print"command doesn't work with USB ports. The only solution which I've found that works with USB printers is the following, rather convoluted procedure.102 Unfortunately, the OS/2 `PRINT` command doesn't work with USB ports. The only solution which I've found that works with USB printers is the following, rather convoluted procedure. 139 103 140 104 First of all, the UNI port settings for the printer object look something like: