我有一个应用程序,其中在 Web 表单中打开 PDF 文件,如下面的代码所示
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<div>
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
</div>
<div id="divPDF" runat="server">
<object data="<%=pdfPath%>" type="application/pdf" style="height:500px; width: "500px" >
</object>
</div>
</div>
</form>
</body>
</html>
protected string pdfPath;
protected void Page_Load(object sender, EventArgs e)
{
divPDF.Visible = false;
}
protected void Button1_Click(object sender, EventArgs e)
{
if (FileUpload1.FileName != "")
{
FileUpload1.SaveAs(Server.MapPath(FileUpload1.FileName));
pdfPath = FileUpload1.FileName;
divPDF.Visible = true;
}
}
它工作正常,我可以查看和阅读pdf
. 现在我需要的是当我滚动浏览当前pagenumber
应该出现在文本框中的页面时。