home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / postscri / 6407 < prev    next >
Encoding:
Text File  |  1993-01-22  |  2.9 KB  |  80 lines

  1. Newsgroups: comp.lang.postscript
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!menudo.uh.edu!nuchat!leeweyr!bill
  3. From: bill@leeweyr.sccsi.com (Bill Lee)
  4. Subject: Re: Page accounting
  5. Message-ID: <1993Jan22.040036.5582@leeweyr.sccsi.com>
  6. Keywords: postscript, page, accounting
  7. Organization: Lee Aerie
  8. References: <86579@ut-emx.uucp>
  9. Date: Fri, 22 Jan 1993 04:00:36 GMT
  10. Lines: 68
  11.  
  12. In article <86579@ut-emx.uucp> tai@utpapa.ph.utexas.edu (Tai Morris) writes:
  13. >I'm new to this newsgroup so I hope this question hasn't been answered
  14. >too many times already...
  15. >
  16. >I need a program that parses a postscript file to see how many pages will
  17. >be printed. Please don't tell me this is impossible - it's impossible that
  18. >it is impossible because postscript printers know how to parse postscript
  19. >files. Otherwise, the printer could be fooled, too.
  20. >
  21. >Any help would be appreciated.
  22. >
  23. >
  24. >
  25. >-- 
  26. >Tai Morris, tai@utpapa.ph.utexas.edu
  27.  
  28.  
  29. O.k., I won't tell you it's impossible. I'll just tell you you have
  30. answered your own question!
  31.  
  32. In order to determine how many pages an arbitrary PS file will
  33. print, you MUST parse the PS. That's what the PS printers do! And
  34. that is exactly what you have already said.
  35.  
  36. See....you answered your own question!   8-{)
  37.  
  38. One solution is to send the file to the printer, count the pieces
  39. of paper it ejects, throw the paper away, and you have the page
  40. count.  8-{)
  41.  
  42. Seriously........ in order to predict accurately the expected page
  43. count, you will need a PostScript interpreter running on the computer
  44. where you want to perform the prediction. I understand that
  45. ghostscript is a likely candidate. There may be others. I'm sure
  46. you will hear of them.
  47.  
  48. From the PostScript FAQ:
  49.  
  50. Subject: 1.2 How can I tell how many pages my document will have? 
  51.  
  52.     The easiest way to count pages is view your document on-line with a 
  53.     PostScript previewer. Some previewers like Ghostview and GSPreview 
  54.     count the pages for you. (See Section 12, ``PostScript Interpreters 
  55.     and Utilities''.) 
  56.  
  57.     If your document is generated by a professional program, you should 
  58.     be able to just count the number of ``%%Page:'' comments 
  59.     imbedded in the document. With UNIX you can type 
  60.   
  61.   grep -c %%Page document.ps
  62.   
  63.     to do this counting. (See Section 9, ``Encapsulated PostScript''.) 
  64.  
  65.     The only completely reliable way to count pages is to ask the 
  66.     printer. PostScript printers maintain a page counter that can be 
  67.     queried before and after the job is printed, and the page count is 
  68.     a simple subtraction. This tends to require rather sophisticated 
  69.     spooling systems and a communications channel that is 
  70.     bidirectional. However, some printers allow you to submit jobs on 
  71.     one port, and issue queries on another. Experts using a level 2 
  72.     printer can use the SerialOff.PS and SerialEHandlder.ps programs to 
  73.     communicate bidirectionally to the printer. 
  74.  
  75.  
  76.  
  77. Regards,
  78.  
  79. Bill Lee
  80.