Changes between Version 5 and Version 6 of GhostScriptRasterPrinting


Ignore:
Timestamp:
Nov 22, 2011, 3:33:20 PM (7 years ago)
Author:
ataylor
Comment:

Cleaned up parallel printing section; added link to latest gs871 DLL; other minor improvements

Legend:

Unmodified
Added
Removed
Modified
  • GhostScriptRasterPrinting

    v5 v6  
    1212== Basic Procedure ==
    1313
    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 the WPI distribution).
     14The 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).
    1515
    1616This 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:
    1717
    18  * Install UNI.PDR (to \OS2\DLL)
     18 * Install UNI.PDR (to `\OS2\DLL`)
    1919 * Create a new port of type UNI.
    2020 * 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.
    2121
    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.
     22The 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
    2324[[br]][[br]]
    2425
     
    4546tmpdir = VALUE('TMP',,'OS2ENVIRONMENT')
    4647gspath = 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. */
     50IF gspath == '' THEN gspath = 'f:\gs\gs8.71'
    4851
    4952IF logdir == '' THEN logdir = tmpdir
     
    8184
    8285(''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
    8387[[br]][[br]]
    8488
    8589=== Printing to a Local Parallel or Serial Attached Printer ===
    8690
    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
     91According 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.)
    9995
    100 logdir = VALUE('LOGFILES',,'OS2ENVIRONMENT')
    101 tmpdir = VALUE('TMP',,'OS2ENVIRONMENT')
    102 gspath = VALUE('GHOSTSCRIPT',,'OS2ENVIRONMENT')
    103 IF gspath == '' THEN gspath = 'f:\gs\gs8.71'
     96Alternatively, 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.
    10497
    105 IF logdir == '' THEN logdir = tmpdir
    106 logfile = logdir'\gs2port.log'
    107 tmpfile = SysTempFileName( tmpdir'\GS_?????.TMP', '?')
    108 
    109 gscmd  = gspath'\bin\gsos2.exe -sDEVICE='model '-dBATCH -dNOPAUSE -sOUTPUTFILE='tmpfile' -q' jobfile
    110 lprcmd = 'print' tmpfile '/D:'port
    111 
    112 '@echo off'
    113 IF STREAM( logfile, 'C', 'QUERY EXISTS') <> '' THEN CALL SysFileDelete logfile
    114 CALL LINEOUT logfile, 'Running GhostScript with command line' gscmd
    115 CALL LINEOUT logfile
    116 ADDRESS CMD gscmd '2>&1 >>'logfile
    117 CALL LINEOUT logfile, 'Return code:' rc
    118 CALL LINEOUT logfile, ''
    119 
    120 CALL LINEOUT logfile, 'Printing job with command line' lprcmd
    121 CALL LINEOUT logfile
    122 ADDRESS CMD lprcmd '2>&1 >>' logfile
    123 CALL LINEOUT logfile, 'Return code:' rc
    124 CALL LINEOUT logfile, ''
    125 
    126 CALL SysFileDelete tmpfile
    127 
    128 RETURN 0
    129 }}}
    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%}}} ||
    13498[[br]][[br]]
    13599
    136100=== Printing to a Local USB Attached Printer ===
    137101
    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.
     102Unfortunately, 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.
    139103
    140104First of all, the UNI port settings for the printer object look something like: