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

查看:38
本文介绍了拦截发送到 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:WindowsSystem32spoolPRINTERS.假脱机文件名为 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:WindowsSystem32spoolPRINTERS. The spoolfile is named NNNNN.spl where NNNNN is the number of the current printjob.
  5. Analyze the PostScript or XPS data.

查看这 3 个屏幕截图:

  

  

但是,如果您...

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

  • ...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 打印假脱机目录中获取假脱机打印作业;

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

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

...analyze your NNNNN.spl file:

  • 在 Windows 8 上,这将是一个 XPS 文件.将其重命名为 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 用于 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天全站免登陆