计数在C#中打印的页数页数

2023-09-04 11:38:32 作者:罚伱噯我①生

我开发一个后台打印监视器来算的是由一个特定的打印机打印的页数。

I am developing a print spool monitor to count the number of pages that are printed by a certain printer.

我是新来这个领域,所以我用下面的文章是我的参考。

I am new to this area, so I am using the following article as my reference.

打印监视器

现在我已经分别计数双面页(双面)和单面页的要求。如何检测呢?

Now I have a requirement of counting the double sided pages (duplex) and single sided pages separately. How can I detect this?

推荐答案

这充其量是困难的。要正确地做到这一点,你就需要通过RIP(光栅图像处理器),可以转换语言的东西打印机究竟要输出,看看什么出来运行输出(PCL / PS / XPS)。你可以看一下正在使用的打印语言双面codeS文件,但你可能会遇到的问题可能复式和关闭整个转动。此外,不同的制造商可能会在工作的开始,而不是在数据流本身标准PCL或PS编码把这个定制的PJL

This is difficult at best. To do it properly you'd need to run the output (PCL/PS/XPS) through a RIP (Raster Image Processor) that can convert the language to something the printer is actually going to output and see what comes out. You can look at the file for duplex codes in the language that is being used for print, but you could run into problems as duplex might be turned on and off throughout. Also, different manufactures might put this in custom PJL at the start of the job and not in standard PCL or PS coding in the datastream itself.

如果精度不是一个大问题,那么你可以将数据分析,并提出了一些号码,但你永远不会是准确的,尤其是如果该文件没有明确有双面打印或关闭和打印机设置为上。在这种情况下,将双面打印和你永远不会知道。要添加到,用户可以打印多张同屏(4页在一张纸上)。如果他们做到这一点通过应用程序将报告1页。如果他们这样做在打印机驱动程序,它可能会通过4页,让打印机做的上篮,在这种情况下,你会报告4页,而不是1。另一种情况是谁想要一个1页文档的100份用户。后台打印程序可能只报告1页,因为打印机是要干什么创建多个副本的工作。

If accuracy isn't a huge issue then you could parse the data and come up with some numbers but you'll never be exact, especially if the file doesn't explicitly have duplex on or off and the printer is set to on. In this case it will duplex and you'll never know. To add to that, the user might print multi-up (4 pages on a single sheet). If they do this through the application it will report 1 page. If they do it in the printer driver, it may pass 4 pages and let the printer do the layup, in this case you will report 4 pages and not 1. Another case is the user who want 100 copies of a 1 page document. The spooler might only report 1 page because the printer is going to do the work of creating multiple copies.

有市场上的许多工具,用于捕获该数据。准确的人通常从设备的数据在打印作业后。大多数现代的打印机必须跟踪打印页数和用户的能力等。

There are many tools on the market for capturing this data. The accurate ones typically get data from the device after the job is printed. Most modern printers have an ability to track pages printed and users etc.

对不起,我没有给你更好/更快乐的答案。祝你好运。

Sorry I don't have nicer/happier answer for you. Good luck.

 
精彩推荐
图片推荐