Changes between Version 3 and Version 4 of GhostScriptRasterPrinting


Ignore:
Timestamp:
Oct 28, 2011, 6:26:39 AM (12 years ago)
Author:
Alex Taylor
Comment:

Complete overhaul

Legend:

Unmodified
Added
Removed
Modified
  • GhostScriptRasterPrinting

    v3 v4  
    1 List of newly supported Epson printers:
    2 
    3 epl2050 epl2050p epl2120 epl2500 epl2750 epl5800 epl5900 epl6100 epl6200 lp1800 lp1900 lp2200 lp2400 lp2500 lp7500 lp7700 lp7900 lp8100 lp8300f lp8400f lp8600 lp8600f lp8700 lp8900 lp9000b lp9100 lp9200b lp9300 lp9400 lp9600 lp9600s alc1900 alc2000 alc4000 alc4100 alc8500 alc8600 alc9100 lp3000c lp8000c lp8200c lp8300c lp8500c lp8800c lp9000c lp9200c lp9500c lp9800c
    4 
    5 Why I made this build.
    6 
    7 Our company bought Epson AcuLaser C1900 color printer. This model is capable to work PCL5 mode but in B/W mode only and doesn't understand poscript., while I wish to print in color too. So I look for solution and found out that Epson sources are GPL now and exist as GS patch.
    8 
    9 So I downloaded the latest GS (8.53 at the moment) and the latest Epson GS patch ghostscript-7.07.tar.bz2. I applied the patch (patched sources GS doesn't changed too much from 7.07 to 8.53 version) and built the modules with gcc 3.3.5, what mean that you need lib06 dll (you may take it here ). I also made some minor changes in main GS code to finish new printer support with OS/2 printing subsystem.
    10 
    11 If You wish to print from GSView You'll need to need to make some changes in gsview printer.ini file. I'm not familar with it's grammar, so for my printer I simply add line in [Devices] section:
    12 
    13 alc1900=1200x1200,600x600,300x300
    14 
    15 I also create a new printer object with IBM NULL printer driver. May be there is no need to do this as GS send data to printer queue in raw mode? Now I'm capable to print pdf and ps files from GSView. To finish printer support to other OS/2 application I installed fake printer object which generate ps file. Now I print to this fake printer and it generate ps file. After that I simply print this ps file from GSView.
    16 This may be automated as well, as I'm at the beginning of the whole way
    17 
    18 Unfortunatelly, I didn't find the universal solution for all aplication. For example, I use ScenicSoft postscript color printer driver (imported with PPD file) in 2400 resolution for printing from OpenOffice and Xerox 4900 postscript printer driver for printing from Mozilla (works fine only in 300dpi mode :\ )
    19 
    20 What's the next?
    21 
    22 I can add the same way most of HP printers support. It operate slightly different - via separate application named ijs server. I already built the server itself, so everything depend on your backward requests :)
    23 
    24 --
    25 Best regards.
    26 Dmitry.
    27 
    28 == Additional Remarks ==
    29 
    30 The additional Epson printers listed above are now (as of version 9.00) included in Paul Smedley's distribution of GhostScript.
    31 
    32 It'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 UNI.PDR] universal port driver:
     1== Ghostscript Raster Printing (a.k.a. Using Ghostscript as a Printer Driver) ===
     2
     3Ghostscript includes a not-insignificant number of built-in printer drivers, many of which are not otherwise supported by OS/2 or CUPS.
     4
     5Normally, 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).
     6
     7However, there is a way to print seamlessly to Ghostscript-supported printers, if some special configuration is used.  Doing it this way bypasses foomatic-rip (and, strictly speaking, CUPS itself) entirely.
     8
     9Most 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
     11== Basic Procedure ==
     12
     13The 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).
     14
     15This 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:
    3316
    3417 * Install UNI.PDR (to \OS2\DLL)
    3518 * 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, UNI.PDR 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.
     19 * 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.
     20
     21=== Printing to a Network Printer ===
    3722
    3823I've used the following script to print to a TCP/IP (LPD) printer on the network:
     
    9176You could presumably print to a Samba printer by using smbspool instead of lpr. 
    9277
    93 (''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.)
    94 
    95 It 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.
    96 
    97 Of course, you can also use the above script to print a pre-existing PostScript file from the command line.
    98 
    99 -- Added by Alex Taylor
     78=== Printing to a Local Parallel or Serial Attached Printer ===
     79
     80It'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.
     81{{{
     82/* GS2PORT.CMD - print to a parallel/serial attached printer through
     83 * GhostScript, using PRINT.
     84 *
     85 * The top-level GhostScript directory should be set in the environment
     86 * variable GHOSTSCRIPT (or just edit the path directly in the file, below).
     87 *
     88 * Syntax: GS2PORT <model> <port> %file%
     89 */
     90PARSE ARG model port jobfile
     91IF jobfile == '' THEN RETURN 1
     92
     93logdir = VALUE('LOGFILES',,'OS2ENVIRONMENT')
     94tmpdir = VALUE('TMP',,'OS2ENVIRONMENT')
     95gspath = VALUE('GHOSTSCRIPT',,'OS2ENVIRONMENT')
     96IF gspath == '' THEN gspath = 'f:\gs\gs8.71'
     97
     98IF logdir == '' THEN logdir = tmpdir
     99logfile = logdir'\gs2port.log'
     100tmpfile = SysTempFileName( tmpdir'\GS_?????.TMP', '?')
     101
     102gscmd  = gspath'\bin\gsos2.exe -sDEVICE='model '-dBATCH -dNOPAUSE -sOUTPUTFILE='tmpfile' -q' jobfile
     103lprcmd = 'print' tmpfile '/D:'port
     104
     105'@echo off'
     106IF STREAM( logfile, 'C', 'QUERY EXISTS') <> '' THEN CALL SysFileDelete logfile
     107CALL LINEOUT logfile, 'Running GhostScript with command line' gscmd
     108CALL LINEOUT logfile
     109ADDRESS CMD gscmd '2>&1 >>'logfile
     110CALL LINEOUT logfile, 'Return code:' rc
     111CALL LINEOUT logfile, ''
     112
     113CALL LINEOUT logfile, 'Printing job with command line' lprcmd
     114CALL LINEOUT logfile
     115ADDRESS CMD lprcmd '2>&1 >>' logfile
     116CALL LINEOUT logfile, 'Return code:' rc
     117CALL LINEOUT logfile, ''
     118
     119CALL SysFileDelete tmpfile
     120
     121RETURN 0
     122}}}
     123
     124In this case the UNI port settings for a printer on LPT1 would be:
     125 * '''Path and file:''' {{{cmd.exe}}}
     126 * '''Parameters:'''    {{{/c c:\os2\gs2port.cmd lp9400 lpt1 %file%}}}
     127
     128
     129=== Printing to a Local USB Attached Printer ===
     130
     131Unfortunately, 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.
     132
     133First of all, the UNI port settings for the printer object look something like:
     134 * '''Path and file:''' {{{cmd.exe}}}
     135 * '''Parameters:'''    {{{/c c:\os2\gs2q.cmd lp9400 LP-9400-Raw %file%}}}
     136
     137Next, 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.
     138
     139The script in this case looks like:
     140{{{
     141/* GS2Q.CMD - print to an IBMNULL print queue using GhostScript.  This
     142 * requires VROBJ.DLL to be installed.
     143 *
     144 * The top-level GhostScript directory should be set in the environment
     145 * variable GHOSTSCRIPT (or just edit the path directly in the file, below).
     146 *
     147 * Syntax: GS2Q <model> <port> %file%
     148*/
     149CALL RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
     150CALL SysLoadFuncs
     151CALL RxFuncAdd 'VRPrintFile', 'VROBJ.DLL', 'VRPrintFile'
     152CALL RxFuncAdd 'VRError', 'VROBJ.DLL', 'VRError'
     153
     154PARSE ARG model printer jobfile
     155IF jobfile == '' THEN RETURN 1
     156
     157logdir = VALUE('LOGFILES',,'OS2ENVIRONMENT')
     158tmpdir = VALUE('TMP',,'OS2ENVIRONMENT')
     159gspath = VALUE('GHOSTSCRIPT',,'OS2ENVIRONMENT')
     160IF gspath == '' THEN gspath = 'f:\gs\gs8.71'
     161
     162IF logdir == '' THEN logdir = tmpdir
     163logfile = logdir'\gs2q.log'
     164tmpfile = SysTempFileName( tmpdir'\GS_?????.TMP', '?')
     165
     166gscmd  = gspath'\bin\gsos2.exe -sDEVICE='model '-dBATCH -dNOPAUSE -sOUTPUTFILE='tmpfile' -q' jobfile
     167
     168'@echo off'
     169IF STREAM( logfile, 'C', 'QUERY EXISTS') <> '' THEN CALL SysFileDelete logfile
     170CALL LINEOUT logfile, 'Running GhostScript with command line' gscmd
     171CALL LINEOUT logfile
     172ADDRESS CMD gscmd '2>&1 >>'logfile
     173CALL LINEOUT logfile, 'Return code:' rc
     174CALL LINEOUT logfile, ''
     175
     176CALL LINEOUT logfile, 'Now sending file to printer' printer
     177rc = VRPrintFile( printer, tmpfile )
     178CALL LINEOUT logfile, 'Return code:' rc
     179IF rc == 0 THEN
     180    call lineout logfile, VRError()
     181CALL LINEOUT logfile, ''
     182
     183CALL SysFileDelete tmpfile
     184
     185RETURN 0
     186}}}
     187
     188This seems to work here, although I had problems until I made sure to use Ghostscript 8.71 (instead of 9.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).
     189
     190Note that this script as shown doesn't accept blanks in the printer name, so you should name your IBMNULL printer accordingly.
     191
     192
     193== Additional Remarks ==
     194
     195(''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.)
     196
     197== Original Note ==
     198
     199The original posting from Dmitry Froloff follows.  This is mainly for historical interest now.
     200
     201===== List of newly supported Epson printers: =====
     202
     203epl2050 epl2050p epl2120 epl2500 epl2750 epl5800 epl5900 epl6100 epl6200 lp1800 lp1900 lp2200 lp2400 lp2500 lp7500 lp7700 lp7900 lp8100 lp8300f lp8400f lp8600 lp8600f lp8700 lp8900 lp9000b lp9100 lp9200b lp9300 lp9400 lp9600 lp9600s alc1900 alc2000 alc4000 alc4100 alc8500 alc8600 alc9100 lp3000c lp8000c lp8200c lp8300c lp8500c lp8800c lp9000c lp9200c lp9500c lp9800c
     204
     205Why I made this build.
     206
     207Our company bought Epson AcuLaser C1900 color printer. This model is capable to work PCL5 mode but in B/W mode only and doesn't understand poscript., while I wish to print in color too. So I look for solution and found out that Epson sources are GPL now and exist as GS patch.
     208
     209So I downloaded the latest GS (8.53 at the moment) and the latest Epson GS patch ghostscript-7.07.tar.bz2. I applied the patch (patched sources GS doesn't changed too much from 7.07 to 8.53 version) and built the modules with gcc 3.3.5, what mean that you need lib06 dll (you may take it here ). I also made some minor changes in main GS code to finish new printer support with OS/2 printing subsystem.
     210
     211If You wish to print from GSView You'll need to need to make some changes in gsview printer.ini file. I'm not familar with it's grammar, so for my printer I simply add line in [Devices] section:
     212
     213alc1900=1200x1200,600x600,300x300
     214
     215I also create a new printer object with IBM NULL printer driver. May be there is no need to do this as GS send data to printer queue in raw mode? Now I'm capable to print pdf and ps files from GSView. To finish printer support to other OS/2 application I installed fake printer object which generate ps file. Now I print to this fake printer and it generate ps file. After that I simply print this ps file from GSView.
     216This may be automated as well, as I'm at the beginning of the whole way
     217
     218Unfortunatelly, I didn't find the universal solution for all aplication. For example, I use ScenicSoft postscript color printer driver (imported with PPD file) in 2400 resolution for printing from OpenOffice and Xerox 4900 postscript printer driver for printing from Mozilla (works fine only in 300dpi mode :\ )
     219
     220What's the next?
     221
     222I can add the same way most of HP printers support. It operate slightly different - via separate application named ijs server. I already built the server itself, so everything depend on your backward requests :)
     223
     224--
     225Best regards.
     226Dmitry.
     227