first question so be gentle with me and thanks in advance for your help!
第一个问题,请对我温柔,并提前感谢您的帮助!
I'm going to add quite a bit of context to explain why I'm asking the question I am and why I want to do what I want to do. Bear with me, it'll all be worth it.
我将添加相当多的背景来解释为什么我问我的问题以及为什么我想做我想做的事情。忍受我,这一切都值得。
I should mention that this app will not be seen by the general public and we have some contraints on our users (only use IE 5.5, that sort of thing).
我应该提到一般公众不会看到这个应用程序,我们对用户有一些限制(只使用IE 5.5,那种事情)。
I have an existing web app that I'm having to add to.
我有一个我必须添加的现有Web应用程序。
Currently an aspx page is navigated to with some IDs passed in as a query string and in the page load a call is made to a business object, passing in the page's Response object. That business object grabs PDF byte content (from a sql server via a business object) and, having set the necessaries in the header, writes the PDF byte data into the Response object. The user gets to see the PDF and all is right with the world.
当前导航到一个aspx页面,其中一些ID作为查询字符串传入,并且在页面加载中,对业务对象进行调用,传入页面的Response对象。该业务对象抓取PDF字节内容(通过业务对象从sql server),并在标头中设置必需项,将PDF字节数据写入Response对象。用户可以看到PDF,所有这些都适合全世界。
Howewver, now we have a requirement that when the page is navigated to the app will get the PDF byte data and in addition to displaying it we'll send it to a proprietary system based local to the web client (we already do this via a java applet other points in the application's workflow and it works).
但是,现在我们要求当页面导航到应用程序时将获得PDF字节数据,除了显示它之外,我们还将它发送到基于Web客户端本地的专有系统(我们已经通过java applet应用程序工作流程中的其他点,它的工作原理)。
Thing is, I need to (depending on some user settings or other) show a modal dialog when the user navigates to the 'view dynamicallly generated pdf document' page, to ask if the user wants to szend the PDF to this proprietary system. For this I need to be able to run client-side javascript to call showModalDialog (using showModalDialog is handy because I can put all the java applet calling stuff and the java applet itself on this one page that gets shown as a modal dialog).
事情是,当用户导航到“查看动态生成的pdf文档”页面时,我需要(取决于某些用户设置或其他)显示模式对话框,询问用户是否想要将PDF szend到此专有系统。为此,我需要能够运行客户端javascript来调用showModalDialog(使用showModalDialog很方便,因为我可以将所有java applet调用东西和java applet本身放在这个显示为模态对话框的页面上)。
Problem is the way we show our PDF at the moment doesn't allow us to run javascript as all that gets sent down to the client is a page with a bunch of pdf data and marked as such.
问题是我们目前显示我们的PDF的方式不允许我们运行javascript,因为所有发送到客户端的是一个包含一堆pdf数据的页面并标记为这样。
So far I've trieed IFrames (yeah, yeah I kow, effluent from Lucifer's fundament) with the src being dynamically set to the url of the PDF display page plus the querystring that page needs. That worked in the sense that I got my modal dialog showing which was great and the PDF displayed (which was something at least) in a cosy little two inches at the top of the page, which was not so great :(
到目前为止,我已经试过IFrames(是的,是的,我知道,从Lucifer的基础中流出),src被动态设置为PDF显示页面的url加上页面需要的查询字符串。这是有效的,我得到了我的模态对话框,显示哪个很好,并且显示的PDF(至少是这个)在页面顶部舒适的两英寸处,这不是很好:(
I've also tried using an object tag but I don't even know where to start getting that sorted to 'runat=server'. When I try to do it client side I get object required errors in my java script.
我也尝试过使用对象标签,但我甚至不知道从哪里开始将其排序为'runat = server'。当我尝试做客户端时,我的java脚本中出现了对象所需的错误。
So all I really want is some kind of 'container' that I can place on a standard aspx page, that I can use to dynamically reference another page from which will give it 'full height' in the viewport. IFrames seemed like that fella but they seem to be a bit...well...poo.
所以我真正想要的是某种“容器”,我可以放在一个标准的aspx页面上,我可以用来动态地引用另一个页面,从而在视口中给它“全高”。 IFrame似乎是那个家伙,但他们似乎有点......好吧......便便。
Oh and just in case you didn't guess: I'm not as experienced a web dev as I am in WinForms.
哦,以防万一你没猜到:我没有像WinForms那样经验丰富的Web开发人员。
2 个解决方案
#1
That worked in the sense that I got my modal dialog showing which was great and the PDF displayed (which was something at least) in a cosy little two inches at the top of the page
这是有效的,我得到了我的模态对话框,显示哪个很棒,并且在页面顶部舒适的两英寸处显示了PDF(至少是这样的东西)
Then give the iframe a bigger height. Either through the ‘height’ attribute, if you can guess a reasonable size in pixels, or using CSS if you want to do something like basing it on page height:
然后给iframe一个更大的高度。通过'height'属性,如果你可以猜出一个合理的像素大小,或者如果你想做一些基于页面高度的事情,可以使用CSS:
<iframe src="pdfscript?id=123" style="position: absolute; top: 10%; left: 10%; width: 80%; height: 80%;"></iframe>
Whilst you can embed a PDF in a web page using the <object> tag, it's strongly not recommended. At least with the iframe option, if you don't have a PDF plugin installed it will prompt you to download as a file; the object-version will just give you a broken plugin icon and maybe prompt you to install the Acrobat plugin.
虽然您可以使用
(And you definitely don't want the Acrobat plugin installed, because of all the security holes that are currently delivering control of our desktops to Russian hackers. Thanks Adobe.)
(而且你肯定不希望安装Acrobat插件,因为目前所有的安全漏洞都会将我们的桌面控制权交给俄罗斯黑客。感谢Adobe。)
#2
please try something like this:
请尝试这样的事情:
<form id="form1" runat="server"> <div style="width:99%;height:99%;border:1px solid green;"> <iframe id="frame1" runat="server" scrolling="auto" frameborder="0" marginheight="0" marginwidth="0" src="Userguide.pdf" style="height:99.5%;width:99.5%;border:1px solid yellow;"></iframe>> </div> </form>
#1
That worked in the sense that I got my modal dialog showing which was great and the PDF displayed (which was something at least) in a cosy little two inches at the top of the page
这是有效的,我得到了我的模态对话框,显示哪个很棒,并且在页面顶部舒适的两英寸处显示了PDF(至少是这样的东西)
Then give the iframe a bigger height. Either through the ‘height’ attribute, if you can guess a reasonable size in pixels, or using CSS if you want to do something like basing it on page height:
然后给iframe一个更大的高度。通过'height'属性,如果你可以猜出一个合理的像素大小,或者如果你想做一些基于页面高度的事情,可以使用CSS:
<iframe src="pdfscript?id=123" style="position: absolute; top: 10%; left: 10%; width: 80%; height: 80%;"></iframe>
Whilst you can embed a PDF in a web page using the <object> tag, it's strongly not recommended. At least with the iframe option, if you don't have a PDF plugin installed it will prompt you to download as a file; the object-version will just give you a broken plugin icon and maybe prompt you to install the Acrobat plugin.
虽然您可以使用
(And you definitely don't want the Acrobat plugin installed, because of all the security holes that are currently delivering control of our desktops to Russian hackers. Thanks Adobe.)
(而且你肯定不希望安装Acrobat插件,因为目前所有的安全漏洞都会将我们的桌面控制权交给俄罗斯黑客。感谢Adobe。)
#2
please try something like this:
请尝试这样的事情:
<form id="form1" runat="server"> <div style="width:99%;height:99%;border:1px solid green;"> <iframe id="frame1" runat="server" scrolling="auto" frameborder="0" marginheight="0" marginwidth="0" src="Userguide.pdf" style="height:99.5%;width:99.5%;border:1px solid yellow;"></iframe>> </div> </form>