OREGON STATE UNIVERSITY

How do I embed a PDF file into a Drupal node?

It is possible to embed a pdf so that the pdf is actually a viewable graphical object versus just a link.  Unfortunately this method requires that the PHP Input Format is used, which means:

  • Authors will not be able to edit this content - either an Advanced Author or Administrator must
  • The rich text editor will not be available for use on future edits so whomever edits this content would have to understand HTML, at a minimum.

To embed a file, it must first be available within the file browser.  Please refer to the FAQ How Do I Upload Files Into Drupal, provided below, for instructions on how the different ways to upload a file into your file browser.

To embed a PDF into a node, do the following:

  1. Go to the node you wish to embed the PDF into, or go to Admin menu > Create Content > content type of your choice to create a new node.
  2. In the text body area, set the Input format to PHP.
  3. Enter the following code in the text area - where the src (source) is actually the directory path needed for your item.
  4. <p>
    <embed src="../sites/default/files/samples/sample.pdf" width="550" height="700">
    </p>
  5. To resize the width of your embedded pdf, change the width property to the desired value.
  6. To resize the height of your embedded pdf, change the height property to the desired value.
  7. Add any additional text. Please note your input format must remain at PHP.  Using any other input format will strip the embed code from your object.  This means you will have to hand code HTML tags.