I need to display a pdf file on a website. I tried many ways, but none of this worked for me. let me explain what I tried and why this is not suitable for me.
- I tried to insert pdf into html with
<object>and tags <embed>. its ok if the client browser flashed. but Android phones do not have this, so this is not a solution. plus iphone streching pdf, so it is not readable. - then I tried to use only the element
<iframe>. works fine only if the browser has a pdf plugin. in other cases, the browser starts downloading files. therefore, this is also not a solution. - then I tried using https://docs.google.com/gview?embedded=true&url=myfile.pdf . Well, here I have problems, because there is an error in google docs, because the file displays only once at a time. other attempts ended with error code 200 from Google. since you already realized that this is not a solution either.
- then I tried loading php libs, which should convert pdf to html (or image), but none of them worked beacuse. I am not so good at php, and sometimes he asked to install third-party libraries, so at the moment I also failed.
So now I'm stuck. I need to do something to display pdf on the page. I need some kind of cruciform / responsive solution. it would be great if you could help me find some service, for example https://docs.google.com/gview , which will work without errors or offer any other solution. there may be a small php lib with good documentation.
any help appriciated!
source
share