This solution first appeared on Baanfans on July 19, 1999 at 04:23:11 EST. It works only with Unix print queues and not with BWPrint (either Unix or Windows).
<h1>"Page of" using Barcode-Functionality</h1>
A completly other way of printing the number of pages is to use Barcode-Functionality.
The Barcode-Feature (Warning : Works only for UNIX-Printers) is in fact a API-Interface for
printing. You can merge everything you want to an existing spool. And the merging ist done
after Baan has createed the whole printing, so Baan also knows the total amount of pages.
I tried my example with an Easy-SQL and it works really fine.
In short the example works like that:
<li>Before printing I generate a unique Spool number and print it (!!) on the report in
a field, which is connected to a Barcode
<li>At the end of printing I write the unique number and the number of pages to an ASCII-File
<li>In the filter-Program of Baan (which puts the correct Escape-Sequences to a spool) I take the
Barcode-Script (which gets the unique number as parameter) and read the corresponding
number of pages. Instead of a barcode i merge the number of pages in the Spool - Output
<p><center><b>--> there we are !!!!</b></center>
The greatest problem is not getting the Page - number, but managing the unique numbers.
<h2> How to use the example</h2>
<li>Print in the header of your report something like "Page : VVVVVVV of FFFFFFFF",
where FFFFFFFF is the new field
(in my example <i>int.unique.s</i> of type tcmcs.str8 and with Barcode - Type 95)
Dont care of the warning : "Input field not declared" . <b>Do not declare the field as input field</b>
<li>Warning: I think there is an error in the Baan-Barcode-API, because, when the Barcode-Field
is the last field in a line the Printer-Daemon gets mad, so i added a "." (= point) after the
barcode-Field and everything works fine. (Note: a empty field of 1 Byte works also)
<li>paste the code on this site to the report-script
<li>create (once) a subdirectory under your $BSE_TMP-folder named "printing". Make sure, that
everyone has accessrights for this directory.
<li>for each Baan-Printer(device), you have to connect the printer to a Baan- Printer-information-File
(see "technical manual" in the online help). Normally every UNIX-printer is
already connected to a Printer-Driver
<li>for each (unix-)printer you want to work with this feature you have to change
the printer driver file ($BSE/lib/printinf/.....), so that it contains a link to a
barcode-directory (there must be a line "barcodedir=xxxxxxx,"; dont forget the comma)
<li>In the barcode-directory ($BSE/lib/barcode/xxxxxx; xxxxx = name of the barcode-Directory)
create the shellscript (Name type95)
I have to admit : I'm not very strong in shell-Scripting. For my Sun it works fine, but
I suppose for other UNIXES you have to change something on the script. I'm sure someone
could do this script in a better way.
Make sure, that the shell-Script is executable !!
Make sure, that the 2 ASCII-Files in the directory "printing"
(and the directory itself) are accessible (UNIX-rights)
In case of error : Check the logfile ($BSE/log/log.filter6.1)
The number for uniqueness ist 8 digits long, so I dont think, there will a be
a problem, but feel free to increment the size
Clear the file with the page numbers every month (or every weekend).
Baan & Schuler GmbH<br>