Convert this!

Apple includes as part of the Printer Libraries, a small conversion utility.  I presume it is used to help convert certain formats to either PDF or Postscript internally…  But here’s some fun we can have with it.

For example, let’s say we have a file called “my.html”, but using this command line:

/System/Library/Printers/Libraries/convert -f my.html -o my.pdf

You would end up with a PDF version of the HTML file.  Strings doesn’t reveal the Mime Type database, so I can’t tell what mime-types this will convert.  My research indicates that it can handle most native formats from Mac OS X (rtf, Jpeg, gif, png, html, txt and more).

Usage: convert [ options ]

Options:

-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