CUPS on FreeBSD:
Note:
If you have a Deskjet Printer, and the printing is excruciatingly
slow, you need to set /dev/lpt0 to print in polled mode instead of
interrupt-driven mode. Polled mode constantly polls the printer
to see if it is ready for more information.
vi /etc/rc.local
Add:
lptcontrol -p -d /dev/lpt0
chmod 755 /etc/rc.local
Instructions:
FreeBSD 9.0 minimal-install
portsnap fetch update
portsnap extract
/usr/ports/print/cups/make install
(Disable everything in the config, such as ghostscript)
Save a copy of your original unlimited HP Filter:
cp /usr/local/libexec/cups/filter/rastertohp /usr/local/libexec/cups/filter/rastertohp.dist
Basically CUPS will do PageLimit quotas over QuotaPeriod, but a
user can print 9 pages of their 10 page quota, and then print out
a 1000 page job and CUPS will finish the whole 1000 page job before
marking them over quota. Killing a job while it is being printed
must be done at the filter level. A couple of lines to the filter
rastertohp.c will accomplish this:
*** Here is the trick for killing an oversize Print Job ***
cd /usr/ports/print/cups-base/work/cups-1.4.2/filter
vi rastertohp.c
Search for "Page ++"
Above fprintf(stderr, "PAGE: %d %d\n", Page, header.NumCopies);
Insert:
/*
* Only print if page count is 10 or less, but we still log the page.
*/
if (Page <= 10) {
Below EndPage();
Insert:
} /* End of Page Restriction per Job */
Now ..
make clean
make
make install
(This will only recompile/reinstall the filters)
*** End of the trick! ***
To clean up the install afterwards:
/usr/ports/print/cups/make distclean
Copy your new HP Filter, and reinstate the original:
cp /usr/local/libexec/cups/filter/rastertohp /usr/local/libexec/cups/filter/rastertohp10
cp /usr/local/libexec/cups/filter/rastertohp.dist /usr/local/libexec/cups/filter/rastertohp
Create a new PPD file for your new filter:
cp /usr/ports/print/cups-base/work/cups-1.4.2/test/testhp.ppd /usr/local/share/cups/model/laserjet10.ppd
Modify laserjet10.ppd, both Description and the rastertohp to use rastertohp10
Tweak /usr/local/etc/cups/cupsd.conf
Set Browsing to "Off"
(Basically set other IP Ranges to be able to view cups other than 127.0.0.1)
/usr/local/etc/rc.d/cups.sh start
lynx http://localhost:631
Under "Manage Printers" add your printer, make sure it is set for
HP and use the Laserjet drivers, we will have the client that is
sending the print job to the server in raw PS format and let CUPS
convert to HP.
Tweak /usr/local/etc/cups/printers.conf
On a Win2k/WinXP box, Add a Network Printer, "Connect to a printer
on the Internet or on a home or office network:", put in
http://hostname:631/printers/Printer_Name and for the driver Select
"MS Publisher Imagesetter" driver found under Generic or use the
specified PostScript driver for your printer (ex: HP Laserjet 4000
Series PS). Print a job of two or more pages and verify that
/var/log/cups/page_log is doing the correct page accounting and
you're set!
I have created a batch file that adds an IPP printer as a local
printer on the machine as well as automating the printer add
process if it must be done on many machines.
addprinter.bat