从ASP.NET应用程序打印到本地Web服务器打印机 [英] Print from ASP.NET application to local web server printer

查看:111
本文介绍了从ASP.NET应用程序打印到本地Web服务器打印机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的网络应用程序中我需要当用户点击打印按钮时,与网络服务器连接的打印机进行打印工作.....我不能使用java脚本,我需要从后面的代码打印它/>


当我从visual studio运行项目时,代码工作正常的问题。将项目发布到IIS后,打印按钮无法正常工作





代码为:



in my web application i need to when user click print button that the printer that connected with web server do the print work ..... i can't use java script and i need to print it from code behind

the problem that the code work fine when i'm running the project from visual studio . put after publish the project to IIS the print button not working


the code is :

Dim DT = CardsProcObj.GetFamilyCardInfoForPrintByID(CInt(camplib.DealWithDB.QSDecrypt(Request.QueryString("caid"))))
            Dim printerSettings As New System.Drawing.Printing.PrinterSettings
            printerSettings.PrinterName = GetDefaultPrinter() '"\\192.168.230.5\DTC1000 Card Printer"
            Dim reportProcessor As New Telerik.Reporting.Processing.ReportProcessor
            Dim standardPrintController As New System.Drawing.Printing.StandardPrintController
            Dim typeReportSource As New Telerik.Reporting.TypeReportSource()
            typeReportSource.TypeName = "camp.familycard, camp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
            typeReportSource.Parameters.Add("CardID", camplib.DealWithDB.QSDecrypt(Request.QueryString("caid")))
            typeReportSource.Parameters.Add("FamilyID", DT.Rows(0).Item("FamilyID").ToString)
            typeReportSource.Parameters.Add("FamilyName", DT.Rows(0).Item("FamilyName").ToString)
            typeReportSource.Parameters.Add("HeadName", DT.Rows(0).Item("FullName").ToString)
            typeReportSource.Parameters.Add("HeadImageUrl", Server.MapPath(DT.Rows(0).Item("ImageUrl").ToString))
            typeReportSource.Parameters.Add("Barcode", DT.Rows(0).Item("Barcode").ToString)
            typeReportSource.Parameters.Add("pCount", DT.Rows(0).Item("pCount").ToString)
            reportProcessor.PrintController = standardPrintController
            reportProcessor.PrintReport(typeReportSource, printerSettings)







如何解决这个问题



thx



我尝试过:



更改设备和打印机的注册表设置




how can solve this

thx

What I have tried:

change registry setting for device and printers

推荐答案

你无法通过服务器代码在客户端计算机上打印,您只需向用户提供文件\page,如果他们想打印它们,他们就会。如果网站可以强制文件到您的打印机,那么每个其他网站都会通过广告和优惠券向您的打印机发送垃圾邮件。
You can't print on the client machine from your server code, you have to just give the user the file\page and if they want to print it they will. If websites could force documents to your printer then every other website would be spamming your printer with adverts and coupons.


这篇关于从ASP.NET应用程序打印到本地Web服务器打印机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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