I have pdf (managed) files on the server that I want users to view in a modal. This will be part of a module I'm creating. There are a couple of modules that help with this, but I haven't found a good way to incorporate those yet.

One of the most promising seems PDF Reader, but it requires you to create a node before it will do its magic. I would like to just use the file (managed file, stored using Drupal) and not create a separate node for each file.

I'm open for any suggestion. I have already implemented some CTools modals and Modal Forms (for easy display of Webform content) so I can work with that. But maybe it would be easier to create a node on the fly of the content type created for PDF Reader (say pdf file) and show that with a custom node--pdf-file.tpl.php. But how to create such a node then and how to get it in a modal?

Or maybe there is a more simple solution altogether. I'm using Drupal 7.

2 Answers 2


PDF Reader does not require you to create node. It only requires you to have file in a field, in any kind of entity. If your file is managed, something uses it (in usage table). just expose that data to entity api, make file a field and you are good.

If you want to avoid entities, this module is open source. Use it as a learning tool. Borrow it's code. Give credit where credit is due, and use as you need.

  • 2
    Thanks! I was sort of hoping this was possible and I'm not opposed to entities and even like doing things the "Drupal way". However, I'm not very familiair with the entity API so could you perhaps elaborate a bit on your steps? The files are uploaded using a Webform.
    – Whiskey
    Jun 25, 2013 at 16:11

You can use the native browser solution to render the PDF and colorbox for the popup (using the iframe method).

Colorbox is a light-weight customizable lightbox plugin for jQuery. This module allows for integration of Colorbox into Drupal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.