Hello World, using printer KR203 and JAVA

// Expert user has replied.
O Omar Barrera 3 years 7 months ago
80 2 0

Hi, I try to send a Hello World to a thermal printer Zebra model KR203, these printers use the language KPL (Kiosk Printer Language), when printing a test page sale correctly but with my code stays in: "Printing ...", I can´t use the link-os-sdk because is not compatible with these type of printers this is my code:
 
    public void Print() {
        PrintService printService = PrintServiceLookup.lookupDefaultPrintService(); //Here ZEBRA KR203 Is default printer
        PrintRequestAttributeSet attributeSet = new HashPrintRequestAttributeSet();
        System.out.println("Default Printer :" + printService);
        String kplcommand = "P\r\n"; // In this line try print test page
        byte[] by = kplcommand .getBytes();
        DocFlavor flavor = DocFlavor.BYTE_ARRAY.AUTOSENSE;
        Doc doc = new SimpleDoc(by, flavor, null);
        DocPrintJob job = printService.createPrintJob();
        try {
            job.print(doc, null);
            //job.print(doc, attributeSet);
        } catch (PrintException e) {
            System.out.println("e " + e);
        }
    }

Please Register or Login to post a reply

2 Replies

D Denis Budenniy

Hi! Please tell me, kr203 accidentally does not support the protocol ESC/POS for printing?

S Samantha Corn

Hi Omar,

I believe it may not be printing because your KPL isn't correct. There should be a number instead of N1 in "P\r\n". The KR203 Programming Guide contains the following table with possible values for N1.

CONTACT
Can’t find what you’re looking for?