JBoss AS 7中的PrintServiceLookup.lookupPrintService解决方案 [英] PrintServiceLookup.lookupPrintService solution in JBoss AS 7
问题描述
我正在尝试从我的JSF Web应用程序中打印pdf文档。
当我从main方法调用方法 findPrinter()
时, PrintServices $找到c $ c>,但是当我从网页上调用此方法
找不到PrintService
时。下面提到的代码..
public static void main(final String [] args)抛出异常{
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 =Printaction =#{printTest.findPrinter()}/>
< / h:form>
任何建议......
路径名= sun / print
从您的JRE打开resources.jar,并提取
META-INF / services / javax.print.PrintServiceLookup并复制到位置
modules / sun / jdk / main / service-loader-resources / META-INF / JbossAS服务。
重新启动JBoss并运行该应用程序。
I am trying to print a pdf document from my JSF web application.
When I call the method findPrinter()
from main method, PrintServices
are found, but when I call this method from web page PrintService
are not found. Code mentioned below..
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>
Any suggestions...
Add extra tag in modules/sun/jdk/main/module.xml of jbossAs as mentioned: path name="sun/print"
Open up resources.jar from your JRE, and extract
META-INF/services/javax.print.PrintServiceLookup and copy to location modules/sun/jdk/main/service-loader-resources/META-INF/services of JbossAS.Restart JBoss and run the application.
这篇关于JBoss AS 7中的PrintServiceLookup.lookupPrintService解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!