Android Question How to set default paper size to A4 on printing dialog

Inman

Well-Known Member
Licensed User
Longtime User
I am using the code given by Erel here to generate a PDF file in A4 size and use print framework to print it. But when the print preview comes up, the paper size is always Letter. User has to manually change to A4 before printing. I found a java code with which we can set the default print size via code.

This java example is for A5 size. Could you please post B4A code for A4?

https://stackoverflow.com/questions...ge-android-default-printing-dialog-paper-size
 

Inman

Well-Known Member
Licensed User
Longtime User

Thanks Erel. I am close to the solution.
B4X:
 Dim jo As JavaObject = Print

 jo.RunMethod("PrintWebView", Array("JobName", wv, PrintAttributesBuilder.RunMethod("build", Null)))
What is the correct format for the above to use PrintPdf instead? I tried the following and it said Method: PrintPdf not matched.
B4X:
jo.RunMethod("PrintPdf",Array("job",rp.GetSafeDirDefaultExternal(""), "1.pdf",PrintAttributesBuilder.RunMethod("build", Null)))
 
Upvote 0
Top