PDFThumb
Questions answered by this recipe
How can I display a PDF thumbnail on my wiki page?
Description
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.
Installation
- download PDFThumb.phpΔ to your cookbook directory.
- add the following line to your config.php file:
include_once($FarmD.'/cookbook/PDFThumb.php');
Configuration
Configuration options (defaults shown):
- $PDFThumb['size'] = 100; // Largest dimension for thumbnail width/height
- $PDFThumb['caption'] = TRUE; // Display caption
Usage
Add PDF:filename.pdf
anywhere your page.
For example:
PDF:document.pdf
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
Notes
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
Contributors
Comments
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.