0

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)
        {
        }
    }
xdev
  • 659
  • 11
  • 23

1 Answers1

0

You really should check the specification of your printer. Generally it is possible to directly send and print PDF-Files or images via IPP to printers that support it. Your printer doesn't seem to support PDF or IPP.

Answer: You need to format your document in your printers propritary format.

Community
  • 1
  • 1
IPP Nerd
  • 992
  • 9
  • 25