I have a Glassfish server where I generate and save a zpl file (for zebra printers) through a standard web application in the default path / var / tmp.
The saving process does it correctly, immediately after this I want to send it to print on the machine where they are using the web application, but for some reason it does not. I would like to know if you have some tips to be able to achieve this.
Here my code:
//Guardo el archivo
public void saveZplFile(String ID) {
try {
java.io.PrintWriter out = new java.io.PrintWriter(new java.io.FileWriter(new java.io.File(rutaServer)));
out.print(this.zpl);
out.close();
} catch (Exception ex) {
System.out.println("El archivo '" + ruta + "' no pudo se creado. Motivo:\n " + ex.toString());
}
}
//Proceso de impresion
public int print (Graphics g, PageFormat f, int pageIndex)
{
String almacena="";
String rutaServer="/var/tmp/Zebra_1612017.zpl";
if(pageIndex==0) {
try {
BufferedReader br = new BufferedReader(new FileReader(rutilla));
String line;
int valorIncrementa=100;
while ((line = br.readLine()) != null) {
valorIncrementa = valorIncrementa+10;
g.drawString(line, 100,valorIncrementa);
System.out.println("imprimiendo> " + line);
}
} catch (Exception e) {
System.out.println("ERROR DE IMPRESION " + e.toString());
}
return PAGE_EXISTS;
} else
return NO_SUCH_PAGE;
}
This process works in my premises, but when it passes to the test or production server, it does not work.