pleinechope / DymoWebservice

Trick for used Dymo outside localhost

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dymo WebService Online

Problem: webservice dymo usable only in localhost:port

Solution: make server who call localhost:port (fr)

Getting start

Wamp configuration

  • Enable php_curl extension (by default is enable)
  • Put online WampServer. Tl;dr:
    • Open port 80
    • Allow extern, wamp > Apache > httpd.conf replace :
    #   onlineoffline tag - don't remove
      Require local
    
    By :
    #   onlineoffline tag - don't remove
      Require all granted
    

Install File

  • Copy git/server/dymo.php to wamp/www

How To use

  • Copy git/client/DYMO.Label.Framework.2.0.2_edited.js in your project

Call library

dymo.label.framework.init('http://yourip/dymo.php?', function(){

  /* === classic function - Framework === */
  /* --- exemple print label (barcode) --- */
  
  var text = '123456789';
  
  var labelXml = `<?xml version="1.0" encoding="utf-8"?>
    <DieCutLabel Version="8.0" Units="twips">
        <PaperOrientation>Landscape</PaperOrientation>
        <Id>LargeAddress</Id>
        <PaperName>30321 Large Address</PaperName>
        <DrawCommands>
            <RoundRectangle X="0" Y="0" Width="2025" Height="5020" Rx="270" Ry="270" />
        </DrawCommands>
        <ObjectInfo>
            <BarcodeObject>
                <Name>Code-barres</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+`</Text>
                <Type>Code39</Type>
                <Size>Large</Size>
                <TextPosition>Bottom</TextPosition>
                <TextFont Family="Arial" Size="14" Bold="True" Italic="False" Underline="False" Strikeout="False" />
                <CheckSumFont Family="Arial" Size="14" Bold="True" Italic="False" Underline="False" Strikeout="False" />
                <TextEmbedding>None</TextEmbedding>
                <ECLevel>0</ECLevel>
                <HorizontalAlignment>Center</HorizontalAlignment>
                <QuietZonesPadding Left="0" Top="0" Right="0" Bottom="0" />
            </BarcodeObject>
            <Bounds X="332" Y="120" Width="4335" Height="1720" />
        </ObjectInfo>
    </DieCutLabel>`;

    var label = dymo.label.framework.openLabelXml(labelXml);
    
    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;
        }
    }

    if (printerName == "")
        throw "No LabelWriter printers found. Install LabelWriter printer";
    
    // finally print the label
    label.print(printerName);
});

Annexes

Test configuration

Change Dymo PORT

  • Edit dymo.php, line 5
$port = 41951; // by your port

About

Trick for used Dymo outside localhost


Languages

Language:JavaScript 98.2%Language:HTML 1.4%Language:PHP 0.4%