5

Does <object> tag widely supported in mobile browser?! I'm trying to embed a PDF file but it seems that it is not supported.

I'm using the following html for viewing PDF

<object data="pdf/sample.pdf#view=Fit" type="application/pdf" width="100%" height="400px"> 
    <p>It appears you don't have Adobe Reader or PDF support in this web browser. <a rel="external" href="pdf/sample.pdf">Click here to download the PDF</a></p>
</object>

and using the PDFObject but both of them are not working in mobile browsers!

Raj
  • 22,346
  • 14
  • 99
  • 142
Ahmed Atia
  • 17,848
  • 25
  • 91
  • 133

3 Answers3

8

No browsers can support native rendering of PDF files without a plugin (except Google Chrome as claimed here).

But you can use Google Docs Viewer to display PDF files inside a webpage like explained here.

Pang
  • 9,564
  • 146
  • 81
  • 122
Raj
  • 22,346
  • 14
  • 99
  • 142
4

Load your url inside iframe using google docs

<iframe id="pdfviewer" src="http://docs.google.com/gview?embedded=true&url=YOUR_URL_HERE&amp;embedded=true" frameborder="0" width="100%" height="100%"></iframe>
itzhar
  • 12,743
  • 6
  • 56
  • 63
2

If embedding isn't important to you you could just link to the PDF on a seperate page.

Safari (and UIWebViews) supports the rendering of PDFs, im not a 100% sure about Android but I suspect its a similar story.

PDF in safari

Robert
  • 37,670
  • 37
  • 171
  • 213