I had been using a module called "filebrowser" for implementing the file management system. This provides with a content type "Directory Listing" (listing all the uploaded files) through which a node can be added in which, the users can upload files, view or download them based on configuration set. I had been searching regarding a possible internal document viewer for drupal that would actually help in view

Files Listing Node The file types like pdf or images are opened via browser when clicked but the file types like doc, excel or PPT are downloaded when clicked on it.

Much appreciate any help or guidance regarding the possibilities of such in the Drupal8 where files can be viewed using a common internal document viewer. There have been few viewer modules but they seem to be suitable for embedding documents onto a page.

So far, I had been thinking of an approach where clicking on the files would actually convert them to the pdf format and viewed via browser, Being a newbie to the drupal, having a challenge in planning an approach to get this done. I believe I may have to develop a custom module integrating with the code of filebrowser module.


Your browser is natively handling those document types, i.e. most browsers can view a pdf or an image in the browser, but the other file types can't be viewed so they're downloaded.

You're on the right track with converting them to PDF or jpg for browser viewing, you might want to have an option for people to download the native file as well.

Google does something similar to this when they let you preview documents uploaded to Drive. I think that a custom module utilizing ImageMagick would be the way to go, there are some examples out there for Drupal 7, including PDFPreview (pdf to jpg), and I found this ImageMagick module that's ready for Drupal 8 that could give you a head start.

  • Hello Matt, Appreciate for the suggestion and sensible guidance towards this. My thoughts revolve around the way to extend this functionality for the filebrowser that I'm already using for the file management. Possibly may need to think how to link the file urls to the custom module that I would have to develop to handle the conversion to image/pdf for preview. Cheers! – Abhi Jan 5 '18 at 16:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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