在ASP.NET C#中实现System.Drawing.Printing.PrintDocument [英] Iimplimenting System.Drawing.Printing.PrintDocument in asp.net C#

查看:100
本文介绍了在ASP.NET C#中实现System.Drawing.Printing.PrintDocument的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

在我的Web项目中,我想在申请表上打印一些值.意味着我想填写从数据库中获取数据的申请表并将其打印在应用程序中的特定位置(即必须设置x,y坐标).例如,申请表由
组成 申请人姓名:
父亲的名字:
城市:
.....等

现在我要填写他的名字,父亲的名字,城市,该位置在该特定位置.申请表是一张印刷纸,我需要使用ASP.NET C#填写(印刷详细信息),因此我在网上看到这表明可以通过
完成

Hello everyone,

In my web project i want to print some values on a application form. Means I want to fill the application form taking data from database and print it on application in a particular location (i.e x,y coordinates has to be set). Say for example application form consists of
Applicant name:
Father name:
City:
..... So on

Now i want to fill his name,father name ,city which is in database in that particular position . The application form is a printed sheet on that I need to fill (print details) using ASP.NET C# so i saw in net about this it showed that it can be done through

using System;
using System.Drawing;
using System.Drawing.Printing;







PrintDocument Membership_Receipt_PrintDocument = new PrintDocument();
           Membership_Receipt_PrintDocument.PrintPage += new PrintPageEventHandler(Membership_Receipt_PrintDocument_PrintPage);
           Membership_Receipt_PrintDocument.Print();




但这在本地系统中有效.问题是,当我在虚拟主机上显示错误
未找到打印机"

所以有人可以告诉我如何完全满足我对打印机零件的要求吗?
我也尝试过这个东西




But this works in local system . Problem is that when i web host it shows an error
"No printers found"

So can can anybody tell me how can i full fill my requirement about printer part
I tried this thing also

Window.Print();



但是它会打印我给的整个标签.
我想在点矩阵打印机上实现它.
所以伙计们给我一些建议或暗示.我需要在Asp.net Web应用程序中完成其自身工作...

在此先感谢
Arun R.V



but it print the whole tag that I gave .
I want to implement it on Dot matrix printer .
So guys give me some suggestion or a hint . I need to do in Asp.net Web application its self ......

Thanks in advance
Arun R.V

推荐答案

使用drawing.printing命名空间对您来说是必需的?
您可以使用javascript调用打印窗口.

长期以来对我有用.
Using drawing.printing namespace is manadate for you ?
In your case you can use javascript to call a print window.

it worked for me from long time.
function CallPrint(strid)
 { 
      var prtContent = document.getElementById(strid);
      // strid is id of the element/control you want to print.
      var WinPrint = window.open('', '', 'letf=100,top=100,width=600,height=600'); // open a new window
      WinPrint.document.write(prtContent.innerHTML); // create desired control on new window
      WinPrint.document.close();
      WinPrint.focus();
      WinPrint.print(); // call a print dailouge.
       
 }



JS将在您的客户端上运行,您将能够看到连接到计算机的所有打印机.



JS will run on your client side and you will be able to see all the printer connected to your machine.


这篇关于在ASP.NET C#中实现System.Drawing.Printing.PrintDocument的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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