记录通过打印机打印的文本 [英] Log the text printed via a printer

查看:128
本文介绍了记录通过打印机打印的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找一个月的答案,但我无法找到确切的解决方案或方法或从哪里开始。



我想要创建一个记录打印数据的应用程序。例如,如果我从记事本打印abcd我想从我的软件中捕获这个abcd。



我想问我应该从哪里开始或者什么我应该使用哪些工具。我想用C#开发这个应用程序。



我可以使用PrintQueue类访问作业ID,队列名称等。但是我无法访问要打印的数据。



我没有开发端口监视器或打印监视器的经验。有没有一种简单的方法来完成这项任务?像任何内置的C#函数或者如果我可以捕获原始的prn文件也可以,但我不想让用户知道prn文件正在保存。



任何帮助或示例代码都将受到高度赞赏。



[如果有相似的帖子,请发布链接到该感谢]

I have been searching for an answer for a month now but i am unable to find the exact solution or a method or from where to start.

I want to create an application that logs the data printed. for example if I print "abcd" from notepad I want to capture this "abcd" from my software.

I want to ask that from where should i start or what tools should I use. I want to develop this application in C#.

I can access the Job ID , queue name etc using the PrintQueue class. but i am unable to access the data that is to be printed.

I dont have any experience developing port monitors or print monitors. Is there a simple way to achieve this task ? Like any built in C# functions or if i can just capture the raw prn file that will be ok as well but i dont want to user know that the prn file is being saved.

Any help or sample code will be highly appreciated.

[If there is a similar post already please post a link to that thanks]

推荐答案

如果您设置了打印假脱机程序设置保留打印文档,则打印完成后将存储假脱机文件(如果您还选择假脱机EMF文件),则可以读取使用此 EMF打印机假脱机文件查看器 [ ^ ]



有一些复杂性,因为这不是一件容易的事 - 例如,在尝试读取假脱机文件之前需要确保打印作业已完成,并且我如果假脱机文件使用的是嵌入式字体,则需要找到要应用的偏移量来获取真实文本字符..
If you set the print spooler setting "Keep printed documents" then the spool file will be stored after the print completes and (if you also choose to spool EMF files) this can be read with this EMF Printer Spool File Viewer[^]

There are some complexities as this is not an easy task - for example you need to make sure the print job is completed before you try to read the spool file, and if the spool file is using embedded fonts you need to find the offset to apply to get the real text characters..


这篇关于记录通过打印机打印的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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