public int print(Graphics g, PageFormat pf, int page) throws
                                                        PrinterException 
    {
        try {
            if (page > 0) { /* We have only one page, and 'page' is zero-based */
                return NO_SUCH_PAGE;
            }
            gHoa_don = (Graphics2D)g;
            gHoa_don.setFont(pFont_time);
            gHoa_don.translate(pf.getImageableX(), pf.getImageableY()-65);
            gHoa_don.setClip(pX_align, 0,200,5000);
            switch (print_type)
            {
                        
                case 0:
                    System.out.println("print_bill();");
                    print_bill();
                    break;
                case 1:
                    System.out.println("print_barcode();");
                    print_barcode(pf);
                    break;
                default :
                    
            }
            return PAGE_EXISTS;
        } catch (WriterException ex) {
            Logger.getLogger(Bill_Printer.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(Bill_Printer.class.getName()).log(Level.SEVERE, null, ex);
                
        }
        return PAGE_EXISTS;
    }