Open PDF file in iFrame on Chrome

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
akumar
New User
Posts: 7
Joined: Fri May 24, 2013 10:48 am
First Name: Amar
Last Name: Kumar
Company Name: Alfa Insurance
Phone: 6153122729
State / Province: Tennessee
Country: United States
Contact:

Open PDF file in iFrame on Chrome

Post 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!!!
Attachments
iframe issue in Chrome.docx
(502.61 KiB) Downloaded 339 times
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Open PDF file in iFrame on Chrome

Post 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?
akumar
New User
Posts: 7
Joined: Fri May 24, 2013 10:48 am
First Name: Amar
Last Name: Kumar
Company Name: Alfa Insurance
Phone: 6153122729
State / Province: Tennessee
Country: United States
Contact:

Re: Open PDF file in iFrame on Chrome

Post 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?
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Open PDF file in iFrame on Chrome

Post 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.
paksilv
New User
Posts: 11
Joined: Thu Oct 20, 2016 5:56 am
First Name: silvano
Last Name: pacifici
Company Name: VIBA SPA
State / Province: Outside Canada/USA
Country: Italy
Contact:

Re: Open PDF file in iFrame on Chrome

Post 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.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Open PDF file in iFrame on Chrome

Post 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
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests