From owner-freebsd-questions Mon Nov 13 16:28: 2 2000 Delivered-To: freebsd-questions@freebsd.org Received: from mail.rpi.edu (mail.rpi.edu [128.113.100.7]) by hub.freebsd.org (Postfix) with ESMTP id 3EEEB37B479 for ; Mon, 13 Nov 2000 16:27:51 -0800 (PST) Received: from [128.113.24.47] (gilead.acs.rpi.edu [128.113.24.47]) by mail.rpi.edu (8.9.3/8.9.3) with ESMTP id TAA389922; Mon, 13 Nov 2000 19:27:45 -0500 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: <001a01c04d9e$64b61540$0d01a8c0@mypc> References: <001a01c04d9e$64b61540$0d01a8c0@mypc> Date: Mon, 13 Nov 2000 19:27:43 -0500 To: "Thomas L." , From: Garance A Drosihn Subject: Re: Count page in lpr output Content-Type: text/plain; charset="us-ascii" ; format="flowed" Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG At 2:20 AM +0800 11/14/00, Thomas L. wrote: >Hi! > It is possible to get the number of page of a print file >for lpr from the print queue before the print file being printed >out? I am working on a project where I have to capture the >printout submitted through lpr, count the number of page of the >print job, show it to the end user on another workstation, only >then print the submitted print job when the user press ok. There is nothing in lpr itself. Lpr & friends are really pretty simple-minded. They do not count pages (or even understand anything about pages), they just copy files around. You would probably have to send the job through something like apsfilter (that is in the ports collection). First you need to change the file from "whatever the user sent" (which might be plain text) to "whatever the printer really wants" (which is likely to be postscript or hpgl). You would then need something to count pages in the postscript or hpgl file. I do not know what would be best to do this, as I use a different strategy for doing printer accounting. It might be that apsfilter itself can give you a page count. If not, then something like ghostscript could do it for postscript files. I have no idea what would do for hpgl files. I think you'd want to have one print queue that users actually send to, and which goes into some filter that you will have to write to figure out the page-count. That filter would then probably want to move the job into a separate queue, one which sends jobs to the physical printer. Your project sounds interesting. As you work on it, please let me (gad@freebsd.org) know what issues come up. -- --- Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message