🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.postscript
Article #1227

Re: How do you count the number of pages in a postscript document?

#1227
From: Jingbai Wang
Date: Mon, 23 Oct 1989 17:19
47 lines
3007 bytes
In article <1517@tukki.jyu.fi> sakkinen@jytko.jyu.fi (Markku Sakkinen) SAKKINEN@FINJYU.bitnet (alternative) writes:
>In article <1955@cunixc.cc.columbia.edu> seth@cunixc.cc.columbia.edu (Seth Strumph) writes:
>>
>>does anyone have (or know of) a program that will count the number of
>>printed pages that an arbitrary postscript file (including those
>                       ^^^^^^^^^
>>created on a macintosh) will generate?
>
>Theoretically impossible!
>Since PostScript is a "Turing-equivalent" language (i.e. a full-powered
>programming language), even the termination of an _arbitrary_ PS programme
>(file) is undecidable.
>The only way to find out is a rather complete emulator or interpreter.
>And you still have problems with possibly nonterminating programmes.
>
>However, PostScript code generated by text processors and similar
>application software should be very well-behaving.
>Indeed, if it conforms to the structuring conventions recommended
>by Adobe, such things as the number of pages are given in special
>comments at the beginning or end of the file.

I think the Q-A is starting to make sense. Since the question is not that
clear, and hence the answers can be rather random. I even saw a piece
of PS code that was claimed to be able to count number of pages. In that
event, you only need to print the PS file, and hence the is no any doubt
how many pages it contains.

I wrote a program called PSScribe (Post-Scribe) that sorts enables you to
count number of pages in a Scribe-generated PostScript file, pull out
certain pages, divide it into even and odd pages, divide it into a few files,
or merge a few files together. However, it is based on the fact that
Scribe PostScript file follows Adobe convention the best (as good as
Adobe illutstrator), but it can also make mistakes, because you can
include a PostScript file that has all the
%%Page
and other comments, since showpage was nulled in the inclusion shell.
I enhanced a version of TeX dvi2ps that also generates reasonably good
Adobe PostScript, but I would still hesitate to use PSScribe on it, because
the bitmap font definitions do not all stay in the Prologue, and neither
in individual pages. They are like blocked global variables in a C code,
rather difficult to figure out which fonts or characters are already defined
before a certain page. 


JB Wang
jbw@pittvms.bitnet
jbw@cisunx.UUCP
Technical Details
Message-ID: <20168@unix.cis.pitt.edu>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!pt.cs.cmu.edu!cadre.dsl.pitt.edu!pitt!unix.cis.pitt.edu!jbw
References: <1955@cunixc.cc.columbia.edu> <1517@tukki.jyu.fi>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!pt.cs.cmu.edu!cadre.dsl.pitt.edu!pitt!unix.cis.pitt.edu!jbw
From: jbw@unix.cis.pitt.edu (Jingbai  Wang)
Newsgroups: comp.lang.postscript
Subject: Re: How do you count the number of pages in a postscript document?
Message-ID: <20168@unix.cis.pitt.edu>
Date: 23 Oct 89 17:19:46 GMT
References: <1955@cunixc.cc.columbia.edu> <1517@tukki.jyu.fi>
Reply-To: jbw@unix.cis.pitt.edu (Jingbai  Wang)
Organization: Univ. of Pittsburgh, Comp & Info Services
Lines: 47