Extracting text from PDF

Jim Ault JimAultWins at yahoo.com
Sat Feb 23 18:51:59 EST 2008




On 2/23/08 2:47 PM, "Richard Gaskin" <ambassador at fourthworld.com> wrote:

> Kay C Lan wrote:
>> use the launch command to force a pdf to open with TextEdit
>> 
>> use do to run this AppleScript:
>> 
>> tell application "TextEdit"
>>     set tText to the text of document 1
>> end tell
> 
> Maybe this is another Leopard thang, I dunno, I haven't set up my test
> stack for this yet, but in Tiger I can't get Text Edit to open a PDF in
> any meaningful way; that is, it just shows the raw PDF data but doesn't
> render it.
> 
> So my question is whether TextEdit renders PDFs normally in Leopard, or
> if the behavior is the same as under Tiger then how does the "launch"
> command differ from dropping a file on the app's Dock icon?

Preview opens a PDF file, but is not directly Applescriptable, and then
using System Events is fairly difficult and time consuming.

You could open Preview, select all, copy to get the text for all the pages.
There must be a way to use system events to do the same thing.

Also, you could download a trial 30 days of Acrobat Professional and then
Applescript.  Have not done this before.


Jim Ault
Las Vegas





More information about the use-livecode mailing list