2

I am working on content oriented website and using I frames to display pdf.when I am opening that page in the mobile browser it starts automatically starts downloading the pdf,how could I display pdf file using iframe in browser instead of downloading.

Now i am thinking to convert pdf's into HTML and pass HTML file as source in frame.

Suggest me some other alternative if I'm wrong and if I'm right then suggested me some pdf to HTML convertors,which can convert in bulk as I have very large number of files.

**EDIT:**thanks,it worked but can how can i stop it from being download,i'm thinking of disabling right click,will it work

Magnotta
  • 933
  • 11
  • 34

2 Answers2

0

One thing you can do is to upload your PDF somewhere and just use its URL. You can also use Google PDF viewer for this purpose.

For more information check this Recommended way to embed PDF in HTML?

Community
  • 1
  • 1
  • if i upload pdf somewhere and use it url in iframe,it automatically get download in android mobile browser – Magnotta Jun 23 '16 at 14:03
0

There are many ways you can make this possible one of them would be use the following <embed> element with source link to your pdf file :

<embed src="http://example.com/yourfile.pdf" width="1000" height="500" type='application/pdf'>

Another one is you can use the javascript library also :

pdf.js

and one last i have in mind is you can use google docs api url to view the : docx,doc,xls,pdf,ppt or any other document file online by using the method below:

https://docs.google.com/viewer?url=http://example.com/yourfile.pdf

Arsh Singh
  • 1,580
  • 1
  • 11
  • 31
  • do i need to put https://docs.google.com/viewer?url=http://example.com/yourfile.pdf in iframe or embed – Magnotta Jun 23 '16 at 14:24
  • You can do both of the things , it will work , but if you use the google link , you can view the pdf without iframe or embed as well – Arsh Singh Jun 23 '16 at 14:29
  • can you type an example for google link,because in my local host google link is working fine but when i am making it live content does n't load – Magnotta Jun 23 '16 at 14:34
  • Is your pdf on live server? Google needs the pdf's files to be online on some server , as it works perfectly normal for me – Arsh Singh Jun 23 '16 at 14:35
  • thanks,it worked but can how can i stop it from being download,i'm thinking of disabling right click,will it work – Magnotta Jun 25 '16 at 06:12