Hi.
How can I convert a file and then stream it to the browser to be opened or downloaded. I have the following code to convert a file, BUT I have to save it to the server before sending to the browser. How can I skip the saving/converting the file to the server? and just convert the image/file in memory and send to the browser?
thx
try
** {**
** // Convert to JPG**
** using (Aspose.Imaging.Image inputImage = Aspose.Imaging.Image.Load(filePath))**
** {**
** JpegOptions imageOptions = new JpegOptions();**
** inputImage.Save(imageFile + Path.GetFileName(filePath).Replace(".bin", “.JPG”), imageOptions);**
** }**
** filePath = imageFile + Path.GetFileName(filePath).Replace(".bin", “.JPG”);**
** }**
** catch (Exception ex)**
** {**
** return new HttpResponseMessage(HttpStatusCode.InternalServerError);**
** }**
** //Read the File into a Byte Array.**
** byte[] bytes = File.ReadAllBytes(filePath);**
** //Set the Response Content.**
** response.Content = new ByteArrayContent(bytes);**
** //Set the Response Content Length.**
** response.Content.Headers.ContentLength = bytes.LongLength;**
** //Set the Content Disposition Header Value and FileName.**
** response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue(“attachment”);**
** response.Content.Headers.ContentDisposition.FileName = Path.GetFileName(filePath);**
** //Set the File Content Type.**
** response.Content.Headers.ContentType = new MediaTypeHeaderValue(MimeMapping.GetMimeMapping(Path.GetFileName(filePath)));**
** return response;**