how to change android default printing dialog paper size?

只谈情不闲聊 提交于 2020-06-28 04:15:10

问题


I am using default android printer in my application i have followed this link to print the web view.

it gets printing but my problem is when the print dialog opens the default page size is A4 , it is possible to change the paper size to A5 as default?? i tried in google but i can't find the answer, can anyone help me


回答1:


After searching lot i got the answer , you have to change the PrinterAttributes Refer this link

And i android code change is

 PrintAttributes.Builder builder = new PrintAttributes.Builder();
 builder.setMediaSize( PrintAttributes.MediaSize.ISO_A5);
 PrintJob printJob = printManager.print(jobName, printAdapter, builder.build());

That's it.



来源:https://stackoverflow.com/questions/29070743/how-to-change-android-default-printing-dialog-paper-size

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!