如何找到启用后台打印文件池,即使对于一个给定的ID作业的假脱机文件? [英] How do I find the spool file for the job with a given ID even when spool file pooling is enabled?

查看:165
本文介绍了如何找到启用后台打印文件池,即使对于一个给定的ID作业的假脱机文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想假脱机数据复制对于一个给定的Windows打印作业到磁盘上的任意位置。

I would like to copy the spool data for a given Windows print job to an arbitrary location on disk.

我有打印作业的作业ID从打印后台处理程序API 。我知道这作业完成后台打印。我知道以前我有时间来完成什么,我需要做的工作不会被删除。

I have the job ID of the print job from the Print Spooler API. I know this job has finished spooling. I know the job won't be deleted before I have time to complete whatever I need to do.

如果文件池被禁用,我可以通过查看做到这一点假脱机目录,格式为xxxxx.spl,其中xxxxx是0填充作业ID文件。

If file pooling is disabled, I can do this by looking in the spool directory for the file with format "xxxxx.spl", where xxxxx is the 0-padded job ID.

我怎样才能做到这一点,如果启用了文件池?

How can I do this if file pooling is enabled?

我会很高兴,如果有是找了份工作ID和返回的假脱机数据流的方法,但在这一点上似乎不太可能。据说类似的东西可能会使用 OpenPrinter 与PrinterName的,工作XXXX和ReadPrinter作为记录的here ,但到目前为止,我的一直没能得到它的工作,即使我这样做看起来喜欢它加载数据到内存中,我不知道这将如何与大型后台打印文件(> 1 GB是不寻常的)工作。

I'd be delighted if there was a method that took a job ID and returned a stream of the spool data, but that seems unlikely at this point. Supposedly something similar might be possible using OpenPrinter with "PrinterName,Job xxxx" and ReadPrinter as documented here, but so far I haven't been able to get it to work, and even if I do it looks like it loads the data into memory, and I'm not sure how this will work with large spool files (>1 GB is not unusual).

我的第二选择会有办法在ID传递并取回文件的位置与磁盘上(无论文件池设置)假脱机数据。

My second preference would be a way to pass in the ID and get back the location of the file with the spool data on disk (regardless of file pooling setting).

我的第三个更倾向于将一种映射的汇总文件(FPyyyyy.spl),以作业ID它是。

My third preference would be a way to map a pooled file ("FPyyyyy.spl") to the job ID it's for.

是任何一个可行的,或没有任何人有一个更好的主意?如何解决这个问题。

Are any of these feasible, or does anybody have a better idea about how to solve this issue?

(编辑补充,因为它并不清楚,我们都知道这个选项):
我们的底牌是要求我们的客户禁用后台打印文件通过编辑每台打印机注册表池,但我们更希望避免这种情况。

(Edited to add since it wasn't clear that we were aware of this option): Our fallback is to require that our customers disable spool file pooling by editing the registry for each printer, but we would much prefer avoid this.

推荐答案

想通了为什么我对 OpenPrinter 是失败,我已经成功地使用读假脱机数据 OpenPrinter ReadPrinter ,它很好地解决了我们的问题。

I figured out why my calls to OpenPrinter were failing and I have successfully read the spool data using OpenPrinter and ReadPrinter, which solves our problem nicely.

我还是会奖赏金给任何人谁更好的解决方案出现,虽然

I'll still award the bounty to anybody who comes up with a better solution, though.

这篇关于如何找到启用后台打印文件池,即使对于一个给定的ID作业的假脱机文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆