@Override
            public int print(Graphics g, PageFormat pf, int ind)throws PrinterException{
                //g.setPaint(Color.black);
                if(ind > printer.kol_chek-1)
                    return NO_SUCH_PAGE;
                Graphics2D g2 = (Graphics2D)g;
                try {
                    BufferedImage bufferedImage = ImageIO.read(new File("/home/terminal/lib/header.png"));
                    //g2.draw
                    g2.drawRenderedImage(bufferedImage, AffineTransform.getTranslateInstance(10,0));
                   // g2.drawImage(bufferedImage,10,10,null);
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                g2.setColor(Color.black);

                g2.setFont(new Font("Arial", Font.ITALIC, 14));
                printer.null_print_line=91;
                g2.drawString(printer.type_pay, 50, printer.null_print_line);
                printer.null_print_line=printer.null_print_line+20;
                g2.setFont(new Font("Arial", Font.ITALIC, 10));
                for (int i=0; i<printer.count_field;i++)
                {
                    g2.drawString(printer.NameTable[i]+" "+printer.JSONTable[i], 15, printer.null_print_line);
                    printer.null_print_line=printer.null_print_line+14;
                }

                g2.setFont(new Font("Arial", Font.ITALIC, 8));
                printer.null_print_line=printer.null_print_line+13;
                // напечатали номер терминала
                if (printer.term.length()<40){
                    printer.null_print_line=printer.null_print_line+7;
                    g2.drawString(printer.term, 15, printer.null_print_line);
                }
                else {
                    int k=printer.term.length()/40;
                    String res="";
                    for (int i=1;i==k;i++)
                    {
                        res = printer.term.substring((i-1)*40,i*40-1);
                        g2.drawString(res, 15, printer.null_print_line);
                        printer.null_print_line=printer.null_print_line+12;
                    }
                    res = printer.term.substring(k*40-1,printer.term.length());
                    g2.drawString(res, 15, printer.null_print_line);
                    printer.null_print_line=printer.null_print_line+12;
                }



                //напечатали спасибо
                g2.setFont(new Font("Arial", Font.ITALIC, 14));
                printer.null_print_line=printer.null_print_line+17;
                g2.drawString("Спасибо :)", 67, printer.null_print_line);
                //g.drawString("Димка привет!", 15, 15);
                //g.setFont(new Font("Times new roman", Font.PLAIN, 10));
                try{
// Если система печати запросила эту страницу первый раз
                   /* if (ind != page){
                        if (eof) return Printable.NO_SUCH_PAGE;
// Читаем строки из файла и формируем массив строк
                        eof = true;
                        page=ind;
                    } */

                    return Printable.PAGE_EXISTS;



                }catch(Exception e){

                    return Printable.NO_SUCH_PAGE;

                }

            }