[Laszlo-user] cannot display a pdf document in an iframe
P T Withington
ptw at pobox.com
Thu May 14 04:33:22 PDT 2009
Perhaps this is of help:
Demo: PDF document in inline frame http://bit.ly/Fu2hS
For me, this works in Safari, and not in FireFox. Safari displays the
PDF inline, scaled to fit the iframe, but Firefox displays a blank
iframe and downloads the PDFs! In my experience, PDF's are treated
specially by browsers, and you can't rely on them displaying them.
On 2009-05-14, at 06:04EDT, Bachstein, Marc wrote:
> Hello,
>
> I have an iframe in my OL-application which shall display a pdf
> document.
>
> I have tried <embed> and <object>. Both tags do not display the pdf
> in the iframe.
>
> Does anybody know what I do wrong?
>
> Kind Regards,
> Marc
>
> --------
>
> <canvas>
> <html x="50" y="50" width="500" height="500" name="HTMLView"
> visible="true"/>
>
> <button name="displayPDF" text="display pdf document">
>
> <method name="_setIframeContent" args="iframeID, content"><!
> [CDATA[
> LzBrowserService.LzBrowser.callJS("window.__seticontent",
> false, iframeID, content);
> ]]></method>
>
> <handler name="oninit" reference="canvas" ><![CDATA[
> var js = "window.__seticontent = function (iframeID,
> content) {" +
> "var iframebody =
> document.getElementById(iframeID).contentWindow.document.body;" +
> "iframebody.innerHTML = content;" +
> "iframebody.style.backgroundColor = 'white'; }";
> if ($dhtml) {
> //LPP-6911
> eval(js);
> } else {
> LzBrowserService.LzBrowser.loadJS(js);
> }
> ]]></handler>
>
> <handler name="onclick"><![CDATA[
> Debug.write("display pdf document");
>
> var htmlContent= "<html><body>"
> + "display PDF"
> + "<embed src='myDocument.pdf' width='100%' height='100%'>"
>
> /* + "<object data='myDocument.pdf' type='application/pdf'
> width='500' height='500'>"
> + "<param name='src' value='myDocument.pdf'>"
> + "Your browser does not support this kind of object."
> + "</object>"
> */
> + "</body></html>";
>
> var theiframeID = canvas.HTMLView.iframeid;
>
> Debug.write("theiframeID="+theiframeID);
>
> Debug.write("htmlContent="+htmlContent)
>
> this._setIframeContent(theiframeID, htmlContent);
>
> ]]>
> </handler>
> </button>
> </canvas>
More information about the Laszlo-user
mailing list