New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

barcode-bakery-1d

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

barcode-bakery-1d

Generates 1D barcodes from Node server to a file or a buffer.

  • 2.0.0-alpha.1
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-75%
Maintainers
1
Weekly downloads
 
Created
Source

Barcode Bakery is library written in Node.JS, .NET Standard and PHP which allows you to generate barcodes on the fly on your server for displaying or saving.

The library has minimal dependencies in each language in order to be supported on a wide variety of web servers.

The library is available for free for non-commercial use; however you must purchase a license if you plan to use it in a commercial environment.

Installation

There are two ways to install our library:

  • With composer, run the following command:
$ npm install barcode-bakery-1d

Requirements

Example usages

For a full example of how to use each symbology type, visit our API page.

Displaying a Code 128 on the screen

import { BCGColor, BCGDrawing, BCGFont } from 'barcode-bakery-common';
import { BCGcode128 } from 'barcode-bakery-1d';

use BarcodeBakery\Common\BCGFontFile;
use BarcodeBakery\Common\BCGColor;
use BarcodeBakery\Common\BCGDrawing;
use BarcodeBakery\Barcode\BCGcode128;

let font = new BCGFontFile('Arial', 18);
let colorFront = new BCGColor(0, 0, 0);
let colorBack = new BCGColor(255, 255, 255);

// Barcode Part
let code = new BCGcode128();
code.setScale(2); // Resolution
code.setThickness(30); // Thickness
code.setBackgroundColor(colorWhite); // Color of spaces
code.setForegroundColor(colorBlack); // Color of bars
code.setFont(font); // Font (or 0)
code.setStart(null);
code.setTilde(true);
code.parse('a123'); // Text

let drawing = new BCGDrawing(code, colorWhite);
drawing.toBuffer(BCGDrawing.ImageFormat.Png, function (err, buffer) {
    response.writeHead(200, { 'Content-Type': 'image/png' });
    response.end(buffer);
});

Saving the image to a file

Replace the last line of the previous code with the following:

var drawing = new BCGDrawing(code, colorBack);
drawing.save('image.png', BCGDrawing.ImageFormat.Png, function() {
    console.log('Done.');
});

This will generate the following:

Sync methods

Both save and toBuffer have counterparts acting synchronously: saveSync and toBufferSync.

Tests

Simply type npm test to run the tests.

Supported types

Other libraries available for purchase

Keywords

FAQs

Package last updated on 15 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc