public void GetDrawingResizeTest(string formatExtension, bool saveResultToStorage, params string[] additionalExportFormats)
        {
            string name        = null;
            int?   newWidth    = 100;
            int?   newHeight   = 150;
            string cloudFolder = CloudTestFolder;
            string storage     = DefaultStorage;
            string outName     = null;

            List <string> formatsToExport = new List <string>(this.BasicExportFormats);

            foreach (string additionalExportFormat in additionalExportFormats)
            {
                if (!formatsToExport.Contains(additionalExportFormat))
                {
                    formatsToExport.Add(additionalExportFormat);
                }
            }

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

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

                    this.TestRawGetRequest(
                        $"input drawing: {name}; Output format: {format}; New width: {newWidth}; New height: {newHeight}",
                        name,
                        outName,
                        saveResultToStorage,
                        delegate(string outPath)
                    {
                        var request = new GetDrawingResizeRequest(name, format, newWidth, newHeight, cloudFolder, outPath, storage);

                        var stream = CadApi.GetDrawingResize(request);
                        return(stream);
                    },
                        cloudFolder,
                        storage);

                    break;
                }
            }
        }
Beispiel #2
0
        // Change Scale of an existing image
        private void GetImageResize()
        {
            var cadApi = new CadApi(AppKey, AppSid);

            string fileName = "910609.dxf";
            // Possible values are jpg, bmp, psd, tiff, gif, png, j2k, wmf and pdf
            string formatToExport = "pdf";
            int?   newWidth       = 100;
            int?   newHeight      = 150;
            string destFileName   = "910609.pdf";

            // Upload document to Cloud Storage
            uploadFileToCloudStorage(fileName);

            var request        = new GetDrawingResizeRequest(fileName, formatToExport, newWidth, newHeight, null, null, null);
            var responseStream = cadApi.GetDrawingResize(request);

            // Save the output file to disk
            saveFileToDisk(responseStream, destFileName);
        }