Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ghostscript: find page count and/or page size

Status
Not open for further replies.

cheyney

Programmer
Jul 16, 2002
335
CA
Is there any command line for ghostscript to parse a page size/ page count from a postscript file?

Thanks in advance,

Cheyney
 
The information you seek is in the PageDeivce dictionary.
The ps string currentpagedevice /PageSize get will put the PageSize array on the stack. Other useful information is also found in this dictionary. To view all of the Key/Value pairs in a dictionary use the following:
nameofdictionary {exch =string cvs print ( ---> ) print ==} forall
 
Can't use your suggestion. I bet you are assuming much better postscript/ghostscript knowledge than I actually have ;)

Can you give a setp by step solution, please?

I am not sure about Cheyney but I am looking for a way to get the size of a PDF file in another file or at STDOUT.
 
Sorry for the inacurracy.

I meant page dimensions but, as you mentioned, it would be nice to have page count also.

Rodrigo Severo
 
I forgot to mention another detail that might be significant: the files I am treating are PDF ones not PS.


Rodrigo Severo
 
Yeah, that's a pretty big detail! PDFs aren't PostScript files. Perhaps the question would be more appropriately posted in the Acrobat forum.

A PostScript programming solution has no applicability at all to a PDF file.

If you're working with a PDF file, you'll likely need to use a component that traverses the PDF object hiearchy look for the /MediaBox and /CropBox dictionary entries.

Thomas D. Greer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top