Shell script and Postscript

Shell script and Postscript

Post by Frederic Vivie » Sat, 14 Mar 1998 04:00:00



Hi there,

I'd like to automate a few tasks, but I do not have a clue on how to do
it:
My problem is to print a bunch a Postcript files, and to have a label
overprinted on each figure. Typically, I have a bunch of figures, and I'd
like to have the figure number written in a corner of the plot.

Printing a bunch of Postscript file is easy:
lp -d my_printer `cat my_list_of_PSfiles`
This is the second part that bugs me:
Ideally, I'd like to have another file with my list of labels to
superimpose on each figure, and run a shell script that would
assign the corresponding label to each PS file and print each figure with
its associated label superimposed in a corner of the sheet.

Any Idea?
Thanks in advance.
Frederic
___________________
~~~ Frederic VIVIER ~~~ Applied Physics Laboratory ~~~ University of ~~
~~~ Washington ~~~ Box 355640 ~~~ 1013 NE 40th Street ~~~ SEATTLE, WA ~
~~~ 98105-6698 ~~~~~~~ tel: (206) 685-7930 ~~~ fax: (206) 543-6785 ~~~~

 
 
 

Shell script and Postscript

Post by John Doher » Sat, 14 Mar 1998 04:00:00


In article

| Printing a bunch of Postscript file is easy:
| lp -d my_printer `cat my_list_of_PSfiles`
|
| Ideally, I'd like to have another file with my list of labels to
| superimpose on each figure, and run a shell script that would
| assign the corresponding label to each PS file and print each figure with
| its associated label superimposed in a corner of the sheet.

That's not as easy as you might think or wish. But here's a start:

For each label, produce a file like this:

  %!
  /Helvetica findfont 10 scalefont setfont
  72 72 moveto % lower-left of the label
  (Your label text here.) show
  %%EOF

A shell script to produce these files from a file with one label
per line should be easy to write.

Then, for each PS file, insert the corresponding label file immediately
after the line that begins "%%Page:". This should also be pretty easy to
do, and if your PS files only print one page, there should be only one
such line. If your PS files print more than one page, this will not work.

If you wanted to get fancy, you could write a script that took the
name of the label file (probably as an option) and a list of PS files
as arguments, and that did the whole thing in one command.

There is no way in which this is anything even remotely like a good
solution, but in simple enough circumstances, there's a decent chance
it will work. Give it a whack if you want, and let me know what happens
if you do.