RSS Feed for This PostCurrent Article

How to Write a Print Driver for Mobile Thermal Printer

Download Source Code

Recently I implemented a project which uses mobile thermal printer. What I perceived is that nowadays a lot of mobile applications are implemented using Windows Mobile to help run business operations like route sales, and even for gambling purposes. If you want nothing but the safest gaming conditions across the online casino spin slot games. Wizard Slotsis dedicated to providing you with nothing but the highest quality of games on the market from recognised global games providers.

For all the mobile printer that I came across, e.g. from Extech, Datecs or Sprint., some provide very good documentation, printer drivers and utilities which make it very easy to print.

Unfortunately, in my project the printer does not come with the necessary printer SDK for Windows Mobile. As such, I have to write a DLL in Visual C++, and called from VB.NET. After digging through the documentation, I came out with a simple library which is enough for my own use.

Below I showed you some of the SDK APIs I implemented. You can download the source code and modify to suite your need.


This API uses CreateFile, SetCommTimeouts, SetCommState, SetupComm to create the bluetooth connection. Take note that for COM port lower than 10, you can use “COMx” but for COM port greater than 10, it uses \\.\COMx.


PortClose just closes the bluetooth connection using CloseHandle.


SetFont uses WriteFile to send the necessary commands specific to the printer to set the fonts. You may need to change this part.


PrintText uses WriteFile to send the text printing commands to the printer.


ReadData uses ReadFile to read data from the printer.

There are some other APIs like PrintImage and PrintBarCode that I implemeneted. It is important that you understand the commands the printer uses. You should read the documentation from the printer manufacturer.

Good luck programming !

Trackback URL

RSS Feed for This Post5 Comment(s)

  1. malloth | Feb 1, 2008 | Reply

    What a nice driver! Good job! However I’m having difficulties, trying to make a dll from the source You’ve given. Could You please mail me a dll with all methods uncomented?
    Thanks in advance.
    (I usually work with C# and try to avoid C++ as much as I can 🙂 )

  2. Developer | May 6, 2008 | Reply

    Which printer was this you had to write this driver for?


  3. malloth | Jun 6, 2008 | Reply

    I wanted to write a standard printer driver for Windows Mobile (for any printer).

    I hate Microsoft for not including this feature to any version of WM.

  4. modulagro | Jul 20, 2008 | Reply

  5. Sunil | Sep 12, 2008 | Reply

    I want to print logo to my serial port thermal printer. How do I decode the text or bit map file

1 Trackback(s)

  1. From Writing a Print Utility on Windows Mobile for Mobile Printer | | Oct 2, 2007

Sorry, comments for this entry are closed at this time.