AppleScript名:PDFのサイズをpointで取得 |
— Created 2017-06-16 00:44:52 +0900 by Takaaki Naganoya — 2017 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" use framework "Quartz" use framework "AppKit" set aHFSPath to (choose file of type {"com.adobe.pdf"} with prompt "Select PDF") set aPOSIX to POSIX path of aHFSPath set aURL to (current application’s |NSURL|’s fileURLWithPath:aPOSIX) set aPDFdoc to current application’s PDFDocument’s alloc()’s initWithURL:aURL set pCount to aPDFdoc’s pageCount() set aPage to aPDFdoc’s pageAtIndex:0 –PDFのサイズを取得する(単位:Point) set aBounds to aPage’s boundsForBox:(current application’s kPDFDisplayBoxMediaBox) set aSize to |size| of aBounds –> {width:595.28, height:841.89} |
More from my site
(Visited 261 times, 3 visits today)
PDFのサイズをpointで取得 v2 – AppleScriptの穴 says:
[…] 以前に掲載したバージョンでは、macOS 10.13以降でboundsの値の返り方が変わったことに対応できていないので、対処してみました。 […]