2017-09-07 11 views
1

Dymo LabelWriter 450 Turbo를 사용하여 여러 라벨을 인쇄하는 기능을 추가하고자합니다. Dymo 사이트에서 DYMO-Label-v.8-SDK.dmg를 다운로드했지만 Javascript/웹 관련 SDK 파일이나 설명서를 볼 수 없습니다. AppleScript 예제가 여기에 도움이되지 않을 수 있습니다.PHP/Web Application에서 Dymo로 여러 라벨 인쇄하기 LabelWriter 450 Turbo

이것이 가능한지 아는 사람이 있습니까 (레이블 데이터는 PHP 웹 앱에 연결된 백엔드 데이터베이스에서 제공됨). Dymo 개발자 웹 사이트에서 Javascript SDK에 대한 설명서를 찾을 수 없습니다. 몇 년 전만해도 몇 가지 예가 있으므로 현재 상태와 최신 버전 등이 무엇인지, 여러 버전을 인쇄 할 수있는 방법이 있는지도 모르겠습니다. 레이블?

답변

0

나는 실제로 똑같은 프린터를 사용하여 내 웹 응용 프로그램에서이 기능을 만들었지 만 나는 오늘 친절하다고 느낍니다. 다음은 프로덕션 수준 응용 프로그램에서 나와 함께 작업 한 것입니다. 행운을 빕니다!

HTML

<!DOCTYPE html> 
<html lang="en"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> 
<title>DYMO: QR-code</title> 
<!-- JQuery --> 
<script src = "http://code.jquery.com/jquery-1.4.2.min.js" type="text/javascript" charset="UTF-8"> </script> 
<!-- Dymo Script --> 
<script src="DYMO.Label.Framework.2.0.2.js" type="text/javascript" charset="UTF-8"></script> 
<!-- QR Code --> 
<script src="QRCode.js" type="text/javascript" charset="UTF-8"> </script> 
<!-- Bootstrap --> 
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> 
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> 


</head> 

<body> 

<div class="container"> 

    <div class="jumbotron"> 
     <h3>DYMO Label Framework JavaScript Library Samples: QR code</h3> 
     <div class="header"> 
      <div id="sampleDesctiption"> 
       <span> 
        This sample shows different ways to print a label with a QR-code barcode. 
       </span> 
      </div> 
     </div> 
    </div> 


    <div class="container"> 
     <div class="printControls"> 

      <div class="row"> 
       <div class="col-md-6"> 
        <div id="printersDiv"> 
         <label for="printersSelect">Printer:</label><br/> 
         <select class="form-control" id="printersSelect"></select> 
        </div> 
       </div> 
      </div> 

      <div id="printDiv" style="padding-top:20px"> 
       <button class="btn btn-primary btn-lg" id="printButton">Print QR Code</button> 
      </div> 

     </div> 
    </div> 

</div> 



</body> 

</html> 

QRCode.js

// stores loaded label info 
var barcodeLabel; 

// called when the document loaded 
function onload() { 
    var printersSelect = document.getElementById('printersSelect'); 
    var printButton = document.getElementById('printButton'); 

    // loads all supported printers into a combo box 
    function loadPrinters() { 
     var printers = dymo.label.framework.getLabelWriterPrinters(); 
     if (printers.length == 0) { 
      alert("No DYMO printers are installed. Install DYMO printers."); 
      return; 
     } 
     console.log("got here: ", printers); 

     for (var i = 0; i < printers.length; i++) { 
      var printer = printers[i]; 

      var printerName = printer.name; 

      var option = document.createElement('option'); 
      option.value = printerName; 
      option.appendChild(document.createTextNode(printerName)); 
      printersSelect.appendChild(option); 
     } 
    } 

    printButton.onclick = function() { 
      var label_text = 'QRCode Text Here..'; 

      barcodeLabel.setObjectText('Barcode', label_text); 

      // Should Be Printer Name, Dymo 450 Turbo.. 
      console.log("print: ", printersSelect.value); 

      barcodeLabel.print(printersSelect.value); 

    } 

    function getBarcodeLabelXml() { 

     var labelXml = '<?xml version="1.0" encoding="utf-8"?>\ 
          <DieCutLabel Version="8.0" Units="twips">\ 
           <PaperOrientation>Landscape</PaperOrientation>\ 
           <Id>Address</Id>\ 
           <PaperName>30252 Address</PaperName>\ 
           <DrawCommands>\ 
            <RoundRectangle X="0" Y="0" Width="1581" Height="5040" Rx="270" Ry="270" />\ 
           </DrawCommands>\ 
           <ObjectInfo>\ 
            <BarcodeObject>\ 
             <Name>Barcode</Name>\ 
             <ForeColor Alpha="255" Red="0" Green="0" Blue="0" />\ 
             <BackColor Alpha="0" Red="255" Green="255" Blue="255" />\ 
             <LinkedObjectName></LinkedObjectName>\ 
             <Rotation>Rotation0</Rotation>\ 
             <IsMirrored>False</IsMirrored>\ 
             <IsVariable>False</IsVariable>\ 
             <Text></Text>\ 
             <Type>QRCode</Type>\ 
             <Size>Small</Size>\ 
             <TextPosition>None</TextPosition>\ 
             <TextFont Family="Arial" Size="8" Bold="False" Italic="False" Underline="False" Strikeout="False" />\ 
             <CheckSumFont Family="Arial" Size="8" Bold="False" Italic="False" Underline="False" Strikeout="False" />\ 
             <TextEmbedding>None</TextEmbedding>\ 
             <ECLevel>0</ECLevel>\ 
             <HorizontalAlignment>Center</HorizontalAlignment>\ 
             <QuietZonesPadding Left="0" Top="300" Right="600" Bottom="0" />\ 
            </BarcodeObject>\ 
            <Bounds X="331" Y="57.9999999999999" Width="2880" Height="1435" />\ 
           </ObjectInfo>\ 
          </DieCutLabel>'; 
     return labelXml; 
    } 

    function loadLabelFromWeb() { 
     barcodeLabel = dymo.label.framework.openLabelXml(getBarcodeLabelXml()); 
    } 

    // Load Labels 
    loadLabelFromWeb(); 

    // load printers list on startup 
    loadPrinters(); 
}; 

// Run's Dymo Javascript.. 
dymo.label.framework.init(onload);