🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.postscript
7 messages
7 total messages Started by Bo Slaughter Wed, 06 Jan 1993 16:39
number of pages
#6583
Author: Bo Slaughter
Date: Wed, 06 Jan 1993 16:39
20 lines
902 bytes
Hopefully someone can point me in the right direction...

I need a program (piece of code, or whatever) that can read in a
postscript document and print out the number of pages that WOULD 
be printed if it were sent to the printer.

If someone can tell me of the existence of such code, or can tell me 
how I can go about writing the code myself, I would be most
appreciative.

Thanks.

Bo Slaughter
Clemson University
-- 

                                ----
                  Bo Slaughter - Unix Administrator
            Engineering Computer Operations (803)656-2721
Re: number of pages
#6592
Author: Vidiot
Date: Thu, 07 Jan 1993 04:25
18 lines
1260 bytes
In article <1993Jan6.163958.27417@hubcap.clemson.edu> bo@hubcap.clemson.edu (Bo Slaughter) writes:
<
<Hopefully someone can point me in the right direction...
<
<I need a program (piece of code, or whatever) that can read in a
<postscript document and print out the number of pages that WOULD 
<be printed if it were sent to the printer.
<
<If someone can tell me of the existence of such code, or can tell me 
<how I can go about writing the code myself, I would be most
<appreciative.

It's called a PostScript interpreter.  That is the only way of really knowing.
-- 
      harvard\                          spool.cs.wisc.edu!astroatc!vidiot!brown
Vidiot  ucbvax!uwvax..........!astroatc!vidiot!brown
      rutgers/            INTERNET:vidiot!brown%astroatc.UUCP@spool.cs.wisc.edu
                                   brown@wi.extrel.com
Re: number of pages
#6607
Author: EG Keizer
Date: Fri, 08 Jan 1993 08:48
23 lines
1559 bytes
bo@hubcap.clemson.edu (Bo Slaughter) writes:

>I need a program (piece of code, or whatever) that can read in a
>postscript document and print out the number of pages that WOULD 
>be printed if it were sent to the printer.

The only way to get an indication of the number of pages to be printed
is by using another PostScript interpreter. It will never be more then
an indication. There are two reasons for this:
1. Several applications produce printer dependent code. A malicious user
   might prefix his/her PostScript file with code to check whether the
   PostScript is really executed on the printer itself, and if so set
   the #copies to 100. Sending that PostScript to another interpreter
   would result in an indication that is a hundred times too low.
2. If the system administrator happens to be standing next to the printer
   and notices something odd, he/she may abort the print job. This external
   factor may greatly reduce the number of pages printed.

-- 
Ed Keizer					tel: +31 20 548 5777
Faculteit Wiskunde & Informatika		fax: +31 20 642 7705
Vrije Universiteit				e-mail: keie@cs.vu.nl
De Boelelaan 1081A, 1081 HV  Amsterdam, The Netherlands
Re: number of pages
#6617
Author: Martin Cracauer
Date: Fri, 08 Jan 1993 17:28
16 lines
962 bytes
bo@hubcap.clemson.edu (Bo Slaughter) writes:


>Hopefully someone can point me in the right direction...

>I need a program (piece of code, or whatever) that can read in a
>postscript document and print out the number of pages that WOULD 
>be printed if it were sent to the printer.

I an using:

grep "Page: " | wc

-- 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Martin Cracauer <cracauer@wavehh.hanse.de>, WAVEDATA, Norderstedt, Germany
Re: number of pages
#6630
Author: Vidiot
Date: Sun, 10 Jan 1993 17:59
23 lines
1389 bytes
In article <1993Jan8.172822.12211@wavehh.hanse.de> cracauer@wavehh.hanse.de (Martin Cracauer) writes:
<bo@hubcap.clemson.edu (Bo Slaughter) writes:
<
<
<>Hopefully someone can point me in the right direction...
<
<>I need a program (piece of code, or whatever) that can read in a
<>postscript document and print out the number of pages that WOULD 
<>be printed if it were sent to the printer.
<
<I an using:
<
<grep "Page: " | wc

If the PostScript file was DSC compliant, then "grep %%Pages:" would be
enough.  If you get back nothing, then it was either a one page document
(where the %%Pages wasn't necessary) or it wasn't DSC compliant, which means
that the grep idea won't work.
-- 
      harvard\                          spool.cs.wisc.edu!astroatc!vidiot!brown
Vidiot  ucbvax!uwvax..........!astroatc!vidiot!brown
      rutgers/            INTERNET:vidiot!brown%astroatc.UUCP@spool.cs.wisc.edu
                                   brown@wi.extrel.com
Re: number of pages
#6631
Author: Chris Lewis
Date: Mon, 11 Jan 1993 06:12
31 lines
1556 bytes
In article <4749@vidiot.UUCP> brown@vidiot.UUCP (Vidiot) writes:
>In article <1993Jan8.172822.12211@wavehh.hanse.de> cracauer@wavehh.hanse.de (Martin Cracauer) writes:
><I an using:

><grep "Page: " | wc

And what if your document also has the text "Page:" in it somewhere?
Please, use

	grep '^%%Page:' | wc

Even that won't work if you're working with nested documents which
may have embedded (but igonred) %%Page directives too.

>If the PostScript file was DSC compliant, then "grep %%Pages:" would be
>enough.  If you get back nothing, then it was either a one page document
>(where the %%Pages wasn't necessary) or it wasn't DSC compliant, which means
>that the grep idea won't work.

I've seen supposedly DSC compliant code emitting %%Page, but not %%Pages:.
Somestimes a "%%Pages: (atend)", but forgot to do the real one at the end...

It's simple enough to try both and see what comes out.

Not very reliable tho.

Consult the FAQ.
-- 
Chris Lewis; clewis@ferret.ocunix.on.ca; Phone: Canada 613 832-0541
Psroff 3.0 info: psroff-request@ferret.ocunix.on.ca
Ferret list: ferret-request@ferret.ocunix.on.ca
Re: number of pages
#6633
Author: James Casey
Date: Mon, 11 Jan 1993 12:56
37 lines
1864 bytes
>In article <4749@vidiot.UUCP> brown@vidiot.UUCP (Vidiot) writes:
>>In article <1993Jan8.172822.12211@wavehh.hanse.de> cracauer@wavehh.hanse.de (Martin Cracauer) writes:
>><I an using:

>><grep "Page: " | wc

>And what if your document also has the text "Page:" in it somewhere?
>Please, use

>	grep '^%%Page:' | wc

>Even that won't work if you're working with nested documents which
>may have embedded (but igonred) %%Page directives too.

>>If the PostScript file was DSC compliant, then "grep %%Pages:" would be
>>enough.  If you get back nothing, then it was either a one page document
>>(where the %%Pages wasn't necessary) or it wasn't DSC compliant, which means
>>that the grep idea won't work.

>I've seen supposedly DSC compliant code emitting %%Page, but not %%Pages:.
>Somestimes a "%%Pages: (atend)", but forgot to do the real one at the end...

>It's simple enough to try both and see what comes out.

>Not very reliable tho.

More reliable-- use ghostscript... Someone on our site hacked it to return
number of pages printed... It was easy enough to do. It comes with a dummy 
driver supplied. He added a global in main,and added code in printpage which 
increments the global every time a page is printed, and before exiting returns
total number of pages printed. He says he will post diffs if anyone is 
interested.

james.
-- 
--
james.
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