如何在ASP.net Web应用程序中以预打印的固定格式打印到预定义的打印机? [英] How can we Print in a pre printed stationary format to a pre defined printers in ASP.net web application?

查看:83
本文介绍了如何在ASP.net Web应用程序中以预打印的固定格式打印到预定义的打印机?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



如何在ASP.net Web应用程序中以预打印的固定格式打印到预定义的打印机?



场景:



印刷固定件的预印刷格式将为客户提供.我们必须使用预定义的设置以这种格式打印数据.必须有一个预定义打印机的选项,并且打印输出必须到达该特定打印机.在单台机器上,将有多种打印机设置,用于不同格式(预先打印用于各种目的的固定打印,如账单,发票,报价单等,将在连接到同一LAN上不同机器的打印机中),并且取决于系统必须识别的设置打印机,然后将输出路由到该特定打印机.设置存储在中央数据库中.我们正在使用WCF服务,ASP.net(框架4.0)和C#作为编程语言.对于仅在中央服务器上托管其数据的不同客户端位置,打印机设置将有所不同.

Hi

How can we Print in a pre printed stationary format to a pre defined printers in ASP.net web application?



Scenario:



Pre printed format of the printing stationary will provide the customer. We have to print data in to this format using pre defined settings. There must be an option to predefine the printer and the print out must come to that particular printer. From single machine there will be multiple printer settings for different formats (Pre print stationary for various purposes like bill, invoice, quotation etc which will be in the printer connected to different machines in the same LAN) and depends on the settings the system must identify the printer and route the output to that particular printer. The settings are stored in the central database. We are using WCF service, ASP.net (Framework 4.0) and C# as programming language. The printer settings will be different for different client locations where their data is hosted in the centralized server only.

推荐答案

请记住,您无法控制用户打印出一些内容.您正在提供一个浏览器应用程序,并且所有打印都在控制之外,尽管您可以使用media = print通过CSS样式表修改客户端打印的 content .

如果要为用户提供预格式化的文档以供打印,则应创建PDF,然后他们可以选择下载并打印(如果具有Chrome或FF/IE插件,则可以在浏览器中进行打印).

如果要在LAN上定义明确的地方打印,请将其设置为网络服务器计算机上的网络打印机 ,然后创建一个打印文档并按常规方式写入该文档(即,以相同的方式)就像您在桌面应用中打印一样).这将需要您编写一个新的输出驱动程序以将适当的内容写入打印机,因为没有设置ASP.net基础结构来执行此操作,但是如果您对数据进行了很好的分离并显示出来,则不应该这样做太难了,要创建PDF,您也需要这样做.显然,这仅在LAN情况下有效,这对于用户打印到Web服务器可访问的中央位置很有用.
Remember that you can''t control how the user prints something. You are providing a browser application and any printing goes on outside your control, although you can modify the content of a client side print through CSS stylesheets with media=print.

If you want to provide a pre-formatted document for users to print, you should create a PDF, which they can then choose to download and print (or print within the browser if they have Chrome or a FF/IE plugin).

If you want to print somewhere well-defined on the LAN, set that up as a network printer on the web server machine, and create a print document and write to it as normal (i.e. in the same way as you''d print in a desktop app). This will require you to write a new output driver to write the appropriate content to the printer, as none of the ASP.net infrastructure is set up to do that, but if you have a good separation of data and display this shouldn''t be too hard, and to create a PDF you need to do that as well. Obviously this only works in a LAN situation where it is useful to the users to print to a central location accessible to the web server.


这篇关于如何在ASP.net Web应用程序中以预打印的固定格式打印到预定义的打印机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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