Code Monkey home page Code Monkey logo

clj-barcode's Introduction

clj-barcode

Clojure wrapper around the Apache Barbecue 1.5 beta library.

Why?

This is for smaller businesses that are integrating Clojure into their core base. This wrapper provides a light weight solution to an existing library already in use. The goal was to provide a more idomatic way to generate barcodes in Clojure. Barbecue 1.5 beta was chosen because the last stable release was in 2005. This at least was released in 2007.

What?

This wrapper currently only contains the functionality to generate barcode objects and image files (PNG, JPEG, GIF). There are GUI API's for Swing components, but in the interest of keeping this small I've left those out.

Usage

Unfortunately, the Barbecue library is not currently in a Leiningen or Maven repository. The source and binaries can be downloaded from here. So download the jar and link it to your projects build path.

Sample Code

Most of the functions are called the same way. A keyword of the barcode you want to generate and a string of the data is usually required. Any functions that have variable arguments are passed using key value pairs.

To create a new barcode:

(create-barcode :int2of5 "12345" :check-digit true)

Write barcode as image file to disk:

(save-to-file (create-barcode :2of7 "12345") "/home/user/barcode.png" :png)

The getter and setter functions are one in the same. If a value is passed with a barcode, then that value will be set for the barcode.

(bar-width (create-barcode :bookland "12345")) ;; Getter
(bar-width (create-barcode :bookland "12345") 100) ;; Setter

Some utility functions are included:

(mod-10-check-digit "12345" :weight-odd 10)

(valid-upc? "12345")

(code39-extended-character \x)

clj-barcode's People

Contributors

cmdrdats avatar

Watchers

 avatar  avatar  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.