diff --git a/README.md b/README.md index c5c1f98..51716ae 100644 --- a/README.md +++ b/README.md @@ -119,10 +119,12 @@ Prawn::Document.new(background_pdf: "letterhead.pdf") do end ``` -QR codes in pure Ruby, drawn as vectors: one path and one fill per code, read back by zbar in CI: +QR codes and barcodes (Code 128, EAN-13, EAN-8, Code 39, ITF-14) in pure Ruby, drawn as vectors: one fill per +code, read back by zbar in CI: ```ruby qr_code "https://example.com/pay/INV-2026-0001", at: [400, 700], size: 80, level: :m +barcode "0123456789012", type: :ean13, width: 120, height: 40, text: true ``` Loading font and SVG support once, before a server such as Puma or Unicorn forks its workers, so they share it in diff --git a/docs/guide.html b/docs/guide.html index a542134..6469467 100644 --- a/docs/guide.html +++ b/docs/guide.html @@ -42,7 +42,7 @@
A QR code is drawn as vector rectangles, one path and one fill, so it stays sharp at any size and a sheet of labels stays small. The encoder is pure Ruby, with no dependency: every version and level of error correction, numeric, alphanumeric and byte modes, and UTF-8 text announced to scanners.
qr_code "https://example.com/pay/INV-2026-0001", at: [400, 700], size: 80, level: :m
size is the width of the whole symbol, its quiet zone of four modules included; module_size gives the width of one module instead (2 points unless told). level is :l, :m (the default), :q or :h, and the smallest version that holds the text at that level is chosen; text too long for any raises ArgumentError. Without at, the code is placed as an image is, with position and vposition. quiet_zone: false leaves the margin to the layout, and color sets the colour of the modules. In Gamba’s own API, qr_code is a box, with size or module_size, level, quiet_zone, color and align.
Linear barcodes are drawn the same way, one fill per symbol: Code 128, with its sets A, B and C chosen as the text goes, EAN-13, EAN-8, Code 39 and ITF-14. A check digit left out is added, and one given is checked.
+barcode "0123456789012", type: :ean13, width: 120, height: 40, text: true
+ width counts the quiet zones, or module_size sets the narrowest bar (2 points unless told); height is the bars’, 50 modules unless told. text: true writes the encoded text under the bars, check digit included, at text_size (8 modules unless told). at, position, vposition, quiet_zone and color work as for QR codes, and in Gamba’s own API barcode is a box too.