2015-12-19 113 views
3

如何在DYMO標籤打印機通過網站打印?我已經按照here所述構建了以下文件,但未成功需要更多幫助來遠程打印。從網站DYMO標籤打印機打印

<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> 
<title>Print a Label</title> 
<script src = "http://labelwriter.com/software/dls/sdk/js/DYMO.Label.Framework.latest.js" type="text/javascript" charset="UTF-8"> </script> 
<script src = "PrintLabel.js" type="text/javascript" charset="UTF-8"> </script> 
</head> 

<body> 
<h1>DYMO Label Framework JavaScript Library Samples: Print Label</h1> 

    <div id="textDiv"> 
     <label for="textTextArea">Label text:</label><br/> 
     <textarea name="textTextArea" id="textTextArea" rows='5' cols='40'></textarea> 
    </div> 

     <div id="printDiv"> 
      <button id="printButton">Print</button> 
     </div> 

</body> 

</html> 
+0

在2016年不工作 – YumYumYum

回答

2

你不能遠程打印,但下面的代碼很好,可以在本地使用DYMO Javascript框架工作。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"> 
<html> 
    <head> 
     <title>Sample DYMO Label Plug-In</title> 


      <script src="http://labelwriter.com/software/dls/sdk/js/DYMO.Label.Framework.latest.js" 
      type="text/javascript" charset="UTF-8"> 



      function GetDYMOPrinters() 
      { 

       var printers = dymo.label.framework.getPrinters(); 
       if (printers.length == 0) 
       throw "No DYMO printers are installed. Install DYMO printers."; 
       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.Label.Open("MyText.label"); 
      label.SetObjectText("NameTxt", "John Smith"); 

      label.print("DYMO LabelWriter"); 
      } 
    </script> 

    </head> 
    <body onload=" GetDYMOPrinters()"> 
     <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> 
+0

它顯示了什麼,但似乎很好。讓我在本地看問題。 –

+0

2016年無法使用,請更新。 – YumYumYum

+0

我想爲了這個工作,你必須用一大堆XML(標籤定義)替換「mytext.label」。這基本上是來自Dymo網站的示例代碼... –