• 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
problems saving pdf
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

problems saving pdf


  • Subject: problems saving pdf
  • From: RJay Hansen <email@hidden>
  • Date: Wed, 08 Apr 2015 17:00:57 -0500

I'm working on a script that uses Acrobat to extract pages from a PDF and save them to a new file. Here's what I've got right now:

--choose a file to separate/will change to a choose folder?
try
set sourceFile to choose file
set userCancelled to false
on error number -128
set userCancelled to true
end try

if userCancelled then
display dialog "User cancelled."
return
end if

--get the file name then strip out the file extension
tell application "Finder"
set myName to name of sourceFile
set myName to ((characters 1 thru -5 of myName) as string)
end tell
set myName to myName & " FRONT.pdf"

--do acrobat stuff
tell application "Adobe Acrobat Pro"
activate
open sourceFile
set mediaSize to get media box of page 1 of active doc --get media box so our new doc can be made the same size


--make a new document then set its size to the source file size
set newFront to make new document
tell newFront
tell page 1
set media box to mediaSize
end tell
end tell
insert pages newFront after 0 from active doc starting with 1 number of pages 1 insert bookmarks no
bring to front newFront
end tell

--set the file path to save the new docs to
tell me to activate
set folderPath to choose folder with prompt "Choose a folder to save the separated pages to."
set defaultPath to POSIX path of folderPath 
set defaultPath to defaultPath & myName

--save the new doc
tell application "Adobe Acrobat Pro"
activate
tell active doc
set myName to myName & " FRONT.pdf"
if modified is true then
save to file (defaultPath)
end if
end tell
end tell

This does everything I want it to, up to the point of saving. When it attempts to save though, I get this error in Acrobat:

"The file may be read-only, or another user may have it open. Please save the document with a different name or in a different folder."

Any help or pointers appreciated.

Thanks,
RJay


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: problems saving pdf
      • From: "Stockly, Ed" <email@hidden>
    • Re: problems saving pdf
      • From: Shane Stanley <email@hidden>
  • Prev by Date: Re: passing a list to FMPro from Mail
  • Next by Date: OS 10.2.3 Applescript Editor gone.
  • Previous by thread: Re: Different behavior with shell scripts with AppleScript versus terminal
  • Next by thread: Re: problems saving pdf
  • Index(es):
    • Date
    • Thread