From: hammer@kis.uni-freiburg.de (Reiner Hammer) Newsgroups: comp.lang.postscript Subject: gs-4.01 and deskjet: bug report and fix Date: 17 Sep 1996 14:36:00 GMT Organization: Kiepenheuer-Institut fuer Sonnenphysik Lines: 86 Message-ID: <51md0g$5nq@n.ruf.uni-freiburg.de> NNTP-Posting-Host: goldie.kis.uni-freiburg.de Summary: deskjet driver does not work for old HP DeskJet printers Keywords: ghostscript, deskjet X-Newsreader: TIN [version 1.2 PL2] Ghostscript version: 4.01 (problem existed already in earlier versions) Where you got Ghostscript: some German mirror (forgot which) Hardware you are using: Sun (various types), HP DeskJet [,Plus, 550C] Operating system you are using: Solaris-2.4, 2.5 (If you compiled Ghostscript yourself) C compiler you are using: gcc-2.5.8 (Use as much space as you need for the remaining items.) Symptoms: driver "deskjet" (intended for printers named "HP DeskJet" and "HP DeskJet Plus", not for newer models) is broken. Print lines are collapsed towards the left boundary. Suggested fix (if any): The following patch fixes the problem: *** gdevdjet.c.cln Tue Sep 17 14:03:38 1996 --- gdevdjet.c Tue Sep 17 15:35:01 1996 *************** *** 429,434 **** --- 429,440 ---- /* End raster graphics, position cursor at top. */ fputs("\033*rB\033*p0x0Y", prn_stream); + + /* DeskJet and DeskJet Plus reset everything upon receiving + \033*rB, so we must reinitialize graphics mode */ + if ( ptype == DJ ) + fputs(init_string, prn_stream); + /* Set resolution. */ fprintf(prn_stream, "\033*t%dR", x_dpi); Other comments: Explanation: the older DeskJets treat \033*rB different from other HP printers; they reset various parameters so that graphics mode must be reinitialized afterwards. Alternative, "external" solution: One could alternatively produce uncompressed (mode 0) output for the old DeskJets, by changing in gdevdjet.c the lines djet_print_page(gx_device_printer *pdev, FILE *prn_stream) { return hpjet_print_page(pdev, prn_stream, DJ, 300, mode_2, "\033&k1W\033*b2M"); into djet_print_page(gx_device_printer *pdev, FILE *prn_stream) { return hpjet_print_page(pdev, prn_stream, DJ, 300, mode_0, "\033*b0M"); since the old DeskJets can well print output generated with driver "laserjet". (Actually, it has been suggested in this newsgroup to use the "laserjet" driver, but this poses two problems: (i) the uncompressed output is huge and takes long to load to the printer; and (ii) the laserjet driver uses page margins inappropriate for DeskJets). The uncompressed output could then be piped through the excellent PCL compression program "pclcomp -d012", which was posted to comp.sources.misc, volume 30, by Tony Parkhurst from HP. It produces about 10% better compression than the deskjet driver from gs-4.01 for the test file "golfer.ps" from the gs examples directory. Incidentally, the pclcomp source code also explains the problem with \033*rB. Incidentally, in a problem report that I posted yesterday I also said that the deskjet driver from gs-4.01 compresses much less efficiently (factor 2) than in the older version gs-2.61 (PL4) that I used before. This was due to the fact that I experimented mainly with "golfer.ps", which uses grey areas that are dithered differently in the newer releases, so that they are less compressible. The difference in output file size disappears for text files. Regards - Reiner -- Dr. R. Hammer Kiepenheuer-Institut fuer Sonnenphysik Schoeneckstr. 6, D-79104 Freiburg, Germany hammer@kis.uni-freiburg.de http://www.kis.uni-freiburg.de/~hammer