Printjob没有更新

时间:2017-11-27 15:52:39

标签: android printing

我需要帮助,请在Android上更新我的printJob。

我正在修改printJobInfo,特别是setCopies参数,但布局仍然将副本数读为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);

但是,这并没有更新我的printJob,它将属性保持为null,副本数量为1,如下所示。

有任何想法吗???

1 个答案:

答案 0 :(得分:0)

您正在测试哪个Android版本?根据此Android bug,PrintAttributes被忽略。这应该在N +设备中修复