Ver Mensaje Individual
  #1 (permalink)  
Antiguo 02/08/2013, 12:01
Avatar de jibran
jibran
 
Fecha de Ingreso: mayo-2011
Ubicación: Estado de Mexico
Mensajes: 27
Antigüedad: 12 años, 11 meses
Puntos: 0
Imprimir desde Servlet directamente en el lado del CLiente

Ayuda por favor tengo el siguiente BLOQUE DE CODIGO en un servlet que genera un pdf a partir de un archivo jrxml...

Código Java:
Ver original
  1. try {
  2.             String iventa=request.getParameter("ventaJs");
  3.             int idVenta=Integer.parseInt(iventa);
  4.             Class.forName("com.mysql.jdbc.Driver");
  5.             Connection conexion = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/puntoDeVenta", "root", "123qwe2");
  6.             JasperReport repTick=(JasperReport) JRLoader.loadObject(getServletContext().getRealPath("WEB-INF/ticket25092011.jasper"));
  7.             Map param=new HashMap();
  8.             param.put("idVentaActual", idVenta);
  9.             byte[] fichero= JasperRunManager.runReportToPdf(repTick, param, conexion);
  10.             response.setContentType("application/pdf");
  11.             response.setContentLength(fichero.length);
  12.             ServletOutputStream out = response.getOutputStream();
  13.             out=response.getOutputStream();
  14.             out.write(fichero, 0, fichero.length);
  15.             out.flush();
  16.             out.close();
  17.             //conexion.commit();
  18.             conexion.close();
  19.         }
  20.         catch(ClassNotFoundException ex){
  21.            
  22.         }
  23.         catch(SQLException ex){
  24.            
  25.         }
  26.         catch(JRException ex){
  27.            
  28.         }
  29.         finally {            
  30.             //out.close();
  31.         }

Alguien me puede ayudar?? necesito que se imprima en la impresora local de donde se este ejcutando la aplicacion web..