Bu makalede, Java kullanarak Barkod nasıl oluşturulacağı ve aynı Java API’si ile Barkodun nasıl tanınacağı konusundaki detayları tartışacağız. Bir barkodun, tüm ürünlere yerleştirilen ve bilgisayarların ürünleri çok daha hızlı ve daha doğru bir şekilde takip etmesini ve işlem yapmasını sağlayan bir kodlama etiketi veya etiket olduğunu zaten biliyoruz. Benzer şekilde, zamanında yazdırılabilir ve ürünlere eklenebilir, böylece tüm envanterinizin hemen etiketlenip takip edilmesini sağlar. Ayrıca, Barkod otomatik ürün tanımlaması, son derece hızlı tanıma ve verilerin çok düşük bir hata oranıyla uygulanmasını sunar. Bu yaklaşım son derece maliyet etkilidir ve işverenlerin genel giderleri azaltmasına ve eğitim süresini ve iş gücünü kısaltmasına yardımcı olabilir.

Barkod Oluşturma API’si

Aspose.BarCode Cloud, programlamada Barkod oluşturma ve manipülasyon yeteneklerini uygulamalarına olanak tanıyan bir REST API’sidir.

API, popüler raster görüntü formatlarını ayrıştırma yeteneğine sahiptir. Daha fazla bilgi için lütfen Supported File Formats ziyaret edin.

Barkod Oluşturma Belirtilen Boyutlarla

Hızlı ve en kolay yol, API’lerimizi test etmek için API referans bölümünü kullanmaktır. GetBarcodeGenerate metodu, Barkod resimleri oluşturmak için kullanılır ve Barkodu gereksinimlerinize göre oluşturmak için geniş bir seçenek yelpazesi sunar; belirli parametrelerle ilgili detaylar API referans sayfasında iyi bir şekilde açıklanmıştır. Barkod oluştururken aşağıdaki türlerden birini belirtebilirsiniz.

  • Codabar
  • Code11
  • Code39Standard
  • Code39Extended
  • Code93Standart
  • Code93Extended
  • Code128
  • GS1Code128
  • EAN8
  • EAN13
  • EAN14
  • SCC14
  • SSCC18
  • UPCA
  • UPCE
  • ISBN
  • ISSN
  • ISMN
  • Standard2of5
  • Interleaved2of5
  • Matrix2of5
  • ItalianPost25
  • IATA2of5
  • ITF14
  • ITF6
  • MSI
  • VIN
  • DeutschePostIdentcode
  • DeutschePostLeitcode
  • OPC
  • PZN
  • Code16K
  • Pharmacode
  • DataMatrix
  • QR
  • Aztek
  • Pdf417
  • MacroPdf417
  • AustraliaPost
  • Postnet
  • Planet
  • OneCode
  • RM4SCC
  • DatabarOmniDirectional
  • DatabarTruncated
  • DatabarLimited
  • DatabarExpanded
  • SingaporePost
  • GS1DataMatrix
  • AustralianPosteParcel
  • SwissPostParcel
  • PatchCode
  • DatabarExpandedStacked
  • DatabarStacked
  • DatabarStackedOmniDirectional
  • MicroPdf417
  • GS1QR
  • MaxiCode
  • Code32
  • DataLogic2of5
  • DotCode
  • DutchKIX
  • UpcaGs1Code128Coupon
  • UpcaGs1DatabarCoupon
  • CodablockF
  • GS1CodablockF

cURL komutu

curl -X GET "https://api.aspose.cloud/v3.0/barcode/generate?Type=Codabar&Text=Hello%20World&TwoDDisplayText=QR&TextLocation=Above&TextAlignment=Center&TextColor=Blue&FontSizeMode=Auto&Resolution=96&TextSpace=2&Units=Point&SizeMode=Nearest&BarHeight=50&ImageHeight=200&ImageWidth=200&RotationAngle=0&BackColor=White&BorderDashStyle=Solid&SupplementData=EAN8&format=PNG" -H  "accept: image/png" -H  "authorization: Bearer <JWT Token>"

Request URL

https://api.aspose.cloud/v3.0/barcode/generate?Type=Codabar&Text=Hello%20World&TwoDDisplayText=QR&TextLocation=Above&TextAlignment=Center&TextColor=Blue&FontSizeMode=Auto&Resolution=96&TextSpace=2&Units=Point&SizeMode=Nearest&BarHeight=50&ImageHeight=200&ImageWidth=200&RotationAngle=0&BackColor=White&BorderDashStyle=Solid&SupplementData=EAN8&format=PNG

Java

Aşağıdaki kod parçacığı, bir Barkod görüntüsü oluşturmak ve bunu Cloud Depolama’da saklamak için kullanılabilir.

// Tam örnekler ve veri dosyaları için lütfen [https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-java/](https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-java/) adresine gidin.

String name = "putBarcodeGenerateFile.png";
String type = EncodeBarcodeType.QR.getValue();
String text = "Put Barcode Generate File";
Double dimensionX = 200.0;

String twoDDisplayText = null;
String textLocation = null;
String textAlignment = null;
String textColor = null;
String fontSizeMode = null;
Double resolution = null;
Double textSpace = null;
String units = null;
String sizeMode = null;
Double barHeight = null;
Double imageHeight = null;
Double imageWidth = null;
Double rotationAngle = null;
String backColor = null;
String barColor = null;
String borderColor = null;
Double borderWidth = null;
String borderDashStyle = null;
Boolean borderVisible = null;
String enableChecksum = null;
Boolean enableEscape = null;
Boolean filledBars = null;
Boolean alwaysShowChecksum = null;
Double wideNarrowRatio = null;
Boolean validateText = null;
String supplementData = null;
Double supplementSpace = null;
String format = null;

String storage = "Storage";
String folder = "Temp/"

ResultImageInfo response =
		api.putBarcodeGenerateFile(
				name,type,text,twoDDisplayText,textLocation,textAlignment,textColor,fontSizeMode,
				resolution,null,null,dimensionX,textSpace,units,sizeMode,barHeight,
				imageHeight,imageWidth,rotationAngle,backColor,barColor,borderColor,borderWidth,
				borderDashStyle,borderVisible,enableChecksum,enableEscape,filledBars,
				alwaysShowChecksum,wideNarrowRatio,validateText,supplementData,
				supplementSpace,storage,folder,format);

assertTrue(response.getFileSize() > 0);
assertTrue(response.getImageWidth() > 0);
assertTrue(response.getImageHeight() > 0);
BarKod Görüntüsü

Resim 1:- Java API ile oluşturulan Barkod önizlemesi

Raster Görüntüden Barkod Tanıma

API ayrıca raster görüntü dosyalarındaki Barkodu tanıma yeteneklerini de sunmaktadır. Görüntü dosyası PNG, JPEG, BMP, GIF, TIFF veya EXIF formatında olabilir. API’nin GetBarcodeRecognize yöntemi, bu gereksinimi yerine getirmenizi sağlar. Ad alanı zorunludur ve diğer isteğe bağlı alanlar, Barkod türü bilgisi, ChecksumValidation, Kodlama, tanıma kalitesini ve hızını yapılandırmaya olanak tanıyan bir ön ayar ve daha fazlasını belirtebildiğiniz için daha iyi tanıma işlemleri gerçekleştirmenize olanak tanır.

cURL

curl -X GET "https://api.aspose.cloud/v3.0/barcode/index.png/recognize?Type=all&ChecksumValidation=Off&DetectEncoding=false&Preset=HighQuality" -H  "accept: application/json" -H  "authorization: Bearer <JWT Token>"

Request URL

https://api.aspose.cloud/v3.0/barcode/index.png/recognize?Type=all&ChecksumValidation=Off&DetectEncoding=false&Preset=HighQuality

Dış Resim URL’sinden Barkod Okuma

// Tam örnekler ve veri dosyaları için lütfen https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-java/ adresine gidin.

String type = null;
String checksumValidation = ChecksumValidation.OFF.toString();
Boolean detectEncoding = null;
String preset = PresetType.HIGHPERFORMANCE.toString();
String url = "http://www.barcoding.com/images/Barcodes/pdf417.gif";

Integer rectX = null;
Integer rectY = null;
Integer rectWidth = null;
Integer rectHeight = null;
Boolean stripFNC = null;
Integer timeout = null;
Integer medianSmoothingWindowSize = null;
Boolean allowMedianSmoothing = null;
Boolean allowComplexBackground = null;
Boolean allowDatamatrixIndustrialBarcodes = null;
Boolean allowDecreasedImage = null;
Boolean allowDetectScanGap = null;
Boolean allowIncorrectBarcodes = null;
Boolean allowInvertImage = null;
Boolean allowMicroWhiteSpotsRemoving = null;
Boolean allowOneDFastBarcodesDetector = null;
Boolean allowOneDWipedBarsRestoration = null;
Boolean allowQRMicroQrRestoration = null;
Boolean allowRegularImage = null;
Boolean allowSaltAndPepperFiltering = null;
Boolean allowWhiteSpotsRemoving = null;
Double regionLikelihoodThresholdPercent = null;
List<Integer> scanWindowSizes = null;
Double similarity = null;
Boolean skipDiagonalSearch = null;
String australianPostEncodingTable = null;
String rectangleRegion = null;
File image = null;

BarcodeResponseList response = 
   	 api.postBarcodeRecognizeFromUrlOrContent( 
      		type,checksumValidation,detectEncoding,preset,rectX,rectY,rectWidth,rectHeight,
      		stripFNC,timeout,medianSmoothingWindowSize,allowMedianSmoothing,allowComplexBackground,
      		allowDatamatrixIndustrialBarcodes,allowDecreasedImage,allowDetectScanGap,
		allowIncorrectBarcodes,allowInvertImage,allowMicroWhiteSpotsRemoving,allowOneDFastBarcodesDetector,
      		allowOneDWipedBarsRestoration,allowQRMicroQrRestoration,allowRegularImage,allowSaltAndPepperFiltering,
      		allowWhiteSpotsRemoving,regionLikelihoodThresholdPercent,scanWindowSizes,similarity,skipDiagonalSearch,
      		australianPostEncodingTable,rectangleRegion,url,image);

assertNotNull(response);
assertFalse(response.getBarcodes().isEmpty());

BarcodeResponse barcode = response.getBarcodes().get(0);
assertEquals(DecodeBarcodeType.CODE11.getValue(), barcode.getType());
assertEquals("1234567812", barcode.getBarcodeValue());

Sonuç

Bu makalede, Java kullanarak programatik olarak Barkod nasıl oluşturulacağı ve mevcut bir Barkod’un nasıl okunup tanınacağı ile ilgili adımları ve ilgili detayları tartıştık. Tüm bu işlemlerin birkaç basit kod satırı ile gerçekleştirildiğini fark etmiş olabilirsiniz. Ek bir yazılım indirme veya kurulum gerekmemektedir ve bu işlemler daha az kod satırı ile tamamlanabilir.

İlgili Makaleler

Aşağıdaki bağlantılara göz atmanızı öneririz, daha fazla bilgi edinmek için