Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

symbology

jshor1.3kGPL-3.04.0.2TypeScript support: included

🔖 Generates 1D, 2D, and composite barcodes in png, svg, or eps formats. Supports 50+ symbologies.

barcode, code 128, qr, ean, upc, isbn, pdf417, gs1, aztec, data matrix, usps onecode

readme

Symbology

A Node.js module that generates barcode images. Supports 50+ different 1D or 2D symbologies in png, eps, or svg formats.

Code coverage Build status npm version

Introduction

This Node.js module will allow you to generate over 50+ different types of 1D or 2D symbologies, including barcodes for books, grocery, shipping carriers, healthcare, and international codes.

It can create a PNG, SVG, or EPS image file, or return a string containing SVG, PostScript, or base64-encoded PNG data.

Documentation

Read the docs →

Quick start

yarn add symbology

Quick Examples

Code 11 Example

import { SymbologyType, createStream } from 'symbology'

(async () => {
  const { data } = await createStream({
    symbology: SymbologyType.CODE11
  }, '8765432164')

  console.log('Result: ', data)
})()

This will log:

{
  "data": "data:image/png+data;base64,PHN [...] eFd==",
  "message": "Symbology successfully created.",
  "code": 0
}

And the base64 PNG generated will look like:

code 11

MaxiCode Example

import { SymbologyType, createFile } from 'symbology'

(async () => {
  const { data } = await createFile({
    symbology: SymbologyType.MAXICODE,
    option1: 2,
    primary: '999999999840012',
    fileName: 'maxiCodeExample.svg'
  }, 'Secondary Message Here')

  console.log('Result: ', data)
})()

This creates maxiCodeExample.svg which looks like:

MaxiCode

USPS Example

import { SymbologyType, createFile } from 'symbology'

(async () => {
  const { data } = await createFile({
    symbology: SymbologyType.ONECODE
    fileName: 'uspsExample.eps'
  }, '01234567094987654321-01234')

  console.log('Result: ', data)
})()

This creates uspsExample.eps which looks like:

USPS

License

GPL-3.

changelog

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

4.0.2 (2025-02-25)

4.0.1 (2023-11-22)

4.0.0 (2023-10-15)

Features

BREAKING CHANGES

  • node: This drops support for Node.js v14.

3.0.13 (2022-11-28)

3.0.12 (2022-11-28)

3.0.11 (2022-11-27)

3.0.10 (2022-11-27)

Bug Fixes

  • bin: updates binary to install as-needed (86ba08c)

3.0.9 (2022-11-27)

Bug Fixes

3.0.8 (2021-11-20)

3.0.7 (2021-11-20)

Bug Fixes

  • deps: corrects nan dependency (45b17cd)

3.0.6 (2021-09-04)

3.0.5 (2021-08-28)

3.0.4 (2021-06-29)

3.0.3 (2021-06-22)

3.0.2 (2021-06-15)

Bug Fixes

3.0.1 (2021-06-05)

3.0.0 (2021-06-01)

Features

BREAKING CHANGES

  • drops support for node v12 and v13.

2.1.6 (2021-04-30)

2.1.5 (2021-04-10)

2.1.4 (2021-04-08)

Bug Fixes

  • build: fixes compatibility of module exports and npm (45ebe3b)

2.1.2 (2021-04-04)

2.1.1 (2021-04-01)

2.1.0 (2021-04-01)

Features

  • ts: updates package to use TS (2c4740a)

2.0.2 (2021-03-31)

Bug Fixes

  • lib: fixes EOF and npmignore issues #55 (085d33b)

2.0.1 (2021-03-29)

2.0.0 (2021-03-29)

Bug Fixes

  • adds patch system to apply stdout fixes (d0ac5bc)
  • adds support for Node v12+ (bffc800)
  • appveyor: update script to include debug msg and wrap conditionals (#26) (2859265)
  • binding: updates lib to properly convert bitmap chars (51c0990)
  • powershell bug (#27) (c8e6fdf)
  • unix: removes remaining png.c refs; enables pipe() for non-Win32 (7131d1c)
  • version: adds missing C file ref, version mgmt (#37) (0903303)

Features

  • alpha: implements alpha channel support #35 (993699b)
  • encoding: adds encoding support for ECI and input modes (#30) (e9ff0d0)
  • implements ability to alter dot size #32 (32b9b42)
  • rotation: implements rotations #31 (11b69e6)
  • windows: adds Node 11+ support (#23) (915f15c)
  • zint: upgrades to v2.9.1 (3bd4855)

BREAKING CHANGES

  • zint: drops support for Node 10 and 11.