9

I need to view pdf file embed with google drive link and view link in iframe.

I have tried following code:

<iframe src="https://drive.google.com/viewerng/viewer?url=https://library.osu.edu/assets/Documents/SEL/QuickConvertWordPDF.pdf" width="400px" height="300px"  />

Advance thanks..

Deenadhayalan Manoharan
  • 5,436
  • 14
  • 30
  • 50
user2725587
  • 115
  • 1
  • 2
  • 8

3 Answers3

30

Try this..

<iframe src="https://drive.google.com/viewerng/viewer?
url=https://library.osu.edu/assets/Documents/SEL/QuickConvertWordPDF.pdf?
pid=explorer&efh=false&a=v&chrome=false&embedded=true" width="400px" height="300px"  />
Deenadhayalan Manoharan
  • 5,436
  • 14
  • 30
  • 50
  • 5
    Please read How to Answer. Even if the code fixes the problem, you should include some context/explanation surrounding your code to make it more useful to others. – Mr Mush Nov 21 '17 at 17:59
  • 1
    I agree with @MrMush -- I also agree this accepted solution worked for me. :) – jimiayler Jan 24 '22 at 18:49
1

This works:

<iframe src="https://drive.google.com/file/d/(your file id)/preview?usp=embed_googleplus" style="border: 0; top: 0; left: 0; width: 640; height: 700; position: absolute;" allowfullscreen></iframe>
  • 2
    Please read [How to Answer](https://stackoverflow.com/help/how-to-answer). Even if the code fixes the problem, you should include some context/explanation surrounding your code to make it more useful to others. – Mr Mush Aug 23 '17 at 13:06
  • It's pretty self-explanatory in this situation, look at the answer above mine for example – MindSpaceApocalypse Nov 21 '17 at 16:59
  • Please do creative stuff by answering the questions and not shooting down others on trivial things. At least he is helping by trying to answer the question and its not that big answer that is difficult to understand without proper format @MrMush – samir Feb 15 '19 at 04:35
  • 1
    As I commented on both answers, an explanation should be added. This is Stackoverflow policy and there is good reason for it. I don't need to be creative and give a better answer to see that both answers are lacking. What made it work? Clearly it was not obvious to the person that posted the question, non the less, both answers are different and still work. A few words explaining why this way solves the issue will go and long way other than giving a copy paste solution. – Mr Mush Feb 16 '19 at 01:03
  • Among other things, this does not solve the person's question: the URL wanting to be embedded is not on a Google Drive, it is hosted at "https://library.osu.edu." Like this person, I'm looking for a solution to view embedded PDFs on pages that are not (or not necessarily) hosted on an actual Google Drive. – jimiayler Jan 24 '22 at 18:45
1

You can use like this

<iframe src="https://docs.google.com/file/d/(your file id)/preview"></iframe>
Vivek Kapoor
  • 431
  • 6
  • 7
  • Among other things, this does not solve the person's question: the URL wanting to be embedded is not on a Google Drive, it is hosted at "https://library.osu.edu." Like this person, I'm looking for a solution to view embedded PDFs on pages that are not (or not necessarily) hosted on an actual Google Drive. – jimiayler Jan 24 '22 at 18:45