Seeking alternative to custom port monitor to redirect XPS print job to file system (i.e. "print to file" without filename prompt)

Yannick Fortin 0 Reputation points
2024-10-12T04:44:18.3566667+00:00

I have a project where I need to write a print job from a given print queue to the file system in XPS format. This needs to happen without user intervention.

In other words, I need to have a printer queue with a PORTPROMPT port without the prompt.

I had researched this years ago. At the time, I found that the best way to achieve this was to write a custom port monitor which would simply write the spool file, provided by the XPS printer driver, to disk. Having a port monitor also nicely takes care of removing the job from the spooler once it has been written out. Easy project, right? Well, not so much.

As it turns out, as per the printer driver DDK documentation at Port monitors and language monitors, a v4 printer driver cannot have a non-Microsoft port monitor. And Microsoft doesn't provide a PORTPROMPT-like port monitor which doesn't have an interactive prompt.

I am brushing on my printer DDK knowledge, but from what I understand, I can't really do this from the printer driver or print processor level. Or does it?

I should also factor in the fact that Microsoft is moving away entirely from the traditional printer driver model, even calling it "legacy". The future is IPP, Universal Print and Mopria, apparently.

One idea is to create a service which would provide a "fake" XPS-compatible printer. The spooler would then send the print job as XPS directly to my service, which could then do whatever it wants. But this seems like a lot of hoops to jump through when everything I need, i.e. the print job in XPS format, is already right there in the spooler directory, thanks to server-side rendering.

(yes, there is a lot of assumptions here, including server-side rendering -- but we have some control over the environment and not supporting client-side rendering is an acceptable limitation)

Anyways, I am seeking guidance as to how to best approach this project. Any idea, do's and dont's would definitely be appreciated.

Thank you,

Yannick

Windows Server Printing
Windows Server Printing
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.Printing: Printer centralized deployment and management, scan and fax resources management, and document services
687 questions
Windows Driver Kit (WDK)
Windows Driver Kit (WDK)
A set of Microsoft tools that are used to develop, test, and deploy Windows drivers.
121 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.