【发布时间】:2013-05-19 23:56:20
【问题描述】:
我有一个包含多个页面的文档。我想先打印所有页面,然后再打印第一页。
是否有我可以设置的属性 (PrintRequestAttributeSet) 以确保它只打印第一页?我没有找到可以使用 PrintRequestAttributeSet 设置的所有属性的列表。
【问题讨论】:
我有一个包含多个页面的文档。我想先打印所有页面,然后再打印第一页。
是否有我可以设置的属性 (PrintRequestAttributeSet) 以确保它只打印第一页?我没有找到可以使用 PrintRequestAttributeSet 设置的所有属性的列表。
【问题讨论】:
您应该使用PageRanges 属性只打印文档的第一页:
DocPrintJob printJob = printService.createPrintJob();
HashPrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
attributes.add(new PageRanges(1));
printJob.print(pdfDoc, attributes);
支持属性的完整列表可以在PrintRequestAttribute的文档页面中找到。
【讨论】: