Sub Globals
Private xui As XUI
Private Print As Printer
End Sub
Sub Activity_Create(FirstTime As Boolean)
Print.Initialize("")
PrintBmp(File.DirAssets, "test.gif")
End Sub
Sub PrintBmp (Dir As String, FileName As String)
Dim wv As WebView
wv.Initialize("wv")
wv.LoadUrl(xui.FileUri(Dir, FileName))
Activity.AddView(wv, 0, 0, 100%x, 100%y)
Wait For wv_PageFinished (Url As String)
wv.RemoveView
Dim PrintAttributesBuilder As JavaObject
PrintAttributesBuilder.InitializeNewInstance("android.print.PrintAttributes.Builder", Null)
Dim resolution As JavaObject
resolution.InitializeNewInstance("android.print.PrintAttributes.Resolution", Array("id1", "id2", 600, 600)) 'dpi
PrintAttributesBuilder.RunMethod("setResolution", Array(resolution))
Dim jo As JavaObject = Print
jo.RunMethod("PrintWebView", Array("JobName", wv, PrintAttributesBuilder.RunMethod("build", Null)))
End Sub