You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Win/HTMLViewer Windows/More HTMLViewer Printing
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Open()
if not TargetWin32 then
MsgBox "This example is for Windows only."
end if
End EventHandler
End Class
Class Window1 Inherits Window
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action()
dim p as new Picture(HTMLViewer1.Width, HTMLViewer1.Height, 32)
dim g as Graphics = p.Graphics
dim h as integer = g.Handle(g.HandleTypeHDC)
if h = 0 then
MsgBox "no handle?"
Return
end if
dim ph as ptr = ptr(h)
dim b as Boolean = HTMLViewer1.IEDrawToHDCMBS(ph,"")
if b then
dim pw as new PicWindow
pw.Backdrop = p
pw.show
end if
End EventHandler
End Control
Control HTMLViewer1 Inherits HTMLViewer
ControlInstance HTMLViewer1 Inherits HTMLViewer
End Control
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action()
dim g as Graphics = OpenPrinter
if g = nil then
MsgBox "Failed to open printer"
Return
end if
dim h as integer = g.Handle(g.HandleTypeHDC)
if h = 0 then
MsgBox "no handle?"
Return
end if
dim ph as ptr = ptr(h)
dim PrinterName as string = WindowsPrinterMBS.GetDefaultPrinter
dim b as Boolean = HTMLViewer1.IEDrawToHDCMBS(ph, PrinterName)
End EventHandler
End Control
EventHandler Sub Open()
HTMLViewer1.LoadURL "http://www.monkeybreadsoftware.de/"
End EventHandler
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
Class PicWindow Inherits Window
End Class