[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

postscript files



    Date: Tue, 18 Dec 90 15:52:23 -0600
    From: pittman@mcc.com

    [...]

    I need to simply make a postscript file.  I could either run my
    (small) program, which outputs to a window, then do a window dump to
    a postscript file, or I could alter my program to direct its output
    to a different stream.  The only I/O operations I do on this stream
    are draw-rectangle, with a :fill option.

The easiest thing to do is something like:

(defmacro with-postscript-file-stream ((stream-var pathname) &body body)
  `(with-open-stream
     (,stream-var (hardcopy:make-hardcopy-stream
		    (hardcopy:get-hardcopy-device '(:file ,pathname :lgp2))))
     ,@body))

as in:

(with-postscript-file-stream (s "alex:>Gadbois>out.ps") 
  (princ "Hello world!" s))

You can also direct the output straight to a print spooler by replacing
the '(:file ,pathname :lgp2) bit above with the name of a printer.

The PostScript stream methods work pretty well for simple stuff, though
it completely garbled fancy output from FORMAT-GRAPH-FROM-ROOT and
FORMATTING-TABLE in 7.2.  I know the former was fixed in 8.0, though the
I haven't tested the latter in the new release.

Also, I have found that specifying a :THICKNESS 0 for lines usually
makes for better-looking output than the default of 1.

--David Gadbois