在不同位置将打印标签发布到同一型号的打印机. [英] Issues printing labels to the same model printer in different locations.

查看:109
本文介绍了在不同位置将打印标签发布到同一型号的打印机.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一些软件来在Avery 5160列模板上打印条形码标签.它们在我办公室的HP4015,HP4100和HP4250激光打印机上居中并正确对齐.我部署了代码,发现同一型号的打印机在公司的不同位置可能无法正确打印标签.例如,在一个位置,HP4100可以完美地打印标签,但是在该位置,HP4250会将右侧列切掉1/8英寸.在另一个站点中,HP4250很好,但是HP4100打印标签时,其垂直位置仅一点点偏离,导致其上方的标签重叠.我不确定如何解决此问题.

I created some software to print barcoded labels on Avery 5160 column templates. They print centered and aligned properly on the HP4015, HP4100, and HP4250 laser jet printers in my office. I deployed the code and am seeing that in different locations across the company the same model printer may not print the labels properly. For example - in one location the HP4100 prints the label perfectly but the HP4250 in that location chops off the right hand column by 1/8 inch. In another site the HP4250 is fine but the HP4100 prints the labels with the verticle positioning just a tad off causing an overlap with the label above it. I am not sure how to fix this issue. Has anyone else had this kind of issue before?

推荐答案

正确的方法是让平台处理所有不同的打印机.您的任务是提供不依赖打印机的渲染.例如,您不能否认是否以矢量格式输出某些数据,例如XPS( http://en.wikipedia.org/wiki /Open_XML_Paper_Specification [ ^ ]),则操作系统尽管有打印机详细信息,但已安装的打印机仍可以正确打印.

当然,您总是可以打印到XPS,因为有一台打印机可以打印到这种类型的文件,但是更一般而言,您需要实时渲染图形.您可以使用类System.Drawing.Printing.PrintDocument:
进行操作 http://msdn.microsoft.com/en-us/library/system. drawing.printing.printdocument.aspx [ ^ ].

查看代码示例以了解如何完成此操作.重要的是要注意,最主要的是这样的代码是将事件处理程序添加到偶数PrintPage中.作为处理程序方法的参数传递的事件参数为您提供了有关页面指标的信息.并且还为您提供了用于渲染的类System.Drawing.Graphics的实例:
http://msdn.microsoft.com/en-us/library/system.drawing. graphics.aspx [^ ].

在渲染方法中,您必须根据页面的大小和方向来缩放图形,仅此而已.对于任何具有足够页面尺寸和分辨率的打印机,您都可以足够准确地排列Avery格式的数据.

祝你好运,
—SA
The right approach is to let the platform dealing with all the different printers; your task is to provide rendering which is not dependent from the printer. For example, you cannot deny that if you output some data in a vector format like XPS (http://en.wikipedia.org/wiki/Open_XML_Paper_Specification[^]), the OS with the installed printer will print it correctly despite the printer detail.

Of course, you can always print to XPS, because there is a printer which prints to a file of this type, but more generally, you need to render your graphics on the fly. You can do it using the class System.Drawing.Printing.PrintDocument:
http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.aspx[^].

Look at the code sample to see how this is done. It''s important to note that the main thing is such code is adding the event handler to the even PrintPage. Event arguments passed as a parameters of the handler method provides you with the information on the page metrics; and you also are given the instance of the class System.Drawing.Graphics to be used for rendering:
http://msdn.microsoft.com/en-us/library/system.drawing.graphics.aspx[^].

In you rendering method, you have to scale your graphics according to the size and orientation of the page, that''s it. For any printer with sufficient page size and resolution, you can arrange your Avery-formatted data with sufficient accuracy.

Good luck,
—SA


这篇关于在不同位置将打印标签发布到同一型号的打印机.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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