PNG JPG BMP TIFF SVG
Aspose.BarCode  for Java
Code 93

สร้างป้ายกำกับ Code 93 ด้วย Java

สร้าง Code 93 Extended และ Code 93 บาร์โค้ดมาตรฐาน ใน Java โดยใช้ Aspose.BarCode ฝั่งเซิร์ฟเวอร์สำหรับ Java API

How to Generate บาร์โค้ด Code 93 Using Java

หากต้องการสร้าง บาร์โค้ด Code 93 ให้รับ Aspose.BarCode for Java API ซึ่งเป็น API บาร์โค้ดที่สมบูรณ์ ทรงพลัง และใช้งานง่ายสำหรับ Java- แพลตฟอร์มที่ใช้ ดาวน์โหลดเวอร์ชันล่าสุดโดยตรงจาก Maven แล้วติดตั้งภายใน Maven- ตามโครงการโดยเพิ่มการกำหนดค่าต่อไปนี้เพื่อ pom.xml:

Repository

<repository>
    <id>AsposeJavaAPI</id>
    <name>Aspose Java API</name>
    <url>https://repository.aspose.com/repo/</url>
</repository>

Dependency

<dependency>
    <groupId>com.aspose</groupId>
    <artifactId>aspose-barcode</artifactId>
    <version>version of aspose-barcode API</version>
    <classifier>jdk17</classifier>
</dependency>

ขั้นตอนในการสร้าง บาร์โค้ด Code 93 ใน Java

Aspose.BarCode ช่วยให้นักพัฒนาสร้างภาพ บาร์โค้ด Code 93 ได้ง่ายด้วยโค้ดไม่กี่บรรทัด

  • สร้างวัตถุใหม่ของคลาส BarCodeGenerator
  • กำหนด บาร์โค้ด Code 93 และประเภทบาร์โค้ดที่จำเป็นอื่นๆ เป็นพารามิเตอร์ EncodeTypes
  • ระบุข้อความป้อนเข้าโดยใช้เมธอด setCodeText
  • ใช้วิธี BarCodeGenerator.save เพื่อบันทึกภาพบาร์โค้ดที่สร้างขึ้น

ความต้องการของระบบ

API บาร์โค้ด Aspose รองรับโดยแพลตฟอร์มและระบบปฏิบัติการหลักทั้งหมด ก่อนดำเนินการตามตัวอย่างโค้ดด้านล่าง โปรดตรวจสอบว่าคุณได้เปิดใช้งานข้อกำหนดเบื้องต้นต่อไปนี้ในระบบของคุณแล้ว

  • Microsoft Windows, Linux หรือระบบปฏิบัติการใดๆ ที่เข้ากันได้กับ Java Runtime Environment สำหรับ JSP/JSF และแอปพลิเคชันเดสก์ท็อป
  • สภาพแวดล้อมการพัฒนา Java เช่น JRE 1.6 หรือสูงกว่า
  • Java Development เวอร์ชัน JSE2 7.0 ขึ้นไป

Code to be executed - Java


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

// 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