0

View で PDF コンテンツを表示するために MVC を使用していますが、正しくレンダリングされません。

コントローラーのアクション:

    [HttpPost]
    public ActionResult GetDocumentContent()
    {
        byte[] result;

        result = System.IO.File.ReadAllBytes(@"C:\test.pdf");

        Response.AppendHeader("Content-Disposition", new System.Net.Mime.ContentDisposition
        {
            FileName = "document.pdf",
            Inline = true,
        }.ToString());

        return  File(result, "application/pdf");
    }

Jクエリ:

        var url = "/DocumentContent/GetDocumentContent";
        var self = this;
        $.post(url, null,function (data) {
            debugger;
            var obj = $('<object type="application/pdf" width="100%" height="100%" border="2"></object>');
            obj.attr('data', data);
            $('#divContainer').append(obj);              
        });

このコードの間違いは何ですか? View で PDF ストリームを表示するには?

4

1 に答える 1