显示pdf

   document.all[document.all.PDFNotKnown ? "IfNoAcrobat" : "IfAcrobat"].style.display = "block";

@{
    Layout = null;
}

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>健康体检网上服务平台</title>
    <script src="../Scripts/jquery-1.7.1.js"></script>
    <script>
        $(function () {
            if ($('#reportUrl') != null) {
                var url = $('#reportUrl').val();
                if (url == null || url.length == 0) {
                    alert("还未出报告或报告有错误,请联系相关人员");
                }
            }
            else {
                alert("还未出报告或报告有错误,请联系相关人员");
            }

            document.all[document.all.PDFNotKnown ? "IfNoAcrobat" : "IfAcrobat"].style.display = "block";
        });
    </script>
</head>
<body>
    <div id="showdiv">
        @if (ViewData["ReportUrl"] != null)
        {
            <div>
                <input type="hidden" value="@ViewData["ReportUrl"]" id="reportUrl" />
            </div>
        }
        @*<iframe src="@ViewData["ReportUrl"]" style="100%;height:700px;border:0;"></iframe> *@
        <noscript>
            Cannot determine if you have Acrobat Reader (or the full Acrobat) 
            installed <font size="-1">(because JavaScript is unavailable or 
            turned off)</font>. 
        </noscript>
        <div id="IfNoAcrobat" style="display: none">
            <a href="http://get.adobe.com/cn/reader/">你需要先安装Adobe Reader才能正常浏览文件,请点击这里下载Adobe Reader.</a>
        </div>
        <object type="application/pdf" style="display: none;  0; height: 0;">
            <div id="PDFNotKnown" style="display: none">&nbsp;</div>
        </object>
        <div id="IfAcrobat">
            <object classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" width="100%" height="700px;" border="0" name="pdf">
                <param name="toolbar" value="false">
                <param name="_Version" value="65539">

                <param name="_ExtentX" value="20108">

                <param name="_ExtentY" value="10866">

                <param name="_StockProps" value="0">

                <param name="SRC" id="pdfName" value="@ViewData["ReportUrl"]">
            </object>
        </div>
    </div>
</body>
</html>



原文地址:https://www.cnblogs.com/jiangyou-lz/p/5592928.html