此問題主要涉及.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