C#/ Javascript设置打印机的页面大小 [英] C# / Javascript Set page size for printer
问题描述
我在我的页面上打印内容DIV并使用以下功能。
I am printing the content DIV on my page and using the following function for it.
function CallPrint( strid){
          var prtContent = document.getElementById(strid);
          var WinPrint = window.open('','','left = 0,top = 0,width = 900,height = 600,toolbar = 1,scrollbars = 1,status = 0');
          WinPrint.document.write(prtContent.innerHTML);
          WinPrint.document.close();
          WinPrint.focus();
          WinPrint.print();
          WinPrint.close();
          prtContent.innerHTML ="" ;;
      }
function CallPrint(strid) {
var prtContent = document.getElementById(strid);
var WinPrint = window.open('', '', 'left=0,top=0,width=900,height=600,toolbar=1,scrollbars=1,status=0');
WinPrint.document.write(prtContent.innerHTML);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
prtContent.innerHTML = "";
}
这项工作正常。现在我需要将页面类型设置为合法或11 x 17.我该怎么做?
This work fine. Now i need to set the Page type to either legal or 11 x 17. How do i do that?
此外,我如何使内容适合打印到一个页面(适合页面) )?
Also how do i fit the content to print to one single page(fit to Page)?
推荐答案
你好
Veer0028,
根据您的描述,您的问题与asp.net JavaScript技术和更好的支持请将您的问题发布到下面的asp.net JavaScrpit论坛
,这个论坛是针对特定的C#代码问题:
http://forums.asp.net/130.aspx/1?HTML+CSS+and+JavaScript
在C#中,我们可以使用PageSettings 。 PaperSize Property来获取或设置纸张尺寸。
In C#, we can use PageSettings.PaperSize Property to get or set the paper size.
http://www.c-sharpcorner.com/uploadfile/mahesh/papersize-in-C-Sharp/
Kristin
Kristin
这篇关于C#/ Javascript设置打印机的页面大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!