Private Sub GetPrinter(Name As String) As Printer
Dim Printers As List = Printer_Static.GetAllPrinters
For Each P As Printer In Printers
If P.GetName.StartsWith(Name) Then Return P
Next
Return Null
End Sub
And call using:
B4X:
Dim P As Printer = GetPrinter("Foxit")
If P <> Null And P.IsInitialized Then
Dim PJ As PrinterJob = PrinterJob_Static.CreatePrinterJob2(P)
PJ.PrintPage(Pane1)
PJ.EndJob
Else
Log("Printer not found")
End If
Private Sub GetPrinter(Name As String) As Printer
Dim Printers As List = Printer_Static.GetAllPrinters
For Each P As Printer In Printers
If P.GetName.StartsWith(Name) Then Return P
Next
Return Null
End Sub
And call using:
B4X:
Dim P As Printer = GetPrinter("Foxit")
If P <> Null And P.IsInitialized Then
Dim PJ As PrinterJob = PrinterJob_Static.CreatePrinterJob2(P)
PJ.PrintPage(Pane1)
PJ.EndJob
Else
Log("Printer not found")
End If
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.