I have been tasked with writing a print driver. I have no experience with this and have been researching it for a few days. The goal of this is to essentially write the data coming to the driver to a file and then do some additional processing of it.

If I understand it correctly, I can start other processes to do most of the work, but I'll need the driver itself to generate the initial file/data. I am confused about what state the data is in when it comes to the driver from an application. Is this something that is determined by the application, or is there a standard of some kind?

  • 2
    Why are there votes to close? This is answerable, specific, and related to application design. – GrandmasterB Dec 19 '13 at 17:44

Go to the Windows DDK website and start from their print and imaging examples. What the driver actually does inside itself is entirely up to you, but the framework for a driver is clearly defined. The text-only driver should get you going.

Spend some time reading those examples and surrounding documentation before going off and inventing your own wheels - there's nothing worse than a shitty printer driver implementation, we have plenty of those already. Write one that integrates like its supposed to.

  • While this is good information, it doesn't really answer my specific question. I'm trying to understand what happens between an application and a printer driver. For example, if I print from MS Word, what is it sending to the printer driver? Is it sending the entire document file, or some kind of processed version of the document, or the text plus metadata, or something else? I apologize if these questions are incredibly ignorant, but this is all brand new to me and I'm honestly a bit overwhelmed by all the information. – user80760 Dec 20 '13 at 18:54
  • 2
    Go there and look - a printer driver is a printer driver. The protocol used to communicate is well defined, whether its XPS or PCL or Postscript. Why not implement the text-only driver sample and see what Word sends you as you debug it. Or you could reading that site and see what it says about print drivers... – gbjbaanb Dec 20 '13 at 19:52

It is quite a while since I developed a printer driver for a customer but I will try to give you an idea of what happens. When your application communicates with an output device such as a printer or the display it opens a DC and starts sending GDI commands to draw an image on the page. The image can contain anything from picture drawing or text. The. Driver collects all this and when your are done with the page it starts transmitting the generated image using the printer language, postscript pcl or anything else to the device. This is the general idea behind these devices and the way they communicate with windows.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy