Weird brhavior while trying to implement auto cutting functionality in a JAVA application for Thermal printer (Bixolon SRP350 plus)
===

I have a java application to print and auto cut the receipt using a thermal printer (Bixolon srp 350 plus)

Initially i was having problem with auto cutting the receipt but after many trials and google search . I somehow manage to auto cut the receipt. But the problem is that when i deploy the war application in my test machine. It is printing fine but it is not cutting the paper at the end. I even deployed the war file into my development machine's tomcat and it is auto cutting fine.

Both the development machine and the test machine are using windows 7 - ultimate. 
Both the development machine and the test machine are  using the same apache-tomcat-6.0.18 , 
And using JDK6/JRE6 . 

Initially the Test machine has a jre6 installed and after auto cutting was unsuccessful . I installed jdk6 which i was using in my development machine to no success.

The two machines are of different brand with different hardware configuration. 
Can anyone please help me out on this? Is this something to do with the previous JRE6 installed and was not properly removed from windows registry?

I am using grails 1.3.7 along with mysql 5.5. 

my code is below



	public void printBill(String printData) throws Exception {
		PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();    
		pras.add(new Copies(5));    
		pras.add(new PrinterResolution(180,180,PrinterResolution.DPI)); 


		PrintService pss[] = PrintServiceLookup.lookupPrintServices(null,pras);    
		if (pss.length == 0)    {
			throw new RuntimeException("No printer services available."); 
		}

		if(printData == null) {
			throw new Exception("nothing to print");
		}

		PrintService ps = pss[0];    

		DocPrintJob job = ps.createPrintJob();
		DocAttributeSet das = new HashDocAttributeSet();    
		das.add(new PrinterResolution(180,180,PrinterResolution.DPI));

		byte[] desc = printData.getBytes();
		Doc doc = new SimpleDoc(desc, DocFlavor.BYTE_ARRAY.AUTOSENSE, das);    
		
		try {
			job.print(doc, pras);
			cutPaper();
		} catch (Exception e) {
			e.printStackTrace();
		} 
	}
	
	/*
	 *  TODO improvision to auto cut bill, need to find a proper way to cut
	 */
	private  void cutPaper() throws Exception{
		TempPageCutter pageCutter = new RestaurantPrinter().new TempPageCutter();

		pageCutter.cutReceipt();

	}

	private class TempPageCutter implements Printable {

		@Override
		public int print(Graphics graphics, PageFormat pageFormat, int pageIndex)
				throws PrinterException {
			if(pageIndex > 0)
				return NO_SUCH_PAGE;

			System.out.println("Cutting");
			graphics.drawString("", 0, 0);

			return PAGE_EXISTS;
		}

		public void cutReceipt() throws PrinterException {
			System.out.println("cutReceipt");
			PrintService[]  printService =  PrinterJob.lookupPrintServices();

			if(printService == null || printService.length < 1) {
				return;
			}
			PrinterJob job = PrinterJob.getPrinterJob();
			job.setPrintable(this);
			job.print();
		}


	}


If anyone can help me out with a better way to implement the auto cutting functionality it will be a great help.

Thanks 

Dave