PNG JPG BMP TIFF SVG
Aspose.BarCode  for Android via Java
UPC

Android via Java で UPC ラベルを生成します

Android via Java API のサーバー側 Aspose.BarCode を使用して、Java に UPC (ユニバーサル製品コード) バーコード を作成します。

How to Generate UPC (ユニバーサル製品コード) バーコード Using Android via Java

Java 経由で Aspose.BarCode for Android を試して、Android アプリケーション内に UPC (ユニバーサル製品コード) バーコード を簡単に作成してください。これは、Android アプリケーション用に特別に設計された、多用途で堅牢かつユーザーフレンドリーなバーコード ライブラリです。次の構成を build.gradle に挿入することで、Maven ベースのプロジェクトから Java 経由で Android 用の Aspose.BarCode を直接簡単に作成できます。

Command

  maven { url "http://repository.aspose.com/repo/" }

Command

  implementation group: 'com.aspose', name: 'aspose-barcode', version: '23.XX', ext: 'aar'      
  implementation group: 'com.aspose', name: 'aspose-barcode', classifier: 'control.android.via.java-javadoc', version: '23.XX' 

Java で UPC (ユニバーサル製品コード) バーコード を生成する手順

Aspose.BarCode を使用すると、開発者は数行のコードで UPC (ユニバーサル製品コード) バーコード 画像を簡単に作成できます。

  • BarCodeGenerator クラスの新しいインスタンスを作成する
  • UPC (ユニバーサル製品コード) バーコード バーコード タイプを EncodeTypes パラメータとして渡す
  • setCodeText メソッドを使用してバーコード テキストを定義する
  • generateBarCodeImage() メソッドを起動して、UPC (ユニバーサル製品コード) バーコード バーコード画像を保存します

システム要求

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

  • Microsoft Windows、Linux、または Android ランタイム環境と互換性のある OS
  • Android SDK v.30
  • Android OS 2.0 以降を実行している Android システム

Code to be executed - Java


// Create an instane of the BarcodeGenerator class
BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.UPC);

// Specify the code text
generator.setCodeText("");

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

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

// Generate image
generator.generateBarCodeImage();
Generation result