Gallery3:Modules:pdf - Gallery Codex
Personal tools


From Gallery Codex

PDF Module

This module adds PDF support to Gallery.


  • Enables PDF as a valid file type: allows uploads as normal with the uploader, server_add, etc.
  • Shows PDF in resize view: Instead of showing the resize image (or movie), an embedded view of the PDF is shown.
  • Generates thumbnails: JPG thumbnails can be created from the first page of the PDF.



PDF requires Gallery v3.0.5 or newer. The API of older versions is not as flexible with adding PDF support.

The module includes PDF as a special "movie" type. As such, it requires that movie uploads be allowed (see the Admin | Settings | Movies menu).


Thumbnail generation requires Ghostscript to be installed. Ghostscript is an interpreter for the PostScript language and for PDF (see

The module will do its best to autodetect a Ghostscript installation, similar to how FFmpeg is detected. Although popular, Ghostscript is not installed on all Linux systems. To use Ghostscript without fully installing it, download a pre-compiled version ( Then, rename the binary file to "gs" and put it in Gallery's "bin" directory (e.g. "/gallery3/bin"), where Gallery will auto-detect it.

If Ghostscript is unavailable or disabled, a PDF icon is used for thumbnails instead.

Compatibility with other modules

Movie Overlay


If you use Movie Overlay, then by default it will include the same overlay atop PDFs. To hide this, check the "Hide movie overlay" option in the Admin | Settings | PDF screen. This feature has been tested with Movie Overlay v3.



If you have existing PDFs that were previously uploaded via the now-obsolete videos module, their mime types may have been set incorrectly in the database. The PDF module automatically corrects this during activation, correctly calling them "application/pdf".


Installing PDF is just like any other module:

  • Download and extract pdf, then put the pdf folder into your Gallery modules folder.
  • Log into your Gallery as an admin and activate the module in the Admin | Modules menu.
  • Change the settings as desired in the Admin | Settings | PDF menu.

Then, go to the Admin | Settings | PDF menu to check that the settings are as desired.


  • 2013/03/08, version 1

Initial release