• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Acrobat 5.0 and extracting pages
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Acrobat 5.0 and extracting pages


  • Subject: Re: Acrobat 5.0 and extracting pages
  • From: "Marc K. Myers" <email@hidden>
  • Date: Tue, 7 Oct 2003 01:31:26 -0400

I'm attempting to write an Acrobat 5.0 script (for OS 9) that will extract each page of an input PDF and create individual PDFs from each page. This is what I've got so far:

set myPath to (path to me) as text
set {od, AppleScript's text item delimiters} to ,
{AppleScript's text item delimiters, ":"}
set myPath to text items 1 thru -2 of myPath
set end of myPath to "dummy.pdf"
set dummyPath to (myPath as text)
set myPath to ((items 1 thru -2 of myPath) as text) & ":"
set AppleScript's text item delimiters to od
set inFile to alias "New Guy:Users:marc:Desktop:test copy.pdf"
set inName to "test copy.pdf"
try
alias dummyPath
on error
display dialog "The dummy.pdf file is missing from the folder containing " & ,
"this script's file" buttons {"Cancel"} default button 1
end try
tell application "Office:Adobe Acrobat 5.0:Acrobat 5.0"
open {inFile}
set pageCnt to (count document 1 each page)
repeat with i from 1 to pageCnt
set prfNbr to text -3 thru -1 of ("00" & (i as text))
tell application "Finder"
set newFile to (duplicate alias dummyPath) as alias
set newName to prfNbr & inName
set name of newFile to newName
end tell
open {newFile}
insert pages document 2 after i from document 1 ,
starting with i number of pages 1
delete pages document 2 first 1 last 1
close document 2 saving yes
end repeat
close document 1 saving no
quit
end tell

The "dummy.pdf" file is a one page PDF that will be duplicated for use as target files for the extracted pages. It'll reside in the same folder as the script. In this case, since I'm testing in Script Editor, it sits in the folder with Script Editor. The "test copy.pdf" file is the source. It's six pages long, so I should end up with six one page PDFs. I think the code looks pretty good but I get an execution error on the "insert pages" command. The message reads, "Acrobat 5.0 got an error: document 2 doesn't understand the insert pages message".

Has anyone got an idea where I'm going wrong?

I'll appreciate any help I can get.

Marc [10/07/03 1:28:09 AM]
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: And another question... (cron and osascript)
  • Next by Date: Re: Drop box script
  • Previous by thread: Re: Drop box script
  • Next by thread: Re: Option key (was Re: Sorting)
  • Index(es):
    • Date
    • Thread