If you have the binary data in the database you can use an HttpHandler to spit out the data using something along the lines of:
public void ProcessRequest(HttpContext context)
{
int id;
if(Int32.TryParse(context.Request.QueryString["id"], out id))
{
var data = GetPDFFromDB(id);
context.Response.Buffer = true;
context.Response.ContentType = "application/pdf";
context.Response.AddHeader("Content-Length", data.Length.ToString());
context.Response.WriteBinary(data);
}
else
{
context.Response.WriteLine("Invalid id");
}
}
See the documentation for more details:
http://msdn.microsoft.com/en-us/library/system.web.httpresponse(v=vs.100).aspx[
^]
Hope this helped :-)