• 100% direct PostScript. Platform, OS and language independent.

  • A set of PostScript “named resources” that can be included in the prolog section of a document that allow you to insert a barcode in the page markup as simply as:

0 0 moveto (Hello world) (version=4) /qrcode /uk.co.terryburton.bwipp findresource exec
  • Executed wholly in a PostScript printer, pre-processor/RIP (GhostScript, Distiller, Jaws, Harlequin) or document management system (CUPS). Your application need only emit ASCII text. No need to link to any libraries, perform pre-processing, etc.

  • Support for ~100 barcode symbologies

  • Free software. MIT/X Licence: Permissive, non-copyleft.

  • Not a “turn-key solution” but a developer resource akin to a library. Your developers integrate it rather than run it directly.

  • Cleanroom development of all code. No IP issues.

  • Began June 2004 by Terry Burton. Continues as the principal developer.

  • Was a small bit of code (to scratch an itch) to include Code 39 symbols in LaTeX-based invoices, logistics notes, etc.

  • In June 2004 placed 150 lines of code on personal website in case useful to others, but expected it to be vapourware.

  • By end of 2004 had 100s of users on the mailing list and support for ~10 symbologies.

  • Has always been maintained as a “spare time” project in the hope that it will be useful to the AIDC community. Many late nights!

  • Numerous valuable contributions over time however supporters tend to come and go  solve their problem then move on. Difficult to build an active community around such a specialised project.

BWIPP Symbology Evolution

  • June 2004: Initial release with support for Code 39.

  • Mid-late 2004: Satisfied community requests for EAN-13, EAN-8, UPC-A, UPC-E, ISBN, 2 of 5, ITF, Code 128 (UCC/EAN-128), Codabar, USPS POSTNET 4-state.

  • 2005: “ISBN-13”, EAN-2/5 (add ons), Code 93, Code 11, MSI, Plessey (UK), Royal Mail 4-state (RM4SCC), USPS FIM, AusPost, Royal TNT Post (KIX).

  • 2006: USPS OneCode (Intelligent Mail), Reduced Space Symbology (GS1 DataBar) family, Pharmacode.

  • 2007: MaxiCode.

  • 2008: Sponsored 2D barcodes: PDF417, Data Matrix, Aztec Code, QR Code (including Micro QR Code).

  • 2009: Code cleanup, fixes, optimisations, ...

  • 2010: Telepen, Two-track Pharmacode, BC412, PosiCode, Channel Code.

  • Late 2010: “Helpers” and “application standards”: ISSN, ISMN, Code 32 (Italian Pharma), PZN, Code 39/93 Extended. GS1 symbols (GS1-128,  ITF-14, GS1-14, SSCC-18), HIBC symbols, Deutsche Post Leitcode/Identcode.

  • 2011: MicroPDF417, GS1 Composite symbols. Some mostly historic value symbols: Code One (Ted William’s first 2D code), Code 49, Code 16K, Codablock F.

  • 2012: Mostly idle. Some QR Code improvements.

  • Mid 2014: Optimised high-level encoding to ensure minimal symbol size for given input.

  • 3 July 2014: Dedicated following the sad passing of Craig Harmon (co-founder of JTC 1/SC 31) whose son Matthew has been a longstanding supporter of this project.

  • Late 2014: Convenience encoders: Micro QR Code, Telepen Numeric, 2 of 5 (Industrial, IATA, Matrix, Matrix, COOP, Datalogic), Compact PDF417, Aztec Runes.

  • 2016: Data Matrix Rectangular Extension (DMRE). Han Xin.

  • Roadmap: GridMatrix, DotCode, UltraCode, Dotted Data Matrix (et al.). Who's interested in these?

What is the PostScript Language?

  • Much more than a page description language.

  • Turing complete programming language focussed on vector-based printed output.

  • Stack-based, akin to Forth. Program is streamed and “consumed” by the printer. Instructions modify the graphics state and are discarded after execution.

  • Very rich language (over 400 operators) with usual plethora of features:

    • Stack manipulation: dup, pop, exch, index, roll, copy, mark

    • Maths: add, sub, mul, div, idiv, mod, abs, and, or, xor

    • Boolean: eq, ne, gt, lt, not, and, or, xor

    • Control: if, loop, for, forall, repeat, exit

    • Exception handling: stop, stopped

    • Structure initialisation: string, ( … ), array, [ … ], dict, << … >>

    • Structure manipulation: get, put, getinterval, putinterval, aload, astore, begin, end

    • Drawing: newpath, moveto, lineto, closepath, stroke, fill, clip

    • Graphical state: gsave, grestore, translate, scale, rotate

    • File IO: file, closefile, writestring, %stdout, %stderr

    • Named resources (libraries): defineresource, findresource

PostScript language features useful for barcoding

  • Advanced device-independent, vector imaging. Directly draw lines and modules of a barcode symbol. No need to resort to barcode fonts.

  • “Exiting the job server loop” provides ability for state (procedures, structures, etc) to gain persistence across jobs, e.g. have a “print job” that places barcode generation routines into the VM so that they are available for all subsequent jobs (until power cycle).

  • “Named Resources” provide ability for procedures to be packaged and stored on printer/document-manager’s disk (and cached by printer) to gain persistence across power cycle. Enhance base capabilities of the printer using only software, i.e. “No barcode font chips required™”

  • “Forms” feature can cache an expensive-to-RIP page then execute PostScript code on variable data (e.g. GTINs) supplied continuously at the tail of the datastream to transform the output (e.g. overlay barcodes on a complex document). RIP once (fixed cost), print many variants (essentially for free). Lightweight Variable Data Printing (VDP).

  • Stack-based programming by its nature can cause you to “think hard” to obtain a satisfyingly novel or optimal implementation. Probably results in improved code quality and fewer bugs per line of code. (Citation needed ;-)

PostScript imaging features useful for barcoding

  • Provides true vector output all the way to the RIP.

  • PostScript can probe the “device space” (output device properties such as pitch, orientation) so that you can perform “grid fitting”, i.e. alignment of user space lines/modules to device space pixels to avoid grazing and ensure integer-multiple mapping for bars of differing widths.

  • For future colour barcodes we can directly specify colours in RGB, CMYK, HSB colour spaces and perform separations such as in the use of spot colour processes.

 

Alternatively…

  • You can avoid PostScript’s imaging system and just perform the symbol bitmap generation using BWIPP then application can import data structure directly for custom rendering.

BWIPP Imaging Evolution

  • Linear renderer (1D barcodes: EAN-13, Code 39, ...)

    • stroke operator with setlinewidth.

  • Matrix renderer (2D barcodes: Data Matrix, QR Code, Han Xin, …)

    • 2004: image operator (thwarted by anti-aliasing in viewers, i.e. fuzzy output).

    • 2008: imagemask “stencil” operator (better, but applications became worse over time, e.g. Preview application on Mac.)

    • 2014: filled, adjacent square paths.

    • 2016: Optimal number of filled polygon paths (supporting ink bleed compensation.)

Demo 1: Interactive session (like Turtle teaching language)

  • Stack exercises: pstack, pop, exch, 2 copy, index, roll, mark

  • Path construction: moveto, rlineto, curveto, newpath, closepath

  • Path impression: stroke, fill

  • Control: loops, ifelse

 

 

 

 

Demo materials available here: http://goo.gl/dth54z

Demo 2: Example of progressive drawing (fractal fern)

  • Programmatic construction of complex objects.

  • CTM, Matrix transformation

  • Blinken lights. Because we can!

 

 

 

 

 

 

Demo materials available here: http://goo.gl/dth54z

Demo 3: Simplified Code 39 code walkthrough

  • Invokation

  • Encoder named resource

  • Linear renderer named resource

 

 

 

 

 

 

Demo materials available here: http://goo.gl/dth54z

Demo 4: Use case - Variable Data Printing with barcodes

  • Inlining of “packaged” flavour of BWIPP.

  • Forms for efficiency (huge benefit from caching):

  • Supplying data continuously at the end of the stream. Unspecified length, data-driven run.

 

Demo materials available here: http://goo.gl/dth54z

Project Hosting

  • 2004: Initially hosted code on personal website.

  • 2006: Moved hosting to Google Code.

  • 2013: Migrated to GitHub foreseeing the closure of Google Code.

    • Good news - more eyes on the commit diffs improves code review!

    • Bad news - GitHub recently stopped showing diffs of non-generated PS files (treats them as binary). Fewer eyes on… https://github.com/github/linguist/issues/2962. Please nudge this issue!

Release Tooling

  • Continuous Integration for all commits using Travis CI. (“Does it build and pass tests?”)

  • Automated Release (“Continuous Delivery”) using travis-github-release script. https://github.com/terryburton/travis-github-release. This uploads tarballs to GitHub Releases when a tag is pushed to GitHub.

  • Automated distribution packaging (deb, RPM, Arch) using OpenSuSE Build Service. http://goo.gl/422q5B

Documentation

  • Primary source is the GitHub wiki (Markdown format). Commit access available on request.

  • Automation to convert this to create PDF and HTML documentation within the tarball and for download separately . http://goo.gl/b4eidU

Development Priorities

The author is in full-time employment and his days are busy doing non-barcoding things...

… but what about evenings and weekends?

  1. Critical bug fixes

  2. What is being sponsored *

  3. Integrating contributed code

  4. What the author finds interesting or fun

  5. Wish list items that people are shouting about

  6. Anything else (may never get done!)

* For core code the sponsor agrees to assign copyright to the author and all development will be released in the main corpus of code under the project’s current license.

User Support

  • Best efforts, community-based support. Code-centric.

  • Mailing list. Issue tracker.

  • On-going commercial support is not currently available.

  • If anyone would like to partner with the author to provide a business-centric commercial support service then feel free to get in touch. Demonstrated PostScript and barcoding proficiency is required.

Third-Party Frontends and Uses

Easy to use third-party “frontends” are available which package BWIPP as an application, plugin or more conventional development library.

 

  • LaTeX - pst-barcode module for PSTricks. Direct use within a TeX document.

  • BWIP-JS - Barcode Writer in Pure JavaScript. A cross-compilation of the PostScript into JavaScript and executed within a browser or hosted via a Node.js server.

  • Integration libraries for Python, Perl and Ruby languages.

  • SAP ABAP and Smart Forms driver.

  • Scribus - Barcode Generator Plugin. Directly generate barcodes within the DTP application.

  • Commercial Adobe InDesign plugins, e.g. Soft Horizons Chartbot, others under NDA.

  • Embedded within several models of high-end laser printers (NDAs).

  • Is a test target for xpost2, a minimal PostScript interpreter.

Many other uses, both open source and commercial.

How to Help

  • Use it for fun and/or profit.

  • Tell people about it.

  • Understand the code.

    • Enjoy learning the PostScript language.

    • Deep dive into barcode encoding. Most reviewers agree that the implementations are the best that they've seen.

  • Fixes and other code contributions are most welcome, including improved documentation.

  • Develop against it. Test against it. Steal bits of the encoder implementations - just report any bugs that you find!

  • Sponsor a feature (see open issues: https://github.com/bwipp/postscriptbarcode/issues)

    • A useful symbology (Dotted Data Matrix, Ultracode...) Specifications and resource kits often cost in excess of £500 and may take several weeks of (spare time) development.

    • Imaging improvements (Upcoming renderer revamp: Grid fitting, evaluation of per-specification constraints.)

    • Anything else that you need.

Barcode Writer in Pure PostScript

By Terry Burton