项目作者: jshor

项目描述 :
🔖 Generates 1D, 2D, or composite barcodes in png, svg, or eps formats. Supports 50+ symbologies.
高级语言: TypeScript
项目地址: git://github.com/jshor/symbology.git
创建时间: 2015-04-18T14:21:43Z
项目社区:https://github.com/jshor/symbology

开源协议:GNU General Public License v3.0

下载







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

  1. yarn add symbology

Quick Examples

Code 11 Example

  1. import { SymbologyType, createStream } from 'symbology'
  2. (async () => {
  3. const { data } = await createStream({
  4. symbology: SymbologyType.CODE11
  5. }, '8765432164')
  6. console.log('Result: ', data)
  7. })()

This will log:

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

And the base64 PNG generated will look like:

code 11

MaxiCode Example

  1. import { SymbologyType, createFile } from 'symbology'
  2. (async () => {
  3. const { data } = await createFile({
  4. symbology: SymbologyType.MAXICODE,
  5. option1: 2,
  6. primary: '999999999840012',
  7. fileName: 'maxiCodeExample.svg'
  8. }, 'Secondary Message Here')
  9. console.log('Result: ', data)
  10. })()

This creates maxiCodeExample.svg which looks like:

MaxiCode

USPS Example

  1. import { SymbologyType, createFile } from 'symbology'
  2. (async () => {
  3. const { data } = await createFile({
  4. symbology: SymbologyType.ONECODE
  5. fileName: 'uspsExample.eps'
  6. }, '01234567094987654321-01234')
  7. console.log('Result: ', data)
  8. })()

This creates uspsExample.eps which looks like:

USPS

License

GPL-3.