
Barcodes visually represent data as graphic symbols. Different types, such as Code128, QR code, Aztec, and PDF417, serve various purposes. In this article you will learn how to add barcode generation to your web applications, including how to generate barcodes of different symbologies within Node.js applications.
- Node.js Barcode Generator API
- Generate a Barcode in Node.js
- Generate a QR Code in Node.js
- Customize Appearance of a Barcode
Node.js Barcode Generator API
To generate barcodes we use Aspose.BarCode for Node.js via Java. This feature‑rich API lets you create and read popular barcode symbologies from Node.js. Download the API or install it with NPM:
> npm install aspose.barcode
Aspose.BarCode for Node.js via Java supports many barcode symbologies.
| Australia Post | EAN8 |
| Aztec | Interleaved2of5 |
| BarCode supplement | ITF14 |
| BooklandEAN | Matrix 2 of 5 |
| Codabar | MSI |
| Code11 | Pdf417 |
| Code128 | Planet |
| Code39 Extended | Postnet |
| Code39 Standard | PZN (Pharma Zentral Nummer, Pharmazentralnummer barcode) |
| Code93 Extended | QR |
| Code93 Standard | SSCC18 |
| Datamatrix | Standard2of5 |
| Deutsche Post Identcode | Swiss QR |
| EAN128 | UPCA |
| EAN13 | UPCE |
| EAN14(SCC14) |
Generate a Barcode in Node.js
Follow these steps to create a barcode in Node.js:
- Create a BarcodeGenerator object and set the type, e.g.,
EncodeTypes.CODE_128. - Set the barcode text with
BarcodeGenerator.setCodeText(string). - Save the image using
BarcodeGenerator.save(string, string).
The sample below generates a barcode image.
Barcode

Generate a QR Code in Node.js
Aspose.BarCode also creates two‑dimensional barcodes such as QR codes. Use these steps:
- Instantiate BarcodeGenerator with
EncodeTypes.QR. - Set the QR text via
BarcodeGenerator.setCodeText(string). - Save the QR image with
BarcodeGenerator.save(string, string).
The code sample below shows QR code generation.
QR Code

Customize Appearance of a Barcode
You can change a barcode’s forecolor, back color, font, border, resolution, and more. Steps:
- Create a BarcodeGenerator object with the desired type, e.g.,
EncodeTypes.AZTEC. - Set the text using
BarcodeGenerator.setCodeText(string). - Adjust appearance via parameters, such as
BarcodeGenerator.getParameters().setBackColor("#A9A9A9"). - Save the customized image with
BarcodeGenerator.save(string, string).
The example below customizes a barcode.
Barcode

Get a Free API License
To remove evaluation limits, you can get a free temporary license.
Conclusion
You have learned how to generate barcodes and QR codes in Node.js and how to customize their appearance. Explore more features in the API’s documentation and share questions on our forum.