M
morebeer
Dear Experts,
I am trying to read a local PDF file using an aspx page and flush it
to the client. Basically my script works but the PDF sent flushed to
the client is broken because I am putting the stream into a string
object. But how do I flush the stream as a binary file? Here's my
code:
Stream lsStream = new FileStream(lsFile, FileMode.Open);
using (BinaryReader lrReadFile = new BinaryReader(lsStream))
{
lsCompletePage = lrReadFile.Read().ToString();
lrReadFile.Close();
}
lsStream.Close();
string strPdf = lsCompletePage;
Response.AddHeader("Content-Disposition", "attachment; filename="
+ Request.QueryString["pdf"].ToString());
Response.AddHeader("Content-Type", "application/pdf");
I am trying to read a local PDF file using an aspx page and flush it
to the client. Basically my script works but the PDF sent flushed to
the client is broken because I am putting the stream into a string
object. But how do I flush the stream as a binary file? Here's my
code:
Stream lsStream = new FileStream(lsFile, FileMode.Open);
using (BinaryReader lrReadFile = new BinaryReader(lsStream))
{
lsCompletePage = lrReadFile.Read().ToString();
lrReadFile.Close();
}
lsStream.Close();
string strPdf = lsCompletePage;
Response.AddHeader("Content-Disposition", "attachment; filename="
+ Request.QueryString["pdf"].ToString());
Response.AddHeader("Content-Type", "application/pdf");