Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6046481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:14:42+00:00 2026-05-23T07:14:42+00:00

I’m experimenting with a Zebra TTP8200 thermal printer. For my application I need to

  • 0

I’m experimenting with a Zebra TTP8200 thermal printer. For my application I need to print plotter type traces continuously until the user hits a stop button. I’ve had a play with the ZPL language and I can successfully generate bitmap data and dump out my bitmap a line (or few lines) at a time by outputting the ZPL as raw data.

I’m using some Microsoft demo code to output the raw data to the printer and this works great, bar one issue: the spooler. It turns out that every time I output some data using the MS rawprn.exe code it is actually spooled as a print job and then transmitted to the printer. This takes up to 10 seconds to get through the spooler, obviously too slow. Disabling spooling in the driver doesn’t help, it just means that the program hangs while the job is passed through the spooler and printing completes.

Is there a way to bypass the spooler and output data straight to this USB printer? My research so far hasn’t turned up anything likely looking in the Windows API. Ideally, I’d like to be able to use the printer like it was a serial printer – open the port and shove data in.

Many thanks in advance for any hints!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T07:14:42+00:00Added an answer on May 23, 2026 at 7:14 am

    Thanks for the comments.

    After some more digging around, I found this interesting article on using Windows printer functions provided by usbprint.sys. With a bit of hacking the sample code there seemed to work. I think I’ll take this route.

    There is the final code given in the article:

    /* Code to find the device path for a usbprint.sys controlled
    * usb printer and print to it
    */
    
    #include <usb.h>
    #include <usbiodef.h>
    #include <usbioctl.h>
    #include <usbprint.h>
    #include <setupapi.h>
    #include <devguid.h>
    #include <wdmguid.h>
    
    /* This define is required so that the GUID_DEVINTERFACE_USBPRINT variable is
     * declared an initialised as a static locally, since windows does not include it
     * in any of its libraries
     */
    
    #define SS_DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
    static const GUID name \
    = { l, w1, w2, { b1, b2,  b3,  b4,  b5,  b6,  b7,  b8 } }
    
    SS_DEFINE_GUID(GUID_DEVINTERFACE_USBPRINT, 0x28d78fad, 0x5a12, 0x11D1, 0xae,
                   0x5b, 0x00, 0x00, 0xf8, 0x03, 0xa8, 0xc2);
    
    void SomeFunctionToWriteToUSB()
    {
      HDEVINFO devs;
      DWORD devcount;
      SP_DEVINFO_DATA devinfo;
      SP_DEVICE_INTERFACE_DATA devinterface;
      DWORD size;
      GUID intfce;
      PSP_DEVICE_INTERFACE_DETAIL_DATA interface_detail;
    
      intfce = GUID_DEVINTERFACE_USBPRINT;
      devs = SetupDiGetClassDevs(&intfce, 0, 0, DIGCF_PRESENT |
                                 DIGCF_DEVICEINTERFACE);
      if (devs == INVALID_HANDLE_VALUE) {
        return;
      }
      devcount = 0;
      devinterface.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);
      while (SetupDiEnumDeviceInterfaces(devs, 0, &intfce, devcount, &devinterface)) {
        /* The following buffers would normally be malloced to he correct size
         * but here we just declare them as large stack variables
         * to make the code more readable
         */
        char driverkey[2048];
        char interfacename[2048];
        char location[2048];
        char description[2048];
    
        /* If this is not the device we want, we would normally continue onto the
         * next one or so something like
         * if (!required_device) continue; would be added here
         */
        devcount++;
        size = 0;
        /* See how large a buffer we require for the device interface details */
        SetupDiGetDeviceInterfaceDetail(devs, &devinterface, 0, 0, &size, 0);
        devinfo.cbSize = sizeof(SP_DEVINFO_DATA);
        interface_detail = calloc(1, size);
        if (interface_detail) {
          interface_detail->cbSize = sizeof (SP_DEVICE_INTERFACE_DETAIL_DATA);
          devinfo.cbSize = sizeof(SP_DEVINFO_DATA);
          if (!SetupDiGetDeviceInterfaceDetail(devs, &devinterface, interface_detail,
                                               size, 0, &devinfo)) {
        free(interface_detail);
        SetupDiDestroyDeviceInfoList(devs);
        return;
          }
          /* Make a copy of the device path for later use */
          strcpy(interfacename, interface_detail->DevicePath);
          free(interface_detail);
          /* And now fetch some useful registry entries */
          size = sizeof(driverkey);
          driverkey[0] = 0;
          if (!SetupDiGetDeviceRegistryProperty(devs, &devinfo, SPDRP_DRIVER, &dataType,
                                                (LPBYTE)driverkey, size, 0)) {
        SetupDiDestroyDeviceInfoList(devs);
        return;
          }
          size = sizeof(location);
          location[0] = 0;
          if (!SetupDiGetDeviceRegistryProperty(devs, &devinfo,
                                                SPDRP_LOCATION_INFORMATION, &dataType,
                                                (LPBYTE)location, size, 0)) {
        SetupDiDestroyDeviceInfoList(devs);
        return;
          }
          usbHandle = CreateFile(interfacename, GENERIC_WRITE, FILE_SHARE_READ,
                     NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL |
                     FILE_FLAG_SEQUENTIAL_SCAN, NULL);
          if (usbHandle != INVALID_HANDLE_VALUE) {
        /* Now perform all the writing to the device ie.
         * while (some condition) WriteFile(usbHandle, buf, size, &bytes_written);
         */
        CloseHandle(usbHandle);
          }
        }
      }
      SetupDiDestroyDeviceInfoList(devs);
    }
    

    Thanks again for the suggestions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to clean up various Word 'smart' characters in user input, including but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I have thousands of HTML files to process using Groovy/Java and I need to
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.