Git Product home page Git Product logo

stickie's Introduction

Stickie

Codeship Status for fashionvalet/stickie

EZPL command generator for label thermal printer. This library is for anyone who wants to integrate directly with their printers without any 3rd party application.

This library was tested using Godex G500 model and with a 50mmx45mm label sticker paper.

Installation

composer require fashionvalet/stickie

Generating EZPL Commands

<?php

use FashionValet\Stickie\Builder;
use FashionValet\Stickie\CommandPipe;

$command = (new Builder(new CommandPipe))
    ->resetMemory()
    ->setLabelWidth(50)
    ->setLabelHeight(30)
    ->setDensity(10)
    ->copies(1)
    ->labelStart()
    ->text(10, 15, 5, 1, 1, 0, 0, 'Item: Brina Flowy Chiffon Skirt - UK 6')
    ->text(10, 15, 30, 1, 1, 0, 0, 'Brand: Aere')
    ->text(10, 15, 90, 1, 1, 0, 0, 'SKU: 1504051610-UK 6')
    ->text(10, 15, 120, 1, 1, 0, 0, 'Price: RM 1,000.00')
    ->barcode('CODE128', 72, 160, 2, 10, 30, 0, 3, 'AR0009287')
    ->labelEnd()
    ->compose();

This will generate the EZPL output as below

~MDEL\n
^W50\n
^Q30\n
^H10\n
^P1\n
^L\n
AB, 15, 5, 1, 1, 0, 0, Item: Brina Flowy Chiffon Skirt - UK 6\n
AB, 15, 60, 1, 1, 0, 0, Brand: Aere\n
AB, 15, 90, 1, 1, 0, 0, SKU: 1504051610-UK 6\n
AB, 15, 120, 1, 1, 0, 0, Price: RM 1,000.00\n
BQ, 72, 160, 2, 10, 30, 0, 3,AR0009287\n
E\n

Printing The Output

<?php

use FashionValet\Stickie\Printer;
use FashionValet\Stickie\Builder;
use FashionValet\Stickie\CommandPipe;
use FashionValet\Stickie\Driver\LinuxConnector;

$command = (new Builder(new CommandPipe))
    ->resetMemory()
    ->setLabelWidth(50)
    ->setLabelHeight(30)
    ->setDensity(10)
    ->copies(1)
    ->labelStart()
    ->text(10, 15, 5, 1, 1, 0, 0, 'Item: Brina Flowy Chiffon Skirt - UK 6')
    ->text(10, 15, 30, 1, 1, 0, 0, 'Brand: Aere')
    ->text(10, 15, 90, 1, 1, 0, 0, 'SKU: 1504051610-UK 6')
    ->text(10, 15, 120, 1, 1, 0, 0, 'Price: RM 1,000.00')
    ->barcode('CODE128', 72, 160, 2, 10, 30, 0, 3, 'AR0009287')
    ->labelEnd();

$connector = new LinuxConnector('/dev/usb/lp0');
$printer = new Printer($connector, $command);

$printer->generate();

stickie's People

Contributors

ahmadshah avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.