Thanks to this forum help, I have now been able to silently generate a picture, to load it later in a WebView and print it with CreatePrinterAttributes and CreateWebPrintJob as described by Erel here :
https://www.b4x.com/android/forum/threads/android-printing-framework.38796/page-2#post-247461
It works fine, but I need to adjust the margins. Top margin is slightly over an inch, left and right margins are 1/2 inch. That is much too much for what I want to do.
Would it be possible in createprinterattribute to set the margins ?
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
I found this
https://developer.android.com/reference/android/print/PrintAttributes.Margins.html
but am a bit lost about how to apply it.
			
			https://www.b4x.com/android/forum/threads/android-printing-framework.38796/page-2#post-247461
It works fine, but I need to adjust the margins. Top margin is slightly over an inch, left and right margins are 1/2 inch. That is much too much for what I want to do.
Would it be possible in createprinterattribute to set the margins ?
			
				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 SubI found this
https://developer.android.com/reference/android/print/PrintAttributes.Margins.html
but am a bit lost about how to apply it.
			
				Last edited: 
			
		
	
								
								
									
	
		
			
		
	
								
							
							 
				 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		