zebrash

package module
v0.0.0-...-787b0ac Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 12 Imported by: 0

README

Zebrash

⚠️ Warning

As I am leaving Ingrid, I am stepping back from being the maintainer of this project. This repository will remain public, but I will no longer be reviewing pull requests, responding to issues, or releasing updates.

It is possible that this project will get a new maintainer from Ingrid in the future. In the meantime, you are welcome to open PRs or issues, though please note that they are unlikely to be reviewed. You are also free to fork this project, as it is released under the MIT license.

Sincerely, Fedir Kryvytskyi

Library for rendering ZPL (Zebra Programming Language) files as raster images

Description

This library emulates subset of ZPL engine and allows you to view most of the ZPL labels that are used by carriers such as Fedex, UPS or DHL as PNGs without the need to possess physical Zebra-compatible printer. Think of https://labelary.com/viewer.html except it is completely free for commercial use, has no API limits and can easily be self-hosted or plugged into existing Go application so you don't need to send labels with real customers information to some 3rd-party servers

Example of the output (more examples can be found inside testdata folder):

UPS label

Usage:


	file, err := os.ReadFile("./testdata/label.zpl")
	if err != nil {
		t.Fatal(err)
	}

	parser := zebrash.NewParser()

	res, err := parser.Parse(file)
	if err != nil {
		t.Fatal(err)
	}

	var buff bytes.Buffer

	drawer := zebrash.NewDrawer()

	err = drawer.DrawLabelAsPng(res[0], &buff, drawers.DrawerOptions{
		LabelWidthMm:         101.6,
		LabelHeightMm:        203.2,
		Dpmm:                 8,
		EnableInvertedLabels: true,
		GrayscaleOutput:      true
	})
	if err != nil {
		t.Fatal(err)
	}

	err = os.WriteFile("./testdata/label.png", buff.Bytes(), 0744)
	if err != nil {
		t.Fatal(err)
	}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Drawer

type Drawer struct {
	// contains filtered or unexported fields
}

func NewDrawer

func NewDrawer() *Drawer

func (*Drawer) DrawLabelAsPng

func (d *Drawer) DrawLabelAsPng(label elements.LabelInfo, output io.Writer, options drawers.DrawerOptions) error

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

func NewParser

func NewParser() *Parser

func (*Parser) Parse

func (p *Parser) Parse(zplData []byte) ([]elements.LabelInfo, error)

Directories

Path Synopsis
internal
barcodes/aztec
Package aztec can create Aztec Code barcodes
Package aztec can create Aztec Code barcodes
barcodes/twooffive
Package twooffive can create interleaved and standard "2 of 5" barcodes.
Package twooffive can create interleaved and standard "2 of 5" barcodes.
hex

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL