AppleScript名:PDFを印刷するテスト v2 |
— Created 2015-08-24 by Takaaki Naganoya — Modified 2018-03-24 by Takaaki Naganoya — 2018 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" use framework "Quartz" use framework "AppKit" –Choose a PDF to print set aDoc to POSIX path of (choose file of type {"com.adobe.pdf"}) my performSelectorOnMainThread:"printPDF:" withObject:aDoc waitUntilDone:true on printPDF:anObject set aDocPath to current application’s NSString’s stringWithString:anObject set aPDF to current application’s PDFDocument’s alloc()’s initWithURL:(current application’s |NSURL|’s fileURLWithPath:aDocPath) –Make PDFView set aPDFView to current application’s PDFView’s alloc()’s init() aPDFView’s setDocument:aPDF aPDFView’s setAutoScales:true aPDFView’s setDisplaysPageBreaks:false –Make Window set aWin to current application’s NSWindow’s alloc()’s init() aWin’s setContentSize:(aPDFView’s frame()’s |size|()) aWin’s setContentView:aPDFView aWin’s |center|() –Print PDF set sharedPrintInfo to current application’s NSPrintInfo’s sharedPrintInfo() aPDFView’s printWithInfo:sharedPrintInfo autoRotate:true end printPDF: |
More from my site
(Visited 86 times, 1 visits today)