Display PDF document within web app iframe on iPad - ipad

I have an HTML5 web app running on webkit browsers. The app contains an iframe used to display pdf documents (and other documents such as images etc). I set the src of the iframe to the pdf or image. On an iPad with no pdf reading software the iframe is blank - it seems an iPad out of the box has no ability to display pdfs.
Given the iframe context, what are my options for displaying the pdf (and other docs) on the ipad?
Thanks.

Related

WKWebview won't show PDF Annotation

I'm using WKWebView to load PDF files. I've found that all the annotations in the pdf are invisible.
Does anyone know how to fix this bug?
If you open the PDFs in Adobe Acrobat do the annotations display?
In a PDF 1.7 and earlier file, annotations are not required to have their appearance defined in the file and instead PDF viewing applications can generate them when the PDF is opened. Not all PDF viewing applications are capable of generating the appearance of all annotation types though (there are many different annotation types in PDF).
If Acrobat displays the annotations and WKWebview does not, then the annotations are most likely missing their appearances and Acrobat is generating them from what is stored in the PDF.
In PDF 2.0 (recently published as a standard), annotations are required to have a defined normal appearance so that PDF viewers do not have to generate the appearance any longer which will provide a much more consistent experience for those who are reading PDFs (it will be a while before this catches on though).
There are a number of tools out there that can be used to create the appearance for annotations and save them into the PDF so if you determine that the annotations are missing their appearances you can get one of those tools and run the PDFs through it before presenting them in your WKWebview.

Partial display of pdf in iframe of iOS browser

We have a main page in which we are having pdf links. On click of these links the page will redirect to another page which contains iframe. The pdf document will be displayed in that iframe. This scenario is working in other OS other than IOS. In IOS the iframe is showing only the pdf part of screen size. It is not providing scroll bar as well for us to scroll down. We tried changing css Overflow: scroll but did not work.
If you are using iOS 8, there is a bug with displaying PDFs in iframes that basically truncates the PDF file to display only the first page like an image would display. Apple has yet to come out with a fix for this (4+ major releases into iOS 8). This affected an application used by my salesforce in the filed on their tablets/phones so I have to create a work-around. Until Apple fixes their issue this is working for us.
Interim solution: Use Google Docs Viewer as pass through for documents
Little know feature of google docs is the ability to pass through a URL to a PDF. Works like a charm in iOS 8.
//url of your PDF hosted wherever you currently keep it
var pdfurl = 'http://www.manning.com/crowther/HH5aCSS3_SampleCh-01.pdf';
//wrap the url with the google docs gview url
pdfurl = 'http://docs.google.com/gview?url=' + pdfurl + '&embedded=true';
Maybe this workaround can help you too.
JSFiddle Demo

Pdf / Docx preview in a Phonegap app on iOS

I need to open Pdf / Docx documents for preview from a Phonegap app.
On Android it's possible to open files in extenal apps using WebIntent plugin.
Now what about iOS? It seems possible to do this entirely with the build-in browser (which surprisingly does render docx) by creating a html page with a header and a back button in the top and an iframe taking up the rest of the screen.
It would be great if the user could zoom and drag the document while the header would remain stationary, but I couldn't get to zoom working at all inside the iframe.
Any suggestions?
I ended up using InAppBrowser Plugin with enableViewportScale=yes. It displays a toolbar with a back button with custom caption. It would be better if I can add my own toolbar, so the navigation is consistent in the whole app, but this is good enough.

ios scroll webview to bookmark in pdf

my webview displays a pdf file that has bookmarks for certain pages. How to I get the code to automatically scroll to the page of a particular bookmark in the pdf?
You better use iOS PDF viewers. (E.g. FastPdfKit)

Bookmarking an embedded pdf on iPad

I have a web page with an embedded pdf file. I can bookmark pages in the pdf using the query string and passing those values to the source tag.
While this works well on a desktop browser, I can't seem to get bookmarks to work in an iPad. Two finger scrolling works, but not the bookmarks.
Anyone have any ideas?

Resources