Can anybody share how to insert a pdf file in html? Please please specify the tags with example so that it would be easy to use the code. I would also like to know if there are any alternative tags available because few tags aren’t compatible on some browsers.
You can’t. Not reliably, anyway. Most browsers on most people’s computers are not set up to display PDFs natively within the browser, but to run Adobe Reader and load them into that. So then you just give a normal link to the PDF.
If you want to display a PDF within an actual web page then you can attempt to do so using an <img> tag and specifying the PDF as the src. It still relies on your visitor having a PDF viewer installed into their browser and would display the alt text in place of the PDF for anyone who doesn’t have such a viewer installed. The safest solution is to do as Stevie D suggested and link to the PDF so as to give the visitor the choice of how to open it.
As Steve and Stephen have said , there is no reliable way to do that. Besides, you weren’t thinking of displaying a PDF in lieu of coding and designing a PROPER HTML document, were you? Of course not
If The PDF can be shown… you see download:and the image. which is good, they can read it online or get the info by downloading it.
If not, then its just reads:“download: my pdf…”( or whatever you put in the ALT attribute) making the information still clearly accessible.
<a href=“some.pdf”> will always work because if the PDF can’t be displayed by the browser then it will be able to be opened in a separate program - provided that your visitor has something that can read PDFs.
<img src=“some.pdf”> will work provided that your visitor has their browser configured so it can display PDFs in the browser - bit will be a broken image if they do not.
Nothing wrong with that. There are plenty of times when a PDF is more suitable than an HTML page. Anything with lots of vector graphics, or large pages where layout is important, is generally better presented as a PDF. If you’re creating documents or reports in Word or Excel, particularly if they are a regular event, an automatic PDF output is probably more realistically achievable than a suitable HTML version, given the appalling attempts they make to convert to HTML themselves.
I’m not saying that laziness is a good reason to use PDF rather than HTML, but there may be good reasons due to the nature of the document or expediency/efficiency.
If you use <a href="file.pdf">Download File (PDF)</a>, that will work for everyone, as long as they have Adobe Reader installed (if they don’t have Adobe Reader installed then there’s nothing you can do, except give them a prompt to download it).[/font]
Sounds like i could use the <a href> tag because most of them would have pdf reader installed in their browsers. And yes, thats a great idea to prompt the visitors to install the adobe reader incase they don’t have a pdf reader. Thanks for your replies!