11. *NIX
gives
us
symbolic
links.
$ ls -ln convert!
lrwxr-xr-x 1 0 0 20 Aug 14 2009
convert -> /usr/sbin/cupsfilter!
12. Is
there
a
manpage
for
cupsfilter?
cupsfilter(8) Apple Inc. cupsfilter(8)!
NAME!
cupsfilter - convert a file to another format using cups filters!
SYNOPSIS!
cupsfilter [ -c config-file ] [ -e ] -j job-id[,N] [ -m mime/type ] [ -n copies ] [ -o!
name=value ] [ -p filename.ppd ] [ -t title ] filename!
DESCRIPTION!
cupsfilter is a front-end to the CUPS filter subsystem which allows you to convert a file to!
a specific format, just as if you had printed the file through CUPS. By default, cupsfilter!
generates a PDF file.!
OPTIONS!
-c config-file!
Uses the named cupsd.conf configuration file.!
-e!
Use every filter from the PPD file.!
-j job-id[,N]!
Converts document N from the specified job. If N is omitted, document 1 is converted.!
-m mime/type!
Specifies the destination file type. The default file type is application/pdf. Use!
printer/foo to convert to the printer format defined by the filters in the PPD file.!
-n copies!
Specifies the number of copies to generate.!
-o name=value!
Specifies options to pass to the CUPS filters.!
-p filename.ppd!
Specifies the PPD file to use.!
13. OpSons?
/System/Library/Printers/Libraries/convert!
Usage: convert [ options ]!
Options:!
-e Use every filter from the PPD file!
-f filename Set file to be converted (otherwise stdin)!
-o filename Set file to be generated (otherwise stdout)!
-i mime/type Set input MIME type (otherwise auto-typed)!
-j mime/type Set output MIME type (otherwise application/pdf)!
-P filename.ppd Set PPD file!
-a 'name=value ...' Set option(s)!
-U username Set username for job!
-J title Set title!
-c copies Set number of copies!
-u Remove the PPD file when finished!
-D Remove the input file when finished!
/usr/sbin/cupsfilter!
Usage: cupsfilter -m mime/type [ options ] filename!
Options:!
-c cupsd.conf Set cupsd.conf file to use!
-e Use every filter from the PPD file!
-j job-id[,N] Filter file N from the specified job (default is file 1)!
-n copies Set number of copies!
-o name=value Set option(s)!
-p filename.ppd Set PPD file!
-t title Set title!
14. Tweak
#1:
OpSons
Cupsfilter
uses
–o
to
set
the
opSons;
convert
uses
-‐a
15. Tweak
#2:
Media
formats
Media
format
opSons
were
"LeIer"
"Legal"
and
"A4"
but
A4
worked
best.
16. What
opSons
did
I
need?
/System/Library/Printers/
Libraries/convert !
-f filename.htm !
-o filename.pdf !
-a landscape !
-a scaling=75 !
-a media=A4!
18. Need
to
automate
ConverSng
hundreds
of
files.
Shell
to
the
rescue!
19. Shell
out
a
soluSon
for name in `ls *.htm` ; do !
/System/Library/Printers/Libraries/convert !
-f $name -o `echo $name !
| sed s/htm/pdf/` !
-a landscape -a scaling=75 -a media=A4; !
done !
20. Room
for
improvement?
• Paul
Hankin
suggested
this
change
for
the
subsStuSon
to
automate
the
conversion:
$
{name/htm/pdf}
instead
of
back
quoSng
using
sed
• Use
cupsfilter
directly;
specify
the
opSons
from
the
manpage.
21. Victory!
World
is
saved;
the
birds
are
singing,
the
rainbows
are
out,
the
sun
is
shining.
*NIX
variant
(OS
X)
to
the
rescue!
I
could
have
used
OS
X,
Linux,
or
CygWin
on
a
PC
for
this.
Ran
in
an
hour
and
some
change
for
100s
of
files
in
a
few
different
directories.
22.
23. CreaSve
Commons
Imagery
List
These
images
are
CreaSve
Commons
licensed
images
I
found
on
Flickr
(through
a
Yahoo
search)
from
the
users
listed
below.
The
excepSons
are
the
Adobe
™
icon
taken
from
the
Adobe
™
website
and
the
wikipedia
page
where
I
got
the
Paper
image
from.
• Reports
image:
artnoose
• QuesSon
Marks:
crystaljingsr
• Manual
labor/man
digging
a
ditch:
worldbank
• Chisels:
cfa
• Australian
Web
Bridge:
Smmythesuk
• Broken
Bridge
(#FAIL):
ghostv
• Light
Bulb
Idea:
preef
• SSck
bug:
safoocat
• Swirls
for
“opSons”
page:
kymberlyanne
• Paper
size
image:
hIp://en.wikipedia.org/wiki/File:A_size_illustraSon2_with_leIer_and_legal.svg
• Super
Hero
clip-‐art:
hIp://www.clker.com/
• Rainbow:
homer4k