Skip to content

BWIPP border vs bwipjs padding

metafloor edited this page Aug 29, 2016 · 3 revisions

There are two ways to specify padding/margins around the images produced by bwipjs. There are the native BWIPP options borderleft, borderright, bordertop, and borderbottom. These values are specified in points/pixels, and scale accordingly. There is also the bwipjs-specific options paddingwidth and paddingheight. paddingwidth sets the left and right padding to the same value. paddingheight sets the top and bottom padding to the same value. The values are specified in points/pixels and scale accordingly.

The BWIPP border options provide padding solely around the bar code symbol; the text is not part of the border calculation. If any text falls outside the border area, bwipjs will automatically expand the image so all text is included.

border only

The bwipjs padding options add space after BWIPP is done rendering the image:

padding only

And the BWIPP and bwipjs options are additive:

border and padding

Finally, the BWIPP border padding only applies to linear barcodes (the feature is only implemented in the relinear renderer). The bwipjs padding options apply to all barcode types.