There are many times when you need to include many different types of documents in your Drupal projects, meaning as a part of your full-fledged content type of Drupal. One of the most commonly used type is PDF embed.

PDFs are considered to be problematic as different browsers treat PDF files in a different way. There are some browsers that are able to directly display them will others will make use of 3rd party applications, like Preview or Acrobat Reader. And then there are many others that only allow you to view the PDF after downloading them. These PDF files are especially harder when it comes to Drupal, as they as treated as binary black-boxes and nothing that Drupal is used to. One of the most common ways to deal with PDF embed into Drupal node is to simply let the users download the PDF file.

However, downloading is not the fastest or efficient manner and the users should be able to directly view them. There are few methods in which you can directly PDF embed file into Drupal node. Continue reading to know them in detail.

  1. PDF Embed For Drupal 6x Version

If you are using Drupal 6X, use the below mentioned steps.

  • Get to the node in which you want to embed PDF or simply click on Admin Menu -> Create Content -> Choose content type. And your new node will be created.
  • Now, go to the text area and select the input format as PHP.
  • Use this code there-

<p>
<embed src=”sample.pdf” width=”450″ height=”600″>
</p>

  • Here, the source (src) will be the path of the PDF file and the height and width can be resized as per the availability of space on the web page.
  • You can also add any other text if required. However, make sure that the input format is PHP. If at all any other code is used, it will remove the embed tag from the object. This means that you will be then required to manually write the HTML tags.
  1. For Drupal 7x Version

  • Just like the first method, get to the node in which you want to embed PDF simply click on Admin Menu -> Create Content -> Choose content type. And your new node will be created.
  • Now, here is the different in Version 7x. Once the node is created, you will see a text body area at the bottom of the page on the left side. Reach there and select Full HTML here. After that click on Disable Rich Text in that area.
  • Use this code there-

<p>
<iframe src=”sample.pdf” width=”450″ height=”600″></iframe>
</p>

  • Here, the source (src) will be the path of the PDF file and the height and width can be resized as per the availability of space on the web page.
  • You can also add any other text if required.

Once the content for the embedded pdf document is ready, you will be able to PDF embed as required. For instance, you can display the PDF right on the page, add the txt that you want to add and anything else that you want to insert in the description field.

These are the methods that can help you to PDF embed into the Drupal node. While placing the link to download the PDF is simple, it is not an ideal way to provide immediate access to the information available in the PDF file. Thus you can use the power of PDF Publishing by simply using the above mentioned methods, you will be able to directly display the PDF while using Drupal 6x or 7x.

comments (0)

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>