Example
<a href="/files/report.pdf">
Click here
</a><a href="/files/report.pdf" download>
Download the annual report (PDF, 2 MB)
</a>The link text tells users what the file is and how big it is before they open it.
Common mistakes
- Links named "Click here" that open a PDF without warning.
- Publishing scanned PDFs with no text layer, so screen readers and search see nothing.
Key points
- Links to PDFs say the file type and size in the link text.
- Important content is also available as an HTML page, not only inside a PDF.
- Generated PDFs are tagged, with a title, language and reading order for screen readers.
- Embedded PDFs in
<iframe>or<object>have a title and a download link as fallback.
Interview questions
How do I embed a PDF in HTML?
Use <iframe src="file.pdf" title="..."> or <object>, and always include a download link because mobile browsers often do not render PDFs inline.
Are PDFs bad for accessibility?
Not by default, but many PDFs lack tags, headings and text. HTML is usually easier to make accessible.
Can search engines index PDF files?
Yes, search engines index text in PDFs, but scanned image-only PDFs need OCR to be searchable.