Windows Printer Driver Development

Posted September 24, 2004

Chat Date: September 21, 2004

Please note: Portions of this transcript have been edited for clarity

Introduction

Moderator: Eric_S (Microsoft)
Welcome to today's Chat. Our topic is Windows Printer Driver Development. Questions, comments, and suggestions are welcome.

Moderator: Eric_S (Microsoft)
We will make an effort to answer as many questions as we can. There may be times when a question may be asked that we do not have an immediate answer for or cannot get to. We encourage you to post any of these questions in the Device Drivers newsgroup at

Moderator: Eric_S (Microsoft)
Let's introduce our hosts for today!

Host: HarveyB (Microsoft)
I am a Test Project Manager for Digital Documents Platforms Solutions.

Host: John (Microsoft)
Hi, I'm John Clavin, Lead Program Manager in the Windows Digital Documents (formerly Printing and Imaging) team.

Host: Mike (Microsoft)
Mike_MS - Connectivity Developer at Microsoft

Host: Sage (Microsoft)
Sage, printing and imaging device program manager and Mikael, printing and imaging setup developer

Host: fyuan (Microsoft)
Hi, I'm Feng Yuan, developer in the driver team.

Host: Jeff (Microsoft)
Jeff, Device driver test lead for printing and imaging devices

Host: benkuhn (Microsoft)
Hi, I'm Ben from the Digital Docs print driver team. I work primarily on Unidrv & related technologies.

Host: Harvinder (Microsoft)
I am a Harvinder. I am a printer driver developer.

Moderator: Eric_S (Microsoft)
Welcome everyone, let's get started!

Start of Chat

Host: benkuhn (Microsoft)
Q: There have been quite a few changes in the print-driver architecture: NT3.51 = user mode, NT4 = kernel, 2k/xp=either one (I think). Are you folks planning any more changes on this front?
A: There's nothing so fundamental as changing the context of the driver for LH, although there will be quite a few improvements. Kernel mode drivers will not be supported at all in future OS's.

Host: John (Microsoft)
Q: WinXP SP2 is causing a crash in our Unidrv printer driver when displaying a custom document property sheet (COMPROPSHEETUI ) no matter how simple. If I use a PROPSHEETPAGE then no problem.
A: It's difficult to answer that with just the details we have here - you could post the question to prninfo@microsoft.com with details of driver model and more info on what you're doing in the driver, and we can try to answer it there if you're not comfortable posting details to a public forum

Host: Sage (Microsoft)
Q: Would you folks consider providing some kind of PPD test parser that we can use to validate a PPD without having to go through the whole installation process and see what "takes" and what didn't? This is hard to test now.
A: I don't know what the URL is, but Adobe provides a tool called PPDCheck. If you poke around on their website you should be able to find it.

Host: benkuhn (Microsoft)
Q: In the MS/Adobe PostScript driver, if the PPD describes a user-defined "Form" that already exists, but the existing form has different dimensions, it's quietly ignored and the form is unavailable in the UI. Does this sound like a bug?
A: This is by design. The forms database is set up by names, and so only one of the two forms can be in there. But the PScript driver's UI is smart enough to realize that the form in the database is not the same as the one in the database. Since that form may not be supported, we don't list it in the UI. It's less than optimal, and reflects some limitations of the system's original design.

Host: John (Microsoft)
As an information source point, there are 3 sites we recommend as general information sources:-

Host: John (Microsoft)
https://www.microsoft.com/whdc/device/print/default.mspx

Host: John (Microsoft)
https://www.microsoft.com/windowsserver2003/technologies/fileandprint/print/default.mspx

Host: John (Microsoft)
https://msdn.microsoft.com/

Host: benkuhn (Microsoft)
Q: Is there be an documented way of accessing the EMF files generated by the spooler?
A: There is no documented way to parse the EMF files. However, you can access the spool files from your (or your print server's) windows directory under %windir%\system32\spool\printers

Host: Mike (Microsoft)
Q: In a port monitor, it's not clear how a job can be properly cancelled per user request once it's started printing. Is there an interface/callback to cancel an in-progress job?
A: The short answer is no. There is no defined API to cancel a job. Once a user tries to cancel/delete an in-progess job the spooler will try to stop sending data and end the job. It depends on how the port monitor acts when the spooler tries to stop.

Host: Mike (Microsoft)
If the printer is stuck the job may will not delete until the monitor returns.

Host: John (Microsoft)
Q: As a hardware manufacturer new to printer driver dev., we need to understand how Windows will recognize our specialized printer. What advice can you give us please?
A: I recommend you read the design guidelines at this site:https://www.microsoft.com/whdc/device/print/default.mspx

Host: John (Microsoft)
There is a lot of information there concerning connectivity, bus types, plug and play, and some architecture recommendations for compatibility with Windows

Host: Mike (Microsoft)
Q: Are there any special considerations when developing a driver that may print to an IPP printer?
A: No. From the driver perspective an IPP printer looks just like a local printer.

Host: fengy (Microsoft)
Q: From a UI plugin that adds a document property sheet how can the DEVMODE be saved in that property sheet's PSN_APPLY message?
A: You need to callback to COMPSTUI with function pfnComPropSheet(..., CPSFUNC_SET_RESULT, ...).

Host: Mike (Microsoft)
Q: When detecting a failure in printing in a Language Monitor what is the best way to cancel the print job?
A: The right action is to hand the error up to the spooler as it occurs. The spooler will post the error and allow the user to delete/cancel the job. Any attempt to delete the job from within the Language Monitor will probably confuse the user and not allow a way to report the error upstream.

Host: HarveyB (Microsoft)
Q: We have very specialized printer (small form factor) nothing comparable to any out of the box Letter printer but want to get the driver certified do all the WHQL requirements have to be fulfilled?
A: There are WHQL testing options available for devices that support only sizes smaller than letter and A4. Information on this case should be at https://www.microsoft.com/whdc/device/print/default.mspx.

Host: John (Microsoft)
Q: We have very specialized printer (small form factor) nothing comparable to any out of the box Letter printer but want to get the driver certified do all the WHQL requirements have to be fulfilled?
A: https://www.microsoft.com/whdc/whql/device/printer.mspx is a more detailed site for WHQL information

Host: benkuhn (Microsoft)
Q: We have OEM devmode structures and the question is can these be modified from a Program as the original Devmode structure?
A: You can modify any part of the devmode from an application, provided that your application understands the devmode. For a Unidrv or PScript-based driver, that is currently not possible, since part of the DEVMODE is controlled by the MS driver infrastructure, and we don't publish that structure. For a driver that does not use one of these technologies, you can write an application that is aware of your driver's devmode, but you should take into consideration versioning and use signatures to ensure that you don't trash another driver's private devmode.

Host: John (Microsoft)
Q: From a UI plugin that adds a document property sheet how can the DEVMODE be saved in that property sheet's PSN_APPLY message?
A: You can also take a look at the syncset sample in the DDK for an example of how to do this

Host: Harvinder (Microsoft)
Q: When using UNIDRV, are there any special considerations concerning the creation of the GPD file, and are there any assumptions made by Windows?
A: The best way to develop a new gpd is to base it on a currently available gpd of a similar printer. You can also check other resources that help in developing gpds : minidriver development tool, gpdcheck, and other documentation regarding gpd keywords. These should be in the DDK.

Host: Mike (Microsoft)
Q: Language Monitor question: So that means informing the spooler with SetJob or SetPrinter that the error appeared? What if the application developer expect the LM to handle the issue?
A: It is possible using SetJob will cancel the job, but I am not positive. Could you please post this question to prninfo@microsoft.com and I will track down the full answer for you

Host: HarveyB (Microsoft)
Q: Under what circumstances would you not use or be unable to use UNIDRV?
A: In theory, you could use it in almost any case. With enough customizations, UNIDRV will support virtually any printer. Practically, when you are targeting a printer that accepts only PostScript or vector only HP-GL/2, the easiest option is to not use UNIDRV. UNIDRV is most easily used when printing to a device that supports a language that UNIDRV already supports.

Host: benkuhn (Microsoft)
Q: It's obvious that the forms DB can only support one form per name, but the "quietly ignoring" part is really troubling. Is there any kind of debugging channel that this is revealed on? We lost a week trying to figure this out.
A: You can run a checked build of PS5UI under a debugger (checked builds of Windows are available from MSDN). The checked build will spew some error messages & warnings into the debugger, though I don't recall if we have a message for this specific case.

Host: HarveyB (Microsoft)
Q: We are developing a specialized printer for machine applications to print on small labels. As you mention printer languages, do we need to embed a language in our printer controller to work with Windows? Do you have a recommendation for a printer language for specialized printing applications?
A: While is not required to embed a printer language, it will be much easier to write your printer driver support if you have a language to use instead of having to support dumping a bitmap to your device. The specific language to choose would depend on your hardware and your specific needs.

Host: benkuhn (Microsoft)
Q: Devmode question: How would you suggest a network wide update of printer property changes if not doing it programmatically?
A: There's no API to change private settings. However, in your case, because you have kiosks that need to have identical settings, you can do a registry slam. What you may be able to do is use the registry monitoring tools from www.sysinternals.com to find the private data for the printer settings in the registry. You can export those registry keys, and them slam them onto your kiosks. You should do careful testing on this for your configuration though, since this is a process that we don't actually support or test.

Moderator: Eric_S (Microsoft)
Thanks for joining us today and thanks for the questions. It's time for us to go now.

Moderator: Eric_S (Microsoft)
You can also ask printer driver development questions to our developers here: prninfo@microsoft.com.

Moderator: Eric_S (Microsoft)
Please see the chats schedule for upcoming topics at https://msdn.microsoft.com/chats/.

Host: John (Microsoft)
Thanks for the questions - hope it was useful. John

Host: HarveyB (Microsoft)
Thanks for coming and participating - Harvey

Email: mailto:prninfo@microsoft.com

Website: https://www.microsoft.com/whdc

Top of pageTop of page