Thread View: comp.lang.postscript
5 messages
5 total messages
Started by Vamsee Lakamsani
Tue, 22 Dec 1992 16:27
printing a range of pages from a postscript file
Author: Vamsee Lakamsani
Date: Tue, 22 Dec 1992 16:27
Date: Tue, 22 Dec 1992 16:27
7 lines
841 bytes
841 bytes
I have an 80 page postscript document and I need only pages 50-60,75, 78 and 80 (this is just a silly example). Is there someway that I can tell the printer to print only these pages? The printer is an Apple LaserWriter 2. We use "/usr/bin/lp". Is there some software for extracting only these pages from the document ? I have used "dviselect" for this on a "dvi" file. Vamsee
Re: printing a range of pages from a postscript file
Author: peter da silva
Date: Wed, 23 Dec 1992 00:48
Date: Wed, 23 Dec 1992 00:48
28 lines
1466 bytes
1466 bytes
In article <1h7flvINNjc1@tamsun.tamu.edu> vamsee@abgen.tamu.edu (Vamsee Lakamsani) writes:
> I have an 80 page postscript document and I need only pages 50-60,75,
> 78 and 80 (this is just a silly example). Is there someway that I can tell
> the printer to print only these pages?
Something like:
awk 'BEGIN { printing=1 }
/^%%EndSetup/ { print; printing=0 }
/^%%Trailer/ { printing=1 }
/^%%Page: 50 / { printing=1 }
/^%%Page: 60 / { lastpage=1 }
/^%%Page: 75 / { printing=1; lastpage=1 }
/^%%Page: 78 / { printing=1; lastpage=1 }
/^%%Page: 85 / { printing=1; lastpage=1 }
/^%%Page/ { if(lastpage) printing=0 }
printing==1 { print }' documents | lp
> The printer is an Apple LaserWriter 2.
> We use "/usr/bin/lp". Is there some software for extracting only these
> pages from the document ?
Yes. It basically does the operation listed above.
--
Peter da Silva `-_-'
Ferranti International Controls Corporation 'U`
Sugar Land, TX 77487-5012 USA
+1 713 274 5180 "Zure otsoa besarkatu al duzu gaur?"
Re: printing a range of pages from a postscript file
Author: Chris Lilley
Date: Wed, 23 Dec 1992 04:07
Date: Wed, 23 Dec 1992 04:07
24 lines
1698 bytes
1698 bytes
In article <1h7flvINNjc1@tamsun.tamu.edu> vamsee@abgen.tamu.edu (Vamsee Lakamsani) writes: >I have an 80 page postscript document and I need only pages 50-60,75, >78 and 80 (this is just a silly example). Is there someway that I can tell >the printer to print only these pages? The printer is an Apple LaserWriter 2. >We use "/usr/bin/lp". Is there some software for extracting only these >pages from the document ? I have used "dviselect" for this on a "dvi" file. You don't state your platform. However, we use Ghostview for this - you pick the page numbers from a list and it extracts them to a file, taking into account the prologs and so on. The PostScript must be DSC compliant. We run it on workstations running VMS and various Unixes (Unixi?) but it may well be available for DOS, OS/2, Macs etc. -- Chris Lilley --------------------------------------------------------------------------- Technical Author, ITTI Computer Graphics and Visualisation Training Project Computer Graphics Unit, Manchester Computing Centre, Manchester, UK Internet: lilley@cgu.mcc.ac.uk Janet: lilley@uk.ac.mcc.cgu Voice: +44 (0)61 275 6095 Fax: +44 (0)61 275 6040 ---------------------------------------------------------------------------
Re: printing a range of pages from a postscript file
Author: Chris Lilley
Date: Wed, 23 Dec 1992 04:10
Date: Wed, 23 Dec 1992 04:10
18 lines
1148 bytes
1148 bytes
Regarding my last posting: I wrote "you don't state your platform" In article <1h7flvINNjc1@tamsun.tamu.edu> vamsee@abgen.tamu.edu (Vamsee Lakamsani) writes: >We use "/usr/bin/lp". I might have drawn an inference from that if I read it slower before posting ;-( -- Chris Lilley --------------------------------------------------------------------------- Technical Author, ITTI Computer Graphics and Visualisation Training Project Computer Graphics Unit, Manchester Computing Centre, Manchester, UK Internet: lilley@cgu.mcc.ac.uk Janet: lilley@uk.ac.mcc.cgu Voice: +44 (0)61 275 6095 Fax: +44 (0)61 275 6040 ---------------------------------------------------------------------------
Re: printing a range of pages from a postscript file
Author: Conrad Kimball
Date: Thu, 31 Dec 1992 08:27
Date: Thu, 31 Dec 1992 08:27
124 lines
3927 bytes
3927 bytes
In article <1h7flvINNjc1@tamsun.tamu.edu> vamsee@abgen.tamu.edu (Vamsee Lakamsani) writes:
> I have an 80 page postscript document and I need only pages 50-60,75,
> 78 and 80 (this is just a silly example). Is there someway that I can tell
> the printer to print only these pages?
>
> The printer is an Apple LaserWriter 2.
> We use "/usr/bin/lp". Is there some software for extracting only these
> pages from the document ?
I use the following script that I got off the net some time ago.
--------------
#!/bin/sh
# Extracts a range of pages from a PostScript file, writing
# output to standard out.
#
# Synopsis:
#
# pssplit file first_page [ last_page ]
#
# If last_page is omitted, extracts from first_page to the end.
# To extract one page, make last_page the same as first_page.
if test $# -gt 2; then
LAST=`expr $3 + 1`
else
LAST=0
fi
sed -n -e "#
# first loop to copy all lines of the prolog
#
:prolog
1,/^%%EndProlog/{p
n
b prolog
}
# end of the prolog - now skip lines until we find the first
# page of the target range or a trailer. if we encounter any
# included images we skip them entirely, without checking
# their contents
:first
/^%BeginIncludedImage/b includ1
/^%%Page: [^ ][^ ]* $2\$/b pages
/^%%Trailer/b trailr1
n
b first
# found an included image - skip until end of included image,
# then rejoin ordinary skip loop (above)
:includ1
/^%EndIncludedImage/b first
n
b includ1
# found a trailer - loop to save lines in hold space until:
#
# 1. a new page (go back to "first" to skip more lines),
# 2. a "%!" line (go back to "first" to skip more lines),
# 3. end of file (print saved trailer).
:trailr1
/^%%Page: /b first
/^%\!/b first
H
/^%%Trailer/h
\${g
p
}
n
b trailr1
# found start of the target page range - copy lines until we
# find the end of the target page range
:pages
/^%%Page: [^ ][^ ]* $LAST\$/b skip
p
n
b pages
# found end of the target page range - skip lines until we
# find the start of the trailer. if we encounter any
# included images we skip them entirely, without checking
# their contents
:skip
/^%BeginIncludedImage/b includ1
/^%%Trailer/b trailr2
n
b skip
# found an included image - skip until end of included image,
# then rejoin ordinary skip loop (above)
:includ2
/^%EndIncludedImage/b skip
n
b includ2
# found a trailer - loop to save lines in hold space until:
#
# 1. a new page (go back to "skip" to skip more lines),
# 2. a "%!" line (go back to "skip" to skip more lines),
# 3. end of file (print saved trailer).
:trailr2
/^%%Page: /b skip
/^%\!/b skip
H
/^%%Trailer/h
\${g
p
}
n
b trailr2" $1
--
--
Conrad Kimball | Client Server Tech Services, Boeing Computer Services
cek@sdc.boeing.com | P.O. Box 24346, MS 7A-35
(206) 865-6410 | Seattle, WA 98124-0346
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads