在客户端从Web打印

时间:2021-09-22 09:52:05

How can we print using print document so that we can control the printer paper size?

我们如何使用打印文档进行打印,以便控制打印机纸张尺寸?

  • It must be controlled after web hosting is done without the print dialog popup or javascript popup.
  • 在没有打印对话框弹出窗口或javascript弹出窗口完成Web托管后,必须对其进行控制。

  • It should print on the client's printer after webhosting without the print dialog option and setting the paper size.
  • 在没有打印对话框选项并设置纸张尺寸的情况下,它应在webhosting后在客户端的打印机上打印。

  • It should be done in C# .net
  • 它应该在C#.net中完成

6 个解决方案

#1


4  

As a user I don't want that when I enter a site someone to change my printer's settings or to take control over my printer.

作为用户,当我进入某个站点时,我不希望有人更改我的打印机设置或控制我的打印机。

For security reasons I hope this is not possible.

出于安全考虑,我希望这是不可能的。

#2


4  

Your best option is to generate PDF-files with the appropriate siez in it. A printer should choose the correct page-size based on that unless the user manually changes it in the print-dialog.

您最好的选择是生成包含相应siez的PDF文件。除非用户在打印对话框中手动更改页面大小,否则打印机应根据该页面大小选择正确的页面大小。

Cirrcumventing the print-dialog is a security-restriction, ActiveX or a firefox-extension is your only alternative then, which might be okay on an intranet-based webapplication.

绕过打印对话框是一个安全限制,ActiveX或firefox扩展是你唯一的选择,在基于Intranet的webapplication上可能没问题。

#3


2  

The only way that I've been able to have this amount of control over the printer client side is to create an ActiveX component that would handling the printing interface and go from there. It's not cross-broswer not the cleanest solution; however, it's the only way that I've been able to manage paper size. I looked into a CSS @print options but was not able to find one that could truly control the size.

我能够对打印机客户端进行这种控制的唯一方法是创建一个ActiveX组件来处理打印界面并从那里开始。这不是最彻底的解决方案,而不是最干净的解决方案;然而,这是我能够管理纸张尺寸的唯一方法。我查看了一个CSS @print选项,但无法找到一个可以真正控制大小的选项。

The only other possibility is to look to see what printing capabilities something like Flash or Silverlight have. I'm not familiar enough to say if they do or don't have what you're looking for; however, it may be another option.

唯一的另一种可能性是查看Flash或Silverlight之类的打印功能。我不熟悉,如果他们有或没有你想要的东西;但是,它可能是另一种选择。

#4


1  

I believe a Java applet has the ability to set paper size if you grant it the proper privileges. I think your users will almost certainly have to jump through hoops for this to work...

我相信如果您授予Java applet适当的权限,它可以设置纸张大小。我认为你的用户几乎肯定要跳过这个工作的箍...

#5


1  

Maybe too late but I'm adding for future reference; you could use a kind of download/print manager utility. Imagine the torrent magnet links, you click a link and a .torrent file opened by torrent client, it reads the necessary info and do the rest at client site.

也许为时已晚,但我正在补充以备将来参考;你可以使用一种下载/打印管理器实用程序。想象一下torrent磁链接,你点击一个链接和一个由torrent客户端打开的.torrent文件,它会读取必要的信息并在客户端站点完成其余的工作。

So you have to write a little utility which one recognizes these 'print jobs' from your web site. You click a [Print Invoice] link and browser downloads a unique .print file and the utility captures it.

因此,您必须编写一个小工具,可以从您的网站识别这些“打印作业”。单击[打印发票]链接,浏览器将下载唯一的.print文件,该实用程序将捕获该文件。

The .print file has two parts: 1. Header and 2. The file (pdf/jpg/any). Header contains predefined printer/paper size/orientation/etc or just asks for user input. And then prints the file from 2. part/body.

.print文件包含两部分:1。标题和2.文件(pdf / jpg / any)。标题包含预定义的打印机/纸张尺寸/方向/等,或者仅询问用户输入。然后从2. part / body打印文件。

You may also queue the print jobs and manage them as well.

您也可以对打印作业进行排队并对其进行管理。

You have to install that utility; define a protocol like http:// or ftp:// to capture print links from the utility. And set printers/papers/etc for specific jobs like invoices/color printings/etc.

你必须安装该实用程序;定义像http://或ftp://这样的协议来捕获实用程序中的打印链接。并为特定工作设置打印机/纸张/等,如发票/彩色印刷/等。

These will be what I'll do when I port our winforms app to web. Plus If you are on a LAN environment then you would print the things from the web server to network printers.

当我将winforms应用程序移植到Web时,这些将是我要做的。如果您在LAN环境中,则可以将Web服务器中的内容打印到网络打印机。

#6


0  

I have looked into this before, and the only way to force things like portrait/landscape etc, is to get the user to install an ActiveX control (or similar).

我之前已经研究过,强制像纵向/横向等一样的唯一方法是让用户安装ActiveX控件(或类似的)。

Javascript or CSS alone cannot do it.

单靠Javascript或CSS无法做到这一点。

#1


4  

As a user I don't want that when I enter a site someone to change my printer's settings or to take control over my printer.

作为用户,当我进入某个站点时,我不希望有人更改我的打印机设置或控制我的打印机。

For security reasons I hope this is not possible.

出于安全考虑,我希望这是不可能的。

#2


4  

Your best option is to generate PDF-files with the appropriate siez in it. A printer should choose the correct page-size based on that unless the user manually changes it in the print-dialog.

您最好的选择是生成包含相应siez的PDF文件。除非用户在打印对话框中手动更改页面大小,否则打印机应根据该页面大小选择正确的页面大小。

Cirrcumventing the print-dialog is a security-restriction, ActiveX or a firefox-extension is your only alternative then, which might be okay on an intranet-based webapplication.

绕过打印对话框是一个安全限制,ActiveX或firefox扩展是你唯一的选择,在基于Intranet的webapplication上可能没问题。

#3


2  

The only way that I've been able to have this amount of control over the printer client side is to create an ActiveX component that would handling the printing interface and go from there. It's not cross-broswer not the cleanest solution; however, it's the only way that I've been able to manage paper size. I looked into a CSS @print options but was not able to find one that could truly control the size.

我能够对打印机客户端进行这种控制的唯一方法是创建一个ActiveX组件来处理打印界面并从那里开始。这不是最彻底的解决方案,而不是最干净的解决方案;然而,这是我能够管理纸张尺寸的唯一方法。我查看了一个CSS @print选项,但无法找到一个可以真正控制大小的选项。

The only other possibility is to look to see what printing capabilities something like Flash or Silverlight have. I'm not familiar enough to say if they do or don't have what you're looking for; however, it may be another option.

唯一的另一种可能性是查看Flash或Silverlight之类的打印功能。我不熟悉,如果他们有或没有你想要的东西;但是,它可能是另一种选择。

#4


1  

I believe a Java applet has the ability to set paper size if you grant it the proper privileges. I think your users will almost certainly have to jump through hoops for this to work...

我相信如果您授予Java applet适当的权限,它可以设置纸张大小。我认为你的用户几乎肯定要跳过这个工作的箍...

#5


1  

Maybe too late but I'm adding for future reference; you could use a kind of download/print manager utility. Imagine the torrent magnet links, you click a link and a .torrent file opened by torrent client, it reads the necessary info and do the rest at client site.

也许为时已晚,但我正在补充以备将来参考;你可以使用一种下载/打印管理器实用程序。想象一下torrent磁链接,你点击一个链接和一个由torrent客户端打开的.torrent文件,它会读取必要的信息并在客户端站点完成其余的工作。

So you have to write a little utility which one recognizes these 'print jobs' from your web site. You click a [Print Invoice] link and browser downloads a unique .print file and the utility captures it.

因此,您必须编写一个小工具,可以从您的网站识别这些“打印作业”。单击[打印发票]链接,浏览器将下载唯一的.print文件,该实用程序将捕获该文件。

The .print file has two parts: 1. Header and 2. The file (pdf/jpg/any). Header contains predefined printer/paper size/orientation/etc or just asks for user input. And then prints the file from 2. part/body.

.print文件包含两部分:1。标题和2.文件(pdf / jpg / any)。标题包含预定义的打印机/纸张尺寸/方向/等,或者仅询问用户输入。然后从2. part / body打印文件。

You may also queue the print jobs and manage them as well.

您也可以对打印作业进行排队并对其进行管理。

You have to install that utility; define a protocol like http:// or ftp:// to capture print links from the utility. And set printers/papers/etc for specific jobs like invoices/color printings/etc.

你必须安装该实用程序;定义像http://或ftp://这样的协议来捕获实用程序中的打印链接。并为特定工作设置打印机/纸张/等,如发票/彩色印刷/等。

These will be what I'll do when I port our winforms app to web. Plus If you are on a LAN environment then you would print the things from the web server to network printers.

当我将winforms应用程序移植到Web时,这些将是我要做的。如果您在LAN环境中,则可以将Web服务器中的内容打印到网络打印机。

#6


0  

I have looked into this before, and the only way to force things like portrait/landscape etc, is to get the user to install an ActiveX control (or similar).

我之前已经研究过,强制像纵向/横向等一样的唯一方法是让用户安装ActiveX控件(或类似的)。

Javascript or CSS alone cannot do it.

单靠Javascript或CSS无法做到这一点。