public void ConvertToSlidesStream() { var file = TestFiles.OnePageDocx; var request = new ConvertToSlidesStreamRequest { Settings = new SlidesConversionSettings { SourceFile = ToConversionFileInfo(file), Options = new SlidesSaveOptionsDto() } }; var response = ConversionApi.ConvertToSlidesStream(request); Assert.IsNotNull(response); Assert.Greater(response.Length, 0); }
/// <summary> /// Returns SLIDES stream, result of conversion of the source file, specified by the provided SlidesConversionSettings /// </summary> /// <param name="request">Request. <see cref="ConvertToSlidesStreamRequest" /></param> /// <returns><see cref="System.IO.Stream"/></returns> public System.IO.Stream ConvertToSlidesStream(ConvertToSlidesStreamRequest request) { // create path and map variables var resourcePath = this.configuration.GetApiRootUrl() + "/conversion/slides/stream"; resourcePath = Regex .Replace(resourcePath, "\\*", string.Empty) .Replace("&", "&") .Replace("/?", "?"); var postBody = SerializationHelper.Serialize(request.Request); // http body (model) parameter return(this.apiInvoker.InvokeBinaryApi( resourcePath, "POST", postBody, null, null)); }
public static void Run() { var configuration = new Configuration { AppSid = Common.MyAppSid, AppKey = Common.MyAppKey }; // Initiate api instance var apiInstance = new ConversionApi(configuration); try { // convert to Slides request var request = new ConvertToSlidesStreamRequest { // convert to Slides Request Request = new SlidesConversionRequest { // source file to convert SourceFile = new ConversionFileInfo() { Folder = "conversions", Name = "sample.docx", Password = "" }, // Slides save options Options = new SlidesSaveOptionsDto() } }; // convert to Slides var response = apiInstance.ConvertToSlidesStream(request); Console.WriteLine(response.Length.ToString()); } catch (Exception e) { Console.WriteLine("Exception when calling ConversionApi.ConvertToSlidesStream: " + e.Message); } }