Changes between Version 6 and Version 7 of GhostScriptRasterPrinting
- Timestamp:
- Apr 10, 2012, 2:29:25 PM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
GhostScriptRasterPrinting
v6 v7 1 1 == Ghostscript Raster Printing (a.k.a. Using Ghostscript as a Printer Driver) == 2 2 3 Ghostscript includes a not-insignificantnumber of built-in printer drivers, many of which are not otherwise supported by OS/2 or CUPS.3 Ghostscript includes a large number of built-in printer drivers, many of which are not otherwise supported by OS/2 or CUPS. 4 4 5 5 Normally, the way CUPS supports such printers is by calling a program called foomatic-rip which validates the incoming postscript print job, adds some extra options to it, and then calls Ghostscript with the predetermined parameters. Unfortunately, this doesn't currently work under OS/2 because foomatic-rip seems to dislike the postscript data generated by the OS/2 printer drivers (ECUPS.DRV, PSCRIPT.DRV, etc). … … 9 9 Most of the discussion below focuses on the printers in the Epson driver collection for Ghostscript, but it should work equally well for any built-in Ghostscript printer driver. 10 10 [[br]][[br]] 11 11 12 12 13 == Basic Procedure == … … 22 23 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 24 24 [[br]][[br]] 25 Two REXX scripts are attached here (see the attachments section at the bottom of this page). 26 * GS2PORT.CMD is for printing to a locally-attached printer on a USB or parallel port (or some other port type). This script requires the EPRINT.EXE utility (also attached). 27 * GS2LPR.CMD is for printing to a TCP/IP network printer using the LPR/LPD protocol. 28 29 ==== Quick Instructions ==== 30 31 1. Make sure you have Ghostscript v8.71 with [http://download.smedley.info/gsdll2.zip the updated DLL] installed and working. 32 2. Download the [http://svn.netlabs.org/unipdr UNI.PDR] port driver and copy UNI.PDR to \OS2\DLL. 33 3. Download [http://www.altsan.org/os2/printing/#eprint EPRINT] and place the executable somewhere in your path. 34 4. Get {{{GS2LPR.CMD}}} (for TCP/IP printers) and/or {{{GS2PORT.CMD}}} (for USB and other local printers) from this page and place them somewhere convenient (these instructions will assume they are in your \OS2 directory). 35 5. Create your printer object in the WPS. 36 6. Open the printer object properties notebook, go to the '''Output port''' page, click on ''Install new port'' and select 'UNI'. (If you don't see 'UNI' listed, select 'New port drivers', enter the path to \OS2\DLL and click on ''Refresh''.) 37 7. Edit the properties of the new UNI''*'' port as follows: 38 * ''Path and file'': {{{cmd.exe}}} 39 * ''Parameters'': 40 * For TCP/IP (LPR) printers: {{{/c}}} ''x''{{{:\os2\gs2lpr.cmd}}} ''<model>'' ''<IP address>'' ''<queue name>'' {{{%file%}}} 41 * For local printers: {{{/c}}} ''x''{{{:\os2\gs2lpr.cmd}}} ''<model>'' ''<port name>'' {{{%file%}}} 42 43 The parameters do not include '<' and '>'. For TCP/IP printers, if there is no queue name then use '*' as the queue. For local printers, if you don't know the port name then use {{{EPRINT /L}}} to get a list of ports. 44 45 This procedure is described in more detail below. 46 47 '''Note:''' You should use Ghostscript version 8.71. Later versions (9.''x'') do not work reliably. 48 49 50 [[br]][[br]] 51 25 52 26 53 === Printing to a Network Printer === … … 29 56 30 57 {{{ 31 /* GS2LPR.CMD - print to a TCP/IP printer through !GhostScript, using LPR.58 /* GS2LPR.CMD - print to a TCP/IP printer through Ghostscript, using LPR. 32 59 * 33 60 * The top-level GhostScript directory should be set in the environment … … 76 103 }}} 77 104 78 Using the above, the following [http://svn.netlabs.org/unipdr UNI.PDR] settings will allow printing to a networked LP-9400 printer with TCP/IP address 192.168.1.100:105 Using the above, the following [http://svn.netlabs.org/unipdr UNI.PDR] settings will allow printing to a networked Epson LP-9400 printer with TCP/IP address 192.168.1.100: 79 106 80 107 ||=''Path and file'' =||{{{cmd.exe}}} || 81 108 ||=''Parameters'' =||{{{/c c:\os2\gs2lpr.cmd lp9400 192.168.1.100 * %file%}}} || 109 110 The '*' is used for the LPR queue name in the event that no explicit queue name is needed (this is generally the case when the printer itself is acting as the print server). 82 111 83 112 You could presumably print to a Samba printer by using {{{smbspool}}} instead of {{{lpr}}}. … … 100 129 === Printing to a Local USB Attached Printer === 101 130 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.103 104 First of all, the UNI port settings for the printer object look something like:131 Unfortunately, the OS/2 `PRINT` command doesn't work with USB ports. There are a couple of ways around this, but the best solution available (at the moment) is to use the EPRINT utility, available at http://www.altsan.org/os2/printing/#eprint (it should also be attached to this page). 132 133 Using this method, the UNI port settings for the printer object look something like: 105 134 ||=''Path and file'' =|| {{{cmd.exe}}} || 106 ||=''Parameters'' =|| {{{/c c:\os2\gs2 q.cmd lp9400 LP-9400-Raw%file%}}} ||107 108 Next, it's necessary to create a ''second'' printer object (in this example called "LP-9400-Raw") which prints to the actual USB port. However, this second printer must use the IBMNULL printer driver with the spool file format set to PM_Q_RAW. 135 ||=''Parameters'' =|| {{{/c c:\os2\gs2port.cmd lp9400 EPSON_LP_9400_1 %file%}}} || 136 137 Here, ''EPSON_LP_9400_1'' is the name of the USB port that OS/2 creates when the printer is plugged in to the computer. (You can find out what the correct port name is by using the {{{EPRINT /L}}} command, which lists all ports in the system.) 109 138 110 139 The script in this case looks like: 111 140 {{{ 112 /* GS2 Q.CMD - print to an IBMNULL print queue using GhostScript. This113 * requires VROBJ.DLL to be installed.141 /* GS2PORT.CMD - print to a locally-attached printer through Ghostscript, using 142 * EPRINT. 114 143 * 115 144 * The top-level GhostScript directory should be set in the environment 116 145 * variable GHOSTSCRIPT (or just edit the path directly in the file, below). 117 146 * 118 * Syntax: GS2Q <model> <port> %file% 119 */ 120 CALL RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs' 121 CALL SysLoadFuncs 122 CALL RxFuncAdd 'VRPrintFile', 'VROBJ.DLL', 'VRPrintFile' 123 CALL RxFuncAdd 'VRError', 'VROBJ.DLL', 'VRError' 124 125 PARSE ARG model printer jobfile 147 * Syntax: GS2PORT <model> <port name> %file% 148 */*/ 149 PARSE ARG model port jobfile 126 150 IF jobfile == '' THEN RETURN 1 127 151 … … 132 156 133 157 IF logdir == '' THEN logdir = tmpdir 134 logfile = logdir'\gs2 q.log'158 logfile = logdir'\gs2port.log' 135 159 tmpfile = SysTempFileName( tmpdir'\GS_?????.TMP', '?') 136 160 137 161 gscmd = gspath'\bin\gsos2.exe -sDEVICE='model '-dBATCH -dNOPAUSE -sOUTPUTFILE='tmpfile' -q' jobfile 162 lprcmd = 'eprint' tmpfile '/D:'port 138 163 139 164 '@echo off' … … 145 170 CALL LINEOUT logfile, '' 146 171 147 CALL LINEOUT logfile, 'Now sending file to printer' printer 148 rc = VRPrintFile( printer, tmpfile ) 149 CALL LINEOUT logfile, 'Return code:' rc 150 IF rc == 0 THEN 151 call lineout logfile, VRError() 172 CALL LINEOUT logfile, 'Printing job with command line' lprcmd 173 CALL LINEOUT logfile 174 ADDRESS CMD lprcmd '2>&1 >>' logfile 175 CALL LINEOUT logfile, 'Return code:' rc 152 176 CALL LINEOUT logfile, '' 153 177 … … 157 181 }}} 158 182 159 This seems to work here, although I had problems until I made sure to use Ghostscript 8.71 (instead of 9.0''x''). It also appears to be very important that the "default spool file type" in the IBMNULL printer driver properties is set to use PM_Q_RAW (and ''not'' PM_Q_STD). 160 161 Note that this script as shown doesn't accept blanks in the printer name, so you should name your IBMNULL printer accordingly. 162 [[br]][[br]] 163 183 [[br]][[br]] 164 184 165 185 ----