Although most of a PostScript file is incomprehensible, you can sometimes read page counts.

With many PostScript files, you can often look at the PostScript file to find out how many pages it contains. For example, you may see this line near the end of a file:

%%Pages: 21

This tells you that there are 21 pages total in the file. I frequently use the tail command on PostScript files to see how many pages to expect:

% tail ch00.ps
  ...
%%Pages: 5

(The tail command shows the last ten lines of a file.)

You can’t always depend on seeing a line like this in a PostScript file, since it isn’t really needed by the printer. It is just a comment that is included for our benefit. But most applications produce some sort of page count at the end.

Get WYNTK: UNIX System Admininistrator now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.