本文介绍了如何使用JavaScript代码获取客户端打印机名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要使用JavaScript的客户端打印机名称的源代码,
我将在.NET编码中实现这一点.
如果有任何解决方案,请帮助我.
预先感谢,
Rakesh
Hi,
I need the source code of client machine printer name using JavaScript,
which I will implement in my .NET coding.
If any one has any solution, please help me.
Thanks in advance,
Rakesh
推荐答案
<script language="javascript" type="text/javascript">
var filename;
function winPrintDialogBox(filename) {
var oShell = new ActiveXObject("WScript.Shell");
sRegVal = 'HKEY_CURRENT_USER\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows\\Device';
var sName = oShell.RegRead(sRegVal)
if (sName == '') {
alert('Please, Check the Default Printer');
}
document.getElementById("hdnResultValue").value = sName;
return sName;
}
function HandleError()
{
alert("\nNothing was printed. \n\nIf you do want to print this page, then\nclick on the printer icon in the toolbar above.")
return false;
}
</script>
这篇关于如何使用JavaScript代码获取客户端打印机名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!