cups-emailpdf Code
Emails document printed by CUPS to the user printing it
Brought to you by:
rstuart
Cups-emailpdf
=============
Overview: Any document printed by CUPS with this driver
will be emailed back to the user that printed it.
Reality: The document is emailed back to the user on the
machine CUPS is running on. You can see the user the email
is sent by looking at the "User" column in the CUPS print
queue displayed on the CUPS admin web page. You have to
arrange for that email to be routed to the users real
in-box.
Documentation is this README.txt.
All documentation is readable online at the home page:
http://cups-emailpdf.sourceforge.net/
Dependencies
------------
- CUPS, http://www.cups.org
- A /usr/lib/sendmail that can send email to local users,
eg http://www.exim.org/
- Unix shell, eg http://gondor.apana.org.au/~herbert/dash
Installing
----------
Packages are available for Debian style distributions
at the home page. If you install using them you can
skip this section.
1. Copy the cups-emailpdf.sh file to the /usr/lib/cups/backend
directory. Permissions should be 0555, and it should be
owned by root.
2. Restart the CUPS server.
3. Create a new CUPS printer using the CUPS admin web page.
Assign it any name/description/location you like and
proceed to the Device list. In there you should see:
"Email Printer" (Emails PDF document to user)
Choose that.
4. Choose a postscript printer description - preferably
colour.
Done!
Using the printer from Windows
------------------------------
1. Set the printer up as a Samba Share. Ensure
"guest ok = no". Restart Samba.
2. Set up a new Windows printer using the Samba share.
Use a colour postscript printer driver - the HP
DesignJet driver does a good job.
3. Setup your email routing, so that email sent to the
local user gets routed to the right place (ie the
place the Windows user collects his email from).
If you don't know what user-id will be used for a
particular Windows user, have them print a test
page and look at the CUPS "Jobs Completed" print
queue.
4. If you have done all this correctly, it should just
work.
Trouble Shooting
----------------
1. If the "PDF-Email" printer does not appear in the CUPS
Driver list when you create the CUPS print queue, the
program hasn't been seen by CUPS. Check:
- Did you restart CUPS after installing it?
- Does it have the right permissions (executable)?
2. Look at the printer using the CUPS web page. There is
no hardware associated with the device, so it should
always be working. If it isn't working, you probably
have a networking problem.
3. Look at root's email on the machine running the CUPS
server. If the script strikes a problem it sends email
to root. If you are sending non-postscript documents
to it the ghostscript interpreter will die. If so,
when you installed the CUPS print queue, did you
choose a Postscript driver? You _must_ use a
Postscript driver.
4. Send a job to the printer. Look at the job in the CUPS
print queue displayed by the web page, and note the user
id. It appears in the "User" column. For the example
below, assume the user displayed by CUPS is "user-id".
Log into the machine running the CUPS server, and run:
echo Test | mail -s cups-emailpfd-test user-id
If that email doesn't arrive, then you have not set up
email routing properly on the machine running the CUPS
driver. You have to get that working before this driver
will work.
You can do this in any number of ways. One is to add
an alias in /etc/aliases. Another is ensure there is
a Unix user of the same name in /etc/passwd, and put
a .forward file in their home directory.
5. If you are having problems with people printing from
Windows, ensure you have "guest ok" turned off in the
printer share.
6. Desperation: The program is just a simple shell script.
You can run it directly and see what it does. If it is
installed in the usual place, you can run it like this:
sh -xv /usr/lib/cups/backend/cups-emailpdf jobid \
user title copies options [file]
"file" must be a postscript file. If not present it is
read from stdin. The email will be sent to "user", and
the "title" will be in the subject, and the pdf file
will be named "title.pdf". The remaining arguments must
be present, but are not used. Best of British. Email
me the patch when you find what is wrong.
License
-------
Copyright (c) 2005-2014,2018,2021 Russell Stuart.
cups-emailpdf is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.
As a special exception to the AGPLv3+, the author grants you permission
to redistribute this program without the accompanying "Installation
Information" described in clause 6.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
--
Russell Stuart
2014-05-09
russell-debian@stuart.id.au