coure2011
coure2011

Reputation: 42404

showing pdf document in safari

I want to show pdf document embedded in html. I am trying code like this but its showing me missing plugin error.

But if I drag the same pdf file to browser it opens it nicely. Why its asking for plugin in html document?

<object data="pdfobject.pdf#view=FitV" type="application/pdf" width="100%" height="100%"></object>

Upvotes: 5

Views: 20718

Answers (3)

Cymbals
Cymbals

Reputation: 1174

Safari just updated their browser which will now properly display pdf's in iframes. Back in the summer of 2011 it did not. Make sure you use an id.

 <div id="scroller">
<iframe name="myiframe" id="myiframe" src="viewpdf-safari.php">
</div>

Then in the css add

#myiframe {width:600px; height:100%;} 

Here's the problem you'll run into: As of today, the iframe will display the pdf, yes, but navigation thru the pdf is a pain. With touch scrolling, the whole iframe will try to scroll, and not the pdf, forcing you to use two finger scrolling (one finger to hold down the iframe, the other to slow-scroll).

Other browsers filler the whole width on iframe properly, but safari does not right now. I'd suggest having a button or a link to open the pdf directly in a new window for now, so that users won't have two-finger-hell.

Another alternative is to try to control the scrolling with the outer div, as mentioned in the link below, but I couldn't get it to work.

how to properly display an iFrame in mobile safari

Upvotes: 10

Omtara
Omtara

Reputation: 3001

Opening a PDF file directly is different than opening an HTML file containing a PDF. Try using an IFRAME as the other post suggests, or use some PDF2SWF viewer listed in the following post:

Recommended way to embed PDF in HTML?

Upvotes: 0

rob mayoff
rob mayoff

Reputation: 385500

Try using an IFRAME to show the document instead of using an OBJECT.

Upvotes: 0

Related Questions