public void PostDrawingRotateFlipTest(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>(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) { foreach (var method in _rotateFlipMethods) { outName = $"{name}_{method}.{format}"; this.TestRawPostRequest( $"input drawing: {name}; Output format: {format}; Method: {method}", name, outName, saveResultToStorage, delegate(Stream inputStream, string outPath) { var request = new PostDrawingRotateFlipRequest(inputStream, format, method, outPath, storage); return(CadApi.PostDrawingRotateFlip(request)); }, folder, storage); } break; } } }
// Rotate and flip existing image and get it from response private void PostImageRotateFlip() { var cadApi = new CadApi(AppKey, AppSid); string fileName = "01.026.385.01.0.I SOPORTE ENFRIADOR.dwg"; // Possible values are jpg, bmp, psd, tiff, gif, png, j2k, wmf and pdf string formatToExport = "pdf"; // Possible values are Rotate180FlipNone, Rotate180FlipX, Rotate180FlipXY, Rotate180FlipY, Rotate270FlipNone, // Rotate270FlipX, Rotate270FlipXY, Rotate270FlipY, Rotate90FlipNone, Rotate90FlipX, Rotate90FlipXY, // Rotate90FlipY, RotateNoneFlipNone, RotateNoneFlipX, RotateNoneFlipXY and RotateNoneFlipY var method = "Rotate180FlipNone"; string destFileName = "01.026.385.01.0.I SOPORTE ENFRIADOR.pdf"; string dataFilePath = Path.Combine(pathToDataDir(), fileName); var request = new PostDrawingRotateFlipRequest(File.OpenRead(dataFilePath), formatToExport, method, null); var responseStream = cadApi.PostDrawingRotateFlip(request); // Save the output file to disk saveFileToDisk(responseStream, destFileName); }