A small Code 128 barcode scanning, generation, and printing C library.
This project was started to provide specialised barcode printing and scanning software with an NGO dentist in Kyrgyzstan operating in partnership with Interserve.
Its aim is to provide barcode generation from up strings up to 20 characters long, versatile barcode printing services, and decoding services.
- Code 128 barcode generation from a 20-character string
- Generate Code 128 barcode SVGs
- Print barcodes (PostScript format)
- Print in user-defined sizes
- Print multiple different barcodes on one page
- Read barcodes from an internal representation
- Add Java bindings
Note: Compiled with GNU Make using Clang on macOS and Linux, and MSVC on Windows.
Include the symb.h
and graphic.h
headers and initialise with init_barcode()
before doing any of the following.
To generate the internal representation of a barcode, a Code128 struct, c128_encode
accepts an array of uchar
(unsigned char
) (Array, NOT a string - remove the null terminator),
the length of the array (int
), and a double pointer to the destination Code128
struct. Memory is allocated during encoding so ideally it should be unassigned.
c128_svg
accepts a pointer to a Code128 struct containing the internal representation
of the barcode and a pointer to the destination string for the SVG. Memory is allocated
in the function so this should also be unassigned.
The resulting SVG can then be written to file and viewed or used in some other way.
See src/main.c
for a PostScript example.
This project is licensed under the Mozilla Public License Version 2.0. See LICENSE for more information.