Platforms to show: All Mac Windows Linux Cross-Platform

/PDFKit/PDFViewControlMBS Test


You find this example project in your Plugins Download as a Xojo project file within the examples folder: /PDFKit/PDFViewControlMBS Test

This example is the version from Tue, 19th Jun 2023.

Project "PDFViewControlMBS Test.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
EventHandler Sub NewDocument() dim f as FolderItem = GetOpenFolderItem(MyFileTypes.Pdf) if f <> nil then OpenDocument f end if End EventHandler
EventHandler Sub OpenDocument(item As FolderItem) dim d as new PDFDocumentMBS(item) if d.pageCount < 1 then return // error? dim p as new PDFWindow dim v as PDFViewMBS = p.PDFView.View v.displaysPageBreaks = true v.autoScales = true v.displayMode = v.kPDFDisplaySinglePage v.document = d dim t as PDFThumbnailViewMBS = p.PDFThumbnailView.View t.maximumNumberOfColumns = 1 t.PDFView = v End EventHandler
End Class
Class PDFWindow Inherits Window
Control PDFView Inherits PDFViewControlMBS
ControlInstance PDFView Inherits PDFViewControlMBS
End Control
Control PDFThumbnailView Inherits PDFThumbnailViewControlMBS
ControlInstance PDFThumbnailView Inherits PDFThumbnailViewControlMBS
EventHandler Sub Open() dim v as PDFThumbnailViewMBS = me.View v.backgroundColor = NSColorMBS.whiteColor End EventHandler
End Control
EventHandler Sub Open() // you can listen for a lot of notifications ListenForNotification PDFViewMBS.PDFViewAnnotationHitNotification ListenForNotification PDFViewMBS.PDFViewAnnotationWillHitNotification ListenForNotification PDFViewMBS.PDFViewChangedHistoryNotification ListenForNotification PDFViewMBS.PDFViewCopyPermissionNotification ListenForNotification PDFViewMBS.PDFViewDisplayBoxChangedNotification ListenForNotification PDFViewMBS.PDFViewDisplayModeChangedNotification ListenForNotification PDFViewMBS.PDFViewDocumentChangedNotification ListenForNotification PDFViewMBS.PDFViewPageChangedNotification ListenForNotification PDFViewMBS.PDFViewPrintPermissionNotification ListenForNotification PDFViewMBS.PDFViewScaleChangedNotification ListenForNotification PDFViewMBS.PDFViewSelectionChangedNotification ListenForNotification PDFViewMBS.PDFViewVisiblePagesChangedNotification End EventHandler
Sub ListenForNotification(NotificationName as string) Dim o As New NSNotificationObserverMBS Static c As NSNotificationCenterMBS = NSNotificationCenterMBS.defaultCenter AddHandler o.GotNotification, WeakAddressOf NotificationReceived c.addObserver o, NotificationName, PDFView.View observers.append o End Sub
Sub NotificationReceived(n as NSNotificationObserverMBS, Notification as NSNotificationMBS) System.DebugLog "Received: " + Notification.Name Dim info As Dictionary = Notification.userInfo If Notification.Name = PDFViewMBS.PDFViewAnnotationHitNotification Then Dim annotation As PDFAnnotationMBS = info.Value("PDFAnnotationHit") Break End If End Sub
Property observers() As NSNotificationObserverMBS
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
MyFileTypes
Filetype application/pdf
End MyFileTypes
End Project

The items on this page are in the following plugins: MBS PDFKit Plugin.


The biggest plugin in space...