此问题主要涉及.net中的Web应用程序中的流。在我的web应用,我将显示如下:合并流:Web应用程序
- bottle.doc
- sheet.xls
- presentation.ppt
stackof.jpg
按钮
我将保留每个人的复选框以供选择。假设用户选择了四个文件并单击了我保存的按钮。然后,我为每种类型的文件实例化分类器,将其转换为pdf,我已经写入并将它们转换为pdf并返回它们。我的问题是clases能够读取数据表单URL并将它们转换为pdf。但我不知道如何返回流并合并它们。
string url = @"url";
//Prepare the web page we will be asking for
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "GET";
request.ContentType = "application/mspowerpoint";
request.UserAgent = "Mozilla/4.0+(compatible;+MSIE+5.01;+Windows+NT+5.0";
//Execute the request
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
//We will read data via the response stream
Stream resStream = response.GetResponseStream();
//Write content into the MemoryStream
BinaryReader resReader = new BinaryReader(resStream);
MemoryStream PresentaionStream = new MemoryStream(resReader.ReadBytes((int)response.ContentLength));
//convert the presention stream into pdf and save it to local disk.
但我想再次返回流。我怎样才能实现这个任何想法是受欢迎的。
看来你有两个问题。 1.如何将多个流合并为一个并将其转换为pdf。 2.如何将pdf流返回给客户端。我会在这里保留数字2,并提出一个新的问题,因为它是一个完全不同的主题。 – Peter 2011-03-03 09:22:05