Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!chinacat!woody From: woody@chinacat.unicom.com (Woody Baker @ Eagle Signal) Newsgroups: comp.lang.postscript Subject: Re: "Take out" a postion of a PS file? Keywords: Postscript Message-ID: <1991Jun2.051004.11517@chinacat.unicom.com> Date: 2 Jun 91 05:10:04 GMT References: <.675678144@dutepp1> Organization: a guest of Unicom Systems Development, Austin Lines: 36 In article <.675678144@dutepp1> luo@dutepp1.et.tudelft.nl (Jian Luo) writes: > >Somebody has developed such a utility? For example, this should work like: >ps2ps -f5 -t10 input.file, output.file >which will put the pages 5 to 10 to the output file (Postscript too). As has been pointed out numerous times, this is more than just a trivial problem. Since keywords can be redefined, and aliases created for them, it becomes almost impossible to determine where a page ends. The best solution to this problem, is an analysis of the output file, looking through the prolog for the end of page command that it uses. (create a couple of single line pages) and then once you have found that, find the start of the page code the same way. Then write a routine to scan the file, locating the start of page and end of page to isolate each page. be sure and emit the preamble. I recently did this for a company here in town for the INTERLEAF package running on a sun workstation. They needed to take the output from interleaf and create a file stream that had the pages rearranged such that they would print 2 up on both sides of a sheet (using a KODAK high speed PS printer) such that when the pages were collated, and staped they would create a neat booklet. It took about 16 hours of hacking and work to get it perfect, but it surely works fine for them. The code is however, specific to the interleaf software. That is the surest way to accomplish this. A good shell script programmer, using standard unix tools such as grep and awk should be able to create a shell script to do this, again for a specific package. Personally, I have been toying with the idea of making a general routine that would read a data file to retrieve lines of data, and use it to parse out pages. the file would contain the start of preamble line, the end of preamble line, the start of page line and the end of page line. That way one could just create this file, and bingo, you have one of these for any given application package. Cheers Woody p.s. I HAVE NOT written this, and am a tad to busy to do so.