Daniel Guerrero Thoughts

Thursday, August 11, 2005

Mac OS X tip

I recently have to convert a lot of docs to pdf's (I made a Search Engine with Lucene, and even with the poi.jar of LuceneInAction 'framework' could index docs, I prefer to do it in PDF).

I used Applescript, but I haven't any example of 'traverse' a dir/folder in applescript, I have to do it by hand (with find and some parsing with greps/seds); so I found a nice command which can convert every 'native' file format of Mac OS X (rtf, jpeg, gif, png, html, txt and a lot more):

/System/Library/Printers/Libraries/convert


For example to convert a rtf document you must use:

/System/Library/Printers/Libraries/convert -i document.rtf -o /Users/danguer/document.pdf -j "application/pdf"

You NEED to put the absolute path to where you want to save your pdf document, because the convert command will try to translate to root directory (document.pdf -> /document.pdf), and don't show any message of error in this case.

1 Comments:

  • Instead of the option "-i" I have to use the option "-f"

    By Blogger Unknown, at 2:23 PM  

Post a Comment

<< Home