我想从我的JSF Web应用程序中打印PDF文档。JBoss AS 7中的PrintServiceLookup.lookupPrintService解决方案
当我从主要方法调用findPrinter()
的方法时,发现PrintServices
,但是当我从网页PrintService
找不到这种方法时。下面的代码中提到..
public static void main(final String[] args) throws Exception {
PrintTest printTest = new PrintTest();
printTest.findPrinter();
}
public void findPrinter() {
PrintService[] printServices = PrinterJob.lookupPrintServices();
System.out.println("Print Services Length :: " + printServices.length);
for (PrintService printService : printServices) {
System.out.println("PrintService :: " + printService);
}
<h:form>
<p:commandButton value="Print" action="#{printTest.findPrinter()}"/>
</h:form>
任何建议...
在Web应用程序的情况下,您将搜索连接到服务器的打印机,不是吗? –
是的,我会搜索打印机的配置到服务器.. –
它是如何“不工作”你有任何错误或只是一个空的列表? –