Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PostDrawingBmpRequest"/> class.
 /// </summary>
 /// <param name="name">Filename of an input drawing on a storage.</param>
 /// <param name="options">Export BMP options passed as a JSON on a request body.</param>
 /// <param name="folder">Folder with a drawing to process.</param>
 /// <param name="outPath">Path to updated file (if this is empty, response contains streamed file).</param>
 /// <param name="storage">Your Aspose Cloud Storage name.</param>
 public PostDrawingBmpRequest(string name, BmpOptionsDTO options, string folder = null, string outPath = null, string storage = null)
 {
     this.Name    = name;
     this.Options = options;
     this.Folder  = folder;
     this.OutPath = outPath;
     this.Storage = storage;
 }
Exemple #2
0
        public void PostDrawingSaveAsTest(string formatExtension, bool saveResultToStorage, params string[] additionalExportFormats)
        {
            string name    = null;
            string folder  = CloudTestFolder;
            string storage = DefaultStorage;
            string outName = null;

            List <string> formatsToExport = new List <string>()
            {
                OutputFormatExtension
            };

            foreach (var inputFile in InputTestFiles)
            {
                if (inputFile.Name.EndsWith(formatExtension))
                {
                    name = inputFile.Name;
                }
                else
                {
                    continue;
                }

                var exportOptions = new BmpOptionsDTO()
                {
                    VectorRasterizationOptions = new CadRasterizationOptionsDTO()
                    {
                        PageHeight = 200,
                        PageWidth  = 300
                    }
                };

                foreach (string format in formatsToExport)
                {
                    outName = $"{name}_opts.{format}";

                    this.TestPostWithOptionsRequest(
                        $"Input drawing: {name}; Output format: {format}",
                        name,
                        outName,
                        saveResultToStorage,
                        exportOptions,
                        delegate(BmpOptionsDTO options, string outPath)
                    {
                        var request = new PostDrawingBmpRequest(name, options, folder, outPath, storage);
                        return(CadApi.PostDrawingBmp(request));
                    },
                        folder,
                        storage);
                }
            }
        }