PNG JPG BMP TIFF SVG
Aspose.BarCode  for Java
Data Matrix

Data Matrix लेबल Java के साथ जनरेट करें

Java API के लिए सर्वर-साइड Aspose.BarCode का उपयोग करके Java में Data Matrix कोड बनाएं।

How to Generate Data Matrix कोड Using Java

Data Matrix कोड जनरेट करने के लिए, जावा के लिए Aspose.BarCode API प्राप्त करें, जो Java के लिए समृद्ध, शक्तिशाली और उपयोग में आसान बारकोड API है- आधारित प्लेटफॉर्म। नवीनतम संस्करण को सीधे मेवेन से डाउनलोड करें और फिर इसे अपने मावेन- 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>

Java में Data Matrix कोड जनरेट करने के चरण

Aspose.BarCode डेवलपर्स के लिए कोड की कुछ पंक्तियों के साथ Data Matrix कोड छवियां बनाना आसान बनाता है।

  • BarCodeGenerator वर्ग का एक नया ऑब्जेक्ट बनाएं
  • Data Matrix कोड और अन्य आवश्यक बारकोड प्रकारों को EncodeTypes पैरामीटर के रूप में परिभाषित करें
  • setCodeText पद्धति का उपयोग करके इनपुट टेक्स्ट निर्दिष्ट करें
  • जेनरेट की गई बारकोड छवि को सहेजने के लिए BarCodeGenerator.save पद्धति का उपयोग करें

सिस्टम आवश्यकताएं

Aspose बारकोड एपीआई सभी प्रमुख प्लेटफॉर्म और ऑपरेटिंग सिस्टम द्वारा समर्थित हैं। नीचे दिए गए कोड नमूने को निष्पादित करने से पहले, कृपया जांच लें कि आपके सिस्टम में निम्नलिखित पूर्वापेक्षाएँ सक्षम हैं।

  • Microsoft Windows, Linux, या कोई भी OS जो JSP/JSF और डेस्कटॉप एप्लिकेशन के लिए Java रनटाइम एनवायरनमेंट के साथ संगत है
  • Java डेवलपमेंट एनवायरनमेंट, जैसे JRE 1.6 या ऊपर
  • जावा विकास संस्करण JSE2 7.0 या ऊपर

Code to be executed - Java


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

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