public void ModifyEmfTest() { string name = "test.emf"; string bkColor = "gray"; int pageWidth = 300; int pageHeight = 300; int borderX = 50; int borderY = 50; bool? fromScratch = null; string folder = TempFolder; string storage = this.TestStorage; this.TestGetRequest( "ModifyEmfTest", $"Input image: {name}; BackColor: {bkColor}; Page width: {pageWidth}; Page height: {pageHeight}; BorderX: {borderX}; BorderY: {borderY}", name, delegate { var request = new ModifyEmfRequest(name, bkColor, pageWidth, pageHeight, borderX, borderY, fromScratch, folder, storage); return(ImagingApi.ModifyEmf(request)); }, delegate(ImagingResponse originalProperties, ImagingResponse resultProperties, Stream resultStream) { int width = pageWidth + borderX * 2; int height = pageHeight + borderY * 2; Assert.IsNotNull(resultProperties.PngProperties); Assert.AreEqual(width, resultProperties.Width); Assert.AreEqual(height, resultProperties.Height); }, folder, storage); }
/// <summary> /// Process existing EMF image using given parameters, and upload updated image to Cloud Storage. /// </summary> public void ModifyEmfAndUploadToStorage() { Console.WriteLine("Update parameters of a EMF image and upload to cloud storage"); UploadSampleImageToCloud(); var bkColor = "gray"; var pageWidth = 300; var pageHeigth = 300; var borderX = 50; var borderY = 50; var format = "png"; // Specifies where additional parameters we do not support should be taken from. // If this is true – they will be taken from default values for standard image, // if it is false – they will be saved from current image. Default is false. bool? fromScratch = null; var folder = CloudPath; // Input file is saved at the Examples folder in the storage string storage = null; // As we are using default Cloud Storage var request = new ModifyEmfRequest( SampleImageFileName, bkColor, pageWidth, pageHeigth, borderX, borderY, fromScratch, folder, storage, format); Console.WriteLine( $"Call ModifyEmf with params: background color:{bkColor}, width:{pageWidth}, height:{pageHeigth}, border x:{borderX}, border y:{borderY}, format:{format}"); using (var updatedImage = ImagingApi.ModifyEmf(request)) { UploadImageToCloud(GetModifiedSampleImageFileName(false, format), updatedImage); } Console.WriteLine(); }