How to programmatically achieve editing of the spool file header of the normal windows print queue 'spool file' before it is sent to the printer?

孤街浪徒 提交于 2019-11-29 12:44:52
Nick Westgate

Editing the spool file is obviously trivial. The trick is how to get access to the spool file.

I can think of a few ways offhand:

  1. Pause the print job after spooling, edit it, then release it. See my answer here. This is not trivial and you may need to resort to third-party software depending on time/effort available.
  2. Create a print driver or spooler component such as a port or language monitor to edit the file. (Thanks to Carey Gregory for the suggestion to use a language monitor). This is a big topic and you'll have to read a lot of documentation to figure out how to do it, but there is a sample (Pjlmon) in the WDK. Note that the newer V4 driver model for Windows 8/Server 2012 doesn't support these components.
  3. If you don't need to do this transparently you could set up RedMon (free) to call your app to edit the spool file. RedMon will then send it to the desired printer.

  4. VeryPDF has some similar commercial products with more capabilities.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!