Printjob not updating

对着背影说爱祢 提交于 2019-12-13 02:58:41

问题


I need help please with updating my printJob on Android.

I am modifying the printJobInfo, specifically the setCopies parameter but the layout still reads the number of copies as 1:


PrintManager printManager = (PrintManager) currentActivity.getSystemService(Context.PRINT_SERVICE);

PrintAttributes.Builder attbuilder = new PrintAttributes.Builder();
attbuilder.setMediaSize( PrintAttributes.MediaSize.ISO_A4);

PrintJob newPrintJob = printManager.print(jobName, pda, null);
PrintJobInfo newPrintJobInfo = newPrintJob.getInfo();

PrintJobInfo.Builder jobBuilder = new PrintJobInfo.Builder(newPrintJobInfo);
jobBuilder.setCopies(numberOfCopies);
jobBuilder.setPages(new PageRange[] {PageRange.ALL_PAGES});
jobBuilder.setAttributes(attbuilder.build());

getActivity().getIntent().putExtra(PrintService.EXTRA_PRINT_JOB_INFO, newPrintJobInfo);
getActivity().setIntent(getActivity().getIntent());
getActivity().setResult(Activity.RESULT_OK, result);

However, this is not updating my printJob which keeps the attributes as null and the number of copies as 1 as seen in the .

Any ideas please???


回答1:


Which Android version are you testing on? According to this Android bug, PrintAttributes were ignored. This should be fixed in N+ devices



来源:https://stackoverflow.com/questions/47514909/printjob-not-updating

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