• 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: Can Acrobat PDF's be saved as single pages via Applescript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can Acrobat PDF's be saved as single pages via Applescript


  • Subject: Re: Can Acrobat PDF's be saved as single pages via Applescript
  • From: Brian Christmas <email@hidden>
  • Date: Sun, 08 Jan 2017 09:20:00 +1100

G’day Again all, particularly Yvan.

Emmanuel, I wish I could use Smile, but I was under strict instructions 9 years ago not to use 3rd part scripting additions.

Ray, I think your method would be nearly as slow as my GUI, but I’ll try it if I can’t get Yvan's suggestion to work.

I’m trying to convert the script to work, but keep striking problems.

So far I’ve got to the 'set p to 5' part, then I’m at a loss what to do. It seems every ‘current application’ needs removing, which I’ve done, but some of the commands no longer seem to work.

Any advice, please?

Error is…

printAdobeAcrobat split Document into pages main handler subroutine, error Adobe Acrobat got an error: page 1 of document "20160307172114111.pdf" doesn’t understand the “dataRepresentation” message.
error number -1708 p = 5

WAS  set thisDoc to (current application’s NSImage’s alloc()’s initWithData:(thisPage’s dataRepresentation()))

Also  repeat with i from 0 to (pCount - 1)
  set thisPage to (aPDFdoc’s pageAtIndex:(i))
did not work

Regards

Santa

 
tell application "Adobe Acrobat"
try
set p to 3.1
activate
set aPDFdoc to document 1
set p to 3.2
set pCount to count of pages of aPDFdoc
set p to 3.3
if my RunForOz then say pCount as text
set p to 3.4
set aPOSIXpath to POSIX path of ((path to desktop as text) & "Temporary Acrobat TIFFS" & ":" & name of document 1)
set p to 3.5
set compFactor to 1.0 - 0.0 # max jpeg compression, 1.0 = none


repeat with i from 1 to pCount
set thisPage to page i of document 1
set p to 5
set thisDoc to (NSImage's alloc()'s initWithData:(thisPage's dataRepresentation()))
set p to 6
if thisDoc = missing value then
set p to 7
tell application "System Events" to display dialog "Error in getting imagerep from PDF in page:" & (i as string) giving up after 20
end if


try
set p to 8
set theData to thisDoc's TIFFRepresentation()
set p to 9
set newRep to (NSBitmapImageRep's imageRepWithData:theData)
set p to 10
set targData to (newRep's representationUsingType:(NSTIFFFileType) |properties|:{NSTIFFCompressionNone:1, NSImageProgressive:false})
set p to 11
set zText to retZeroPaddingText((i + 1), 4) of me
set p to 12
set outPath to addString_beforeExtensionIn_addingExtension_("-" & zText, aPOSIXpath, "tiff")
on error errmsg number errnum
set my didItPrint to false
set end of my tempPrintingErrors to "Acrobat split Document into pages start 1"
tell application "System Events" to display dialog "printAdobeAcrobat split Document into pages start Part 1, error " & errmsg & return & "error number " & errnum & " p = " & p giving up after 20
end try
try
(targData's writeToFile:outPath atomically:true)
on error
set theData to thisDoc's TIFFRepresentation()
set newRep to (NSBitmapImageRep's imageRepWithData:theData)
set targData to (newRep's representationUsingType:(NSJPEGFileType) |properties|:{NSImageCompressionFactor:1, NSImageProgressive:false})
set zText to retZeroPaddingText((i + 1), 4) of me
set outPath to addString_beforeExtensionIn_addingExtension_("-" & zText, aPOSIXpath, "jpg")
try
(targData's writeToFile:outPath atomically:true)
on error errmsg number errnum
set my didItPrint to false
set end of my tempPrintingErrors to "Acrobat split Document into pages start 2"
tell application "System Events" to display dialog "printAdobeAcrobat split Document into pages start Part 2, error " & errmsg & return & "error number " & errnum giving up after 20
end try
end try
end repeat
on error errmsg number errnum
set my didItPrint to false
set end of my tempPrintingErrors to "Acrobat split Document into pages main handler subroutine"
tell application "System Events" to display dialog "printAdobeAcrobat split Document into pages main handler subroutine, error " & errmsg & return & "error number " & errnum & " p = " & p giving up after 20
end try
end tell


 _______________________________________________
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: Can Acrobat PDF's be saved as single pages via Applescript
      • From: Shane Stanley <email@hidden>
    • Re: Can Acrobat PDF's be saved as single pages via Applescript
      • From: Ray Robertson <email@hidden>
References: 
 >Can Acrobat PDF's be saved as single pages via Applescript (From: Brian Christmas <email@hidden>)
 >Re: Can Acrobat PDF's be saved as single pages via Applescript (From: Yvan KOENIG <email@hidden>)

  • Prev by Date: Re: Can Acrobat PDF's be saved as single pages via Applescript
  • Next by Date: Re: Can Acrobat PDF's be saved as single pages via Applescript
  • Previous by thread: Re: Can Acrobat PDF's be saved as single pages via Applescript
  • Next by thread: Re: Can Acrobat PDF's be saved as single pages via Applescript
  • Index(es):
    • Date
    • Thread