2

PDFファイルストリームを返すWebページのタイトルを次のように設定したい:

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
}

このページでは、タイトルを設定したいと思います。

このページにタイトルを設定するにはどうすればよいですか。

現在、ページのタイトルは以下の画像のようになっています::

ここに画像の説明を入力

4

2 に答える 2

0

そのスレッドのように、HTTP ヘッダーを見てください。

次のようなものを試してください:

Response.AppendHeader("Content-Disposition", "inline; filename=your page title");

推奨するこのスレッドもご覧ください。

return File(stream, "application/pdf", "your page title");

この種のデータは、ブラウザによって異なる方法で実行される可能性があることに注意してください。

于 2014-01-28T09:58:01.193 に答える