PHP code example of variograma / weez-zpl

1. Go to this page and download the library: Download variograma/weez-zpl library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

variograma / weez-zpl example snippets


$faker      = Factory::create();
$fakerImage = $faker->image(null, 150, 150, 'transport', true);
//Init Label
$zebraLabel = new ZebraLabel(912, 912);
$zebraLabel->setDefaultZebraFont(new ZebraFont(ZebraFont::ZEBRA_ZERO));
//Add Text element
$zebraLabel->addElement(new ZebraText(10, 84, "Product:", 14));
$zebraLabel->addElement(new ZebraText(395, 84, "Camera", 14));

$zebraLabel->addElement(new ZebraGraficBox(10, 100, 800, 5));

$zebraLabel->addElement(new ZebraText(10, 161, "CA201212AA", 14));

//Add Code Bar 39
$zebraLabel->addElement(new ZebraBarCode39(10, 297, "CA201212AA", 118, 2, 2));

$zebraLabel->addElement(new ZebraText(10, 365, "Qté:", 11));
$zebraLabel->addElement(new ZebraText(180, 365, "3", 11));
$zebraLabel->addElement(new ZebraText(317, 365, "QA", 11));

$zebraLabel->addElement(new ZebraText(10, 520, "Ref log:", 11));
$zebraLabel->addElement(new ZebraText(180, 520, "0035", 11));
$zebraLabel->addElement(new ZebraText(10, 596, "Ref client:", 11));
$zebraLabel->addElement(new ZebraText(180, 599, "1234", 11));
//Add Image from Url
$zebraLabel->addElement(new ZebraImage(350, 850, $fakerImage));
//Add Qr Code
$zebraLabel->addElement(new ZebraQrCode(350, 297, 'test'));

echo $zebraLabel->getZplCode();


$zebraLabel.addElement(new ZebraNativeZpl("^KD0\n"));
/*
You can also use usefull fonction ZplUtils.zplCommand to generate a zpl command (with many variables)
*/
ZplUtils::zplCommand("A", ["0", "R"]); //will return ^A,0,R