public static void Run() { // ExStart:1 // Instantiate Aspose BarCode Cloud API SDK BarcodeApi barcodeApi = new BarcodeApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH); // set input file name String name = "sample-barcode.jpeg"; //The barcode type. //If this parameter is empty, autodetection of all supported types is used. String type = ""; //Set mode for checksum validation during recognition String checksumValidation = ""; //Set if FNC symbol stripping should be performed bool stripFnc = false; //Set recognition of rotated barcode int rotationAngle = 0; //Set the image file url String url = null; byte[] file = System.IO.File.ReadAllBytes(Common.GetDataDir() + name); try { //invoke Aspose.BarCode Cloud SDK API to read barcode from local file BarcodeResponseList apiResponse = barcodeApi.PostBarcodeRecognizeFromUrlorContent(type, checksumValidation, stripFnc, rotationAngle, url, file); if (apiResponse != null) { foreach (Barcode barcode in apiResponse.Barcodes) { Console.WriteLine("Codetext: " + barcode.BarcodeValue + "\nType: " + barcode.BarcodeType); } Console.WriteLine("Read Barcode from Local File, Done!"); } } catch (Exception ex) { Console.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); } // ExEnd:1 }
public static void Run() { // ExStart:1 // Instantiate Aspose BarCode Cloud API SDK BarcodeApi barcodeApi = new BarcodeApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH); //The barcode type. //If this parameter is empty, autodetection of all supported types is used. String type = ""; //Set mode for checksum validation during recognition String checksumValidation = ""; //Set if FNC symbol stripping should be performed bool stripFnc = false; //Set recognition of rotated barcode int rotationAngle = 0; //Set the image file url String url = "http://www.barcoding.com/images/Barcodes/code93.gif"; byte[] file = null; try { //invoke Aspose.BarCode Cloud SDK API to read barcode from external image URL BarcodeResponseList apiResponse = barcodeApi.PostBarcodeRecognizeFromUrlorContent(type, checksumValidation, stripFnc, rotationAngle, url, file); if (apiResponse != null) { foreach (Barcode barcode in apiResponse.Barcodes) { Console.WriteLine("Codetext: " + barcode.BarcodeValue + "\nType: " + barcode.BarcodeType); } Console.WriteLine("Read Barcode from External Image URL, Done!"); } } catch (Exception ex) { Console.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); } // ExEnd:1 }
public void TestPostBarcodeRecognizeFromUrlorContent() { BarcodeApi target = new BarcodeApi(APIKEY, APPSID, BASEPATH); string type = "gif"; string checksumValidation = ""; bool? stripFnc = false; int? rotationAngle = null; string url = "http://www.barcoding.com/images/Barcodes/code93.gif"; byte[] file = null; BarcodeResponseList actual; actual = target.PostBarcodeRecognizeFromUrlorContent(type, checksumValidation, stripFnc, rotationAngle, url, file); Assert.AreEqual("200", actual.Code); Assert.IsInstanceOfType(new BarcodeResponseList(), actual.GetType()); }