Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

print zpl from 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 :: Kadane Algorithm for maximum sub-array 
Java :: ex: java loop 
Java :: How to define lambda expression in Java? 
Java :: java.lang.NullPointerException: Cannot store to double array because is null 
Java :: power of a number in java 
Java :: gson to class 
Java :: split by asterisk java 
Java :: textfield invisible java 
Java :: primitive vs wrapper classes in java 
Java :: null check in line java 
Java :: arraycopy merging arrays 
Java :: return string consistent of n lowercase letters such is all letters occurs an odd number 
Java :: SmallChange 
Java :: netbeans how to get string from jcombobox 
Java :: configuration reader java 
Java :: public class ForLoop { public static void main(String[] args){ for(int i=1; i=n ;i++ ) System.out.println("i"); } } 
Java :: lelen suratlari ramkasidagi oltinlar 
Java :: android studio setbackgroundcolor drawable 
Java :: java stream anymatch vs findany 
Java :: java string replace last 4 characters 
Java :: jwt token in android studio 
Java :: spigot deal damage 
Java :: android java shared preferences 
Java :: bukkit shutdown 
Java :: lauch app from brodcast reciever 
Java :: geometric primitive 
Java :: how to wirte an XPlane Plugin 
Java :: IMEI DEVISE ANDROID JAVA 
Java :: make pattern for V in jaca 
Java :: Java pollfirst() and pollLast() Methods 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =