selecting pages from PostScript

Bertrand Decouty decouty at irisa.fr
Fri Jan 18 01:08:03 AEST 1991


In article <1991Jan17.082652.24288 at msuinfo.cl.msu.edu> raja at cpswh.cps.msu.edu writes:
| 
| In article <1091 at ecicrl.UUCP>, (Chris Lewis) writes:
| < In article <1991Jan12.194650.25292 at starnet> (Mark Zellers) writes:
| < >In article <1991Jan10.171621 at madmax> (Kenstir) writes:
| 
| < >>Is it possible for a filter to select only certain pages
| < >>from a PostScript document?  I have a huge document
| < >>(thanks, OSF/Motif) which I need to print in small chunks
| < >>so as not to offend the community at large by hogging
| < >>the printer.
| < 
[......]
| 
| 
| In fact, if you have the `Transcript' filters
| (which you probably do), you can do it quite 
| simply using psrev:
| 
|   "psrev -s 23,65-69,81 file.ps | lpr"
| 
| will print pages 23,65-69, and 81 on your
| default printer.  Check the psrev man page.
[....]
| 
| 
| Narayan Sriranga Raja.


I think you are speaking about printing motif manual ps document. We have
been faced recently to the same trouble. It is a huge file (around 15
MBytes), made with (di?)troff and so no epsf (begins with %! only). More,
it includes a lot of figures, each figure being an included epsf file with
%%Page: comment.

I have tried psrev (several versions from Transcript). No one worked because
of figures.

So i suggest you the following method, which uses sed (remember it is a 15
MB file...):
1- first locate the prologue
sed -e "1,/%%EndProlog/w prolog.ps" manual.ps >/dev/null
(from memory, in fact manual.ps is all.ps)

2- then prints selected pages:
sed -e "/Page: label 70/,/Page: label 75/w tmp" manual.ps >/dev/null
cat prolog.ps tmp |lpr
(and you print pages 70 to 75)

Notes: 
- prolog.ps MUST begin with %!
- as sed reads each time the whole file, it is rather long, but...
- do not try this method for pages <=46 because there is a page # 460!
- print few pages together because due to figures, some pages are huge:
e.g.: pages 5-11 to 5-14 are 900 KB long.
- if somebody has a better method, tell us!

Flame: IMHO, it is a shame a company like OSF can't produce a real ps file
using decent products. At least, they could have cut their man into several
parts. Don't forget many people print on laserwriter at 9600 bauds! Time to
download 15 megabytes??

Disclaimer: i speak for myself

Bertrand Decouty.

-- 
[ Bertrand DECOUTY             | EMAIL : decouty at irisa.fr, decouty at irisa.uucp  ]
[ IRISA - INRIA (Atelier)      |         {uunet,mcsun,inria}!irisa!decouty     ]
[ Campus de Beaulieu           | PHONE : +33  99 36 20 00                      ]
[ F-35042 Rennes Cedex - FRANCE| FAX : +33  99 38 38 32 | TELEX: 950473 UNIRISA]



More information about the Comp.unix.questions mailing list