Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PDF inside iFrame not working on iOS

I have been trying to display PDF inside iFrame, it works well for all other browsers and platforms but not working with iOS. When I tried to access in chrome/Safari in iPhone/iPad, it shows the first page BUT does not allow to scroll down the PDF. And when it comes to HTML inside iFrame, it works perfectly, per my observation it looks like issue is with PDF inside iFrame on iOS. Tried all the links provided on various websites, overflow-auto, webkit scrolling, scrolling only y axis, position absolute/relative increasing the height which results in white pages and all other possible solutions, but no luck yet. The language of implementation is ASP.NET-C# where I am setting the iFrame source dynamically. Below is the source through which I am trying to achieve above task.

<div id="wrapper" class="Sales-container container">
    <iframe runat="server" id="Contents" class="myiframe" scrolling="no" width="100%" height="100%" frameborder="0" />        
</div>


.Sales-container{position:absolute !important;width:100%}

.container{margin-right:auto;margin-left:auto;padding-left:7px;padding-right:8px}

.myiframe{z-index:0;white-space:nowrap}

Any help would be much appreciated. Thanks.

like image 413
user3074648 Avatar asked Oct 18 '22 05:10

user3074648


1 Answers

If you don't need https, you can use the google docs viewer

make the src http://docs.google.com/gview?url=YOURADDRESSHERE&embedded=true

If that won't work for you, I'm currently looking into pdf.js

like image 62
user8429387 Avatar answered Oct 21 '22 01:10

user8429387