How to display pdf inside a div

This is quick tutorial about display pdf inside div using HTML Object element. You can easily display any .pdf file inside div, You just only need to set the path of the pdf and all done.



See code snippets.

<div class="pdf">
    <object data="pdf_file_name.pdf" type="application/pdf" width="600" height="400">
        alt : <a href="pdf_file_name.pdf">PDF TITLE</a>
    </object>
</div>

Note: This code support only browsers which have pdf viewer feature.
Where alt: tag means suppose your browser don’t have pdf viewer feature, then your pdf title with link will be automatically loaded which you have assigned.

2 Replies to “How to display pdf inside a div”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.