在C#中使用页边距和其他打印机配置打印原始数据 [英] Printing raw data with margins and other printer configurations in C#

查看:284
本文介绍了在C#中使用页边距和其他打印机配置打印原始数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,这是我第一次在互联网上提问.因此,我希望有人在这种特殊情况下对我有所帮助:

我将原始数据完美地发送到了点矩阵打印机,但是我无法处理页边距,我的意思是,当我将文件或字符串发送到要发送到打印机的方法时,它会打印在页面的左上方完全没有边距,并且当打印机完成后,它不会加载页面,而是将纸张停在其中,所以我需要如何控制它...
我导入了"winspool.drv"驱动器,例如MSDN给出的示例(我为大家提供的简单礼物: http://support.microsoft.com/?kbid=322091 [^ ]),但我需要更多有关更多配置命令或所需内容的信息.

h!顺便说一句,MSDN在其示例中忘记了一件事情:将这一行放在类的顶部(创建文件所需):

使用System.IO;否则,将无法正常工作

我希望我的信息也能对他人有所帮助,但是...

请也帮我!!!这是C#.谢谢!

Francisco Roldan Arauz

Hello everybody, this is my first time asking a question on Internet ever. So, I hope somebody help me on this particular situation:

I send raw data to a dot matrix printer perfectly BUT, I can''t handle margins, I mean, when I send a file or a String to a method which sends to the printer, it is printed on the top left of the page without margins at all, and when it finishes the printer don''t load the page, instead, it stops with the paper in it SO I need how to control it...
I import the ''winspool.drv'' drive such as the example given by MSDN (my simple gift for you all: http://support.microsoft.com/?kbid=322091[^]), but I need more information about more configuration commands or whatever I need.

Uh! by the way, MSDN has forgotten one thing with their example: Put this line on the top of their class (needed for creating files):

using System.IO; Otherwise, It won''t work

I hope my info help somebody as well, but...

Please help me too!!! It''s C#. Thanks!

Francisco Roldan Arauz

推荐答案

您似乎正在使用较旧的技术进行打印.为什么不使用一些较新的东西使您更轻松:使用C#打印.这样,您就可以绘制到Graphics对象,然后将其发送到打印机.您可以通过不绘制Graphics对象的边缘来处理边距,但是我认为API允许您显式设置边距.
It looks like you are using an older technology to do printing. Why not use some newer stuff that makes things easier for you: Printing Using C#. That allows you to draw to a Graphics object, which then gets sent to the printer. You could handle margins by just not drawing on the edge of the Graphics object, but I think the API allows you to set the margin explicitly.


在阅读完对上一个答案的评论后. br/>
我认为您可能误解了aspdotnetdev的建议.

关键是,通过将输出定向到最新方法提供的Graphics Object,可以在将其发送到物理打印机之前控制对齐方式,边距,标题和其他内容.

为了直接在打印机上影响页边距设置,否则您必须知道客户可能使用的所有可能打印机的代码.

如果我误解了您的情况,请忽略此帖子. :)
After reading your comment to the previous answer.

I think that you might have misunderstood what aspdotnetdev was suggesting.

The point is that by directing your output to the Graphics Object provided by the more recent methods, you can control the alignment, margins, headers and whatever else before sending it to the physical printer.

In order to influence margin settings directly on the printer you would otherwise have to know the codes for all possible printers your customers might be using.

If I have misunderstood your situation, please ignore this post. :)


这篇关于在C#中使用页边距和其他打印机配置打印原始数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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