home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.postscript
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!menudo.uh.edu!nuchat!leeweyr!bill
- From: bill@leeweyr.sccsi.com (Bill Lee)
- Subject: Re: Page accounting
- Message-ID: <1993Jan22.040036.5582@leeweyr.sccsi.com>
- Keywords: postscript, page, accounting
- Organization: Lee Aerie
- References: <86579@ut-emx.uucp>
- Date: Fri, 22 Jan 1993 04:00:36 GMT
- Lines: 68
-
- In article <86579@ut-emx.uucp> tai@utpapa.ph.utexas.edu (Tai Morris) writes:
- >I'm new to this newsgroup so I hope this question hasn't been answered
- >too many times already...
- >
- >I need a program that parses a postscript file to see how many pages will
- >be printed. Please don't tell me this is impossible - it's impossible that
- >it is impossible because postscript printers know how to parse postscript
- >files. Otherwise, the printer could be fooled, too.
- >
- >Any help would be appreciated.
- >
- >
- >
- >--
- >Tai Morris, tai@utpapa.ph.utexas.edu
-
-
- O.k., I won't tell you it's impossible. I'll just tell you you have
- answered your own question!
-
- In order to determine how many pages an arbitrary PS file will
- print, you MUST parse the PS. That's what the PS printers do! And
- that is exactly what you have already said.
-
- See....you answered your own question! 8-{)
-
- One solution is to send the file to the printer, count the pieces
- of paper it ejects, throw the paper away, and you have the page
- count. 8-{)
-
- Seriously........ in order to predict accurately the expected page
- count, you will need a PostScript interpreter running on the computer
- where you want to perform the prediction. I understand that
- ghostscript is a likely candidate. There may be others. I'm sure
- you will hear of them.
-
- From the PostScript FAQ:
-
- Subject: 1.2 How can I tell how many pages my document will have?
-
- The easiest way to count pages is view your document on-line with a
- PostScript previewer. Some previewers like Ghostview and GSPreview
- count the pages for you. (See Section 12, ``PostScript Interpreters
- and Utilities''.)
-
- If your document is generated by a professional program, you should
- be able to just count the number of ``%%Page:'' comments
- imbedded in the document. With UNIX you can type
-
- grep -c %%Page document.ps
-
- to do this counting. (See Section 9, ``Encapsulated PostScript''.)
-
- The only completely reliable way to count pages is to ask the
- printer. PostScript printers maintain a page counter that can be
- queried before and after the job is printed, and the page count is
- a simple subtraction. This tends to require rather sophisticated
- spooling systems and a communications channel that is
- bidirectional. However, some printers allow you to submit jobs on
- one port, and issue queries on another. Experts using a level 2
- printer can use the SerialOff.PS and SerialEHandlder.ps programs to
- communicate bidirectionally to the printer.
-
-
-
- Regards,
-
- Bill Lee
-