From owner-doc-jp@jp.freebsd.org  Wed Aug 28 21:27:59 1996
Received: by mail.jp.freebsd.org (8.7.3+2.6Wbeta5/8.7.3) id VAA28243
	Wed, 28 Aug 1996 21:27:59 +0900 (JST)
Received: by mail.jp.freebsd.org (8.7.3+2.6Wbeta5/8.7.3) with SMTP id VAA28238
	for <doc-jp@jp.freebsd.org>; Wed, 28 Aug 1996 21:27:44 +0900 (JST)
Received: from iwasaki.sirim.my ([161.142.131.209]) by relay3.jaring.my (8.6.13/8.6.12) with SMTP id UAA02062; Wed, 28 Aug 1996 20:27:14 +0800
Message-ID: <32243BD0.2EDE@pc.jaring.my>
Date: Wed, 28 Aug 1996 20:30:08 +0800
From: Mitsuru IWASAKI <iwasaki@pc.jaring.my>
Organization: AISDEL; SIRIM
X-Mailer: Mozilla 3.0b7 (Win95; I)
MIME-Version: 1.0
To: doc-jp@jp.freebsd.org, kimura@netlab.is.tsukuba.ac.jp
CC: iwasaki@pc.jaring.my
References: <199608280232.LAA13071@fairy.netlab.is.tsukuba.ac.jp> <32241EEC.124E@pc.jaring.my> <322424DB.695F@pc.jaring.my>
Content-Type: text/plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit
Reply-To: doc-jp@jp.freebsd.org
X-Distribute: distribute [version 2.1 (Alpha) patchlevel=19]
X-Sequence: doc-jp 625
Subject: [doc-jp 625] Re: printing.sgml [Aug-23-1996]
Errors-To: owner-doc-jp@jp.freebsd.org
Sender: owner-doc-jp@jp.freebsd.org

$B$$$o$5$-$G$9!#(J

Mitsuru IWASAKI wrote:
> > $B5Z$P$:$J$,$i!"=uB@Ea$7$^$9!#(J
> > $B$6!<$C$H$d$C$F$_$?$@$1$J$s$G!"$"$^$jNI$/$J$$LuJ8$+$b$7$l$^$;$s!#(J
> > $B$o$1$"$C$F(J sgml$B$N7A<0$G$OM-$j$^$;$s$,$4MF<O2<$5$$!#(J
> 
> $B$"$H!"$I$3$d$l$P$$$$$s$G$9$+$M(J?

$B$H$j$"$($:!"!V(JAccounting for Printer Usage$B!W$N:G8e$r$d$C$F$_$^$7$?!#(J
$B$o$+$i$s$H$3$bB?$+$C$?$N$G!"86J8$b;D$7$FM-$j$^$9!#(J
$B$^$?;~4V$,$G$-$?$i=uB@Ea$7$^$9!#(J
$B4hD%$C$F$/$@$5$$!#(J

$B$3$3$+$i$3$3$+$i$3$3$+$i$3$3$+$i$3$3$+$i$3$3$+$i$3$3$+$i$3$3$+$i(J

7.6.5.2. $B0u:~:Q$_%Z!<%8$N%+%&%s%HJ}K!(J (How Can You Count Pages Printed?)

$B%j%b!<%H$G$b@53N$J(J accounting $B$r9T$&$?$a!"%8%g%V$,;HMQ$9$k;f$NKg?t$r(J
$B7hDj$G$-$kI,MW$,$"$j$^$9!#$3$l$O%W%j%s%?$N(J accounting $B$N$-$o$a$F=EMW$J(J
$BLdBj$G$9!#(J

In order to perform even remotely accurate accounting, you need to be
able to determine how much paper a job uses. This is the essential
problem of printer accounting.

plain text $B$N%8%g%V$KBP$7$F$O!"$3$NLdBj$r2r7h$9$k$N$OFq$7$/$"$j$^$;$s(J:
$B%8%g%V$K2?9T$"$k$+$r?t$(!"%W%j%s%?$N%5%]!<%H$9$k%Z!<%8Kh$N9T?t$HHf3S$7$^(J
$B$9!#(J
$B%U%!%$%k$K$"$k%P%C%/%9%Z!<%9$r7W;;$K$$$l$k;v$rK:$l$J$$$G$/$@$5$$!#$3$l$O(J
$B9T$r(J overprint $B$9$k$+!"D9$$NQM}E*$J9T$r0l$D0J>e$NJ*M}E*$J9T$K(J wrap $B$7$^(J
$B$9!#(J

For plain text jobs, the problem's not that hard to solve: you count how
many lines are in a job and compare it to how many lines per page your
printer supports. Do not forget to take into account backspaces in the
file which overprint lines, or long logical lines that wrap onto one or
more additional physical lines.

$B%F%-%9%H!&%U%#%k%?(J lpf (lpf: a Text Filter $B$G>R2p$7$^$7$?(J) $B$O!"(J
accounting
$B$9$k$H$-$K$O!"$3$l$i$N;v$r7W;;$KF~$l$^$9!#$b$7$"$J$?$,(J accounting $B$r9T$&(J
$BI,MW(J
$B$N$"$k%F%-%9%H!&%U%#%k%?$r=q$$$F$$$k$N$G$7$?$i!"(Jlpf $B$N%=!<%9(I%$B%3!<%I$rD4(J
$B$Y$F(J
$B$_$?$/$J$k$G$7$g$&!#(J

The text filter lpf (introduced in lpf: a Text Filter ) takes into
account these things when it does accounting. If you are writing a text
filter which needs to do accounting, you might want to examine lpf's
source code.

$B$7$+$7!"B>$N%U%!%$%k!&%U%)!<%^%C%H$O$I$&=hM}$7$^$9$+(J? 

How do you handle other file formats, though?

$B$(!<$H!"(JDVI $B$+$i(J LaserJet $B$^$?$O(J DVI $B$+$i(J PostScript $B$X$NJQ49$K$O!"(J
dvilj $B$+(J dvips $B$N?GCG=PNO$r(J parse $B$7$F!"2?%Z!<%8JQ49$5$l$?$+$r8+$k(J 
filer $B$r;}$D;v$,$G$-$^$9!#B>$N%U%!%$%k(I%$B%U%)!<%^%C%H$HJQ49%W%m%0%i%`(J
$B$G$bF1MM$N$3$H$,$G$-$k$G$7$g$&!#(J

Well, for DVI-to-LaserJet or DVI-to-PostScript conversion, you can have
your filter parse the diagnostic output of dvilj or dvips and look to
see how many pages were converted. You might be able to do similar
things with other file formats and conversion programs.

$B$7$+$7$3$l$i$NJ}K!$K$O!"%W%j%s%?$O<B:]$K$OA4$F$N%Z!<%8$r0u:~$7$F$$$J$$(J
$B$H$$$&LdBj$,$"$j$^$9!#Nc$($P!"%8%c%`!"%H%J!<@Z$l$^$?$O(J eplode ---
$B$=$7$F%f!<%6$,$^$@(J charge $B$7$F$*$-$?$$!"$H$$$C$?$3$H$,$"$jF@$^$9!#(J

But these methods suffer from the fact that the printer may not actually
print all those pages. For example, it could jam, run out of toner, or
explode---and the user would still get charged.

$B$5$F!"$I$&$7$^$9$+(J?
So, what can you do?

$B@53N$J(J accounting $B$r9T$&3N$+$JJ}K!$,0l$D$@$1$"$j$^$9!#;f$r$I$l$@$1(J
$B;HMQ$9$k$+$rEA$($i$l$k%W%j%s%?$rF~<j$7!"%7%j%"%k!&%i%$%s$^$?$O(J
$B%M%C%H%o!<%/@\B37PM3$G<h$jIU$1$^$9!#KX$IA4$F$N(J PostScript $B%W%j%s%?$O(J
$B$3$N9M$($r%5%]!<%H$7$^$9!#B>$N$b$N$b$I$&$h$&$K(J make $B$=$7$F(J model $B$7$^$9(J
($BNc$($P!"%M%C%H%o!<%/@\B3$5$l$?(J Imagen $B%l!<%6!&%W%j%s%?(J)$B!#$3$l$i$N%W%j%s(J
$B%?(J
$B$,3F%8%g%V$N0u:~8e$K;HMQ%Z!<%8?t$r<hF@$9$k$h$&$K%U%#%k%?$r=$@5$7!"$=$NCM(J
$B$K(J
$B4p$E$-(J accounting $B>pJs$N(J log $B$r<h$j$^$9!#9T$N%+%&%s%H$b(J error-prone $B$N(J
$B8!::$NMW5a$b$"$j$^$;$s!#(J

There is only one sure way to do accurate accounting. Get a printer that
can tell you how much paper it uses, and attach it via a serial line or
a network connection. Nearly all PostScript printers support this
notion. Other makes and models do as well (networked Imagen laser
printers, for example). Modify the filters for these printers to get the
page usage after they print each job and have them log accounting
information based on that value only. There is no line counting nor
error-prone file examination required.

$B$b$A$m$s!">o$K5$A0$h$/<+M3$KA4It$r0u:~$5$;$k$3$H$b$G$-$^$9!#(J

Of course, you can always be generous and make all printouts free.


$B$3$3$^$G$3$3$^$G$3$3$^$G$3$3$^$G$3$3$^$G$3$3$^$G$3$3$^$G$3$3$^$G(J
-- 
                               o
                         [=]   O
                        (.~.)_P
+==================oooO==( )//Oooo=================+
|Mitsuru Iwasaki                                   |
|15A-1-3, Scots Tower, MONT' KIARA CONDOMINIUM,    |
|Jalan 1/70C, Off Bikit Kiara, 50480 Kuala Lumpur  |
|TEL: 03-253-8579                    _/_/_/    _/  |
|FAX: 03-253-8579                   _/_/_/    _/   |
|e-mail: iwasaki@sirim.my(OFFICE)  _/  _/ _/ _/    |
|        iwasaki@pc.jaring.my(HOME)                |
|        JAA03673@niftyserve.or.jp(JAPAN)          |
+==================================================+
