Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/MacControls/NSPrintOperation HTMLViewer
Function:
Required plugins for this example: MBS MacBase Plugin, MBS MacCocoa Plugin, MBS MacControls Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacControls/NSPrintOperation HTMLViewer
This example is the version from Mon, 22th Nov 2015.
Project "NSPrintOperation HTMLViewer.rbp"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control PageSetupButton Inherits PushButton
ControlInstance PageSetupButton Inherits PushButton
EventHandler Sub Action() NSPageLayoutMBS.runPageLayout End EventHandler
End Control
Control PrintDialogButton Inherits PushButton
ControlInstance PrintDialogButton Inherits PushButton
EventHandler Sub Action() 'PrintInfo.horizontalPagination = PrintInfo.NSAutoPagination printinfo.verticalPagination = PrintInfo.NSAutoPagination dim o as NSPrintOperationMBS = NSPrintOperationMBS.printOperationWithView(HTMLViewer1.WebViewMBS, PrintInfo) o.showsPrintPanel = true o.runOperationModalForWindow(Self) o = nil End EventHandler
End Control
Control PrintButton Inherits PushButton
ControlInstance PrintButton Inherits PushButton
EventHandler Sub Action() dim o as NSPrintOperationMBS = NSPrintOperationMBS.printOperationWithView(HTMLViewer1) o.showsPrintPanel = false o.runOperationModalForWindow(Self) o = nil End EventHandler
End Control
Control PrintPDFButton Inherits PushButton
ControlInstance PrintPDFButton Inherits PushButton
EventHandler Sub Action() dim f as FolderItem = SpecialFolder.Desktop.Child("test.pdf") dim w as WebViewMBS = HTMLViewer1.WebViewMBS dim o as NSPrintOperationMBS = NSPrintOperationMBS.PDFOperationWithView(w, w.bounds, PrintInfo, f) o.runOperationModalForWindow(Self) o = nil f.launch End EventHandler
End Control
Control HTMLViewer1 Inherits HTMLViewer
ControlInstance HTMLViewer1 Inherits HTMLViewer
EventHandler Sub Open() me.LoadURL "http://www.mbs-plugins.de" 'me.LoadURL "file:///Users/cs/Desktop/test.html" End EventHandler
End Control
EventHandler Sub Open() if TargetCocoa then PrintInfo = NSPrintInfoMBS.sharedPrintInfo else MsgBox "Please run as Cocoa Mac app." end if PrintInfo.HorizontallyCentered = false PrintInfo.VerticallyCentered = false PrintInfo.verticalPagination = PrintInfo.NSAutoPagination End EventHandler
Property PrintInfo As NSPrintInfoMBS
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
End Project

Feedback, Comments & Corrections

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





Links
MBS Xojo Chart Plugins