Android Question PrintAttributes

Robert Valentino

Well-Known Member
Licensed User
Longtime User
I am trying to use this code or something like it from this post by Erel: https://www.b4x.com/android/forum/threads/android-printing-framework.38796/page-2

The below code creates a PrintAttributes what I really need to do is obtain the current PrintAttributes
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

To be able to get the printer margins as described in this post: https://developer.android.com/reference/android/print/PrintAttributes#getMinMargins()

For my post: https://www.b4x.com/android/forum/threads/printer-margins.102764/#content

PrinterAttributes should allow me to get the MediaSize and Margins

public PrintAttributes.MediaSize getMediaSize ()
public PrintAttributes.Margins getMinMargins ()

According to the documentation getMinMargins should give me the minimal margins
B4X:
These margins are physically imposed by the printer and they are not rotated, i.e. they are the same for both portrait and landscape. For example, a printer may not be able to print in a stripe on both left and right sides of the page

ANY Help?
 
Top