[Laszlo-user] cannot display a pdf document in an iframe

Bachstein, Marc bachstein at visus-tt.com
Thu May 14 03:04:39 PDT 2009


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