Summary: Generate thumbnail images for PDFs
Version: 1.0.1 (2020-05-12)
Prerequisites: ImageMagick
Maintainer: Michael Eager
Categories: Images, Uploads
Download: PDFThumb.phpΔ

Questions answered by this recipe

How can I display a PDF thumbnail on my wiki page?


This recipe displays a thumbnail of the first page of a PDF, along with the name of the file as a caption. Both image and caption link to the PDF file.

A JPEG of the first page of the PDF will be created if one does not exist. If the file has not been attached, an upload link will be displayed.

The (:pdfthumb:) markup allows specifying options on a per-page basis.


  • download PDFThumb.phpΔ to your cookbook directory.
  • add the following line to your config.php file:


Configuration options (defaults shown):

  • $PDFThumb['size'] = 100; // Largest dimension for thumbnail width/height
  • $PDFThumb['caption'] = TRUE; // Display caption


Add PDF:filename.pdf anywhere your page.

For example:


Files must have the extension .pdf or .PDF.

Markup (:pdfthumb <option>:) only affects current page.

  • size=100 // Set thumbnail max width/height
  • caption // Display captions
  • nocaption // Do not display captions
  • regen // Regenerate thumbnails


Generating thumbnail jpegs is slow and may result in the PHP server being interrupted. Reloading the page will continue generation of thumbnail images.

To do / some day / maybe

  • Use CSS to set how image is displayed and where caption appears

Change log / Release notes

  • 2020-04-23: Initial version
  • 2020-05-12: Add configuration options, make caption optional, option to regenerate thumbnails.

See also


Michael Eager


See discussion at PDFThumb-Talk?

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.