hide pdf view's scrollbar

9
Hide scroll bar from PDFView Piyomaru Software Takaaki Naganoya Feb 24, 2017

Upload: takaaki-naganoya

Post on 03-Mar-2017

90 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Hide pdf view's scrollbar

Hide scroll bar from PDFViewPiyomaru Software Takaaki Naganoya

Feb 24, 2017

Page 2: Hide pdf view's scrollbar

Project “PDFViewScrollerTest”

Page 3: Hide pdf view's scrollbar

Now *enclosingScrollView* does not workhttp://stackoverflow.com/questions/24797357/disable-scroll-for-pdfview-inside-nscollectionview

set encScroll to aPDFView’s enclosingScrollView() encScroll’s setHasHorizontalScroller:false encScroll’s setHasVerticalScroller:false

Page 4: Hide pdf view's scrollbar

Program Code (AppleScript)-- -- AppDelegate.applescript -- PDFViewScrollerTest -- -- Created by Takaaki Naganoya on 2017/02/25. -- Copyright © 2017年 Takaaki Naganoya. All rights reserved. --

script AppDelegate property parent : class "NSObject" -- IBOutlets property theWindow : missing value property leftPDF : missing value on applicationWillFinishLaunching:aNotification hideScroller(leftPDF) of me end applicationWillFinishLaunching: on applicationShouldTerminate:sender return current application's NSTerminateNow end applicationShouldTerminate: on clicked:sender set aFile to POSIX path of (choose file with prompt "Select

PDF" of type {"com.adobe.pdf"}) set leftPDFmax to (my dispPDFonAView:leftPDF withFile:aFile) hideScroller(leftPDF) of me end clicked:

on dispPDFonAView:aPDFView withFile:aFile set aURL to current application's |NSURL|'s fileURLWithPath:aFile set newPDFdoc to current application's PDFDocument's alloc()'s

initWithURL:aURL set aPageNum to newPDFdoc's pageCount() aPDFView's setDocument:newPDFdoc aPDFView's setAutoScales:true aPDFView's setDisplaysPageBreaks:true aPDFView's goToFirstPage:(missing value) return aPageNum end dispPDFonAView:withFile: on hideScroller(aObj) set sList to aObj's subviews() set tClass to current application's

NSClassFromString("NSScrollView") repeat with i in sList set aRes to (i's isKindOfClass:tClass) as boolean if aRes = true then (i's setHasHorizontalScroller:false) (i's setHasVerticalScroller:false) end if end repeat end hideScroller end script

Hide horizontal/vertical scroller handler

Call “hideScroller” handler per display PDF/PDFPage

Page 5: Hide pdf view's scrollbar

ResultBefore: After:

Page 6: Hide pdf view's scrollbar

Advertize

Page 7: Hide pdf view's scrollbar

絶賛発売中!(1/3)AppleScriptの詳細な歴史OSバージョンごとの違いなどの資料充実!

https://piyomarusoft.booth.pm

環境依存しないScriptの書き方から、Cocoaの呼び出し方、クラウド系のREST APIの呼び出しまで最新事情にフォーカスした読み物系の本

全148ページ(PDF)

Page 8: Hide pdf view's scrollbar

絶賛発売中!(2/3)AppleScriptの詳細な参考書プログラマ向けの簡素な入門編「最速マスター」ほぼすべての予約語で用例サンプルを掲載

全483ページ(PDF)

iOSとの連携、OfficeやFMのスクリプト内での書き方クリックするとエディタに転送されるサンプル多数掲載

https://piyomarusoft.booth.pm

Page 9: Hide pdf view's scrollbar

絶賛発売中!(3/3)購入者特典!(要メール)

コンテクストメニューからASのほぼすべての基本構文を入力「スクリプトアシスタント」

各種命令のオプション自動入力から、高度なScript書き換え、分析機能、実行したらスリープさせるなどの運用機能を搭載

https://piyomarusoft.booth.pm