Changes between Version 1 and Version 2 of GhostScriptRasterPrinting


Ignore:
Timestamp:
Sep 22, 2010, 8:32:02 AM (14 years ago)
Author:
Alex Taylor
Comment:

Add description of using UNIPDR

Legend:

Unmodified
Added
Removed
Modified
  • GhostScriptRasterPrinting

    v1 v2  
    2525Best regards.
    2626Dmitry.
     27
     28== Additional Remarks ==
     29
     30The additional Epson printers listed above are now (as of version 9.00) included in Paul Smedley's distribution of GhostScript.
     31
     32It's possible to send the print job directly from the application --> GhostScript --> printer without having to go through the intermediate stage of running GSView.  This is made possible using the new [http://svn.netlabs.org/unipdr UniPdr] universal port driver:
     33
     34 * Install UNI.PDR (to \OS2\DLL)
     35 * Create a new port of type UNI.
     36 * 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, UniPdr doesn't seem to support piping the job through multiple programs, so you have to write a REXX script (or something similar) which does the work.
     37
     38I've used the following script to print to a TCP/IP (LPD) printer on the network:
     39
     40{{{
     41/* GS2LPR.CMD - print to a TCP/IP printer through GhostScript, using LPR.
     42 * The top-level GhostScript directory should be set in the environment
     43 * variable GHOSTSCRIPT (or just edit the path directly in the file, below).
     44 * Syntax: GS2LPR <model> <LPD server> <LPD printer> %file%
     45 */
     46PARSE ARG model server printer jobfile
     47IF jobfile == '' THEN RETURN 1
     48
     49logdir = VALUE('LOGFILES',,'OS2ENVIRONMENT')
     50tmpdir = VALUE('TMP',,'OS2ENVIRONMENT')
     51gspath = VALUE('GHOSTSCRIPT',,'OS2ENVIRONMENT')
     52IF gspath == '' THEN gspath = 'f:\gs\gs9.00'
     53
     54IF logdir == '' THEN logdir = tmpdir
     55logfile = logdir'\gs2lpr.log'
     56tmpfile = SysTempFileName( tmpdir'\GS_?????.TMP', '?')
     57
     58gscmd  = gspath'\bin\gsos2.exe -sDEVICE='model '-dBATCH -dNOPAUSE -sOUTPUTFILE='tmpfile' -q' jobfile
     59lprcmd = 'lpr.exe -a 0 -b -s' server '-p' printer tmpfile
     60
     61'@echo off'
     62IF STREAM( logfile, 'C', 'QUERY EXISTS') <> '' THEN CALL SysFileDelete logfile
     63CALL LINEOUT logfile, 'Running GhostScript with command line' gscmd
     64CALL LINEOUT logfile
     65ADDRESS CMD gscmd '2>&1 >>'logfile
     66CALL LINEOUT logfile, 'Return code:' rc
     67CALL LINEOUT logfile, ''
     68
     69CALL LINEOUT logfile, 'Printing job with command line' lprcmd
     70CALL LINEOUT logfile
     71ADDRESS CMD lprcmd '2>&1 >>' logfile
     72CALL LINEOUT logfile, 'Return code:' rc
     73CALL LINEOUT logfile, ''
     74
     75CALL SysFileDelete tmpfile
     76
     77RETURN 0
     78}}}
     79
     80Using the above, the following [http://svn.netlabs.org/unipdr UniLpr] settings will allow printing to a networked LP-9400 printer with TCP/IP address 192.168.1.100:
     81
     82 * '''Path and file:''' {{{cmd.exe}}}
     83 * '''Parameters:'''    {{{/c c:\os2\gs2lpr.cmd lp9400 192.168.1.100 * %file%}}}
     84
     85You could presumably print to a Samba printer by using smbspool instead of lpr. 
     86
     87(''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.)
     88
     89It may also be possible to print to a local (LPT/COM/USB) printer using the OS/2 'print' command or somesuch program, but I haven't tried this.
     90
     91-- Added by Alex Taylor