PHP Classes
elePHPant
Icontem

PHP Print EPL: Print labels to Zebra printers using EPL commands

Recommend this page to a friend!
  Info   View files Example   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum (4)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2016-06-02 (2 months ago) RSS 2.0 feedNot enough user ratingsTotal: 269 This week: 10All time: 7,209 This week: 93Up
Version License PHP version Categories
zprinter 1.0.1MIT/X Consortium ...5.6PHP 5, Graphics, Printing
Description Author

This class can print labels to Zebra printers using EPL commands.

It can compose labels to print with label text and barcode information and generates a PRN file using EPL commands.

The class can send the PRN file to a Zebra printer with a given printer host name.

It can also configure the number of label copies to print.

Innovation Award
PHP Programming Innovation award nominee
March 2016
Number 13


Prize: One downloadable copy of PhpED Professional
There some types of printers that are dedicated to print labels.

This class can print barcodes in labels supported by Zebra printers.

Manuel Lemos
Picture of Thiago Abrantes
  Performance   Level  
Name: Thiago Abrantes <contact>
Classes: 3 packages by
Country: Brazil Brazil
Age: 31
All time rank: 2800207 in Brazil Brazil
Week rank: 106 Up5 in Brazil Brazil Up
Innovation award
Innovation award
Nominee: 1x

Details

PHP2EPL

PHP2ELP is a short class that creates an EPL command and sends it to a remote shared Zebra© Printer

Step By Step

1) Creating the object

Start by creating an ZebraPrinter object and setting the Host Printer, speed, darkness (or tempeture), the label size and reference point. The label size is an array composed by the Label height followed by the gap width.

$hostPrinter = "\\computername\sharedprintername";
$speedPrinter = 4;
$darknessPrint = 2;
$labelSize = array(240,024);
$referencePoint = array(215,15);
$z = new ZebraPrinter($hostPrinter, $speedPrinter, $darknessPrint, $labelSize,$referencePoint);

2) Calling the methods

$z->writeLabel($l,$x,$y,$f);

Write the content l at the (x, y) position with f font size. Be careful, the coordinates are expressed in "dots".

$z->setBarcode($code, $x, $y, $content)

Set the barcode codification (see the [manual][manual] at page 53), (x, y) possition and barcode value. Again, the coordinates are expressed in "dots".

$z->setLabelCopies($n);

After the label config is done, call this method to set the number of copies.

$z->print2zebra();

This method generates the a temp *.prn with an EPL command and sends it to the remote Zebra© printer.

Observations

- This code was tested in a Windows environment. - [PLEASE CHECK THE REFERENCE MANUAL][manual] [manual]:https://www.zebra.com/content/dam/zebra/manuals/en-us/printer/epl2-pm-en.pdf

###

The MIT License (MIT)

Copyright (c) 2016 Thiago Abrantes de C. Souza, <abrantes.souza@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    
      

- This code was tested in a Windows environment. - [PLEASE CHECK THE REFERENCE MANUAL][manual] [manual]:https://www.zebra.com/content/dam/zebra/manuals/en-us/printer/epl2-pm-en.pdf

  Files folder image Files  
File Role Description
Plain text file classZebra.php Class Class of application
Plain text file README.md Doc. Readme File
Plain text file testeZebra.php Example Test File.

 Version Control Unique User Downloads Download Rankings  
 100%
Total:269
This week:10
All time:7,209
This week:93Up
User Comments (1)