我可以通过蓝牙便携式打印机的Windows Phone 8打印? [英] Can I print with windows phone 8 using Bluetooth to a portable printer?
问题描述
我开发在Windows Phone 8这个程序必须使用移动打印机像斑马MZ 220移动打印机打印票据的应用程序。
I am developing an app on windows phone 8. This app must print tickets using a mobile printer like a Zebra MZ 220 Mobile Printer.
我一直在使用Google试图获得有关使用Windows手机8打印到蓝牙打印机信息,但有没有多的信息。
I have been googling trying to get information about printing to a bluetooth printer using windows phone 8 but there is not to much information.
我担心的是有在其他手机操作系统如Android,开始了新的发展,只是因为WP8不支持蓝牙打印。
My fear is to have to start a new development in another mobile operating system like android, just because wp8 does not support printing on bluetooth.
是否有任何关于它的例子吗?
是否与微软Windows Phone 8?
Is there any example about it? Is there any portable printer compatible with Microsoft Windows Phone 8?
推荐答案
这code为我工作在一台Zebra 420与诺基亚820配对
This code works for me on a Zebra 420 paired with a Nokia 820.
private async void PrintStuff()
{
string command = "^XA^LH30,30^F020,10^AD^FDHello World^FS^XZ";
Byte[] buffer = new byte[command.Length];
buffer = StringToAscii(command);
PeerFinder.AlternateIdentities["Bluetooth:Paired"] = "";
var pairedDevices = await PeerFinder.FindAllPeersAsync();
if (pairedDevices.Count == 0)
{
Debug.WriteLine("No paired devices were found.");
}
else
{
PeerInformation selectedDevice = pairedDevices[0];
StreamSocket socket = new StreamSocket();
await socket.ConnectAsync(selectedDevice.HostName, "1");
await socket.OutputStream.WriteAsync(WindowsRuntimeBufferExtensions.AsBuffer(buffer));
}
}
这篇关于我可以通过蓝牙便携式打印机的Windows Phone 8打印?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!