Path filePath = Path.of("C:UsersPublicDocumentslabelingLabel.prn");
try {
byte[] bytes = Files.readAllBytes(Paths.get(String.valueOf(filePath)));
commands = new String(bytes);
//Replace data
String cmd1 = commands.replaceAll("@Part@", PartLead);
String cmd2 = cmd1.replaceAll("@Date@", Adate);
cmdF = cmd2.replaceAll("@Shift@", Ashift);
} catch (IOException e) {
e.printStackTrace();
}
FileOutputStream os = new FileOutputStream("\localhostzebra1"); //printer Should be Shared
PrintStream ps = new PrintStream(os);
ps.println(cmdF);
ps.print("f");
ps.close();
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}