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

Re: Postscript Merging & Dial-in PPP Access



On Thu, Oct 14, 1999 at 10:44:12PM -0700, Peter Ludwig wrote
> 
> I'm trying to get a couple of things running for a
> client here.  I need the system to be able to do two
> things :-
> 
> 1) Merge two postcript files.  I'm trying to run a
> small script that converts the text output from
> another program into Postscript, and then merge that
> file with a previously createed postscript file.
> 
> Here's the script segment that does these things :-
> 
> ----------- Begin Script Segment ------------------
> for $source.*
> do
>  cat "$file" | enscript -p/tmp/outfile.ps -R -B
>  cat /u/psback.ps /tmp/outfile.ps | lpr -PHPLaser
> done
> ------------ End Script Segment -------------------
> 
> The HP Laser is a fully postscript capable printer, I
> can print both files seperately, and the files are
> able to merge print on a SCO box, but under linux the
> files seem to not want to merge.
> 
> psback.ps is a background image that is needed
> "behind" every page printed.
> 
> source.* is a collection of single pages (organised
> through another section of the script, quite simple
> really).
> 
> Comments about this will be greatly appreciated.  All
> help useful.
> 

pstops can do this sort of re-arranging (and much more besides),
provided that the pages to be overlaid are in a single file; gs
can be used to merge arbitrary postscript files.  Try something 
like this:

  gs -q -dNOPAUSE -dBATCH -sPAPERSIZE=a4 -sDEVICE=pswrite \
     -sOutputFile=- /u/psback.ps /tmp/outfile.ps | \
  pstops -pa4 '2:0+1' | \
  gs -q -dNOPAUSE -dBATCH -sPAPERSIZE=a4 -sDEVICE=pswrite \
     -sOutputFile=- - | \
  lpr -PHPLaser

The first gs merges the two pages into a single file (file '-'
for output sends postscript to stdout and '-q' stops messages
being sent there too), then pstops places page 1 on top of page
0.  The second gs may not be necessary, but it does *something*
that makes my printer spit out the page; without it I get output
that I can view in gv, but not print using lpr.  Perhaps it just
adds a showpage to the end...

If you wanted to you could make one big merged ps file
containing alternating pages of background and text and then
pipe the lot through pstops, gs and lpr to print it all in one
job (provided you have sufficient space in your print spool
directory).

Note that gs may bulk up the size of your input postscript as it
adds resources, fonts, and general padding that may or may not
be required by your printer.


John P.
-- 
huiac@camtech.net.au
john@huiac.apana.org.au
"Oh - I - you know - my job is to fear everything." - Bill Gates in Denmark


Reply to: