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.
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