PNG JPG BMP TIFF SVG
Aspose.BarCode  for Node.js via Java
GS1 Code 128

Node.js via Java で GS1 Code 128 ラベルを生成します

Node.js via Java API のサーバー側 Aspose.BarCode を使用して、JavaScript に GS1 Code 128 バーコード を作成します。

How to Generate GS1 Code 128 バーコード Using Node.js via Java

Node.js アプリケーション内で GS1 Code 128 バーコード バーコードを作成するには、Java 経由で Aspose.BarCode for Node.js を取得します。これは、Java 指向のプラットフォーム向けに設計された、高度で強力で使いやすいバーコード API です。 NPM から Javascript 用の aspose.barcode を簡単にインストールできます。

Command

  > npm i aspose.barcode

JavaScript で GS1 Code 128 バーコード を生成する手順

Aspose.BarCode を使用すると、開発者は数行のコードで GS1 Code 128 バーコード 画像を簡単に作成できます。

  • BarCodeGenerator クラスのインスタンスを作成する
  • GS1 Code 128 バーコード を EncodeTypes パラメータとして設定する
  • 2 番目のパラメータとしてエンコードするテキストを定義する
  • 必要に応じてバーコードの寸法と位置を決定します
  • BarCodeGenerator.save メソッドを呼び出して、生成されたバーコード画像を取得します

システム要求

Aspose バーコード API は、すべての主要なプラットフォームとオペレーティング システムでサポートされています。以下のコード サンプルを実行する前に、システムで次の前提条件が有効になっていることを確認してください。

  • Microsoft Windows、Linux、または Node.js と互換性のある OS
  • Node.js および Node.js/Java Bridge がインストールされていること
  • Oracle JDK バージョン 7 以降

Code to be executed - JavaScript


const barcode_ = require("aspose.barcode");
const aspose_barcode = barcode_.AsposeBarcode

let BarcodeGenerator = aspose_barcode.BarcodeGenerator;
let EncodeTypes = aspose_barcode.EncodeTypes;

// Create an instane of the BarcodeGenerator class
let generator = new BarcodeGenerator(EncodeTypes.QR, "");

// Specify the X-dimension 
// the smallest width of the unit of BarCode bars or spaces
generator.getParameters().getBarcode().getXDimension().setMillimeteres(2);

// Set codetext position
generator.getParameters().getBarcode().getCodeTextParameters().setLocation(CodeLocation.Below);

// Generate and save image
generator.save("example.png", aspose_barcode.BarCodeImageFormat.PNG);
Generation result