Kif tiżviluppa App tal-iskaner tal-barcode billi tuża Java SDK. Implimenta kapaċitajiet ta’ skanjar QR fl-Applikazzjonijiet tal-Web, tal-Mowbajl u tad-Desktop tiegħek.

Skaner tal-barcode

Scan barcode online | QR code scanner

F’dan l-artikolu, se niddiskutu d-dettalji ta ‘kif tiżviluppa skaner tal-Barcode u app tal-iskaner tal-kodiċi QR billi tuża Java REST API. Aħna nifhmu li fl-ekonomiji b’ritmu mgħaġġel tal-lum, il-Barcodes huma soluzzjoni essenzjali u vijabbli għall-bejjiegħa u n-negozjanti għall-ħażna tad-dettalji tal-prodott. Matul is-snin, urew li huma għażla siewja u vijabbli għan-negozji. Tejbu ħafna l-effiċjenza u naqqsu l-overhead. Il-barcodes huma kemm kost-effettivi kif ukoll affidabbli. Fost benefiċċji oħra tal-użu tal-BarCode, speċifikati hawn taħt hemm ftit vantaġġi oħra tal-użu tagħhom

  • Barcodes jeliminaw il-possibbiltà ta ‘żball uman
  • L-użu ta ‘sistema tal-barcode inaqqas il-ħin tat-taħriġ tal-impjegati
  • Barcodes huma estremament versatili u jistgħu jintużaw għal kull tip ta ‘ġbir ta’ data meħtieġa
  • Jippermettu kontroll preċiż tal-inventarju, u għalhekk il-kontroll tal-inventarju jitjieb
  • Barra minn hekk, il-Barcodes jipprovdu data aħjar jiġifieri barcode wieħed jista’ jipprovdi inventarju u dettalji tal-prezzijiet

Pertinenti għall-karatteristiċi kollha bħal dawn, Aspose.BarCode Cloud Java SDK jagħti s-setgħa lill-iżviluppaturi Java biex joħolqu kif ukoll jiskannjaw Barcode onlajn bl-użu tal-lingwa Java. Simili għall-API tal-Cloud l-oħra tagħna, Aspose.BarCode Cloud Java SDK jeħtieġ li tirreġistra kont fuq Cloud Dashboard. Jekk diġà rreġistrajt kont, tista’ tkompli tużah. Ladarba jkollok il-kont tiegħek lest, int tajjeb li tuża s-Servizzi tal-Cloud permezz tal-AppKey u l-AppSID.

Tista’ tikkunsidra li tuża Aspose Cloud storage jew, tuża kwalunkwe servizz ta’ cloud storage ta’ parti terza għall-ħażna u l-irkupru tal-fajls.

Simboliji tal-Barcode Appoġġjati

L-SDK jappoġġja bosta simboli tal-Barcode (aktar minn 60) bħal EAN, UPC, Codabar, PDF417, QR, MicroQR, Postnet, Planet, RM4SCC, eċċ. Ikollok ukoll l-għażla li tgħabbi l-informazzjoni eżistenti tal-BarCode u tissejvja l-output f’immaġni popolari formati, bħal JPEG, PNG, GIF, BMP, TIFF, EMF, WMF 9], SVG, EXIF, u ICON. Għal lista kompleta tas-simboliji appoġġjati, jekk jogħġbok żur Aspose.BarCode Cloud Java SDK.

Iġġenera Barcode

L-SDK joffrilek li toħloq immaġini tal-barcode Lineari, 2D u postali f’ħafna formati. Tista’ tispeċifika attributi tal-immaġni tal-barcode bħall-wisa’ tal-immaġni, l-għoli, l-istil tal-fruntiera, u l-format tal-immaġni tal-ħruġ. Tista’ wkoll tispeċifika t-tip tal-barcode u l-attributi tat-test bħall-post tat-test u l-istili tat-tipa skont ir-rekwiżiti tal-applikazzjoni tiegħek. Tipprovdi wkoll il-kapaċitajiet biex tissettja l-għoli tal-vireg u dawwar immaġini tal-barcode f’angolu.

L-eżempju li ġej juri l-passi biex jinħoloq Code39Standard Barcode, imqiegħed fuq l-allinjament Top-Center tal-paġna. Il-kulur tat-test huwa speċifikat bħala Navy, Orizzontali, u Vertikali riżoluzzjoni hija speċifikata bħala 200. Il-BarColor huwa speċifikat bħala Oranġjo, il-kulur fl-isfond huwa ssettjat bħala fidda u l-format tal-output huwa format JPEG.

Qabel ma nipproċedu aktar, nirrakkomandaw li żżur il-link li ġejja peress li token JWT huwa meħtieġ meta taċċessa l-API billi tuża l-kmand cURL.

cURL

curl -X PUT "https://api.aspose.cloud/v3.0/barcode/MySample.jpeg/generate?Type=Code39Standard&Text=BarCode%20processing&TextLocation=Above&TextAlignment=Center&TextColor=Navy&FontSizeMode=Auto&Resolution=200&ResolutionX=200&BackColor=silver&BarColor=Orange&BorderColor=Blue&format=jpeg" \
-H  "accept: application/json" \
-H  "authorization: Bearer <JWT Token>"

URL talba

https://api.aspose.cloud/v3.0/barcode/MySample.jpeg/generate?Type=Code39Standard&Text=BarCode%20processing&TextLocation=Above&TextAlignment=Center&TextColor=Navy&FontSizeMode=Auto&Resolution=200&ResolutionX=200&BackColor=silver&BarColor=Orange&BorderColor=Blue&format=jpeg

Java

ApiClient client = new ApiClient(
"App SID from https://dashboard.aspose.cloud/#/apps",
"App Key from https://dashboard.aspose.cloud/#/apps");
		        
com.aspose.barcode.cloud.api.BarcodeApi api = new com.aspose.barcode.cloud.api.BarcodeApi(client);
String name = "MySample.jpeg";
String type = com.aspose.barcode.cloud.model.EncodeBarcodeType.CODE39STANDARD.getValue();	
String text = "Barcode processing API"; // String | Text to encode.
String twoDDisplayText = null;
String textLocation = com.aspose.barcode.cloud.model.CodeLocation.ABOVE.getValue();
String textAlignment = com.aspose.barcode.cloud.model.TextAlignment.CENTER.getValue();
String textColor = "Navy";
String fontSizeMode = com.aspose.barcode.cloud.model.FontMode.AUTO.getValue();
int resolution = 200;
double resolutionX = 200;
double resolutionY = 200;
String barColor = "Orange";
String format = "JPEG";
		        
try {
com.aspose.barcode.cloud.model.ResultImageInfo result = api.putBarcodeGenerateFile(
    name, 
		type, 
		text, 
		twoDDisplayText, 
		textLocation, 
		textAlignment, 
		textColor, 
		fontSizeMode, 
		(double) resolution, 
		resolutionX, 
		resolutionY, 
		null, 
		null, 
		null, 
		null, 
		null, 
		null, 
		null, 
		null, 
		"Silver", 
		barColor, 
		"Blue",
		null, 
		null, 
		true, 
		null, 
		null, 
		null, 
		null, 
		null, 
		null, 
		null, 
		null, 
		null, 
		null,
		format);
		            
  System.out.println(result);
	} catch (ApiException e) {
  System.err.println("Exception when calling BarcodeApi#PutBarcodeGenerateFile");
	e.printStackTrace();
}
Skaner tal-barcode onlajn

Immaġni 1:- Preview tal-BarCode Riżultanti.

Barcode Reader Online

QR scan

Stampa 2: QR code scanner

Il-Cloud API huwa kapaċi wkoll li jirrikonoxxi informazzjoni minn barcodes eżistenti. Ikollok l-għażla li tispeċifika d-dettalji tat-tip tal-Barcode għal irkupru malajr jew tħalli l-API jiddetermina t-tip awtomatikament. Tista’ wkoll tispeċifika d-dettalji ta’ ChecksumValidation, DetectEncoding, jew tħalli l-API tiddeterminahom matul ir-runtime.

cURL

curl -X POST "https://api.aspose.cloud/v3.0/barcode/recognize?Type=all&DetectEncoding=true" \
-H  "accept: application/json" \
-H  "authorization: Bearer <JWT Token>" \
-H  "Content-Type: multipart/form-data" \
-H  "x-aspose-client: Containerize.Swagger" -d {"image":{}}

URL talba

https://api.aspose.cloud/v3.0/barcode/recognize?Type=all&DetectEncoding=true

Java

// Għal eżempji kompluti u fajls tad-dejta, jekk jogħġbok mur https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-java/

String type = null;
String checksumValidation = ChecksumValidation.OFF.toString();
Boolean detectEncoding = null;
String preset = PresetType.HIGHPERFORMANCE.toString();

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;
String url = null;

Path currentRelativePath = Paths.get("");
String currentPath = currentRelativePath.toAbsolutePath().toString();
Path filePath = Paths.get(currentPath, "data", "sample.png");

File image = new File(String.valueOf(filePath));

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());
2d barcode

Immaġni 3:- Preview tal-barcode 2D.

Jekk tmexxi l-kodiċi ta ‘hawn fuq fuq l-immaġni speċifikata hawn fuq, il-korp ta’ Rispons se jirrendi l-output bħala

Korp ta’ rispons

{  "barcodes":  [  {  "barcodeValue":  "12345678",  "type":  "Code39Standard",  "region":  [  {  "x":  **28**,  "y":  **3**  },  {  "x":  **222**,  "y":  **3**  },  {  "x":  **222**,  "y":  **74**  },  {  "x":  **28**,  "y":  **74**  }  ],  "checksum":  ""  }  ]  }

Konklużjoni

F’dan l-artikolu, tgħallimna l-passi dwar kif tiżviluppa App tal-iskaner tal-Barcode bl-użu tal-API REST Java. Bl-istess mod, l-API jippermettilek ukoll li timplimenta qarrej tal-kodiċi QR mill-fajl tal-immaġni. Minbarra li nużaw il-Java SDK, aħna jkollna wkoll għażla li tiskennja l-barcode onlajn billi tuża kmandi tal-cURL. M’hemmx bżonn ta’ tniżżil jew installazzjoni ta’ softwer addizzjonali. F’każ li tiltaqa’ ma’ xi kwistjonijiet waqt li tuża l-API, jekk jogħġbok tħossok liberu li tikkuntattjana permezz tal-forum ta’ appoġġ tal-prodott b’xejn.

Artikoli Relatati

Nirrakkomandaw ukoll li żżur il-links li ġejjin biex titgħallem aktar dwar: