ps.map, hp650c's and paper wasting

Chris Rewerts rewerts at diego.cecer.army.mil
Thu Oct 5 19:07:57 EDT 1995


>>From: seel at theos.com (Kevin Seel)
>>Newsgroups: info.grass.user
>>Subject: ps.map, hp650c's and paper wasting
>>Date: 5 Oct 95 19:33:09 GMT
>>Reply-To: grassu-list at max.cecer.army.mil
>
>When I send a postscript plot to our hp650c using ps.map, the printer
>happily scrolls our 6 feet or so of expensive paper before it decides
>to print something.  Does anybody have an idea why it does this, and
>how I can get around it?
>
>/////\\\\\/////\\\\\
>Kevin Seel
>Golder Associates Ltd.
>Calgary, AB, Canada
>seel at theos.com
>

Kevin:

It could be your plotter has 'scrolliosis', which sometimes happens in
northern climes.

Assuming all else is set up correctly, including, but not limited to:
 - the $GISBASE/etc/paint/ps.devices file properly defines the size to
   be plotted
 - the HP650c is expecting postscript
 - the HP650c is set to print 'inked area' (although this is not a hard rule)
 - the ps.map script didn't have some obvious flaw
 - the current GRASS region set was reasonable at the time of the running
   of ps.map

Then you may still get the excess paper scrolling.

I have been able reduce the symptoms of this problem with the help of
a script created by someone who will be un-named but appreciated. 
(as a matter of fact, he may have uploaded a form of this script
to the moon several months ago...). The script is kind of a nasty 
work-around (see notes, below), but seems to work.

It goes something like this:

#################################################################
#!/bin/sh
# usage $0 plot.ps
# where plot.ps is name of ps.map output (postscript) file 
 
if [ ! "$GISRC" ] 
   then
   echo ""
   echo "You need to be running grass to use this shellscript"
   echo ""
   exit
fi

if [ ! -f $1 ]
then
    echo 
    echo $0: Input file not found  <$1> 
    echo 
    echo usage: $0 plot.ps  (where plot.ps is name of ps.map output)
    exit
fi

# Read currently selected ps.map configuration file to determine
# plot width and height in pixels.  

CONFIG=$GISBASE/etc/paint/ps.devices/`ps.select -p`
 
if [ -s $CONFIG ]
  then
   WIDTH=` awk ' /page width:/ { printf "%s\n", $3 * 72 + 200 }' $CONFIG `
   HEIGHT=` awk ' /page height:/ { printf "%s\n", $3 * 72 + 200 }' $CONFIG `
else
  echo
  echo problem: $CONFIG
fi 

# add magic line

  TMP_PS_FILE=/tmp/$1
  mv $1 $TMP_PS_FILE
  head -4 $TMP_PS_FILE > $1
  echo \<\</PageSize [$WIDTH $HEIGHT]\>\> setpagedevice >> $1
  tail +5 $TMP_PS_FILE >>  $1
  rm $TMP_PS_FILE

exit
#################################################################

Notes: 

1. all that is being done is to add a line like this:

<</PageSize [1856 2288]>> setpagedevice

as the fifth line of the postscript file.

2. one thing I have not been able to figure out how to script is
to change the postscript file without having to make a copy of it.
If disk resources are low, and the file is big, copying a multi-meg file
to /tmp and then back can pop some seams. any wizard help out there?

one could just change the script into a filter program that adds the
line in stream mode and just pipes to lpr or the /dev/ printer port, but...

3. I use openwin's pageview to preview output before sending to plot.
pageview doesn't like the postscript after the magic line is added.

4. added bonus: the magic line (setpagedevice) will cause the plot to
rotate 90 degrees, if it is longer than wide, and it will fit rotated
on the plotter; thus saving even more paper.

5. one side effect I have noticed is that after doing the plot and 
cutting the paper, the potter then scrolls out a couple cm's of 
paper and cuts it off. these make dandy ribbons.

6. and you may be thinking it would be easier to add this line to the
ps.map code and be done with it. I thought that too, but didn't know
how it would effect other situations that are otherwise working well,
(but that is not saying you can hack up your own code).


Lastly (and this is the good news) much better cartographic output
programs are under development as part of the GRASS 5.0 plot.


Chris (rewerts at diego.cecer.army.mil)



More information about the grass-user mailing list