Aguém poderia me ajudar por favor! Estou Tentando imprimir numa Impressora não fiscal Daruma DR800 cabo usb. Quando executo o projeto no eclipse consigo imprimir, mas quando coloco o .war no servidor Não acha a impressora.
[code]
FacesContext context = FacesContext.getCurrentInstance();
ServletContext servletContext = (ServletContext) context.getExternalContext().getContext();
String caminhoRelatorio = servletContext.getRealPath("/relatorios/pedido/pedidoSeparado.jasper");
PrinterLister pLister = new PrinterLister();
pLister.getPrinters();
HttpServletResponse response2 = (HttpServletResponse) context.getExternalContext().getResponse();
response2.setContentType(“text/plain”);
if (produtos.size()>0) {
JRBeanCollectionDataSource dataSource = new JRBeanCollectionDataSource(produtos, false);
JasperPrint impressao = JasperFillManager.fillReport(caminhoRelatorio, mapFicha, dataSource);
@SuppressWarnings("unused")
PrintServiceAttributeSet printServiceAttributeSet = new HashPrintServiceAttributeSet();
printServiceAttributeSet.add(new PrinterName(impressora.getImpressora , null));
JRPrintServiceExporter exporter = new JRPrintServiceExporter();
exporter.setExporterInput(new SimpleExporterInput(impressao));
SimplePrintServiceExporterConfiguration configuration = new SimplePrintServiceExporterConfiguration();
//configuration.setPrintRequestAttributeSet(printRequestAttributeSet);
configuration.setPrintServiceAttributeSet(printServiceAttributeSet);
configuration.setDisplayPageDialog(false);
configuration.setDisplayPrintDialog(false);
exporter.setConfiguration(configuration);
exporter.exportReport();
}
//FacesContext.getCurrentInstance().responseComplete();
FacesContext.getCurrentInstance().renderResponse();
[\code
Quando rodo pelo eclipse funciona. Mas quando coloco na pasta webapp não encontra o caminho da impressora. O meu getImpressora retorna: \servidor\nomeImpressora
Desde ja agradeço.