问题
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