Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

zebra zpl print java

private static boolean printLabel(PrintService printService, String label) {
    if (printService == null || label == null) {
        System.err.println("[Print Label] print service or label is invalid.");
        return false;
    }
    String czas = new SimpleDateFormat("d MMMMM yyyy'r.' HH:mm s's.'").format(new Date());
    String command =  
            "N
"+
            "A50,50,0,2,2,2,N,""+label+""
"+
            "B50,100,0,1,2,2,170,B,""+label+""
"+
            "A50,310,0,3,1,1,N,""+czas+""
"+
            "P1
"
            ;
    
    byte[] data;
    data = command.getBytes(StandardCharsets.US_ASCII);
    Doc doc = new SimpleDoc(data, DocFlavor.BYTE_ARRAY.AUTOSENSE, null);
    
    boolean result = false;
    try {
        printService.createPrintJob().print(doc, null);
        result = true;
    } catch (PrintException e) {
        e.printStackTrace();
    }
    return result;
}
Comment

PREVIOUS NEXT
Code Example
Java :: komplettes array ausgeben java 
Java :: Not allowed to bind to service Intent 
Java :: java multi threading Buzzer program 
Java :: android notification addaction example 
Java :: aspectj after returning 
Java :: number output swing java 
Java :: @expose(serialize = false) not working 
Java :: get number value of an output to another script java 
Java :: java notnull returns null 
Java :: find center of screen graphic g 
Java :: TestNG Data Provider 
Java :: retrofit gradle 
Java :: How to code the Fibonacci Sequence using simple iterative loops java 
Java :: reading data from wsdl in java 
Java :: android detect screen on by intent broadcast receiver 
Java :: mock stream java 
Java :: java reverse nodes with single node 
Java :: regex plit string with dash or undescore java 
Java :: Java Public Access Modifier package one 
Java :: centrar valores en celda jtable java netbeans 
Java :: Converting data in java 
Java :: get selected text in java 
Java :: java producer consumer queue 
Java :: spigot check if inventory is empty 
Java :: expiry time of otp android 
Java :: open youtube in landscape mode on button click in android progmatically 
Java :: save logs tomcat java spring boot 
Java :: convert int to array in java 
Java :: Reference in java equal operator 
Java :: java get difference days without weekends 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =