A quick and simple way to output some text to a printer is to print to OS logical device attached a printer. For example, on a Windows machine : import java.io.*;
public class SimplePrinting {
public static void main(String[] args) {
try {
FileWriter out = new FileWriter("lpt1");
out.write("Hello world");
out.write(0x0c); // CR
out.close();
}
catch (IOException e) {
e.printStackTrace();
}
}
}
public class SimplePrinting {
public static void main(String[] args) {
try {
FileWriter out = new FileWriter("lpt1");
out.write("Hello world");
out.write(0x0c); // CR
out.close();
}
catch (IOException e) {
e.printStackTrace();
}
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货