我從這裏通過該守則C#塊流爲http repsonse
https://forums.asp.net/t/1556522.aspx?RDLC+Export+directly+to+Excel+or+PDF+from+codebehind
我建我的字節數組
byte[] bytes = viewer.LocalReport.Render("PDF", null, out mimeType,
out encoding,
out extension, out streamIds, out warnings);
Response.Buffer = true;
Response.Clear();
Response.ContentType = mimeType;
Response.AddHeader("content-disposition", "attachment; filename=" + fileName + "." + extension);
Response.BinaryWrite(bytes); // create the file
Response.Flush(); // send it to the client to download
但是我擔心的字節被周圍的4Gb巨大並把它寫進http響應需要以塊的形式進行流式傳輸。
我在.net版本4.6任何想法如何我可以寫入響應對象的塊大小的流? 當Response.BinaryWrite(字節)將死亡如果字節是巨大的,我打算取代它,但想知道如何?
我的研究把我帶到 https://msdn.microsoft.com/en-us/library/ms252172.aspx
凡渲染方法可以使流對象
public void Render(
string format,
string deviceInfo,
CreateStreamCallback createStream,
out Warning[] warnings
)
如何塊從流回調到一個HTTP響應的數據對象的任何線索?
PDF超過4GB將成爲任何人查看它的真正問題;) 您將需要遍歷文件讀取塊,並在每個塊做BinaryWrite。 – Charlie