a2pdf
a2pdf
A2pdf is a very special-purpose backend written to allow for filtering and formatting legacy text-only jobs arriving over LPD to use the formatting options allowed by the very mature a2ps.
Download a2pdf
NAME
a2pdf
DESCRIPTION
This is a very special-purpose CUPS backend written to allow for filtering
text jobs arriving over legacy LPD, using the formatting options allowed by the
very mature a2ps. It expects formatting parameters to be passed in the job
title, split on X.
This backend is designed to be used on a raw queue. In the case of a non-raw
queue, the job will be filtered by CUPS into something other than text by the
time it gets to the backend, and therefore the formatting options will not be
applied because the backend will not call a2ps. However, if it sees postscript,
it will still convert the job to PDF using ps2pdf.
Example URIs:
a2pdf://var/spool/pdf
REQUIREMENTS
1) Perl
2) The venerable a2ps
3) Ghostscript tool ps2pdf
4) The File::Copy Perl module
5) A raw print queue that receives text
INSTALLATION
Download the script and copy it into the CUPS backends directory, which is
typically /usr/lib/cups/backend. Once there, you have to send CUPS a SIGHUP
for it to re-scan all the available backends. Do a 'killall -HUP cupsd', or
use the init script: '/etc/init.d/cups reload'. A restart will work just as
well, but no real need to stop and start the server daemon.
Now check the web interface. When creating or modifying printers, you should
see an option for a "A2PDF Writer" in the dropdown box of available devices.
If not, make sure the permissions on the file are chmodded to 755 and owned by
the correct user:group (check the rest of the files in the directory and match
it).
CONFIGURATION
Variables in the conf hash can be set in script, affecting all queues, or can
be overridden on a per-queue basis through an external configuration file. The
$queues_conf variable determines location, default /etc/cups/queues.conf.
qconf
The qconf file is formatted exactly like the printcap file, except that
comments, blank lines, and whitespace between all elements are allowed. All
variables above can be overridden on a per-queue basis. Location is
determined by the queues_conf variable. If this file does not exist,
variable values are simply those set in the script. Example file:
# TEST1 has debugging, saving jobs, and factor four set
TEST1|debug:save_jobs
# TEST2 is identical
TEST2 | debug : save_jobs
# Some other random configuration
TEST3 | check_user : check_job
JOB FORMATTING
The job title must conform to a specific syntax for this backend to be useful.
The title conists of three fields separated by underscores: a descriptive tag,
formatting options, and a job name for the final file. Consider this example
job title: PDFVAX_OLXL130XCOL80XDS_testpage:
PDFVAX: descriptive name
OLXL130XCOL80XDS: formatting options
testpage: job name
The formatting options themselves are split on capital X:
OL: orientation landscape, adds "--landscape" to a2ps options
L130: lines 130, adds "--lines-per-page=130" to a2ps options
COL80: columns 80, adds "--columns=80" to a2ps options
DS: datestamp, adds a gentime datestamp to the filename
(If the formatting parameter begins with capital X, no a2ps formatting is done)
The job will be converted from text to Postscript by a2ps using the above
formatting options, and then converted to PDF by ps2pdf. The final file name
will be $uripath/PDFVAX_$user_testpage_$date.pdf.
CHANGES
a2pdf 1.02 (20120421)
- All script variables can be overridden on a per-queue basis using new
"qconf" configuration file format. Most variables renamed in a more
consistent manner to fit with this scheme.
- Integrated perldoc.
a2pdf 1.01 (20051129)
- Fixed some tortuous logic centered around temp files.
- More flexible checking of file type using Unix file utility.
a2pdf 1.00 (20050708)
- First release.
|