Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!linac!att!ucbvax!MWUNIX.MITRE.ORG!jcmorris From: jcmorris@MWUNIX.MITRE.ORG (Joe Morris) Newsgroups: comp.laser-printers Subject: Re: Counting pages on a HPLJ II Message-ID: <9104191549.AA03474@crayola.cs.UMD.EDU> Date: 18 Apr 91 14:58:11 GMT References: <9104171649.AA25809@crayola.cs.UMD.EDU> Sender: daemon@ucbvax.BERKELEY.EDU Organization: The MITRE Corporation, Bedford MA Lines: 33 Approved: laser-lovers@brillig.umd.edu matt@EECS.NWU.EDU (Matt Larson) writes: >I am interested in writing a filter that can count the number of pages >printed to an HPLJ II. The input stream could be plain text or the HP >graphics language. Counting pages of text is easy; counting pages of >graphics (for example, output from Ghostscript, gnuplot, dvijep, etc.) >is the part that has me stumped. >Is there a sequence that always means, ``End of the page; print it''? >I thought that's what the formfeed character (ASCII 12) did. I tried >counting formfeed characters, but that doesn't seem to work: there are >way too many. My current guess is that the formfeed character really >means what I think it means, but that it is also possible for >formfeeds to be part of other commands or in some sort of "quoted >string." If I am on the right track, then the question is: How do I >tell the real formfeeds that mean end of page from the other ones? You're right; FF is the all-done-now-print order, but only if it is received in a protocol context. The bit pattern (x'0C') can also appear in any of a number of binary data fields, either for graphic images or in a font download. I suspect that you'll have to write code to parse all of the PCL sequences in much the same manner that VT-100 emulators have to parse its escape sequences, even if you don't do anything with them. I don't have the book handy, but there are many PCL sequences of the form: which you'll have to recognize and skip over without testing for the presence of a form-feed command. Joe Morris