articles:cupsprinting
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
articles:cupsprinting [2009/02/11 12:28] – timallen | articles:cupsprinting [2010/02/08 08:54] (current) – timallen | ||
---|---|---|---|
Line 71: | Line 71: | ||
Using Samba, the CUPS Windows Postscript driver allows for " | Using Samba, the CUPS Windows Postscript driver allows for " | ||
- | Obtain the tarball from the CUPS website, extract and build. '' | + | Obtain the tarball from the CUPS website, extract and build. '' |
aptitude install libcupsys2-dev smbclient | aptitude install libcupsys2-dev smbclient | ||
cd /tmp | cd /tmp | ||
Line 149: | Line 150: | ||
===== Putting It All Together ===== | ===== Putting It All Together ===== | ||
+ | |||
==== Sambafax ==== | ==== Sambafax ==== | ||
- | Sambafax uses Hylafax to send a document to a recipient, based on a fax number embedded in a Postscript document. Sambafax was originally written by Ignace Suy. {{articles: | + | Sambafax uses Hylafax to send a document to a recipient, based on a fax number embedded in a Postscript document. Sambafax was originally written by Ignace Suy. The modified version |
+ | |||
+ | < | ||
+ | #!/bin/sh | ||
+ | # | ||
+ | # Faxing with HylaFax through a faxprinter | ||
+ | # Heavily modified from original version. Supports CUPS and LPR | ||
+ | # | ||
+ | # $Id: sambafax,v 1.9 2009-06-30 08:43:41 tda Exp $ | ||
+ | |||
+ | |||
+ | # Printer spool type (LPR or CUPS) | ||
+ | PRINTSYSTEM=" | ||
+ | |||
+ | # Constants | ||
+ | SENDMAIL="/ | ||
+ | |||
+ | # Make up a temporary file using PID | ||
+ | FAXFILE=/ | ||
+ | |||
+ | # Fax number format | ||
+ | # Match FAX : '01234 567890' | ||
+ | # Deals with newlines in string and 0xad as hyphen | ||
+ | PARSE=" | ||
+ | b testfirst | ||
+ | : appendnext | ||
+ | N | ||
+ | y/ | ||
+ | : testfirst | ||
+ | s/.*fax *: *' | ||
+ | T appendnext | ||
+ | s/[ -]//g | ||
+ | p | ||
+ | q | ||
+ | " | ||
+ | |||
+ | # Retrieve the username and hostname from the parameters | ||
+ | if [ $PRINTSYSTEM = " | ||
+ | while : | ||
+ | do | ||
+ | case " | ||
+ | -n) Username=" | ||
+ | shift ; shift | ||
+ | ;; | ||
+ | -h) Hostname=" | ||
+ | shift ; shift | ||
+ | ;; | ||
+ | -*) shift | ||
+ | ;; | ||
+ | *) break | ||
+ | esac | ||
+ | done | ||
+ | cat > | ||
+ | else | ||
+ | # CUPS | ||
+ | Username=" | ||
+ | cat " | ||
+ | fi | ||
+ | |||
+ | # If the samba user is anonymous then send mails to the postmaster | ||
+ | if [ " | ||
+ | MailTo=" | ||
+ | else | ||
+ | MailTo=" | ||
+ | fi | ||
+ | |||
+ | # Retrieve the faxnumber from the printfile | ||
+ | FAXNUM=`pstotext ${FAXFILE} | sed -n " | ||
+ | |||
+ | # If faxnumber is found fax the tempfile | ||
+ | # We do not check the validity of the faxnumber, let sendfax do this... | ||
+ | if [ " | ||
+ | (echo "To: ${MailTo}" | ||
+ | echo "From: The HylaFAX Samba print service < | ||
+ | echo " | ||
+ | echo "" | ||
+ | echo -n "The faxnumber is not recognized in your fax of " | ||
+ | echo -n `date` | ||
+ | echo " | ||
+ | echo "The faxnumber is recognised by this text:" | ||
+ | echo "" | ||
+ | echo " | ||
+ | echo "" | ||
+ | echo "Only spaces, ',' | ||
+ | echo "" | ||
+ | echo " | ||
+ | ) | 2>&1 $SENDMAIL -ffax -oi ${MailTo} | ||
+ | else | ||
+ | sendfax -n -D -m -f ${MailTo} -d ${FAXNUM} ${FAXFILE} | ||
+ | fi | ||
+ | |||
+ | # Remove the temp file | ||
+ | # rm -f ${FAXFILE} | ||
+ | |||
+ | # End of file | ||
+ | </ | ||
+ | |||
First, copy the sambafax script to ''/ | First, copy the sambafax script to ''/ | ||
Line 233: | Line 331: | ||
BrowseAllow @LOCAL | BrowseAllow @LOCAL | ||
BrowsePoll server.domain.com | BrowsePoll server.domain.com | ||
+ | |||
+ | ===== Printing Text Files ===== | ||
+ | Print options can be specified on the '' | ||
+ | |||
+ | lpr -pLaserjet-6P -o cpi=11.5 -o lpi=6 -o page-top=33 [file] | ||
+ | |||
+ | Alternatively, | ||
+ | |||
+ | lpoptions -pLaserjet-6P -o cpi=11.5 -o lpi=6 -o page-top=33 | ||
+ | |||
+ | ==== Printer Instances ==== | ||
+ | Multiple options set can be set up using printer " | ||
+ | |||
+ | To set a printer instance, use: | ||
+ | |||
+ | lpoptions -pLaserjet-6P/ | ||
+ | |||
+ | To delete an instance: | ||
+ | |||
+ | lpoptions -xLaserjet-6P/ | ||
+ | |||
+ | Printer instances set by root are global. | ||
+ | |||
+ | Note that printer instances are not presented on the CUPS web interface. | ||
+ | |||
+ | === Printing Text Files From Windows Command Line === | ||
+ | There are a number of obstacles to printing with specific option sets through Samba with CUPS: | ||
+ | |||
+ | - Samba appears to not support printer instances via the CUPS API. They simply do not appear as listed printers. Furthermore, | ||
+ | - Any printer options set with '' | ||
+ | - It may be possible to define a special printer, printing = sysv, and define a specific '' | ||
+ | |||
+ | One solution is to give up on Samba and simply pipe the file to '' | ||
+ | |||
+ | type file | ssh cupsserver lpr -pLaserjet-6P -o cpi=11.5 -o lpi=6 -o page-top=33 | ||
+ | |||
articles/cupsprinting.txt · Last modified: 2010/02/08 08:54 by timallen