Android Question How print without preview with printManager

MicroDrie

Well-Known Member
Licensed User
Longtime User
If you can show with a small sample program what you want and have already achieved, we can give you a much more applicable tailor-made answer.
 
Upvote 0

pcicom

Member
Licensed User
Longtime User
This is a sample to print with preview
How disabled preview and print direct ?

B4X:
Sub CreatePrinterAttributes As JavaObject
   Dim builder As JavaObject
   builder.InitializeNewInstance("android.print.PrintAttributes.Builder", Null)
   Dim mediaSize As JavaObject
   mediaSize = mediaSize.InitializeStatic("android.print.PrintAttributes.MediaSize").GetField("ISO_A6")
   Return builder.RunMethod("build", Null)
End Sub

Sub CreateWebPrintJob (wv As WebView)
    DIm jwv As JavaObject = wv
    Dim jPrintManager As JavaObject = jwv.RunMethodJO("getContext", null).RunMethod("getSystemService", Array As Object("print"))
  
    Dim jPrintAdapter As JavaObject = jwv .RunMethod("createPrintDocumentAdapter", null)
    dim jobName as String = "Document"
   jPrintManager.RunMethod("print", Array As Object(jobName, jPrintAdapter, CreatePrinterAttributes ))
End Sub
 
Upvote 0
Top