如何在ASP.NET中的客户端打印机中打印服务器端文件? [英] How to print server side file in client side printer in ASP.NET ?

查看:103
本文介绍了如何在ASP.NET中的客户端打印机中打印服务器端文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi
我们有网站并托管在不同的域名,而不是在同一个网络中。该网站有一些文件doc,pdf和png,当使用url访问该网站并尝试打印时,则需要调用客户端打印和打印该文件,在chrome和mozila客户端打印代码仅用于pdf文件,可能是安装在客户端机器上的pdf查看器,即边缘它只是要求保存,另存为和打开选项,但我们需要调用客户端打印机没有保存在客户端机器上。可以吗?



我尝试过:



这只适用于chrome和mozilla

Hi We have website and hosted in different domain ,not in same network.That website have some files doc,pdf and png,when access that website using url and try to print,then need to call client side print and print that file,In chrome and mozila client side print code woring only for pdf file,may be pdf viewer installed in client machine,ie,edge it just ask save,save as and open option,but we need to call client side printer without saving in client machine.it is possible ?

What I have tried:

This only work in chrome and mozilla

function btnPrint1_ClientClick() {
              var opts = 'width=700,height=500,toolbar=0,menubar=0,location=1,status=1,scrollbars=1,resizable=1,left=0,top=0';
              var newWindow = window.open("pdf/SKMBT_C22416051313120.pdf", 'name', opts);
              newWindow.print();
              return false;

          }



这个服务器端代码什么都没发生


This server side code nothing happen

Dim objPJ As New Process
        objPJ.StartInfo.FileName = Server.MapPath("") + "/pdf/originalfile.pdf"
        objPJ.StartInfo.Verb = "Print"
        objPJ.StartInfo.CreateNoWindow = True
        objPJ.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden
        Dim setting As New PrinterSettings
        setting.DefaultPageSettings.Landscape = True
        objPJ.Start()



我推荐此链接



http://stackoverflow.com/questions/21900261/printing-a -pdf-file-on-client-side-printer-in-asp-net-c



问候

Aravind


I referred this link

http://stackoverflow.com/questions/21900261/printing-a-pdf-file-on-client-side-printer-in-asp-net-c

Regards
Aravind

推荐答案

您所能做的就是将文件发送到客户端,如果他们有办法打印该文件(即他们有一个PDF阅读器,如果它如果是Word文件,则为PDF或Word;然后,如果需要,他们可以选择打印文档。您无法通过服务器代码影响客户端打印。如果他们没有PDF阅读器,他们只需要安装一个。
All you can do is send the file to the client and if they have a way of printing that file (ie they have a PDF reader of some sort if it is a PDF, or Word if it is a Word file) then they can choose to print the document if they want to. You can't influence client-side printing from your server code. If they don't have a PDF reader they'll just need to install one.


这篇关于如何在ASP.NET中的客户端打印机中打印服务器端文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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