Page 1 of 1

Open PDF file in iFrame on Chrome

Posted: Thu Feb 27, 2014 7:23 pm
by akumar
I have a iframe container whose iframe url property is set to open a pdf file in IFS. The pdf file opens fine in IE10 inside the iframe.

However, google chrome does not show the pdf file inside of the iframe. It just does not show anything neither gives any kind of msg (see attached).

Based on some free advice on the internet, I even enabled the Adobe Reader plugin in Chrome, however no luck.
Any suggestion to get around the problem!!!

Re: Open PDF file in iFrame on Chrome

Posted: Fri Feb 28, 2014 12:59 am
by Scott Klement
Hmm... I'm certainly no expert, but... I don't think this is the proper way to embed a PDF in an HTML document, is it? An iframe is for loading another HTML page so that it's embedded in a larger HTML page.

Instead, try using an <embed> tag. To do that, drag an "html container" widget onto your canvas. Set its height/width to the size of the section of your page for the PDF (I used 375 and 500 for my test) and then set the html attribute of the html container (Note: make sure you use the html attribute, not the value attribute) to the following:

Code: Select all

<embed src="http://www.adobe.com/enterprise/accessibility/pdfs/acro6_pg_ue.pdf" width="500" height="375">
Obviously, change the URL to the right one for your PDF document, and make the height/width in the <embed> tag match the height/width of the HTML container.

<embed> is an official HTML5 way to do this... but it was around prior to HTML5 in all major browsers (Even though it wasn't a part of the standard yet) so should work for just about any browser out there, and should continue to work.

Does that work properly for you?

Re: Open PDF file in iFrame on Chrome

Posted: Fri Feb 28, 2014 3:25 pm
by akumar
Thanks Scott for the suggestion.

I got Access Denied in IE when I tried to embed the PDF. I learnt that the version 10 and beyond, the Adobe reader opens in a protected mode due to which the Access denied msg was reported.

With regards to Chrome, nothing showed up using the embed tag too.

My PDF file is residing in one of the IFS folder, therefore I have my src url defined as "file://server/folder/file.pdf" Do you see anything that I am missing that may be causing.

Would PUI download pgm be of any help?

Re: Open PDF file in iFrame on Chrome

Posted: Fri Feb 28, 2014 4:02 pm
by Scott Klement
The "access denied" might be due to the use of a file:// URL?? I'm not sure if that's the case without trying other things, but it might be.

IMHO, you should not use file:// URLs. That's for accessing the user's local hard drive, and is really intended for users to access their own files (such as HTML files they are creating) from the browser. I would never do it in a production application... imagine if any web page you went to on the Internet could suddenly grab things off of your hard drive.

You could use the Profound UI download process to get to these files. That would make sense if you want to allow/disallow access based on their user profile, and have set up the IFS to check authorities based on the logged in user, etc. If these PDFs are publicly accessible (you don't need to restrict by userid), then I would just add an Alias into your httpd.conf, which would be simpler and quicker.

The pui download also can let you run RPG code when the request is made, which is useful if you want to generate the PDFs on the fly.

Tell me more about your situation and I'll be happy to make recommendations.

Re: Open PDF file in iFrame on Chrome

Posted: Thu Jul 26, 2018 5:59 am
by paksilv
Hi akumar,
i'm interested in what you did.
Can you show me how you designed the iFrame for show an embedded pdf in it?
Thank you.

Re: Open PDF file in iFrame on Chrome

Posted: Mon Jul 30, 2018 1:41 pm
by Scott Klement
It does not appear that Mr. Kumar is still visiting these forums. (The question is from 4 years ago.)

All you would need to do set the "iframe url" property to a URL that points to your PDF. As I mentioned above, you cannot use a file:// URL -- for security reasons, browsers will only allow file URLs when the HTML page was also loaded from a file url.

Hope that helps