我想在我的Android应用程序中包含功能,通过WiFi从网络打印机打印图像。我尝试下面的代码,发布在stackoverflow上,但我只能打印文本:(如果我想打印图像该怎么办。
try
{
Socket sock = new Socket("192.168.1.222", 9100);
PrintWriter oStream = new PrintWriter(sock.getOutputStream());
oStream.println("HI,test from Android Device");
oStream.println("\n\n\n");
oStream.close();
sock.close();
}
catch (UnknownHostException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
}