拦截发送到Windows打印机的数据(使用RedMon) [英] Intercepting data sent to a Windows printer (using RedMon)

查看:800
本文介绍了拦截发送到Windows打印机的数据(使用RedMon)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要拦截发送到Windows上的ESC / POS打印机的数据并进行分析。

I need to intercept data being sent to a ESC/POS printer on Windows and analyze it.

所以我想以纯文本格式获取数据,以便我可以提取并理解发送到打印机的信息。

So I wanted to get the data in plain text, so that I can extract and make sense of information being sent to the printer.

目前,我已尝试使用RedMon将数据流发送到打印机端口。但是发送的数据是光栅图形的形式,即要打印的点,嵌入在ESC / POS命令中。

Currently, I have tried using RedMon to get the data stream being sent to the printer port. But the data being sent is in the form of raster graphics i.e. dots to be printed, embedded within ESC/POS commands.

所以我想知道是否有人可以建议我如何以文本格式获取打印数据,以便能够从中提取一些信息。

So I was wondering if somebody can suggest me on how can I get the print data in text format so as to be able to extract some information from it.

推荐答案

发送到ESC / POS打印机 IS 嵌入了ESC / POS命令的栅格数据。这是ESC / POS打印机驱动程序从其输入生成的内容。这就是RedMon为您捕获的内容。

The data which is sent to a ESC/POS printer IS raster data embedded with ESC/POS commands. This is what the ESC/POS printer driver generates from its input. And that's what RedMon catched for you.

似乎您希望看到发送到打印机驱动程序的输入。这意味着你必须找出哪些应用程序使用打印机,你必须拦截到达打印机驱动程序的内容。

Seems you want to see the input sent to the printer driver. That means you'll have to find out which applications do use the printer and you have to intercept what arrives at the printer driver.

你没有说你是否想要在实时环境中设置拦截,或者仅用于临时测试。如果您想暂时测试,可以选择执行以下步骤:

You do not say if you want to set up your interception in a 'live' environment, or if it is for temporary testing only. If you want to test temporarily, you could alternatively do the following steps:


  1. 暂停打印队列(上方屏幕截图,如下)。

  2. 可选:将驱动程序从ESC / POS更改为PostScript或Microsoft XPS。如上所述,在打印机属性对话框上的相同高级选项卡上执行此操作。 (右下方的屏幕截图)。

  3. 打印。

  4. 检索在假脱机目录中等待的假脱机文件。在Windows 8上,默认情况下为 C:\ Windows \ System32 \spool \ PRINTERS 。假脱机文件名为 NNNNN.spl 其中NNNNN是当前打印作业的编号。

  5. 分析PostScript或XPS数据。

  1. Pause the print queue (upper screenshot, below).
  2. Optionally: change the driver away from ESC/POS to, say PostScript or Microsoft XPS. Do this on the same "Advanced" tab on the printer properties dialog as mentioned above. (lower screenshot on the right, below).
  3. Print.
  4. Retrieve the spoolfile waiting in the spool directory. On Windows 8 this is by default C:\Windows\System32\spool\PRINTERS. The spoolfile is named NNNNN.spl where NNNNN is the number of the current printjob.
  5. Analyze the PostScript or XPS data.

查看以下3个屏幕截图:

  

  

然而,如果你......它会更容易(而不是使用RedMon)...

However, it would be much easier (instead of using RedMon) if you...


  • ...只需启用名为保留打印文档的打印机驱动程序设置:转到打印队列属性=>选择高级 tab =>启用相应的复选框(参见上面的左侧屏幕截图);

  • ...simply enable the printer driver setting called "Keep printed documents": go to print queue properties => select "Advanced" tab => enable respective checkbox (see left screenshot, above);

...从Windows打印假脱机目录中假脱机的printjob;

...fish spooled printjob from the windows print spool directory;

...分析您的 NNNNN.spl 文件:

...analyze your NNNNN.spl file:


  • 在Windows 8上,这将是一个XPS f ILE。将其重命名为NNNNN.xps,您可以使用内置的XPS查看器打开它。

  • on Windows 8 this will be an XPS file. Re-name it to NNNNN.xps and you can open it with the builtin XPS viewer.

在以前版本的Windows上, NNNNN.spl 将具有相应打印机驱动程序的文件格式(PostScript for PostScript驱动程序,XPS用于Microsoft XPS打印机,ESC / POS用于打印机,...)。相应地重命名并在XPS或PostScript查看器中打开它。

on previous version of Windows, the NNNNN.spl will have the file format of the respective printer driver (PostScript for PostScript drivers, XPS for Microsoft XPS printer, ESC/POS for your printer, ...). Rename it accordingly and open it in XPS or PostScript viewer.

这篇关于拦截发送到Windows打印机的数据(使用RedMon)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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