Sending ESC/POS Commands to Thermal Printer in Windows 8 RT RRS feed

  • Question

  • Hi, 

    We have POS (Point of sale) Software for restaurants, which print receipts on Thermal printers. We are using class from http://support.microsoft.com/kb/322091 to send raw data (text, and commands) to Receipt printers. 

    We are currently looking for solution to send same commands to Bluetooth printers (which support ESC/POS commands) from Windows store app (or any shared POS printer if it's possible). We can do it from IOS/Android - but can't find any example of how to do it from Win 8 apps. Not sure is it even possible. 

    We are using C# if it means anything :) and here is example of printer http://www.bixolon.com/html/en/product/product_detail.xhtml?pgNum=&prod_id=19&large_cd=0003&small_cd= 


    Tuesday, February 12, 2013 11:03 AM

All replies

  • I don't believe this is currently possible. Printing in Windows store apps is managed through a heavily abstract print contract manager. To generate the document to print you simply supply a XAML/HTML surface to the print manager when particular events are raised. As the document is generated by the GUI there is no ability to send low level commands to the printer. I've also taken a look through the extensions to the printer objects and I can't see anything related their either.

    The likely scenario is you'll need to write some kind of WinRT extension which is utilized by your app to communicate with the driver at a much lower level. I'm still searching for documentation on how to achieve something similar and will post if/when I find something.

    Windows/Windows Phone Device & integration consultant | Follow Me on Twitter: @LewisBenge Or check out my blog: http://www.lewisbenge.net

    Thursday, February 14, 2013 12:14 AM
  • Thanks Lewis. I'm currently talking with MS stuff regarding this, and will also post answer here. For now, it looks like these devices (bluetooth printers) are not Printers (when it comes to communication protocols and standards they support), they are more like bluetooth devices which have attached printer capabilities (Which means we need to have support for SPP in WinRT, I guess).   
    Thursday, February 14, 2013 10:08 AM
  • Hi fun.ky,

    what you're guessing is possible, and also with the product you mentioned.

    I'm currently writing foy my business a Windows Phone 8 app, that will print receipts with a Bixolon SPP R300 Bluetooth printer.

    After a lot of search (there is few documentation on the web), I believe the only way to communicate with these printers is to use RFCOMM protocol (virtualizing serial ports).

    So, you would send data to the printer using ESC/POS commands, that are widely used for printing: also BIXOLON printers support them.

    I don't like very much this approach, but my customers need a solution, and this is quite easy to implement...

    I can try to help with the code if you want.

    Tuesday, May 7, 2013 6:13 PM
  • Hi Stefano and thanks for sharing your solution, 

    code example (or sln with that code) would be amazing.  

    Thursday, May 9, 2013 8:58 AM
  • Hi and sorry for the late...

    First of all, make the Bluetooth pairing between the printer and your device (Windows Phone 8 needed), then check the capabilities of your project (proximity must be activated):

          <Capability Name="ID_CAP_PROXIMITY" />

    These namespaces will be required:

    using Windows.Networking.Proximity;
    using Windows.Networking.Sockets;
    using Windows.Storage.Streams;

    Start from this code for the connection to the printer:

    // New socket:
    StreamSocket streamSocket = new StreamSocket();
    // Init connection:
    await streamSocket.ConnectAsync(this.PeerInformation.HostName, "1");
    // Data writer:
    DataWriter dataWriter = new DataWriter(this.StreamSocket.OutputStream);
    // Data reader:
    DataReader dataReader = new DataReader(this.StreamSocket.InputStream);

    And then you can start sending you ESC/POS commands via socket:

    // Initialize printer:
    dataWriter.WriteString(String.Concat((char)27, (char)64));
    // Send text:
    dataWriter.WriteString("Hello, world!");
    // Send line feed:
    // Let all the commands be flushed/printed:
    await dataWriter.StoreAsync();
    await dataWriter.FlushAsync();
    // Release any resource:

    I hope this can help you...

    Friday, May 17, 2013 6:55 AM
  • Also, you can check out my Windows Phone 8 app (which has also a Windows Phone 7.1 version, that obviously doesn't support this Bluetooth print feature): in the next 2 weeks I hope I will publish on the Windows Phone 8 Store some interesting features related to this topic.

    The app (that is an ERP mobile client) will be able to print documents sending ESC/POS commands to BIXOLON Bluetooth printers, having a simple "receipt" as a result...

    This is the link of the app (the name is Smart.1): Smart.1 download

    Friday, May 17, 2013 9:22 AM
  • Thank you......thank you..... thank you..... very much...... this gave me some hope and relief thanks again.....

    Thursday, April 30, 2015 6:00 PM