1.下载pdfobject.js文件
2.
1 <script type="text/javascript" src="<%= Application["rootURL"] %>JS/pdfobject.js"></script> 2 3 <div id="divPDFContent" style="height:860px; margin-top:5px; z-index:-9999;"> 4 <embed class="pdfobject" src=‘<%=GetImageSrc() %>‘ type="application/pdf" style="overflow: auto; width: 100%; height: 100%;"> 5 </div>
3.
1 protected string GetImageSrc() 2 { 3 string sSrc = "ShowImage.aspx?ID=" + ImageID.ToString(); 4 return sSrc; 5 }
4.
1 //读文件 2 Byte[] content = File.ReadAllBytes(Server.MapPath(Sql.ToString(rdr["ImagePath"]))); 3 Response.ContentType = sFileType; 4 Response.OutputStream.Write(content, 0, content.Length); 5 Response.OutputStream.Close(); 6 //读二进制 7 Response.ContentType = Sql.ToString(rdr["FILE_MIME_TYPE"]); 8 Response.OutputStream.Write(Sql.ToByteArray(rdr["CONTENT"]), 0, Sql.ToInteger(rdr["FILE_SIZE"])); 9 Response.OutputStream.Close();
时间: 2024-10-10 00:05:35