[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
groff-1.19: setpagedevice prevents printing
From: |
Nelson H. F. Beebe |
Subject: |
groff-1.19: setpagedevice prevents printing |
Date: |
Tue, 6 May 2003 09:16:46 -0600 (MDT) |
Groff Bug Report
GROFF VERSION:
1.19
MACHINE:
Sun Ultra Enterprise 5500 (4 CPUs)
[or any other platform]
OS:
Solaris 2.8
[or any other system]
COMPILER:
c89 [Sun WorkShop 6 update 2 C 5.3 Patch 111679-09 2002/11/12]
[or any other compiler]
INPUT FILES:
none
COMMAND LINE:
groff -man /usr/man/man1/ls.1
DESCRIPTION OF INCORRECT BEHAVIOUR:
groff-1.19 added a setpagedevice command to its output via
code in the file src/devices/grops/ps.cpp; setpagedevice was
not used in earlier versions. That command appears in the
output PostScript as
<< /PageSize [ 595 842 ] /ImagingBBox null >> setpagedevice
preventing printing on at least HP LaserJet 4M and Lexmark
Optra/S laser printers. No printed output was produced on
either of them: the print job was just silently swallowed.
When I selected the "Print PS Error:On" setting on the Lexmark
printer control panel, it printed a page with
ERROR: configurationerror
OFFENDING COMMAND: setpagedevice
EERRORINFO: Key = --nostringval-- Value = --nostringval--
STACK:
dicttype
The [ 595 842 ] settings corresponds to ISO A4 format (210mm x
297mm). Even if this command had worked, it would likely have
caused the printer to pause awaiting insertion of A4 format
paper, which is virtually unknown, and unobtainable, in the
USA.
As an experiment, I replaced those A4-format settings with US
A-format settings: 612 792. The file then printed correctly
on both printers.
SUGGESTED FIX:
Remove the code in src/devices/grops/ps.cpp that outputs
setpagedevice. That command is anyway forbidden in
Encapsulated PostScript.
COMMENTS:
I have previously needed to include groff output as figures
in other documents, including ones set by groff and by TeX.
In both cases, it took substantial work to massage the
groff-produced PostScript to get it to work correctly as an
inserted figure.
The problem is that groff produces operators which modify the
underlying page transformations, interfering with attempts to
scale, translate, and rotate the image at the current point by
the inserting application.
For example, try this:
% groff -man /usr/man/man1/ls.1 > ls.eps
% cat ls.tex
\input epsf.sty
\def \PSfig #1#2{\centerline{\epsfsize=#2\hsize\epsffile{#1}}}
\PSfig{ls.eps}{0.10}
\PSfig{ls.eps}{0.20}
\PSfig{ls.eps}{0.30}
\PSfig{ls.eps}{0.40}
\PSfig{ls.eps}{0.50}
\bye
% tex ls.tex
% dvips ls.dvi
% gs ls.ps
The ls.eps figures overwrite one another, instead of being
properly scaled.
Part of the problem is a lack of a proper %%BoundingBox
comment in the groff output: that is where the default
page dimensions should appear.
I added
%%BoundingBox: 0 0 612 792
to ls.eps, and reran tex, dvips, and gs. The output is better
positioned, since TeX now gets the correct bounding box, but
text still overwrites text very badly.
It would be very nice if groff could be changed to produce
output that can be used as Encapsulated PostScript figures.
Here's a small script that I wrote several years ago to scan
PostScript files for the operators forbidden in Encapsulated
PostScript:
% cat ~/bin/FIND-BAD-POSTSCRIPT
#!/bin/sh
# Find forbidden PostScript operators in the files specified
# on stdin.
# [21-May-1999] -- update with extended list for PostScript Level 3,
# from pp. 802--803 of the PostScript Language
Reference
# Manual, 3rd edition, 1999.
# [29-Jun-1996] -- update to show matching bad operator
# [23-Oct-1992]
# Level 2 list (19 operators):
#
/banddevice|grestoreall|nulldevice|setpageparams|copypage|initclip|quit|setsccbatch|erasepage|initgraphics|renderbands|setscreen|exitserver|initmatrix|setdevice|settransfer|framedevice|note|setmatrix/
# Level 3 list (36 operators):
nawk '
/^%/ {next}
match($0,/[^A-Za-z](banddevice|clear|cleardictstack|copypage|erasepage|executive|exitserver|framedevice|grestoreall|initclip|initgraphics|initmatrix|nulldevice|quit|renderbands|setblackgeneration|setcolorrendering|setcolorscreen|setcolortransfer|setflat|setglobal|setgstate|sethalftone|setmatrix|setoverprint|setpagedevice|setscreen|setshared|setsmoothness|settransfer|setundercolorremoval|startjob|statusdict|undefinefont|undefineresource|userdict)[^A-Za-z]/)
{
print FILENAME ":" NR ": " $0 ": [" substr($0,RSTART,RLENGTH)
"] illegal in EPS file"
}' $*
-------------------------------------------------------------------------------
- Nelson H. F. Beebe Tel: +1 801 581 5254 -
- Center for Scientific Computing FAX: +1 801 581 4148 -
- University of Utah Internet e-mail: address@hidden -
- Department of Mathematics, 110 LCB address@hidden address@hidden -
- 155 S 1400 E RM 233 address@hidden -
- Salt Lake City, UT 84112-0090, USA URL: http://www.math.utah.edu/~beebe -
-------------------------------------------------------------------------------
- groff-1.19: setpagedevice prevents printing,
Nelson H. F. Beebe <=