public void TestGetBarcodeRecognize() { BarcodeApi target = new BarcodeApi(APIKEY, APPSID, BASEPATH); StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); string name = "barcodePng.png"; string type = ""; string checksumValidation = ""; bool? stripFnc = null; int? rotationAngle = null; int? barcodesCount = null; int? rectX = null; int? rectY = null; int? rectWidth = null; int? rectHeight = null; string storage = ""; string folder = ""; storageApi.PutCreate(name, null, null, System.IO.File.ReadAllBytes("\\temp\\barcode\\resources\\" + name)); BarcodeResponseList actual; actual = target.GetBarcodeRecognize(name, type, checksumValidation, stripFnc, rotationAngle, barcodesCount, rectX, rectY, rectWidth, rectHeight, storage, folder); Assert.AreEqual("200", actual.Code); Assert.IsInstanceOfType(new BarcodeResponseList(), actual.GetType()); }
public void TestPutGenerateMultiple() { BarcodeApi target = new BarcodeApi(APIKEY, APPSID, BASEPATH); string name = "barcodePng.png"; string format = ""; string folder = ""; BarcodeBuilders body = new BarcodeBuilders(); BarcodeBuilder barcodeBuilder1 = new BarcodeBuilder(); barcodeBuilder1.TypeOfBarcode = "qr"; barcodeBuilder1.Text = "The Latest barcode"; BarcodeBuilder barcodeBuilder2 = new BarcodeBuilder(); barcodeBuilder2.TypeOfBarcode = "qr"; barcodeBuilder2.Text = "The Latest barcode"; body.BarcodeBuilderList = new System.Collections.Generic.List <BarcodeBuilder> { barcodeBuilder1, barcodeBuilder2 }; SaaSposeResponse actual; actual = target.PutGenerateMultiple(name, format, folder, body); Assert.AreEqual("200", actual.Code); Assert.IsInstanceOfType(new SaaSposeResponse(), actual.GetType()); }
public void TestPostGenerateMultiple() { BarcodeApi target = new BarcodeApi(APIKEY, APPSID, BASEPATH); string format = "png"; BarcodeBuilders body = new BarcodeBuilders(); BarcodeBuilder barcodeBuilder1 = new BarcodeBuilder(); barcodeBuilder1.TypeOfBarcode = "qr"; barcodeBuilder1.Text = "The Latest barcode"; BarcodeBuilder barcodeBuilder2 = new BarcodeBuilder(); barcodeBuilder2.TypeOfBarcode = "qr"; barcodeBuilder2.Text = "The Latest barcode"; body.BarcodeBuilderList = new System.Collections.Generic.List <BarcodeBuilder> { barcodeBuilder1, barcodeBuilder2 }; ResponseMessage actual; actual = target.PostGenerateMultiple(format, body); Assert.AreEqual(200, actual.Code); Assert.IsInstanceOfType(new ResponseMessage(), actual.GetType()); }
public static string Run(string blobUrl, TraceWriter log) { // Instantiate Aspose BarCode Cloud API SDK BarcodeApi barcodeApi = new BarcodeApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH); String barcodeStr = "(n/a)"; // The barcode type. If this parameter is empty, autodetection of all supported types is used. String barcodetype = ""; //Code39Standard"; //leave empty in production. In Aspose evaluation version, only Code39 is possible. // Set mode for checksum validation during recognition String checksumValidation = "Default"; // 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 = blobUrl; //"http://www.barcoding.com/images/Barcodes/code93.gif"; //url = "https://www.nationwidebarcode.com/wp-content/uploads/2011/09/code39.jpg"; byte[] file = null; log.Info("Try barcode URL: " + url); log.Info("Parameters: barcodetype=" + barcodetype + " checksumValidation=" + checksumValidation + " stripFnc=" + stripFnc + " rotationAngle=" + rotationAngle + " url=" + url + " file=" + file); BarcodeResponseList apiResponse; try { // Invoke Aspose.BarCode Cloud SDK API to read barcode from external image URL //BarcodeResponseList apiResponse = barcodeApi.PostBarcodeRecognizeFromUrlorContent(barcodetype, checksumValidation, stripFnc, rotationAngle, url, file); apiResponse = barcodeApi.PostBarcodeRecognizeFromUrlorContent(barcodetype, checksumValidation, stripFnc, rotationAngle, url, file); if (apiResponse != null) { foreach (Barcode barcode in apiResponse.Barcodes) { log.Info("Barcode text: " + barcode.BarcodeValue + "\nType: " + barcode.BarcodeType); barcodeStr = barcode.BarcodeValue; } log.Info("Read Barcode from External Image URL, Done!"); } } catch (Exception ex) { log.Info("error from barcode service:" + ex.Message + "\n" + ex.StackTrace); barcodeStr = "Can't read barcode: " + ex.Message; } return(barcodeStr); // ExEnd:1 }
public string Extract_Text() { var barcodeApi = new BarcodeApi(_apiKey, _appSid, "http://api.aspose.cloud/v1.1"); var apiResponse = barcodeApi.PostBarcodeRecognizeFromUrlorContent(_type, _enableChecksum, false, 0, null, _imageBytes); if (apiResponse.Status == "OK") { var code = apiResponse.Barcodes.First(); return(code.BarcodeValue); } return(string.Empty); }
static void Main(string[] args) { string fileName = Path.GetFullPath(Path.Join( Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "..", "..", "..", "..", "qr.png" )); var api = new BarcodeApi(MakeConfiguration()); GenerateQR(api, fileName); Console.WriteLine($"File '{fileName}' generated."); }
static void Main(string[] args) { string fileName = Path.GetFullPath(Path.Join( Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "..", "..", "..", "..", "qr.png" )); var api = new BarcodeApi(MakeConfiguration()); string result = ReadQR(api, fileName); Console.WriteLine($"File '{fileName}' recognized, result: '{result}'"); }
public void GetBarcodeGenerateTestThrows() { // Arrange var api = new BarcodeApi(clientId: "client id", clientSecret: "client secret"); var request = new GetBarcodeGenerateRequest( text: "Very sample text", type: EncodeBarcodeType.Code128.ToString(), format: "png" ); // Act var ex = Assert.Throws <ApiException>( () => { api.GetBarcodeGenerate(request); }); Assert.AreEqual(400, ex.ErrorCode); Assert.AreEqual("Bad Request", ex.Message); }
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()); }
public byte[] Create() { if (string.IsNullOrWhiteSpace(_text)) { return(new byte[0]); } var barcodeApi = new BarcodeApi(_apiKey, _appSid, "http://api.aspose.cloud/v1.1"); var apiResponse = barcodeApi.GetBarcodeGenerate(_text, _type, _format, _resolutionX, _resolutionY, _dimensionX, _dimensionY, _enableChecksum); if (apiResponse == null) { return(new byte[0]); } return(apiResponse.ResponseStream); }
public void TestGetBarcodeGenerate() { BarcodeApi target = new BarcodeApi(APIKEY, APPSID, BASEPATH); string text = "TestGetBarcodeGenerate"; string type = "1"; string format = "jpeg"; float? resolutionX = null; float? resolutionY = null; float? dimensionX = null; float? dimensionY = null; string enableChecksum = ""; ResponseMessage actual; actual = target.GetBarcodeGenerate(text, type, format, resolutionX, resolutionY, dimensionX, dimensionY, enableChecksum); Assert.AreEqual(200, actual.Code); Assert.IsInstanceOfType(new ResponseMessage(), actual.GetType()); }
public void TestPutBarcodeRecognizeFromBody() { BarcodeApi target = new BarcodeApi(APIKEY, APPSID, BASEPATH); StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); string name = "barcodePng.png"; string type = ""; string folder = ""; BarcodeReader body = new BarcodeReader(); body.StripFNC = true; body.ChecksumValidation = "OFF"; storageApi.PutCreate(name, null, null, System.IO.File.ReadAllBytes("\\temp\\barcode\\resources\\" + name)); BarcodeResponseList actual; actual = target.PutBarcodeRecognizeFromBody(name, type, folder, body); Assert.AreEqual("200", actual.Code); Assert.IsInstanceOfType(new BarcodeResponseList(), actual.GetType()); }
public async Task CanUseExternalToken() { if (TestConfiguration.AuthType != AuthType.JWT) { Assert.Ignore($"Unsupported TestConfiguration.AuthType={TestConfiguration.AuthType}"); } var configWithToken = new Configuration { ApiBaseUrl = TestConfiguration.ApiBaseUrl, TokenUrl = TestConfiguration.TokenUrl, JwtToken = await FetchToken() }; var api = new BarcodeApi(configWithToken); using Stream generated = api.GetBarcodeGenerate( new GetBarcodeGenerateRequest( EncodeBarcodeType.QR.ToString(), "Test") ); Assert.Greater(generated.Length, 0); }
public void TestPutBarcodeGenerateFile() { BarcodeApi target = new BarcodeApi(APIKEY, APPSID, BASEPATH); string name = "testbar.png"; string text = "Aspose.Barcode for Cloud"; string type = "qr"; string format = ""; float? resolutionX = null; float? resolutionY = null; float? dimensionX = null; float? dimensionY = null; string codeLocation = ""; string grUnit = ""; string autoSize = ""; float? barHeight = null; float? imageHeight = null; float? imageWidth = null; string imageQuality = ""; float? rotAngle = null; float? topMargin = null; float? bottomMargin = null; float? leftMargin = null; float? rightMargin = null; string enableChecksum = ""; string storage = ""; string folder = ""; byte[] file = null; SaaSposeResponse actual; actual = target.PutBarcodeGenerateFile(name, text, type, format, resolutionX, resolutionY, dimensionX, dimensionY, codeLocation, grUnit, autoSize, barHeight, imageHeight, imageWidth, imageQuality, rotAngle, topMargin, bottomMargin, leftMargin, rightMargin, enableChecksum, storage, folder, file); Assert.AreEqual("200", actual.Code); Assert.IsInstanceOfType(new SaaSposeResponse(), actual.GetType()); }
public void Init() { _api = new BarcodeApi(TestConfiguration); }
public static void Main(String[] args) { string APIKEY = "xxxxxx"; string APPSID = "xxxxxx"; string BASEPATH = "http://api.aspose.com/v1.1"; ///* //* Working with Barcode Generation //* Create Barcode and Get Image as Stream //*/ //BarcodeApi barcodeApi = new BarcodeApi(APIKEY, APPSID, BASEPATH); //String name = "sample-barcode"; //String text = "Aspose.BarCode"; //String type = "datamatrix"; //String format = "PNG"; //float? resolutionX = null; //float? resolutionY = null; //float? dimensionX = null; //float? dimensionY = null; //String enableChecksum = null; //try //{ // //invoke Aspose.PDF Cloud SDK API to append word document // ResponseMessage apiResponse = barcodeApi.GetBarcodeGenerate(text, type, format, resolutionX, resolutionY, dimensionX, dimensionY, enableChecksum); // if (apiResponse != null) // { // //download appended document from storage server // System.IO.File.WriteAllBytes("\\temp\\new_" + name + "." + format, apiResponse.ResponseStream); // Console.WriteLine("Create Barcode and Get Image as Stream, Done!"); // Console.ReadKey(); // } //} //catch (Exception ex) //{ // System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); //} ///* //* Working with Barcode Generation //* Create Barcode on Aspose Cloud Storage //*/ //BarcodeApi barcodeApi = new BarcodeApi(APIKEY, APPSID, BASEPATH); //StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); //String name = "sample-barcode"; //String text = "AsposeBarCode"; //String type = "Code128"; //String format = "jpeg"; //float? resolutionX = null; //float? resolutionY = null; //float? dimensionX = null; //float? dimensionY = null; //String codeLocation = "Below"; //String grUnit = "mm"; //String autoSize = "true"; //float? barHeight = null; //float? imageHeight = null; //float? imageWidth = null; //String imageQuality = "default"; //float? rotAngle = null; //float? topMargin = null; //float? bottomMargin = null; //float? leftMargin = null; //float? rightMargin = null; //String enableChecksum = ""; //String storage = ""; //String folder = ""; //byte[] file = null; //try //{ // //invoke Aspose.PDF Cloud SDK API to append word document // SaaSposeResponse apiResponse = barcodeApi.PutBarcodeGenerateFile(name, text, type, format, resolutionX, resolutionY, dimensionX, dimensionY, codeLocation, grUnit, autoSize, barHeight, imageHeight, imageWidth, imageQuality, rotAngle, topMargin, bottomMargin, leftMargin, rightMargin, enableChecksum, storage, folder, file); // if (apiResponse != null) // { // //download appended document from storage server // Com.Aspose.Storage.Model.ResponseMessage storageRes = storageApi.GetDownload(name + "." + format, null, null); // System.IO.File.WriteAllBytes("\\temp\\new_" + name + "." + format, storageRes.ResponseStream); // Console.WriteLine("Create Barcode on Aspose Cloud Storage, Done!"); // Console.ReadKey(); // } //} //catch (Exception ex) //{ // System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); //} ///* //* Working with Barcode Generation //* Create Barcode and Save Image to Local Disk //*/ //BarcodeApi barcodeApi = new BarcodeApi(APIKEY, APPSID, BASEPATH); //StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); //String name = "sample-barcode"; //String text = "Aspose.BarCode"; //String type = "QR"; //String format = "PNG"; //float? resolutionX = 96.0f; //float? resolutionY = 96.0f; //float? dimensionX = 0.7f; //float? dimensionY = 2.0f; //String enableChecksum = null; //try //{ // //invoke Aspose.PDF Cloud SDK API to append word document // ResponseMessage apiResponse = barcodeApi.GetBarcodeGenerate(text, type, format, resolutionX, resolutionY, dimensionX, dimensionY, enableChecksum); // if (apiResponse != null) // { // //download appended document from storage server // System.IO.File.WriteAllBytes("\\temp\\new_" + name + "." + format, apiResponse.ResponseStream); // Console.WriteLine("Create Barcode and Save Image to Local Disk, Done!"); // Console.ReadKey(); // } //} //catch (Exception ex) //{ // System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); //} ///* //* Working with Barcode Generation //* Set Barcode Image Resolution //*/ //BarcodeApi barcodeApi = new BarcodeApi(APIKEY, APPSID, BASEPATH); //StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); //String name = "sample-barcode"; //String text = "AsposeBarCode"; //String type = "Code128"; //String format = "jpeg"; //float? resolutionX = 200.0f; //float? resolutionY = 200.0f; //float? dimensionX = 0.0f; //float? dimensionY = 0.0f; //String codeLocation = "Above"; //String grUnit = "mm"; //String autoSize = "true"; //float? barHeight = 0.0f; //float? imageHeight = 0.0f; //float? imageWidth = 0.0f; //String imageQuality = "default"; //float? rotAngle = 0.0f; //float? topMargin = 0.0f; //float? bottomMargin = 0.0f; //float? leftMargin = 0.0f; //float? rightMargin = 0.0f; //String enableChecksum = "Yes"; //String storage = ""; //String folder = ""; //byte[] file = null; //try //{ // //invoke Aspose.PDF Cloud SDK API to append word document // SaaSposeResponse apiResponse = barcodeApi.PutBarcodeGenerateFile(name, text, type, format, resolutionX, resolutionY, dimensionX, dimensionY, codeLocation, grUnit, autoSize, barHeight, imageHeight, imageWidth, imageQuality, rotAngle, topMargin, bottomMargin, leftMargin, rightMargin, enableChecksum, storage, folder, file); // if (apiResponse != null) // { // //download appended document from storage server // Com.Aspose.Storage.Model.ResponseMessage storageRes = storageApi.GetDownload(name + "." + format, null, null); // System.IO.File.WriteAllBytes("\\temp\\new_" + name + "." + format, storageRes.ResponseStream); // Console.WriteLine("Set Barcode Image Resolution, Done!"); // Console.ReadKey(); // } //} //catch (Exception ex) //{ // System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); //} ///* //* Working with Barcode Generation //* Set X and Y Dimensions of a Barcode //*/ //BarcodeApi barcodeApi = new BarcodeApi(APIKEY, APPSID, BASEPATH); //StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); //String name = "sample-barcode"; //String text = "AsposeBarCode"; //String type = "Code128"; //String format = "jpeg"; //float? resolutionX = 1.0f; //float? resolutionY = 0.0f; //float? dimensionX = 1.0f; //float? dimensionY = 0.5f; //String codeLocation = "Above"; //String grUnit = "mm"; //String autoSize = "true"; //float? barHeight = 0.0f; //float? imageHeight = 0.0f; //float? imageWidth = 0.0f; //String imageQuality = "default"; //float? rotAngle = 0.0f; //float? topMargin = 0.0f; //float? bottomMargin = 0.0f; //float? leftMargin = 0.0f; //float? rightMargin = 0.0f; //String enableChecksum = "Yes"; //String storage = ""; //String folder = ""; //byte[] file = null; //try //{ // //invoke Aspose.PDF Cloud SDK API to append word document // SaaSposeResponse apiResponse = barcodeApi.PutBarcodeGenerateFile(name, text, type, format, resolutionX, resolutionY, dimensionX, dimensionY, codeLocation, grUnit, autoSize, barHeight, imageHeight, imageWidth, imageQuality, rotAngle, topMargin, bottomMargin, leftMargin, rightMargin, enableChecksum, storage, folder, file); // if (apiResponse != null) // { // //download appended document from storage server // Com.Aspose.Storage.Model.ResponseMessage storageRes = storageApi.GetDownload(name + "." + format, null, null); // System.IO.File.WriteAllBytes("\\temp\\new_" + name + "." + format, storageRes.ResponseStream); // Console.WriteLine("Set X and Y Dimensions of a Barcode, Done!"); // Console.ReadKey(); // } //} //catch (Exception ex) //{ // System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); //} ///* //* Working with Barcode Generation //* Specify Barcode Image Save Format //*/ //BarcodeApi barcodeApi = new BarcodeApi(APIKEY, APPSID, BASEPATH); //StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); //String name = "sample-barcode"; //String text = "AsposeBarCode"; //String type = "Code128"; //String format = "jpeg"; //float? resolutionX = 1.0f; //float? resolutionY = 0.0f; //float? dimensionX = 1.0f; //float? dimensionY = 0.5f; //String codeLocation = "Above"; //String grUnit = "mm"; //String autoSize = "true"; //float? barHeight = 0.0f; //float? imageHeight = 0.0f; //float? imageWidth = 0.0f; //String imageQuality = "default"; //float? rotAngle = 0.0f; //float? topMargin = 0.0f; //float? bottomMargin = 0.0f; //float? leftMargin = 0.0f; //float? rightMargin = 0.0f; //String enableChecksum = "Yes"; //String storage = ""; //String folder = ""; //byte[] file = null; //try //{ // //invoke Aspose.PDF Cloud SDK API to append word document // SaaSposeResponse apiResponse = barcodeApi.PutBarcodeGenerateFile(name, text, type, format, resolutionX, resolutionY, dimensionX, dimensionY, codeLocation, grUnit, autoSize, barHeight, imageHeight, imageWidth, imageQuality, rotAngle, topMargin, bottomMargin, leftMargin, rightMargin, enableChecksum, storage, folder, file); // if (apiResponse != null) // { // //download appended document from storage server // Com.Aspose.Storage.Model.ResponseMessage storageRes = storageApi.GetDownload(name + "." + format, null, null); // System.IO.File.WriteAllBytes("\\temp\\new_" + name + "." + format, storageRes.ResponseStream); // Console.WriteLine("Specify Barcode Image Save Format, Done!"); // Console.ReadKey(); // } //} //catch (Exception ex) //{ // System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); //} ///* //* Working with Barcode Generation //* Generate Barcode with Appropriate Code Text Location //*/ //BarcodeApi barcodeApi = new BarcodeApi(APIKEY, APPSID, BASEPATH); //StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); //String name = "sample-barcode"; //String text = "AsposeBarCode"; //String type = "Code128"; //String format = "jpeg"; //float? resolutionX = 0.0f; //float? resolutionY = 0.0f; //float? dimensionX = 0.0f; //float? dimensionY = 0.0f; //String codeLocation = "Above"; //String grUnit = "mm"; //String autoSize = "true"; //float? barHeight = 0.0f; //float? imageHeight = 0.0f; //float? imageWidth = 0.0f; //String imageQuality = "default"; //float? rotAngle = 0.0f; //float? topMargin = 0.0f; //float? bottomMargin = 0.0f; //float? leftMargin = 0.0f; //float? rightMargin = 0.0f; //String enableChecksum = "Yes"; //String storage = ""; //String folder = ""; //byte[] file = null; //try //{ // //invoke Aspose.PDF Cloud SDK API to append word document // SaaSposeResponse apiResponse = barcodeApi.PutBarcodeGenerateFile(name, text, type, format, resolutionX, resolutionY, dimensionX, dimensionY, codeLocation, grUnit, autoSize, barHeight, imageHeight, imageWidth, imageQuality, rotAngle, topMargin, bottomMargin, leftMargin, rightMargin, enableChecksum, storage, folder, file); // if (apiResponse != null) // { // //download appended document from storage server // Com.Aspose.Storage.Model.ResponseMessage storageRes = storageApi.GetDownload(name + "." + format, null, null); // System.IO.File.WriteAllBytes("\\temp\\new_" + name + "." + format, storageRes.ResponseStream); // Console.WriteLine("Generate Barcode with Appropriate Code Text Location, Done!"); // Console.ReadKey(); // } //} //catch (Exception ex) //{ // System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); //} ///* //* Working with Barcode Generation //* Generate Barcode with Checksum Option //*/ //BarcodeApi barcodeApi = new BarcodeApi(APIKEY, APPSID, BASEPATH); //StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); //String name = "sample-barcode"; //String text = "AsposeBarCode"; //String type = "Code128"; //String format = "jpeg"; //float? resolutionX = 0.0f; //float? resolutionY = 0.0f; //float? dimensionX = 0.0f; //float? dimensionY = 0.0f; //String codeLocation = "Above"; //String grUnit = "mm"; //String autoSize = "true"; //float? barHeight = 0.0f; //float? imageHeight = 0.0f; //float? imageWidth = 0.0f; //String imageQuality = "default"; //float? rotAngle = 0.0f; //float? topMargin = 0.0f; //float? bottomMargin = 0.0f; //float? leftMargin = 0.0f; //float? rightMargin = 0.0f; //String enableChecksum = "Yes"; //String storage = ""; //String folder = ""; //byte[] file = null; //try //{ // //invoke Aspose.PDF Cloud SDK API to append word document // SaaSposeResponse apiResponse = barcodeApi.PutBarcodeGenerateFile(name, text, type, format, resolutionX, resolutionY, dimensionX, dimensionY, codeLocation, grUnit, autoSize, barHeight, imageHeight, imageWidth, imageQuality, rotAngle, topMargin, bottomMargin, leftMargin, rightMargin, enableChecksum, storage, folder, file); // if (apiResponse != null) // { // //download appended document from storage server // Com.Aspose.Storage.Model.ResponseMessage storageRes = storageApi.GetDownload(name + "." + format, null, null); // System.IO.File.WriteAllBytes("\\temp\\new_" + name + "." + format, storageRes.ResponseStream); // Console.WriteLine("Generate Barcode with Checksum Option, Done!"); // Console.ReadKey(); // } //} //catch (Exception ex) //{ // System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); //} ///* //* Working with Barcode Generation //* Rotate Barcode Image with Suitable Angle //*/ //BarcodeApi barcodeApi = new BarcodeApi(APIKEY, APPSID, BASEPATH); //StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); //String name = "sample-barcode"; //String text = "AsposeBarCode"; //String type = "Code128"; //String format = "jpeg"; //float? resolutionX = 0.0f; //float? resolutionY = 0.0f; //float? dimensionX = 0.0f; //float? dimensionY = 0.0f; //String codeLocation = "Above"; //String grUnit = "mm"; //String autoSize = "true"; //float? barHeight = 0.0f; //float? imageHeight = 0.0f; //float? imageWidth = 0.0f; //String imageQuality = "default"; //float? rotAngle = 90.0f; //float? topMargin = 0.0f; //float? bottomMargin = 0.0f; //float? leftMargin = 0.0f; //float? rightMargin = 0.0f; //String enableChecksum = "Yes"; //String storage = ""; //String folder = ""; //byte[] file = null; //try //{ // //invoke Aspose.PDF Cloud SDK API to append word document // SaaSposeResponse apiResponse = barcodeApi.PutBarcodeGenerateFile(name, text, type, format, resolutionX, resolutionY, dimensionX, dimensionY, codeLocation, grUnit, autoSize, barHeight, imageHeight, imageWidth, imageQuality, rotAngle, topMargin, bottomMargin, leftMargin, rightMargin, enableChecksum, storage, folder, file); // if (apiResponse != null) // { // //download appended document from storage server // Com.Aspose.Storage.Model.ResponseMessage storageRes = storageApi.GetDownload(name + "." + format, null, null); // System.IO.File.WriteAllBytes("\\temp\\new_" + name + "." + format, storageRes.ResponseStream); // Console.WriteLine("Rotate Barcode Image with Suitable Angle, Done!"); // Console.ReadKey(); // } //} //catch (Exception ex) //{ // System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); //} ///* //* Working with Barcode Generation //* Set Barcode Image Height, Width and Quality along with Auto Size Option //*/ //BarcodeApi barcodeApi = new BarcodeApi(APIKEY, APPSID, BASEPATH); //StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); //String name = "sample-barcode"; //String text = "AsposeBarCode"; //String type = "Code128"; //String format = "jpeg"; //float? resolutionX = 0.0f; //float? resolutionY = 0.0f; //float? dimensionX = 0.0f; //float? dimensionY = 0.0f; //String codeLocation = "Above"; //String grUnit = "mm"; //String autoSize = "true"; //float? barHeight = 0.0f; //float? imageHeight = 0.0f; //float? imageWidth = 0.0f; //String imageQuality = "default"; //float? rotAngle = 90.0f; //float? topMargin = 0.0f; //float? bottomMargin = 0.0f; //float? leftMargin = 0.0f; //float? rightMargin = 0.0f; //String enableChecksum = "Yes"; //String storage = ""; //String folder = ""; //byte[] file = null; //try //{ // //invoke Aspose.PDF Cloud SDK API to append word document // SaaSposeResponse apiResponse = barcodeApi.PutBarcodeGenerateFile(name, text, type, format, resolutionX, resolutionY, dimensionX, dimensionY, codeLocation, grUnit, autoSize, barHeight, imageHeight, imageWidth, imageQuality, rotAngle, topMargin, bottomMargin, leftMargin, rightMargin, enableChecksum, storage, folder, file); // if (apiResponse != null) // { // //download appended document from storage server // Com.Aspose.Storage.Model.ResponseMessage storageRes = storageApi.GetDownload(name + "." + format, null, null); // System.IO.File.WriteAllBytes("\\temp\\new_" + name + "." + format, storageRes.ResponseStream); // Console.WriteLine("Set Barcode Image Height, Width and Quality along with Auto Size Option, Done!"); // Console.ReadKey(); // } //} //catch (Exception ex) //{ // System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); //} ///* //* Working with Barcode Generation //* Set Height of the Bars in the Barcode Image //*/ //BarcodeApi barcodeApi = new BarcodeApi(APIKEY, APPSID, BASEPATH); //StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); //String name = "sample-barcode"; //String text = "AsposeBarCode"; //String type = "Code128"; //String format = "jpeg"; //float? resolutionX = 0.0f; //float? resolutionY = 0.0f; //float? dimensionX = 0.0f; //float? dimensionY = 0.0f; //String codeLocation = "Above"; //String grUnit = "mm"; //String autoSize = "true"; //float? barHeight = 50.0f; //float? imageHeight = 0.0f; //float? imageWidth = 0.0f; //String imageQuality = "default"; //float? rotAngle = 90.0f; //float? topMargin = 0.0f; //float? bottomMargin = 0.0f; //float? leftMargin = 0.0f; //float? rightMargin = 0.0f; //String enableChecksum = "Yes"; //String storage = ""; //String folder = ""; //byte[] file = null; //try //{ // //invoke Aspose.PDF Cloud SDK API to append word document // SaaSposeResponse apiResponse = barcodeApi.PutBarcodeGenerateFile(name, text, type, format, resolutionX, resolutionY, dimensionX, dimensionY, codeLocation, grUnit, autoSize, barHeight, imageHeight, imageWidth, imageQuality, rotAngle, topMargin, bottomMargin, leftMargin, rightMargin, enableChecksum, storage, folder, file); // if (apiResponse != null) // { // //download appended document from storage server // Com.Aspose.Storage.Model.ResponseMessage storageRes = storageApi.GetDownload(name + "." + format, null, null); // System.IO.File.WriteAllBytes("\\temp\\new_" + name + "." + format, storageRes.ResponseStream); // Console.WriteLine("Set Height of the Bars in the Barcode Image, Done!"); // Console.ReadKey(); // } //} //catch (Exception ex) //{ // System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); //} ///* //* Working with Barcode Generation //* Set Barcode Image Margin //*/ //BarcodeApi barcodeApi = new BarcodeApi(APIKEY, APPSID, BASEPATH); //StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); //String name = "sample-barcode"; //String text = "AsposeBarCode"; //String type = "Code128"; //String format = "jpeg"; //float? resolutionX = 0.0f; //float? resolutionY = 0.0f; //float? dimensionX = 0.0f; //float? dimensionY = 0.0f; //String codeLocation = "Above"; //String grUnit = "mm"; //String autoSize = "true"; //float? barHeight = 50.0f; //float? imageHeight = 0.0f; //float? imageWidth = 0.0f; //String imageQuality = "default"; //float? rotAngle = 90.0f; //float? topMargin = 2.0f; //float? bottomMargin = 2.0f; //float? leftMargin = 2.0f; //float? rightMargin = 2.0f; //String enableChecksum = "Yes"; //String storage = ""; //String folder = ""; //byte[] file = null; //try //{ // //invoke Aspose.PDF Cloud SDK API to append word document // SaaSposeResponse apiResponse = barcodeApi.PutBarcodeGenerateFile(name, text, type, format, resolutionX, resolutionY, dimensionX, dimensionY, codeLocation, grUnit, autoSize, barHeight, imageHeight, imageWidth, imageQuality, rotAngle, topMargin, bottomMargin, leftMargin, rightMargin, enableChecksum, storage, folder, file); // if (apiResponse != null) // { // //download appended document from storage server // Com.Aspose.Storage.Model.ResponseMessage storageRes = storageApi.GetDownload(name + "." + format, null, null); // System.IO.File.WriteAllBytes("\\temp\\new_" + name + "." + format, storageRes.ResponseStream); // Console.WriteLine("Set Barcode Image Margin, Done!"); // Console.ReadKey(); // } //} //catch (Exception ex) //{ // System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); //} ///* //* Working with Barcode Generation //* Specify Codetext and Symbology for barcode //*/ //BarcodeApi barcodeApi = new BarcodeApi(APIKEY, APPSID, BASEPATH); //StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); //String name = "sample-barcode"; //String text = "AsposeBarCode"; //CodeText //String type = "Code128"; //symbology //String format = "jpeg"; //float? resolutionX = 0.0f; //float? resolutionY = 0.0f; //float? dimensionX = 0.0f; //float? dimensionY = 0.0f; //String codeLocation = "Above"; //String grUnit = "mm"; //String autoSize = "true"; //float? barHeight = 50.0f; //float? imageHeight = 0.0f; //float? imageWidth = 0.0f; //String imageQuality = "default"; //float? rotAngle = 90.0f; //float? topMargin = 2.0f; //float? bottomMargin = 2.0f; //float? leftMargin = 2.0f; //float? rightMargin = 2.0f; //String enableChecksum = "Yes"; //String storage = ""; //String folder = ""; //byte[] file = null; //try //{ // //invoke Aspose.PDF Cloud SDK API to append word document // SaaSposeResponse apiResponse = barcodeApi.PutBarcodeGenerateFile(name, text, type, format, resolutionX, resolutionY, dimensionX, dimensionY, codeLocation, grUnit, autoSize, barHeight, imageHeight, imageWidth, imageQuality, rotAngle, topMargin, bottomMargin, leftMargin, rightMargin, enableChecksum, storage, folder, file); // if (apiResponse != null) // { // //download appended document from storage server // Com.Aspose.Storage.Model.ResponseMessage storageRes = storageApi.GetDownload(name + "." + format, null, null); // System.IO.File.WriteAllBytes("\\temp\\new_" + name + "." + format, storageRes.ResponseStream); // Console.WriteLine("Specify Codetext and Symbology for barcode, Done!"); // Console.ReadKey(); // } //} //catch (Exception ex) //{ // System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); //} ///* //* Working with Barcode Recognition //* Read Barcode from External Image URL //*/ //BarcodeApi barcodeApi = new BarcodeApi(APIKEY, APPSID, BASEPATH); //String type = ""; //String checksumValidation = ""; //bool stripFnc = false; //int rotationAngle = 0; //String url = "http://www.barcoding.com/images/Barcodes/code93.gif"; //byte[] file = null; //try //{ // //invoke Aspose.PDF Cloud SDK API to append word document // 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("Create Barcode and Get Image as Stream, Done!"); // Console.ReadKey(); // } //} //catch (Exception ex) //{ // System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); //} ///* //* Working with Barcode Recognition //* Read Barcode from Local Image //*/ //BarcodeApi barcodeApi = new BarcodeApi(APIKEY, APPSID, BASEPATH); //StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); //String name = "sample-barcode.jpeg"; //String type = ""; //String folder = ""; //BarcodeReader body = new BarcodeReader(); //body.StripFNC = true; //body.ChecksumValidation = "OFF"; //try //{ // //invoke Aspose.PDF Cloud SDK API to append word document // BarcodeResponseList apiResponse = barcodeApi.PutBarcodeRecognizeFromBody(name, type, folder, body); // if (apiResponse != null) // { // foreach (Barcode barcode in apiResponse.Barcodes) // { // Console.WriteLine("Codetext: " + barcode.BarcodeValue + "\nType: " + barcode.BarcodeType); // } // Console.WriteLine("Read Barcode from Local Image, Done!"); // Console.ReadKey(); // } //} //catch (Exception ex) //{ // System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); //} ///* //* Working with Barcode Recognition //* Read Barcode from Aspose Cloud Storage //*/ //BarcodeApi barcodeApi = new BarcodeApi(APIKEY, APPSID, BASEPATH); //StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); //String name = "barcodePng.png"; //String type = ""; //String checksumValidation = ""; //bool stripFnc = true; //int? rotationAngle = null; //int? barcodesCount = null; //int? rectX = null; //int? rectY = null; //int? rectWidth = null; //int? rectHeight = null; //String storage = ""; //String folder = ""; //try //{ // //upload source file to aspose cloud storage // storageApi.PutCreate(name, "", "", System.IO.File.ReadAllBytes("\\temp\\barcode\\resources\\" + name)); // //invoke Aspose.PDF Cloud SDK API to append word document // BarcodeResponseList apiResponse = barcodeApi.GetBarcodeRecognize(name, type, checksumValidation, stripFnc, rotationAngle, barcodesCount, rectX, rectY, rectWidth, rectHeight, storage, folder); // if (apiResponse != null) // { // foreach (Barcode barcode in apiResponse.Barcodes) // { // Console.WriteLine("Codetext: " + barcode.BarcodeValue + "\nType: " + barcode.BarcodeType); // } // Console.WriteLine("Read Barcode from Aspose Cloud Storage, Done!"); // Console.ReadKey(); // } //} //catch (Exception ex) //{ // System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); //} ///* //* Working with Barcode Recognition //* Read Barcode from Specific Region of Image //*/ //BarcodeApi barcodeApi = new BarcodeApi(APIKEY, APPSID, BASEPATH); //StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); //String name = "barcodePng.png"; //String type = ""; //String checksumValidation = ""; //bool stripFnc = true; //int? rotationAngle = null; //int? barcodesCount = null; //int? rectX = 10; //int? rectY = 10; //int? rectWidth = 200; //int? rectHeight = 200; //String storage = ""; //String folder = ""; //try //{ // //upload source file to aspose cloud storage // storageApi.PutCreate(name, "", "", System.IO.File.ReadAllBytes("\\temp\\barcode\\resources\\" + name)); // //invoke Aspose.PDF Cloud SDK API to append word document // BarcodeResponseList apiResponse = barcodeApi.GetBarcodeRecognize(name, type, checksumValidation, stripFnc, rotationAngle, barcodesCount, rectX, rectY, rectWidth, rectHeight, storage, folder); // if (apiResponse != null) // { // foreach (Barcode barcode in apiResponse.Barcodes) // { // Console.WriteLine("Codetext: " + barcode.BarcodeValue + "\nType: " + barcode.BarcodeType); // } // Console.WriteLine("Read Barcode from Specific Region of Image, Done!"); // Console.ReadKey(); // } //} //catch (Exception ex) //{ // System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); //} ///* //* Working with Barcode Recognition //* Recognize Barcode with Checksum Option from Storage //*/ //BarcodeApi barcodeApi = new BarcodeApi(APIKEY, APPSID, BASEPATH); //StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); //String name = "sample-barcode.jpeg"; //String type = ""; //String folder = ""; //BarcodeReader body = new BarcodeReader(); //body.StripFNC = true; //body.ChecksumValidation = "ON"; //body.BinarizationHints = BinarizationHints.ComplexBackground; //try //{ // //invoke Aspose.PDF Cloud SDK API to append word document // BarcodeResponseList apiResponse = barcodeApi.PutBarcodeRecognizeFromBody(name, type, folder, body); // if (apiResponse != null) // { // foreach (Barcode barcode in apiResponse.Barcodes) // { // Console.WriteLine("Codetext: " + barcode.BarcodeValue + "\nType: " + barcode.BarcodeType); // } // Console.WriteLine("Recognize Barcode with Checksum Option from Storage, Done!"); // Console.ReadKey(); // } //} //catch (Exception ex) //{ // System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); //} ///* //* Working with Barcode Recognition //* Recognize Specified count of Barcodes //*/ //BarcodeApi barcodeApi = new BarcodeApi(APIKEY, APPSID, BASEPATH); //StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); //String name = "sample-barcode.jpeg"; //String type = ""; //String checksumValidation = "ON"; //bool stripFnc = true; //int? rotationAngle = null; //int? barcodesCount = null; //int? rectX = null; //int? rectY = null; //int? rectWidth = null; //int? rectHeight = null; //String storage = ""; //String folder = ""; //try //{ // //upload source file to aspose cloud storage // storageApi.PutCreate(name, "", "", System.IO.File.ReadAllBytes("\\temp\\barcode\\resources\\" + name)); // //invoke Aspose.PDF Cloud SDK API to append word document // BarcodeResponseList apiResponse = barcodeApi.GetBarcodeRecognize(name, type, checksumValidation, stripFnc, rotationAngle, barcodesCount, rectX, rectY, rectWidth, rectHeight, storage, folder); // if (apiResponse != null) // { // foreach (Barcode barcode in apiResponse.Barcodes) // { // Console.WriteLine("Codetext: " + barcode.BarcodeValue + "\nType: " + barcode.BarcodeType); // } // Console.WriteLine("Read Barcode from Aspose Cloud Storage, Done!"); // Console.ReadKey(); // } //} //catch (Exception ex) //{ // System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); //} ///* //* Working with Barcode Recognition //* Recognize Specified count of Barcodes //*/ //BarcodeApi barcodeApi = new BarcodeApi(APIKEY, APPSID, BASEPATH); //StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); //String name = "sample-barcode.jpeg"; //String type = ""; //String checksumValidation = "ON"; //bool stripFnc = true; //int? rotationAngle = null; //int? barcodesCount = null; //int? rectX = null; //int? rectY = null; //int? rectWidth = null; //int? rectHeight = null; //String storage = ""; //String folder = ""; //try //{ // //upload source file to aspose cloud storage // storageApi.PutCreate(name, "", "", System.IO.File.ReadAllBytes("\\temp\\barcode\\resources\\" + name)); // //invoke Aspose.PDF Cloud SDK API to append word document // BarcodeResponseList apiResponse = barcodeApi.GetBarcodeRecognize(name, type, checksumValidation, stripFnc, rotationAngle, barcodesCount, rectX, rectY, rectWidth, rectHeight, storage, folder); // if (apiResponse != null) // { // foreach (Barcode barcode in apiResponse.Barcodes) // { // Console.WriteLine("Codetext: " + barcode.BarcodeValue + "\nType: " + barcode.BarcodeType); // } // Console.WriteLine("Recognize Specified count of Barcodes, Done!"); // Console.ReadKey(); // } //} //catch (Exception ex) //{ // System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); //} /* * Working with Barcode Recognition * Read Barcodes by Applying Image Processing Algorithm */ BarcodeApi barcodeApi = new BarcodeApi(APIKEY, APPSID, BASEPATH); StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); String name = "sample-barcode.jpeg"; String type = ""; String folder = ""; BarcodeReader body = new BarcodeReader(); body.StripFNC = true; body.ChecksumValidation = "OFF"; body.BinarizationHints = BinarizationHints.ComplexBackground; try { //upload source file to aspose cloud storage storageApi.PutCreate(name, "", "", System.IO.File.ReadAllBytes("\\temp\\barcode\\resources\\" + name)); //invoke Aspose.PDF Cloud SDK API to append word document BarcodeResponseList apiResponse = barcodeApi.PutBarcodeRecognizeFromBody(name, type, folder, body); if (apiResponse != null) { foreach (Barcode barcode in apiResponse.Barcodes) { Console.WriteLine("Codetext: " + barcode.BarcodeValue + "\nType: " + barcode.BarcodeType); } Console.WriteLine("Read Barcodes by Applying Image Processing Algorithm, Done!"); Console.ReadKey(); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); } /* * End... */ }