2013-05-19 69 views
1

我有一个有多个页面的文档。我想先打印所有页面,然后再打印第一页。仅打印多页的一页pdf

是否有一个属性可以设置(PrintRequestAttributeSet)以确保它只打印第一页?我没有找到可以使用PrintRequestAttributeSet设置的所有属性的列表。

回答

1

您应该使用PageRanges属性只打印文档的第一页:

DocPrintJob printJob = printService.createPrintJob(); 
HashPrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet(); 
attributes.add(new PageRanges(1)); 
printJob.print(pdfDoc, attributes); 

支持的属性的全部列表可以在PrintRequestAttribute的文档页面中找到。