当前位置: 首页>>代码示例>>C#>>正文


C# StorageApi.GetDownload方法代码示例

本文整理汇总了C#中Com.Aspose.Storage.Api.StorageApi.GetDownload方法的典型用法代码示例。如果您正苦于以下问题:C# StorageApi.GetDownload方法的具体用法?C# StorageApi.GetDownload怎么用?C# StorageApi.GetDownload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Com.Aspose.Storage.Api.StorageApi的用法示例。


在下文中一共展示了StorageApi.GetDownload方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        public static void Main(String[] args){

            try
            {
                System.Diagnostics.Debug.WriteLine("\n\nFetching the results...");
                StorageApi storageApi = new StorageApi("xxx", "xxx", "http://api.aspose.com/v1.1");

                string fileName = "test_multi_pages.docx";

                System.Diagnostics.Debug.WriteLine(storageApi.PutCreate(fileName,null, null, System.IO.File.ReadAllBytes("\\temp\\"+fileName)));

                //storageApi.PutCreate(fileName, null, null, System.IO.File.ReadAllBytes("\\temp\\resources\\" + fileName));

                ////System.Diagnostics.Debug.WriteLine(storageApi.GetDownload(fileName, null, null)+"\n\nthese were the file contents");


                byte[] responseStream = storageApi.GetDownload(fileName, null, null).ResponseStream;
                System.IO.File.WriteAllBytes("\\temp\\new_" + fileName, responseStream);

                //System.Diagnostics.Debug.WriteLine(storageApi.GetListFiles("", ""));

                //System.IO.File.WriteAllBytes("\\temp\\new_" + fileName, System.IO.File.ReadAllBytes("\\temp\\"+fileName));

            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("\nError:"+ex.Message+"\n" + ex.StackTrace + "\n");
            }
        }
开发者ID:imranwar,项目名称:AsposeStoragePHP,代码行数:29,代码来源:Storage.cs

示例2: Run

        public static void Run()
        {

            // ExStart:1
            // Instantiate Aspose Storage Cloud API SDK
            StorageApi storageApi = new StorageApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH);

            // Instantiate Aspose BarCode Cloud API SDK
            BarcodeApi barcodeApi = new BarcodeApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH);

            // Set the barcode file name created on server.
            String name = "sample-barcode";

            // Set Text to encode inside barcode.
            String text = "AsposeBarCode";

            // Set Barcode Symbology
            String type = "Code128";

            // Set Generated Barcode Image Format
            String format = "png";

            // Set Resolution along X and Y in dpi.
            float? resolutionX = null;
            float? resolutionY = null;

            //Set Width and Height of barcode unit
            float? dimensionX = null;
            float? dimensionY = null;

            //Set Location, Measurement  of the code
            String codeLocation = "Below";
            String grUnit = "mm";

            // Sets if barcode's size will be updated automatically
            String autoSize = "true";

            // Height of the bar.
            float? barHeight = null;

            //Set height, Width and quality of the image.
            float? imageHeight = null;
            float? imageWidth = null;
            String imageQuality = "default";

            // Set Angle of barcode orientation
            float? rotAngle = null;

            // Set Margin of image border
            float? topMargin = null;
            float? bottomMargin = null;
            float? leftMargin = null;
            float? rightMargin = null;

            // Sets if checksum will be added to barcode image.
            String enableChecksum = "";

            //Set 3rd party cloud storage server (if any)
            String storage = "";
            String folder = "";

            // Set local file (if any)
            byte[] file = null;

            try
            {
                // invoke Aspose.BarCode Cloud SDK API to generate barcode with appropriate code text location and put in cloud storage
                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 generated barcode from cloud storage
                    Com.Aspose.Storage.Model.ResponseMessage storageRes = storageApi.GetDownload(name, null, null);

                    //Save response stream to a file 
                    System.IO.File.WriteAllBytes(Common.OUTFOLDER + name + "." + format, storageRes.ResponseStream);
                    Console.WriteLine("Generate Barcode with Appropriate Code Text Location, Done!");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
            }
            // ExEnd:1
        }
开发者ID:farooqsheikhpk,项目名称:Aspose.BarCode-for-Cloud,代码行数:84,代码来源:GenerateBarcodewithAppropriateCodeTextLocation.cs


注:本文中的Com.Aspose.Storage.Api.StorageApi.GetDownload方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。