An Automator workflow for extracting text as speech from PDF files I get PDFs to revise course content which I want to convert to MP3 files and take with me as spoken audio.

Automator offers 'text to speech' conversion and it's great. When I try and build a workflow around it, seemingly everything happens except what I need.

I want, as a folder action:


To extract the text from a PDF dropped on the relevant folder
To get this text turned into spoken audio
To provide details for iTunes
Import this into a playlist of my choosing


I currently have variations on this sequence, which does not work:


Extract PDF Text, save
Convert text to Audio, save
Import Audio
Give iTunes info
Add title to PlayList


Currently the PDF text gets extracted, doesn't end up where I expect, and the script then seems to hang on generating the audio. Simple TextEdit documents work fine.

What's wrong?

(This question is a continuation of one I asked yesterday: here)
While Automator is pretty useful, I personally find the Terminal / command line a nice place to solve problems like this.

The basic idea is still using the steps you describe, but doing all the work from the command line. I researched a useful PDF-to-Text converter, and I found PDFminer quite useful. If you can get it to run, half of your work is done!

pip install pdfminer


Step one and two, then can be solved with this one-liner in Terminal:

pdf2txt.py example.pdf | say -v Daniel -o example.aiff


Still missing is the addition of metadata — what do you need here: Title / Album / "Artist"?

In a final step, you would add the file to a certain iTunes playlist. Depending on your ideal workflow, one then could build a little LaunchAgent that monitors a folder for new files...