I want to display PDF-file on my cite, so it can be viewed online - without downloading - even on on mobile devices. Host just the file (like www.site.com/file.pdf) works only for computers. Would be best to do it in pure html, but if not possible, OK.
Have tried many options, like
<object data="pdf/sample.pdf#view=Fit" type="application/pdf" width="100%" height="400px"> </object>
or
<embed src="filename.pdf#toolbar=0" width="500" height="375">
All of them or still download on some devices, or give an error (eg. when using embed - "plugin not supported").
Would also be happy to work without google docs viewer, if possible. Any ideas?
This depends solely on client (browser) capabilities whether it supports embedded PDF or not. Mobile browsers usually does not support it.
If browser does not support embedded PDF, you would need to render PDF as image or html or something that the browser is capable of displaying. See Mozzila's PDF.js project https://github.com/mozilla/pdf.js
Similar questions: