then replace the loop commented by : --PDFをページごとに分割してJPEGでファイル書き出し
by this code in which I highlighted the few changes applied.: --PDFをページごとに分割してTIFFでファイル書き出し repeat with i from 0 to (pCount - 1) set thisPage to (aPDFdoc's pageAtIndex:(i)) set thisDoc to (current application's NSImage's alloc()'s initWithData:(thisPage's dataRepresentation())) if thisDoc = missing value then error "Error in getting imagerep from PDF in page:" & (i as string)
set theData to thisDoc's TIFFRepresentation() set newRep to (current application's NSBitmapImageRep's imageRepWithData:theData) set targData to (newRep's representationUsingType:(current application's NSTIFFFileType) |properties|:{NSTIFFCompressionNone:1}) set zText to retZeroPaddingText((i + 1), 4) of me set outPath to addString_beforeExtensionIn_addingExtension_("_" & zText, aPOSIXpath, "tiff")
(targData's writeToFile:outPath atomically:true) --書き出し end repeat
You will get a script splitting the PDF selected in a choose file dialog into TIFF files.
Yvan KOENIG running Sierra 10.12.2 in French (VALLAURIS, France) samedi 7 janvier 2017 17:23:02
|