PostScript Page Count

Hi,

I know you read the title and immediately thought… ‘not this question again’!. But it is not really that sort of question. I was playing around in Workflow and decided that PostScript output would be best for a job. However this job required reporting done in Excel, so I wrote a script that creates a xls report with cell formatting and page counts etc. So after changing my output preset to output PS instead of PDF I was faced with this issue. However looking at the View as Text option in debug after the Create Output plugin was executed I get the below data. From there I grabbed the page count via a Set Job Infos. (Pages: 530 below) Now I only have the KONICA MINOLTA 1200 printer and wanted to ask others here using different printers if this is a viable solution to get page counts from PS files.

%!PS-Adobe-3.0
%%Creator: PlanetPress Connect 2018.1.6.52339
%%CreationDate: 2018-11-06 02:43 PM CAT
%%DocumentData: Binary
%%LanguageLevel: 3
%%Pages: 530
%%OLPrinterDefintion: KONICA MINOLTA 1200_1051 PS(P)-DuplexFix
%%DocumentMedia:
%%+ Media 1 595.276 841.89 0 () Unspecified
%%+ Media 2 595.276 841.89 0 () Unspecified
%%EndComments
%%BeginDefaults
%%PageOrientation: Portrait
%%PageBoundingBox: 0 0 595 842
%%PageMedia: Media 1
%%EndDefaults
%%BeginProlog
%%BeginResource: file DMW_Dict

Regards,
S

Yes, the %%Pages comment is part of the DSC specification and as such, it is present in an overwhelming majority of PostScript streams… but there is no guarantee that all PostScript-producing applications and drivers will include it in their output since DSC’s are a complement to the PostScript standard (as opposed to an actual part of the standard).

But between you and me, I can’t remember the last time I saw a PostScript file generated by a print driver that didn’t include the %%Pages comment, so I think your solution is absolutely viable.

That is good news then. Thanks for your input.