pdf在网络表单中 [英] pdf inside a web form

查看:93
本文介绍了pdf在网络表单中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨...



我正在使用asp.net和c#进行项目。

在我的GUI中我可以选择使用fileupload控件的pdf文件。

我需要在下面显示这个文件,以便我可以阅读详细信息。



can任何一个PLZ帮助。这是非常紧急....



我已经通过各种帮助,发现我们可以使用对象标签插入adobe com对象和我试过..它正在工作但是..





hi...

I am working on a project using asp.net and c#.
in my GUI i can select a pdf file by using a fileupload control.
I need this file to be displayed below so that i can read the details.

can any one plz help.This is very urgent....

i've gone thru various helps and found we can use object tag to insert adobe com object and i tried that ..it is working but..


<object data="Pdffilename" type="application/pdf"           style="height:1030px; width: 928px" >
       <param name="SRC" value="='<%=src%>'<br" mode="hold" /> </object>  







src文件如何在点击按钮时设置?




the src file how to set at the time of a button click?

推荐答案

使用JavaScript设置SRC会导致安全问题。首先要实现此目的,首先将文件上传到某个临时文件夹中的服务器,而不是显示它,一旦用户确认它。将其移动到目标文件夹。以下是供您参考的代码





Setting SRC using JavaScript will cause security issue.Other way to achieve this first you upload file to the sever in some temp folder than display it and once user confirm it. Move it to the target folder. Below is code for your reference


<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;
            }
        }


我还需要一个帮助plzzz ...



我可以在文件上传控件中选择文件而不点击任何其他视图按钮时调用pdf视图功能吗? br />


plz advice ...
I need one more help plzzz...

Can i invoke the pdf view function at the time of selecting a file in fileupload control without clicking any other view button?

plz advice...


这篇关于pdf在网络表单中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆