Subject: Re: Page counting
From: [email-masked] (P Savundararaj)
Date: 18 Aug 93 15:30:17
Newsgroups: comp.lang.postscript

On 18 Aug 93 06:50:04 GMT,
[email-masked] (Vidiot) said:

Vidiot> In article <[email-masked]> [email-masked] writes:
Vidiot> <
Vidiot> <Does anyone know of a way to take a postscript file and determine
Vidiot> <how many pages it will be?   Can the Gnu Ghostscript program do this?
Vidiot> <or would it be possible to send the Postscript job to the printer, and
Vidiot> <have the printer NOT print it, but respond with the number of pages
Vidiot> <that would be printed?   Any other possibilities??? Thanks in advance
Vidiot> <for any help.

Vidiot> Your closest possibility will be GhostScript.  But that is a manual operation.
Vidiot> I think someone has something that can be used with GhostScript and have GS
Vidiot> give the page count.

Vidiot> But, a single line piece of PostScript code could result in a different
Vidiot> number of pages being printed with each run.  Yes, this is the extreme,
Vidiot> but it is possible.

Vidiot> As for doing it in the printer, the showpage operator could be redefined to
Vidiot> just could pages.  I never thought of doing that before.  Interesting thought.
Vidiot> -- 
Vidiot>       harvard\                spool.cs.wisc.edu!astroatc!vidiot!brown
Vidiot> Vidiot  ucbvax!uwvax!astroatc!vidiot!brown
Vidiot>       rutgers/  INTERNET:[email-masked]
Vidiot>                          [email-masked]
In article <[email-masked]> [email-masked] (Vidiot) writes:

>

I think there is another way to do this. Get the "psutils" packages by 
Angus Duggan.

On of the utilities in this package "pstops" performs general page  
rearrangement and selection; you can use it to get a page count also - kind 
of crude, but works.

Also it has many other goodies.

Below is the README file for that package:

-------------------- Include file --------------------

PostScript Utilities	        Angus Duggan		        7 June 1993

This shar file contains some utilities for manipulating PostScript documents.
Page selection and rearrangement are supported, including arrangement into
signatures for booklet printing, and page merging for n-up printing.

ENVIRONMENT

These utilities have been compiled and run on Sun-3 and Sun-4 machines under
SunOS 5.1 (Solaris 2.1), 4.1.3, 4.1.2, 4.1.1 and 4.0.1, HP9000/375 machines
under HPUX 7.0 and HPUX 8.0, Sequent Symmetry machines under Dynix 3.1.4
and PTX 3.2.0, IBM RS/6000, VAX/VMS and Decstation 3100 machines under Ultrix
4.0.

FILES

The files contained are:
-rw-r--r--  1 ajcd         1945 Jun  7 15:40 LICENSE
-rw-r--r--  1 ajcd         3367 Jun  7 11:30 Makefile
-rw-r--r--  1 ajcd          432 Jun  7 11:33 Manifest
-rw-r--r--  1 ajcd         6295 Jun  7 15:40 README
-rw-r--r--  1 ajcd         1864 Jun  5 16:31 descrip.mms
-rw-r--r--  1 ajcd         4431 Jun  5 11:05 epsffit.c
-rw-r--r--  1 ajcd         1045 Jun  7 11:01 epsffit.man
-rw-r--r--  1 ajcd          538 Apr  9 22:33 fixfmps.man
-rw-r--r--  1 ajcd          419 Apr  9 17:14 fixfmps.pl
-rw-r--r--  1 ajcd          559 Apr  9 22:35 fixmacps.man
-rw-r--r--  1 ajcd         1751 Jun  7 11:30 fixmacps.pl
-rw-r--r--  1 ajcd          564 Apr  9 22:35 fixpsditps.man
-rw-r--r--  1 ajcd          596 Apr  9 17:15 fixpsditps.pl
-rw-r--r--  1 ajcd          533 Apr  9 22:35 fixpspps.man
-rw-r--r--  1 ajcd         1236 Apr  9 17:15 fixpspps.pl
-rw-r--r--  1 ajcd          551 Apr  9 22:32 fixtpps.man
-rw-r--r--  1 ajcd          602 Apr  9 22:31 fixtpps.pl
-rw-r--r--  1 ajcd          556 Apr  9 22:36 fixwfwps.man
-rw-r--r--  1 ajcd          318 Apr  9 17:15 fixwfwps.pl
-rw-r--r--  1 ajcd          544 Apr  9 22:36 fixwpps.man
-rw-r--r--  1 ajcd          669 May  5 13:54 fixwpps.pl
-rw-r--r--  1 ajcd          542 Apr 22 12:38 fixwwps.man
-rw-r--r--  1 ajcd          364 Apr 22 12:37 fixwwps.pl
-rwxr-xr-x  1 ajcd         6124 Jun  7 15:25 getafm
-rw-r--r--  1 ajcd          702 Jun  7 15:38 getafm.man
-rw-r--r--  1 ajcd        42798 May  6 09:16 md68_0.uue
-rw-r--r--  1 ajcd        48726 May  6 09:16 md71_0.uue
-rw-r--r--  1 ajcd           40 Apr  9 21:03 patchlevel.h
-rw-r--r--  1 ajcd         2155 Jun  4 15:23 psbook.c
-rw-r--r--  1 ajcd         1059 Mar 31 15:33 psbook.man
-rw-r--r--  1 ajcd         6967 Jun  7 10:29 psnup.c
-rw-r--r--  1 ajcd         2578 Jun  7 11:28 psnup.man
-rw-r--r--  1 ajcd         5298 Jun  4 15:24 psselect.c
-rw-r--r--  1 ajcd         1893 Mar 31 15:33 psselect.man
-rw-r--r--  1 ajcd         6682 Jun  5 16:49 psspec.c
-rw-r--r--  1 ajcd          604 Jun  5 13:38 psspec.h
-rw-r--r--  1 ajcd         4215 Jun  5 13:04 pstops.c
-rw-r--r--  1 ajcd         3512 Jun  7 10:43 pstops.man
-rw-r--r--  1 ajcd         8195 Jun  5 16:43 psutil.c
-rw-r--r--  1 ajcd          988 Jun  5 14:48 psutil.h
-rwxr-xr-x  1 ajcd         2552 Feb 10 12:47 showchar

PROGRAMS

psbook          rearranges pages into signatures
psselect        selects pages and page ranges
pstops          performs general page rearrangement and selection
psnup           put multiple pages per physical sheet of paper
epsffit         fits an EPSF file to a given bounding box

psselect in modeled after Chris Torek's dviselect program, and pstops is
modeled after Tom Rokicki's dvidvi program. psbook is modeled on my own
dvibook program, which borrows heavily from Chris Torek's dviselect.

SCRIPTS

getafm   (sh)   outputs PostScript to retrieve AFM file from printer
showchar (sh)   outputs PostScript to draw a character with metric info
fixfmps  (perl) filter to fix framemaker documents so that psselect etc. work
fixmacps (perl) filter to fix Macintosh documents with saner version of md
fixpsditps (perl) filter to fix Transcript psdit documents to work with PSUtils
fixpspps (perl) filter to fix PSPrint PostScript so that psselect etc. work
fixtpps  (perl) filter to fix Troff Tpscript documents
fixwfwps (perl) filter to fix Word for Windows documents for PSUtils
fixwpps  (perl) filter to fix WordPerfect documents for PSUtils
fixwwps  (perl) filter to fix Windows Write documents for PSUtils

INSTALLATION

UUdecode md71_0.uue and md68_0.uue (if supplied encoded), edit Makefile to put
in required paths and CFLAGS (-DSYSV for System V machines, -DMSDOS for
Messy-DOS, -DVMS for VMS), "make", and "make install".

BUGS

The utilities don't check for PS-Adobe-?.? conformance; they assume documents
conform. Utilities need an extra save/restore around whole document on a
SPARCPrinter with NeWSPrint 1.0, because of bugs in the xnews server.

Bug fixes and suggestions to [email-masked]

NOTE

This is an interim release; these utilities are currently being re-written
from scratch, with a full DSC-3.0 parser and more extraction, merging, and
inclusion options included.

ACKNOWLEDGEMENTS

Bug fixes and suggestions for improvements to PSUtils have come from many
people, including:

        Brian Colfer            [email-masked]
        Charles A. Finnell      [email-masked]
        Conrad Kimball          [email-masked]
        J.W.Hawtin              
        Jochen Schwarze         [email-masked]
        Ken Carpenter           [email-masked]
        Kristian Jorg           [email-masked]
        Larry Weissman          [email-masked] 
        Michael L. Brown        [email-masked]
        Hunter Goatley	        [email-masked]
        John Interrante         [email-masked]
        Maurizio Cremonesi      [email-masked]
        Matthew Stier           [email-masked]
        Gerry Pratt             [email-masked]
        Robert Joop             [email-masked]

(Apologies to anyone who I have left out.)

NEWS

Patchlevel 11 contains some significant enhancements to PSUtils, in
preparation for the eventual release of version 2 (don't hold your breath
waiting for it). These include:

* Specify paper sizes by name for pstops and psnup.
* Psnup re-written in C to be much more versatile (do any number n-up).
* Epsffit can input broken %%BoundingBox comments which use real numbers.
* Should work on MSDOS and VMS machines as well as Unix.
* Accept more DSC compliant documents (Page labels are better supported).

-------------------- End include file --------------------
--
***********************************************************************
*  Philip M. Savundararaj          *               e-mail addresses:  *
*  Schlumberger Well Services	   *    [email-masked]  *
*  Houston Products Center         *      [email-masked]  *
*  Interpretation Products         *                   SWS::SAVUNDAR  *
*  5000, Gulf Freeway, 1T          *        America OnLine: philipS3  *
*  Houston, Texas, 77023.          *          CompuServe: 76377,1605  *
*  U.S.A.                          *           Phone: (713) 928-4123  *
***********************************************************************