במאמר זה, אנחנו הולכים לדון בפרטים על איך ליצור קוד QR באמצעות Java וכן להכיר את הקוד QR באמצעות אותה API של Java. אנחנו כבר מכירים שקוד QR הוא תג הזנה או תווית הממוקמת על כל הסחורה המאפשרת למחשבים לעקוב ולרשום מוצרים הרבה יותר מהר ובדיוק רב יותר. באותה מידה, ניתן בקלות להדפיסם ולהוסיף אותם לפריטים בזמן כך שכל המלאי שלך מסומן ומעקב מיידי. יתרה מכך, הקוד QR מציע זיהוי אוטומטי של מוצרים, הכרה מהירה מאוד, והטמעה של נתונים בשיעור שגיאות נמוך מאוד. גישה זו היא חסכונית מאוד ויכולה לסייע למעסיקים בהפחתת הוצאות והקטנת זמן ההכשרה ועבודה.
API לייצור ברקודים
Aspose.BarCode Cloud הוא API REST המאפשר ללקוחותינו ליישם יכולות יצירת קודים וברקוד ועיבוד ב-programming.
ה-API מסוגל לפענח פורמטים פופולריים של תמונות רסטר. למידע נוסף, בבקשה בקר ב-Supported File Formats.
צור תווית ברקוד עם ממדי תוכן שנקבעו
הדרך המהירה והקלה ביותר לבדוק את ה-APIs שלנו היא להשתמש במקטע הפניות API. השיטה GetBarcodeGenerate משמשת ליצירת תמונות BarCode והיא מספקת מגוון רחב של אפשרויות ליצירת ה-BarCode לפי הדרישות שלך ופרטים רלוונטיים הקשורים לפרמטרים ספציפיים מוסברים היטב בדף הפניות API. בעת יצירת BarCode, תוכל לציין כל אחד מהסוגים הבאים
- Codabar
- Code11
- Code39Standard
- Code39Extended
- Code93Standard
- 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
- Aztec
- Pdf417
- MacroPdf417
- AustraliaPost
- Postnet
- כוכב לכת
- 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 command
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>"
בקשת 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
המקטע קוד הבא יכול לשמש כדי ליצור דימוי ברקוד ולשמור אותו על אחסון בענן.
// בשביל דוגמאות שלמות וקבצי נתונים, אנא גשו ל- https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-java/
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);

תמונה 1:- תצוגה מקדימה של ברקוד שנוצר עם Java API
זהה ברקוד מתמונה רסטרית
ה- API גם מציע את היכולות לזהות ברקוד מקבצי תמונה רסטר. קובץ התמונה יכול להיות בפורמטים PNG, JPEG, BMP, GIF, TIFF או EXIF. השיטה GetBarcodeRecognize של ה- API מאפשרת לך להשיג דרישה זו. שדה השם הוא חובה ושדות אפשריים אחרים מספקים את היכולות לבצע פעולות זיהוי טובות יותר מכיוון שאתה יכול לציין את מידע סוג הברקוד, אימות סכום בדיקה, קידוד, הגדרה המאפשרת לקבוע את איכות ומהירות הזיהוי, ועוד הרבה יותר.
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>"
בקשת URL
https://api.aspose.cloud/v3.0/barcode/index.png/recognize?Type=all&ChecksumValidation=Off&DetectEncoding=false&Preset=HighQuality
קרא ברקוד מכתובת תמונה חיצונית
// לגבי דוגמאות מלאות וקבצי נתונים, אנא כנסו ל- 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();
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());
סיכום
במאמר הזה, דנו בצעדים ובפרטים הקשורים כיצד ליצור בר קוד בצורה תוכנתית באמצעות Java כמו גם כיצד לקרוא ולהכיר בר קוד קיים באמצעות קריאת קוד Java. ייתכן ששמתם לב שכל הפעולות הללו מתבצעות עם כמה שורות קוד פשוטות. אין צורך בהורדה או התקנה של תוכנה נוספת ופעולות אלה יכולות להתבצע עם פחות שורות קוד.
מאמרים קשורים
אנו ממליצים לך לבקר בלינקים הבאים כדי ללמוד עוד על