How to Display a PDF on Drupal

Written by hosam el-aker

Share

Tweet

Share

Email

Drupal is a feature-rich Web content management system with a deep, open-source code base. It is free to download and use, and you are free to remove from, add to and otherwise alter the code however you want. One of the features of Drupal is the ability to use a variety of different file types, including Portable Document Format (PDF) files. Though Drupal comes with the ability to display PDFs, the feature is not enabled by default. Displaying PDF files on your Drupal website requires the insertion of HTML code.

Skill level:

Easy

Other People Are Reading

Instructions

1

Navigate to your Drupal website's admin control panel and log in. This is usually found at your domain name followed by "/admin," for example, http://website.com/admin.

>

2

Click "Content" at the top of the screen. Click "Edit" across from the content in which you would like to display a PDF file, in the "Operations" column.

3

Insert the following HTML code where you would like to display the PDF file:

Edit "your_pdf_file_path" accordingly, as this refers to the path of the PDF file you would like to display. The ability for PDF files to be displayed depends in part on the user's browser configuration settings. If the visitor to whom you wish to show the PDF file does not have his browser configured accordingly or if you do not know if his browser is configured accordingly, add the following snippet of HTML code instead of the one above:

This code adds a link to the PDF file as well. Edit "your_pdf_file_path" to the path of the PDF file you wish to display. "Download PDF file" is the text that is displayed in the download link. You can make this say whatever you want.

4

Click "Save" when you have finished entering the HTML code to display your PDF. Your PDF file will now be displayed the next time a visitor navigates to that content.