I wish to print to a network printer (Brother 720nw) an image or a pdf (that represents a label). Is there a way to print a well formatted image/pdf using any of the low level printing protocols such as RAW/LPR or IPP ?
I have tried the LPR client from http://www.codeproject.com/Articles/12677/An-LPR-client-in-C. But, it prints just plain ASCII to the printer. I have also tried reading the bytes of the file and sending it to printer over the RAW port (9100), it also results in the same ASCII text.
Do I need to format my document in certain way so that the printer can print it well?
Here is my code using the RAW protocol (9100) :
private async static void PrintTest()
{
try
{
StreamSocket socket = new StreamSocket();
await socket.ConnectAsync(new HostName("192.168.15.7"), "9100"); // epson
byte[] fileBytes = await readImage();
DataWriter writer = new DataWriter(socket.OutputStream);
writer.WriteBytes(fileBytes);
await writer.StoreAsync();
await writer.FlushAsync();
writer.Dispose();
socket.Dispose();
} catch (Exception e)
{
}
}