如何获取 Spooler API 打印的原始完整文件路径
我想通过使用 Windows Spooler API 的独立程序来监视系统范围的打印作业,但只能获取打印作业的名称。如何获取带有完整路径的原始文件。
I want to monitor the system scope's printing jobs through a standalone program using the Windows Spooler API, but only the print job's name can be fetched. How do I get the original file with full path.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您正在查找原始文档路径(例如,您刚刚打印的 Word 文档的位置),后台处理程序将无法告诉您这一点。
假脱机程序通常通过 GDI 或 XPS 路径接收文件。执行打印的应用程序有效地向假脱机程序发送一系列图形命令(通过适当的设备驱动程序),假脱机程序服务将在发送到打印机之前将其缓存到临时文件中。这意味着假脱机程序本身不知道有关原始源文件或其位置的任何信息。
如果您想知道假脱机程序如何获取文档名称,可以通过 StartDoc 调用来完成,该调用将传入 DOC_INFO_x 结构。这是关于假脱机程序收到的有关源文档本身的所有信息。
If you are looking for the original document path (e.g. location of Word Document that you just printed), the spooler will not be able to tell you this.
The spooler generally receives files through the GDI or XPS paths. The application that does the printing effectively sends the spooler a series of graphical commands (via the appropriate device driver) which the spooler service will cache into a temporary file before sending to the printer. This means the spooler itself does not know anything about the originating source file, or where it is located.
If you are wondering how the spooler gets the document name, it is done via the StartDoc call that will pass in a DOC_INFO_x structure. That is about all the information that the spooler receives with regard to the source document itself.