[GRASS-dev] Re: [GRASS-user] need help with mac os x installation

I did some experimentation with the lpr part of mapprint.tcl tonight. I'm
thinking that maybe I've done this before and come up with the same
result--and that is why I turned to ghostscript.

TclTk will output to a PS file that looks just fine when I open it.

However, just sending this to lpr (>>lpr file.ps) gives a very poor result.
The map is up against the upper right edges of the page, rather than being
centered. It is clipped on all edges but the bottom and clipped a
significant amount on the left side of the map (a side which is NOT against
the edge of a page).

Is there something I'm missing in sending this to lpr?

Michael

On 9/4/07 3:06 AM, "Glynn Clements" <glynn@gclements.plus.com> wrote:

William Kyngesburye wrote:

Yea. TclTk (at least the packages we use) doesn't have any good built in
printing routines. I wrote one that is included in the GUI, but it needs
ghostscript to translate from the native postscript of the canvas
into print output.

On Unix, "print output" traditionally *is* PostScript.

The backbone of most Unix printing setups is the use of Ghostscript to
make your printer look like a PostScript printer. If you happen to
have an actual PostScript printer, the Ghostscript step is omitted.

There's no need for gis.m to invoke Ghostscript itself when printing;
it can just feed PostScript to "lpr" (with CUPS, you can feed a lot of
other formats, but PostScript is the one format which is likely to be
accepted on non-CUPS systems).

Moreover, using gs to render to an image format then sending the image
to lpr will invariably produce worse results than letting the printing
system perform the rendering (or sending the data directly to a
PostScript printer).

I got to thinking about the GS license (it's GPL now) and I'll either
have to make it a separate download or find an existing Mac binary,
or maybe use an older AFPL GS. Maybe there's an equivalent in the
system somewhere - it already uses CUPS for printing, maybe there's a
CLI postscript renderer...

"lpr file.ps" should work.

Is your GUI printing use of GS the only thing in GRASS that uses it?
Does it generate an image, or print-ready postscript?

Looking at mapprint.tcl, it either:

1. Generates an image and sends it to "lpr". (CUPS will first convert
this to PostScript, then either invoke Ghostscript to convert it to
the printer's raw image format or send it directly to a PostScript
printer).

2. Invokes gs with DEVICE set to a user-defined string. [This one
looks wrong; it doesn't appear to send the output anywhere.]

3. Generate a PDF.

__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

On Sep 5, 2007, at 1:17 AM, Michael Barton wrote:

I did some experimentation with the lpr part of mapprint.tcl tonight. I'm
thinking that maybe I've done this before and come up with the same
result--and that is why I turned to ghostscript.

TclTk will output to a PS file that looks just fine when I open it.

However, just sending this to lpr (>>lpr file.ps) gives a very poor result.
The map is up against the upper right edges of the page, rather than being
centered. It is clipped on all edges but the bottom and clipped a
significant amount on the left side of the map (a side which is NOT against
the edge of a page).

Is there something I'm missing in sending this to lpr?

Michael

What about job options? The CUPS manual has better documentation than the lpr man page. Check http://localhost:631/documentation.html.

A mismatch of the document orientation and the job orientation can cause odd clipping. And default position is probably upper-left, but again orientation can cause trouble, rotation said upper left to another corner.

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

"We are at war with them. Neither in hatred nor revenge and with no particular pleasure I shall kill every ___ I can until the war is over. That is my duty."

"Don't you even hate 'em?"

"What good would it do if I did? If all the many millions of people of the allied nations devoted an entire year exclusively to hating the ____ it wouldn't kill one ___ nor shorten the war one day."

<Ha, ha> "And it might give 'em all stomach ulcers."

- Tarzan, on war

The options described in the CUPS docs may be what I need. Thanks.

Michael

On 9/5/07 7:14 AM, "William Kyngesburye" <woklist@kyngchaos.com> wrote:

On Sep 5, 2007, at 1:17 AM, Michael Barton wrote:

I did some experimentation with the lpr part of mapprint.tcl
tonight. I'm
thinking that maybe I've done this before and come up with the same
result--and that is why I turned to ghostscript.

TclTk will output to a PS file that looks just fine when I open it.

However, just sending this to lpr (>>lpr file.ps) gives a very poor
result.
The map is up against the upper right edges of the page, rather
than being
centered. It is clipped on all edges but the bottom and clipped a
significant amount on the left side of the map (a side which is NOT
against
the edge of a page).

Is there something I'm missing in sending this to lpr?

Michael

What about job options? The CUPS manual has better documentation
than the lpr man page. Check http://localhost:631/documentation.html.

A mismatch of the document orientation and the job orientation can
cause odd clipping. And default position is probably upper-left, but
again orientation can cause trouble, rotation said upper left to
another corner.

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

"We are at war with them. Neither in hatred nor revenge and with no
particular pleasure I shall kill every ___ I can until the war is
over. That is my duty."

"Don't you even hate 'em?"

"What good would it do if I did? If all the many millions of people
of the allied nations devoted an entire year exclusively to hating
the ____ it wouldn't kill one ___ nor shorten the war one day."

<Ha, ha> "And it might give 'em all stomach ulcers."

- Tarzan, on war

__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

Michael Barton wrote:

I did some experimentation with the lpr part of mapprint.tcl tonight. I'm
thinking that maybe I've done this before and come up with the same
result--and that is why I turned to ghostscript.

TclTk will output to a PS file that looks just fine when I open it.

However, just sending this to lpr (>>lpr file.ps) gives a very poor result.
The map is up against the upper right edges of the page, rather than being
centered. It is clipped on all edges but the bottom and clipped a
significant amount on the left side of the map (a side which is NOT against
the edge of a page).

Is there something I'm missing in sending this to lpr?

When you say that it "looks just fine when I open it", are you looking
at it as a page, or as EPS? Viewers such as GV typically show EPS
files (which is what Tk's canvas generates) cropped to the bounding
box, with no notion of a page.

Also, it's possible that there's something wrong with your printer
setup. Have you tried printing PostScript generated by other
applications?

--
Glynn Clements <glynn@gclements.plus.com>