I want to set the Title of Web page which is returning the PDF file stream as:
public ActionResult PrintInvoice(long ID)
{
var data = db.Documents.Where(x => x.InvoiceNumber == ID);
ReportDocument rd = new ReportDocument();
rd.Load(Server.MapPath("~/Reports/InvoiceDocument.rpt"));
Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
stream.Seek(0, SeekOrigin.Begin);
return new FileStreamResult(stream, "application/pdf"); //For Showing PDF in Browser itself
}
and on this Page I want to set the Title.
How can I set the Title on this Page.
Currently the Title on the Page looks like as shown below in Image::
Have a look at HTTP Headers, like in that thread.
Try something like :
Response.AppendHeader("Content-Disposition", "inline; filename=your page title");
Also have a look at this thread which recommend :
return File(stream, "application/pdf", "your page title");
Keep in mind that this kind of data can be executed differently from different browsers.