0
我嘗試使用Chrome中的Dymo打印機打印標籤。我使用javascript sdk。在鉻中找不到dymo打印機
只有當我找到我的腳本打印機,我得到以下控制檯日誌錯誤:
未捕獲無DYMO安裝打印機。安裝DYMO打印機。 我改變了像dymo網站說的設置。有誰知道如何從鉻打印?
當我用IE或Firefox做到這一點時沒有問題。
這是我的代碼:
<!DOCTYPE>
<html>
<head>
<title>Sample DYMO Label Plug-In</title>
<script src="http://labelwriter.com/software/dls/sdk/js/DYMO.Label.Framework.latest.js"></script>
<!-- your script second -->
<script>
function OnLoad()
{
//GetCurrentPlugin();
GetDYMOPrinters();
//GetPaperTray();
//GetMRUList();
//GetObjectNames();
//GetLabelImage();
}
function GetDYMOPrinters()
{
// alert(" Testing 1");
var printers = dymo.label.framework.getPrinters();
if (printers.length == 0)
throw "No DYMO printers are installed. Install DYMO printers.";
//alert("dfdsfd");
var printerName = "";
for (var i = 0; i < printers.length; ++i)
{
var printer = printers[i];
if (printer.printerType == "LabelWriterPrinter")
{
printerName = printer.name;
break;
}
}
//var label = dymo.label.framework.open("MyText.label");
label.SetObjectText("Text", "John Smith");
//alert(" Testing 2"); // Here this alert also not working .
label.print("DYMO LabelWriter 310");
}
</script>
</head>
<body onload="OnLoad()"><form action="" method="post" id="DYMOLabel">
<center>
<h2>DYMO Label Example</h2>
<input type=button value="Get DYMO Printers" onClick="GetDYMOPrinters()">
</center>
</form>
</body>
</html>
鉻開發人員工具控制檯中的任何錯誤? –
否,僅未讀取未安裝DYMO打印機。安裝DYMO打印機 – robind38
你正在加載這個本地網頁,即'file:///'而不是'http://'? –