Using the Spotlight Importer to Extract Text from a PDF

Ever have a PDF that you need to grab a bunch of text from and don’t want to spend a lot of time selecting and copy/pasting? You can use the Spotlight Importer command-line utility to extract the text on OS X.

/usr/bin/mdimport -d2 /path/to/pdf/file.pdf >& pdf.txt 

It’s the raw text that Spotlight is using to index the file, so you’ll need to do some clean up, but your mouse hand will thank you.

(via Borkware Quickies)

Comments are closed.