Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Using Applescript to tell Acrobat Pro 9 to create and save a file

I'm trying to extract a specified page from a pdf file, insert it into a new file, and save the new file.

I have a script that will do the first two steps (i.e. open a specified pdf file and insert a range of pages into a new file) but I can't save the new file.

The save step should be trivial but the basic save command doesn't seem to work. Does anyone have a version that they have used that actually works? I am using Acrobat Pro 9 v9.3.2.

Here is my AppleScript:

set theFile1 to "xxx:sourcefile.pdf" -- the source file from which to extract pages
tell application "Adobe Acrobat Pro"
launch
activate
set doc1 to open theFile1
set mydoc to make new document -- this is where the extracted pages will go
insert pages mydoc after 1 from document 1 starting with <page number of first page to insert> number of pages <number of pages to insert> without insert bookmarks
delete pages mydoc first 1 last 1
-- using insert and delete because replace command gives error.
bring to front mydoc -- can see the new doc on the screen
save mydoc to "path:name.pdf" --- doesn't work!
end tell

MacBook Pro 2.66 Ghz Intel Core 2 Duo, Mac OS X (10.6.3)

Posted on May 16, 2010 4:56 PM

Reply
Question marked as Best reply

Posted on May 16, 2010 7:56 PM

Hi neal_B

Try these suggestions

set Default_Path to (path to desktop as Unicode text)
tell application "Adobe Acrobat Pro"
activate
tell active doc
set _Name to name
if modified is true then
save to file (Default_Path & _Name) -- Save as required… For Certified Document
close
end if
end tell
end tell

another way

-- close front document saving yes


Budgie
2 replies
Question marked as Best reply

May 16, 2010 7:56 PM in response to neal_B

Hi neal_B

Try these suggestions

set Default_Path to (path to desktop as Unicode text)
tell application "Adobe Acrobat Pro"
activate
tell active doc
set _Name to name
if modified is true then
save to file (Default_Path & _Name) -- Save as required… For Certified Document
close
end if
end tell
end tell

another way

-- close front document saving yes


Budgie

Using Applescript to tell Acrobat Pro 9 to create and save a file

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.