public static void main(JSONObject data)
    {
        String pr_string="";
        payment = data;
        Service.WriteLog(payment.toString());
        try {
            pr_string = payment.getString("params");

            File fXmlFile = new File("/home/terminal/lib/print/print.xml");
            DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
            DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
            Document doc = dBuilder.parse(fXmlFile);

            //optional, but recommended
            //read this - http://stackoverflow.com/questions/13786607/normalization-in-dom-parsing-with-java-how-does-it-work
            doc.getDocumentElement().normalize();

            Service.WriteLog("Root element :" + doc.getDocumentElement().getNodeName());
            NodeList nList = doc.getElementsByTagName("field");
            DataTable= new String[nList.getLength()];
            NameTable= new String[nList.getLength()];
            JSONTable= new String[nList.getLength()];
            count_field=nList.getLength();

            for (int temp = 0; temp < nList.getLength(); temp++) {
                Node nNode = nList.item(temp);
                //Service.WriteLog("Current Element :" + nNode.getNodeName());
                if (nNode.getNodeType() == Node.ELEMENT_NODE) {
                    Element eElement = (Element) nNode;
                    Service.WriteLog("data : " + eElement.getElementsByTagName("data").item(0).getTextContent());
                    Service.WriteLog("name : " + eElement.getElementsByTagName("name").item(0).getTextContent());
                    DataTable[temp] = eElement.getElementsByTagName("data").item(0).getTextContent();
                    NameTable[temp] = eElement.getElementsByTagName("name").item(0).getTextContent();
                    try
                    {
                        JSONObject param = new JSONObject(pr_string);
                        JSONTable[temp]=param.getString(DataTable[temp]);
                    }
                    catch (Exception e)
                    {
                        JSONTable[temp]="Ошибка ответа!";
                    }
                    try
                    {
                        JSONObject param = new JSONObject(pr_string);
                        term=param.getString("id_terminal");
                    }
                    catch (Exception e)
                    {
                        term="Ошибка ответа!";
                    }
                }

            }
            try
            {
                kol_chek=1;
                JSONObject param = new JSONObject(pr_string);
                kol_chek = param.getInt("copy_count");

            }
            catch (Exception e)
            {

            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        PrinterJob pj = PrinterJob.getPrinterJob();
        PageFormat pf = pj.defaultPage();
        Paper paper = new Paper();
        //pj.
        paper.setSize(240, 350);
        paper.setImageableArea(0,0, 240, 350);
        pf.setPaper(paper);
        pj.setPrintable(new FilePagePainter("test.doc"), pf);
        try{
            pj.print();
        }
        catch(PrinterException e)
        {

        }
       // System.exit(0);
        cashe_machine.send_json_cashe_answ = "{\"command\":\"print\",\"error\":\"0\"}";

    }