在Asp.Net PDF阅读器 [英] PDF viewer in Asp.Net
问题描述
我在服务器上的文件清单。而要发展,其中的文档列表将显示在左侧面板/ DIV超链接和页面
而点击一个链接。右侧面板从服务器上显示相应的PDF文档。
任何人可以帮助我使用jQuery或JavaScript来开发一样吗?
在此先感谢
我试过低于code根据一些文章,我读
脚本:
< SCRIPT LANGUAGE =JavaScript的类型=文/ JavaScript的>函数previewPdf(URL,目标)
{ VAR的div =的document.getElementById(目标);
VAR OBJ =使用document.createElement(<嵌入风格=宽度:939px;高度:736px;FRAMEBORDER =0SRC ='+ URL +')>< /嵌入>中);
div.appendChild(OBJ);
}
< / SCRIPT>
块引用>正文:
<车身风格=高度:741px>
<表ID =form1的=服务器> < DIV ID =DIV1的风格=浮动:左;宽度:20%;文本对齐:左;高度:100%;边框宽度:2px的;>
<按钮的onclick =previewPdf(文件/ Accomodation.pdf','DIV2')>住宿和LT; /按钮>
< BR />
<按钮的onclick =previewPdf(文件/ Insurance.pdf','DIV2')>保险和LT; /按钮>
< BR />
<按钮的onclick =previewPdf(文件/空气Ticket.pdf','DIV2')>空气Ticket.pdf< /按钮>
< BR /> < / DIV> < DIV ID =DIV2的风格=浮动:权利;宽度:80%;文本对齐:左;高度:100%;边框颜色:栗色> < / DIV>
< /表及GT;
< /身体GT;但它不与内容[PDF]替换'DIV2。
解决方案如果您可以使用ASP.NET的PDF查看器组件,然后在这里是它是如何使用的Gnostice PDFOne .NET完成。
PDFViewer1.ActiveLicense(您的许可密钥);
PDFViewer1.LoadDocument(使用Server.Mappath()+\\\\ App_Data文件\\\\ sample.pdf,。);免责声明:我对工作的Gnostice
。I have a list of documents at server. and want to develop a page where the list of documents will be displayed as hyperlinks in left panel/div and while click on a link. the right panel displays the corresponding PDF document from server.
can anybody help me out to develop the same using jquery or javascript?
thanks in advance
i tried below code based on some articles i read Script :
<script language="javascript" type="text/javascript"> function previewPdf(url, target) { var div = document.getElementById(target); var obj = document.createElement("<embed style='width:939px; height:736px;' frameborder='0' src='" + url +"')></embed>"); div.appendChild(obj); } </script>
Body :
<body style="height: 741px"> <form id="form1" runat="server"> <div id="div1" style="float:left; width: 20%; text-align: left; height: 100%; border-width:2px;"> <button onclick="previewPdf('Documents/Accomodation.pdf','div2')">Accomodation</button> <br /> <button onclick="previewPdf('Documents/Insurance.pdf','div2')">Insurance</button> <br /> <button onclick="previewPdf('Documents/Air Ticket.pdf','div2')">Air Ticket.pdf</button> <br /> </div> <div id="div2" style="float:right;width: 80%; text-align: left; height: 100%; border-color:Maroon"> </div> </form> </body>
but it doesnt replace the 'div2' with the content[pdf].
解决方案If you can use a ASP.NET PDF viewer component, then here is how it is done with Gnostice PDFOne .NET.
PDFViewer1.ActiveLicense("your-license-key"); PDFViewer1.LoadDocument(Server.MapPath(".") + "\\App_Data\\sample.pdf");
DISCLAIMER: I work for Gnostice.
这篇关于在Asp.Net PDF阅读器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!