wiki:GhostScriptRasterPrinting

Version 2 (modified by Alex Taylor, 14 years ago) (diff)

Add description of using UNIPDR

List of newly supported Epson printers:

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

Why I made this build.

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.

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.

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:

alc1900=1200x1200,600x600,300x300

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. This may be automated as well, as I'm at the beginning of the whole way

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 :\ )

What's the next?

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 :)

-- Best regards. Dmitry.

Additional Remarks

The additional Epson printers listed above are now (as of version 9.00) included in Paul Smedley's distribution of GhostScript?.

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 UniPdr universal port driver:

  • Install UNI.PDR (to \OS2\DLL)
  • Create a new port of type UNI.
  • 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.

I've used the following script to print to a TCP/IP (LPD) printer on the network:

/* GS2LPR.CMD - print to a TCP/IP printer through GhostScript, using LPR.
 * The top-level GhostScript directory should be set in the environment
 * variable GHOSTSCRIPT (or just edit the path directly in the file, below).
 * Syntax: GS2LPR <model> <LPD server> <LPD printer> %file%
 */
PARSE ARG model server printer jobfile
IF jobfile == '' THEN RETURN 1

logdir = VALUE('LOGFILES',,'OS2ENVIRONMENT')
tmpdir = VALUE('TMP',,'OS2ENVIRONMENT')
gspath = VALUE('GHOSTSCRIPT',,'OS2ENVIRONMENT')
IF gspath == '' THEN gspath = 'f:\gs\gs9.00'

IF logdir == '' THEN logdir = tmpdir
logfile = logdir'\gs2lpr.log'
tmpfile = SysTempFileName( tmpdir'\GS_?????.TMP', '?')

gscmd  = gspath'\bin\gsos2.exe -sDEVICE='model '-dBATCH -dNOPAUSE -sOUTPUTFILE='tmpfile' -q' jobfile
lprcmd = 'lpr.exe -a 0 -b -s' server '-p' printer tmpfile

'@echo off'
IF STREAM( logfile, 'C', 'QUERY EXISTS') <> '' THEN CALL SysFileDelete logfile
CALL LINEOUT logfile, 'Running GhostScript with command line' gscmd
CALL LINEOUT logfile
ADDRESS CMD gscmd '2>&1 >>'logfile
CALL LINEOUT logfile, 'Return code:' rc
CALL LINEOUT logfile, ''

CALL LINEOUT logfile, 'Printing job with command line' lprcmd
CALL LINEOUT logfile
ADDRESS CMD lprcmd '2>&1 >>' logfile
CALL LINEOUT logfile, 'Return code:' rc
CALL LINEOUT logfile, ''

CALL SysFileDelete tmpfile

RETURN 0

Using the above, the following UniLpr settings will allow printing to a networked LP-9400 printer with TCP/IP address 192.168.1.100:

  • Path and file: cmd.exe
  • Parameters: /c c:\os2\gs2lpr.cmd lp9400 192.168.1.100 * %file%

You could presumably print to a Samba printer by using smbspool instead of lpr.

(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.)

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.

-- Added by Alex Taylor

Attachments (3)

  • gs2port.cmd (1.0 KB) - added by Alex Taylor 12 years ago. REXX wrapper for printing to a local port (USB/parallel/etc) with Ghostscript as an inline print processor
  • gs2lpr.cmd (1.1 KB) - added by Alex Taylor 12 years ago. REXX wrapper for printing to a TCP/IP (LPR) printer, using Ghostscript as an inline print processor
  • eprint_05.zip (28.6 KB) - added by Alex Taylor 12 years ago. EPRINT command-line utility, required by GS2PORT.CMD

Download all attachments as: .zip