{"id":15037254,"url":"https://github.com/lindell/jsbarcode","last_synced_at":"2026-01-07T21:17:38.081Z","repository":{"id":2126484,"uuid":"3069402","full_name":"lindell/JsBarcode","owner":"lindell","description":"Barcode generation library written in JavaScript that works in both the browser and on Node.js","archived":false,"fork":false,"pushed_at":"2024-06-22T04:35:32.000Z","size":3317,"stargazers_count":5624,"open_issues_count":129,"forks_count":1109,"subscribers_count":135,"default_branch":"master","last_synced_at":"2025-04-23T16:07:00.687Z","etag":null,"topics":["barcode","barcode-generator","es2015","es6","javascript"],"latest_commit_sha":null,"homepage":"http://lindell.me/JsBarcode","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lindell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"MIT-LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2011-12-29T15:38:35.000Z","updated_at":"2025-04-22T18:52:07.000Z","dependencies_parsed_at":"2023-07-05T16:15:21.929Z","dependency_job_id":"a9661b61-c235-4eb7-b927-17e2c030c3b5","html_url":"https://github.com/lindell/JsBarcode","commit_stats":{"total_commits":559,"total_committers":35,"mean_commits":"15.971428571428572","dds":"0.31127012522361364","last_synced_commit":"06d81fc2fb24eb8f33961cd048b680349742b284"},"previous_names":[],"tags_count":109,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lindell%2FJsBarcode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lindell%2FJsBarcode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lindell%2FJsBarcode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lindell%2FJsBarcode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lindell","download_url":"https://codeload.github.com/lindell/JsBarcode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253745921,"owners_count":21957466,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["barcode","barcode-generator","es2015","es6","javascript"],"created_at":"2024-09-24T20:34:01.046Z","updated_at":"2026-01-07T21:17:38.075Z","avatar_url":"https://github.com/lindell.png","language":"JavaScript","readme":"\u003cp align=\"center\"\u003e\n\t\u003ca href=\"http://lindell.me/JsBarcode\"\u003e\u003cimg src=\"http://lindell.me/JsBarcode/other/logo.svg\" alt=\"JsBarcode\"/\u003e\u003c/a\u003e\n\t\u003cbr\u003e\u003cbr\u003e\n\t\u003ca href=\"http://travis-ci.org/lindell/JsBarcode\"\u003e\u003cimg src=\"https://secure.travis-ci.org/lindell/JsBarcode.svg\" alt=\"Build Status\"/\u003e\u003c/a\u003e\n\t\u003ca href=\"https://scrutinizer-ci.com/g/lindell/JsBarcode/?branch=master\"\u003e\u003cimg src=\"https://scrutinizer-ci.com/g/lindell/JsBarcode/badges/quality-score.png?b=master\" alt=\"Scrutinizer Code Quality\"/\u003e\u003c/a\u003e\n\t\u003ca href=\"https://www.jsdelivr.com/package/npm/jsbarcode\"\u003e\u003cimg src=\"https://data.jsdelivr.com/v1/package/npm/jsbarcode/badge?style=rounded\" alt=\"CDN\"\u003e\u003c/a\u003e\n\t\u003ca href=\"https://github.com/lindell/JsBarcode/blob/master/MIT-LICENSE.txt\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-MIT-blue.svg\" alt=\"License\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nIntroduction\n----\n**JsBarcode** is a **barcode generator** written in JavaScript. It supports multiple barcode formats and works in browsers and with *Node.js*. It has *no dependencies* when it is used for the web but works with *jQuery* if you are into that.\n\n\n\nDemo\n----\n#### [Barcode Generator](http://lindell.github.io/JsBarcode/generator/)\n#### [Simple CodePen Demo](http://codepen.io/lindell/pen/eZKBdO?editors=1010)\n#### [Settings CodePen Demo](http://codepen.io/lindell/pen/mPvLXx?editors=1010)\n\nSupported barcodes:\n----\n* [CODE128](https://github.com/lindell/JsBarcode/wiki/CODE128)\n  * CODE128 (automatic mode switching)\n  * CODE128 A/B/C (force mode)\n* [EAN](https://github.com/lindell/JsBarcode/wiki/EAN)\n  * EAN-13\n  * EAN-8\n  * EAN-5\n  * EAN-2\n  * UPC (A)\n  * UPC (E)\n* [CODE39](https://github.com/lindell/JsBarcode/wiki/CODE39)\n* [ITF](https://github.com/lindell/JsBarcode/wiki/ITF-14)\n  * ITF\n  * ITF-14\n* [MSI](https://github.com/lindell/JsBarcode/wiki/MSI)\n  * MSI10\n  * MSI11\n  * MSI1010\n  * MSI1110\n* [Pharmacode](https://github.com/lindell/JsBarcode/wiki/pharmacode)\n* [Codabar](https://github.com/lindell/JsBarcode/wiki/codabar)\n* CODE93\n\nExamples for browsers:\n----\n\n#### First create a canvas (or image)\n````html\n\u003csvg id=\"barcode\"\u003e\u003c/svg\u003e\n\u003c!-- or --\u003e\n\u003ccanvas id=\"barcode\"\u003e\u003c/canvas\u003e\n\u003c!-- or --\u003e\n\u003cimg id=\"barcode\"/\u003e\n````\n\n\n\n#### Simple example:\n````javascript\nJsBarcode(\"#barcode\", \"Hi!\");\n// or with jQuery\n$(\"#barcode\").JsBarcode(\"Hi!\");\n````\n\n##### Result:\n![Result](https://s3-eu-west-1.amazonaws.com/js-barcode/barcodes/simple.svg)\n\n\n#### Example with options:\n````javascript\nJsBarcode(\"#barcode\", \"1234\", {\n  format: \"pharmacode\",\n  lineColor: \"#0aa\",\n  width:4,\n  height:40,\n  displayValue: false\n});\n````\n##### Result:\n![Result](https://s3-eu-west-1.amazonaws.com/js-barcode/barcodes/advanced.svg)\n\n\n#### More advanced use case:\n````javascript\nJsBarcode(\"#barcode\")\n  .options({font: \"OCR-B\"}) // Will affect all barcodes\n  .EAN13(\"1234567890128\", {fontSize: 18, textMargin: 0})\n  .blank(20) // Create space between the barcodes\n  .EAN5(\"12345\", {height: 85, textPosition: \"top\", fontSize: 16, marginTop: 15})\n  .render();\n````\n##### Result:\n![Result](https://s3-eu-west-1.amazonaws.com/js-barcode/barcodes/simple.svg)\n\n\n\n#### Or define the value and options in the HTML element:\nUse any `jsbarcode-*` or `data-*` as attributes where `*` is any option.\n````html\n\u003csvg class=\"barcode\"\n  jsbarcode-format=\"upc\"\n  jsbarcode-value=\"123456789012\"\n  jsbarcode-textmargin=\"0\"\n  jsbarcode-fontoptions=\"bold\"\u003e\n\u003c/svg\u003e\n````\n\nAnd then initialize it with:\n````javascript\nJsBarcode(\".barcode\").init();\n````\n\n##### Result:\n![Result](https://s3-eu-west-1.amazonaws.com/js-barcode/barcodes/init.svg)\n\n\n\n#### Retrieve the barcode values so you can render it any way you'd like\nPass in an object which will be filled with data.\n```javascript\nconst data = {};\nJsBarcode(data, 'text', {...options});\n```\ndata will be filled with a ``` encodings ``` property which has all the needed values.\nSee wiki for an example of what data looks like.\n\n\nSetup for browsers:\n----\n### Step 1:\nDownload or get the CDN link to the script:\n\n| Name | Supported barcodes | Size (gzip) | CDN / Download |\n|------|--------------------|:-----------:|---------------:|\n|  *All*  |  *All the barcodes!*  |  *11.1 kB*  |  *[JsBarcode.all.min.js][1]*  |\n|  CODE128  |  CODE128 (auto and force mode)  |  6.3 kB  |  [JsBarcode.code128.min.js][2]  |\n|  CODE39  |  CODE39  |  5.1 kB  |  [JsBarcode.code39.min.js][3]  |\n|  EAN / UPC  |  EAN-13, EAN-8, EAN-5, EAN-2, UPC (A)  |  6.7 kB  |  [JsBarcode.ean-upc.min.js][4]  |\n|  ITF  |  ITF, ITF-14  |  5.1 kB  |  [JsBarcode.itf.min.js][5]  |\n|  MSI  |  MSI, MSI10, MSI11, MSI1010, MSI1110  |  5 kB  |  [JsBarcode.msi.min.js][6]  |\n|  Pharmacode  |  Pharmacode  |  4.8 kB  |  [JsBarcode.pharmacode.min.js][7]  |\n|  Codabar  |  Codabar  |  4.9 kB  |  [JsBarcode.codabar.min.js][8]  |\n|  CODE93  |  CODE93  |    |  JsBarcode.code93.min.js  |\n\n\n### Step 2:\nInclude the script in your code:\n\n\n````html\n\u003cscript src=\"JsBarcode.all.min.js\"\u003e\u003c/script\u003e\n````\n\n### Step 3:\nYou are done! Go generate some barcodes :smile:\n\nBower and npm:\n----\nYou can also use [Bower](http://bower.io) or [npm](https://www.npmjs.com) to install and manage the library.\n````bash\nbower install jsbarcode --save\n````\n````bash\nnpm install jsbarcode --save\n````\n\nNode.js:\n----\n\n#### With canvas:\n```` javascript\nvar JsBarcode = require('jsbarcode');\n\n// Canvas v1\nvar Canvas = require(\"canvas\");\n// Canvas v2\nvar { createCanvas } = require(\"canvas\");\n\n// Canvas v1\nvar canvas = new Canvas();\n// Canvas v2\nvar canvas = createCanvas();\n\nJsBarcode(canvas, \"Hello\");\n\n// Do what you want with the canvas\n// See https://github.com/Automattic/node-canvas for more information\n````\n\n#### With svg:\n```` javascript\nconst { DOMImplementation, XMLSerializer } = require('xmldom');\nconst xmlSerializer = new XMLSerializer();\nconst document = new DOMImplementation().createDocument('http://www.w3.org/1999/xhtml', 'html', null);\nconst svgNode = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n\nJsBarcode(svgNode, 'test', {\n    xmlDocument: document,\n});\n\nconst svgText = xmlSerializer.serializeToString(svgNode);\n````\n\n\nOptions:\n----\nFor information about how to use the options, see [the wiki page](https://github.com/lindell/JsBarcode/wiki/Options).\n\n| Option | Default value | Type |\n|--------|---------------|------|\n| [`format`](https://github.com/lindell/JsBarcode/wiki/Options#format) | `\"auto\" (CODE128)` | `String` |\n| [`width`](https://github.com/lindell/JsBarcode/wiki/Options#width) | `2` | `Number` |\n| [`height`](https://github.com/lindell/JsBarcode/wiki/Options#height) | `100` | `Number` |\n| [`displayValue`](https://github.com/lindell/JsBarcode/wiki/Options#display-value) | `true` | `Boolean` |\n| [`text`](https://github.com/lindell/JsBarcode/wiki/Options#text) | `undefined` | `String` |\n| [`fontOptions`](https://github.com/lindell/JsBarcode/wiki/Options#font-options) | `\"\"` | `String` |\n| [`font`](https://github.com/lindell/JsBarcode/wiki/Options#font) | `\"monospace\"` | `String` |\n| [`textAlign`](https://github.com/lindell/JsBarcode/wiki/Options#text-align) | `\"center\"` | `String` |\n| [`textPosition`](https://github.com/lindell/JsBarcode/wiki/Options#text-position) | `\"bottom\"` | `String` |\n| [`textMargin`](https://github.com/lindell/JsBarcode/wiki/Options#text-margin) | `2` | `Number` |\n| [`fontSize`](https://github.com/lindell/JsBarcode/wiki/Options#font-size) | `20` | `Number` |\n| [`background`](https://github.com/lindell/JsBarcode/wiki/Options#background)  | `\"#ffffff\"` | `String (CSS color)` |\n| [`lineColor`](https://github.com/lindell/JsBarcode/wiki/Options#line-color) | `\"#000000\"` | `String (CSS color)` |\n| [`margin`](https://github.com/lindell/JsBarcode/wiki/Options#margins) | `10` | `Number` |\n| [`marginTop`](https://github.com/lindell/JsBarcode/wiki/Options#margins) | `undefined` | `Number` |\n| [`marginBottom`](https://github.com/lindell/JsBarcode/wiki/Options#margins) | `undefined` | `Number` |\n| [`marginLeft`](https://github.com/lindell/JsBarcode/wiki/Options#margins) | `undefined` | `Number` |\n| [`marginRight`](https://github.com/lindell/JsBarcode/wiki/Options#margins) | `undefined` | `Number` |\n| [`valid`](https://github.com/lindell/JsBarcode/wiki/Options#valid) | `function(valid){}` | `Function` |\n\nContributions and feedback:\n----\nWe :heart: contributions and feedback.\n\nIf you want to contribute, please check out the [CONTRIBUTING.md](https://github.com/lindell/JsBarcode/blob/master/CONTRIBUTING.md) file.\n\nIf you have any question or suggestion [create an issue](https://github.com/lindell/JsBarcode/issues/new) or ask about it in the [gitter chat](https://gitter.im/lindell/JsBarcode).\n\nBug reports should always be done with a [new issue](https://github.com/lindell/JsBarcode/issues/new).\n\nLicense:\n----\nJsBarcode is shared under the [MIT license](https://github.com/lindell/JsBarcode/blob/master/MIT-LICENSE.txt). This means you can modify and use it however you want, even for comercial use. But please give this the Github repo a :star: and write a small comment of how you are using JsBarcode in the [gitter chat](https://gitter.im/lindell/JsBarcode).\n\n\n\n[1]: https://cdn.jsdelivr.net/npm/jsbarcode@3.11.0/dist/JsBarcode.all.min.js \"jsdelivr all barcodes\"\n[2]: https://cdn.jsdelivr.net/npm/jsbarcode@3.11.0/dist/barcodes/JsBarcode.code128.min.js \"jsdelivr code128\"\n[3]: https://cdn.jsdelivr.net/npm/jsbarcode@3.11.0/dist/barcodes/JsBarcode.code39.min.js \"jsdelivr code39\"\n[4]: https://cdn.jsdelivr.net/npm/jsbarcode@3.11.0/dist/barcodes/JsBarcode.ean-upc.min.js \"jsdelivr ean/upc\"\n[5]: https://cdn.jsdelivr.net/npm/jsbarcode@3.11.0/dist/barcodes/JsBarcode.itf.min.js \"jsdelivr itf\"\n[6]: https://cdn.jsdelivr.net/npm/jsbarcode@3.11.0/dist/barcodes/JsBarcode.msi.min.js \"jsdelivr msi\"\n[7]: https://cdn.jsdelivr.net/npm/jsbarcode@3.11.0/dist/barcodes/JsBarcode.pharmacode.min.js \"jsdelivr pharmacode\"\n[8]: https://cdn.jsdelivr.net/npm/jsbarcode@3.11.0/dist/barcodes/JsBarcode.codabar.min.js \"jsdelivr codabar\"\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flindell%2Fjsbarcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flindell%2Fjsbarcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flindell%2Fjsbarcode/lists"}