Earlier today, I needed to come up to speed quickly on IBM WebSphere MQ, a complex piece of enterprise software so I could discuss it with a senior manager at a potential consulting client. The easiest way to do this was to read an introductory whitepaper on Websphere MQ that would provide me with a very high level understanding of the software and some applications of it.
The problem was that I didn’t have time to read the whitepaper because it’s a 32 pages document and I needed to be at the client’s office in less than two hours. I decided to take a few minutes and try to use my Mac to convert the text of the document to an audio file that I could listen to on my iPhone while driving.
I based my solution on the idea published by Ben Waldie in Automator Power: Variables and Looping that was published in the February issue of Macworld. Ben’s solution has two limitations:
- It’s Mac-only, which is not a problem for me.
- It’s intended to handle articles from RSS and Atom feeds, and what I needed was to read the text contained in a PDF file.
My adaptation neatly extracts the text out of the PDF file and uses the same suggested MacOS services to create the audio file. Here’s how I did it:
Before I began writing my Automator workflow, I needed to install PDFtoText, a shell program that converts PDF documents into plain text. Carsten Blüm built a DMG installer for this open source utility.
My Automator workflow is as follows:
- Internet: Get Specified URLs to retrieve ftp://ftp.software.ibm.com/software/integration/wmq/WS_MQ_Messaging_Backbone_for_SOA.pdf.
- Internet:Download URLs to the Downloads directory.
-
Utilities:Run Shell Script on the following script using the “/bin/bash” shell:
/usr/local/bin/pdftotext
/Users/…/WS_MQ_Messaging_Backbone_for_SOA.pdf
/Users/…/WS_MQ_Messaging_Backbone_for_SOA.textThis invokes the utility to read the PDFtoText converter and extract the text from the PDF file. The text above is one continuous command statement separated by spaces. Substitute your home directory and “/Downloads” for the ellipsis in the previous two lines.
- Files & Folders: Open Finder Items to open the text file created above.
- Text: Get Contents of TextEdit Document extracts the text out of the file.
- Text: Text to Audio File reads the extracted text into an AIFF file. I store it that file in the Downloads directory to be consistent.
- Music: Import Audio Files brings the file into iTunes. I use the AAC Encoder and delete the source AIFF file after I’ve encoded it.
- Music: Add Songs to Playlist to add the new audio file to a playlist I call “Technology Reading”.
This workflow worked incredibly well for me. It should work well for you too, assuming you can fast forward through things that aren’t meant to be read like tables of contents, page numbers, and the text that is contained in tables and charts.
This technique is going to change the way I prepare for meetings with potential clients. Now I can listen to PDF documents on the way to an important meeting and not have to worry about trying to scan my notes while driving.