PDF Thumbnail Modules

Most of these require Imagick installed on the server, and use the spatie/pdf-to-image library to generate the thumbnail.

See notes on troubleshooting Imagick.

Media PDF Thumbnail
View Media PDF Thumbnail on Drupal.orgMedia PDF ThumbnailCovered by the Drupal security advisory policy (3,488 installs)
Works with media thumbnail field.
Docs

PDF Preview
View PDFPreview on Drupal.orgPDFPreviewCovered by the Drupal security advisory policy (2,463 installs)
Works on file fields, thumbnail of first page.
README

Media Thumbnails PDF
View Media Thumbnails PDF on Drupal.orgMedia Thumbnails PDFCovered by the Drupal security advisory policy (3,526 installs)
Uses View Media Thumbnails on Drupal.orgMedia ThumbnailsCovered by the Drupal security advisory policy (7,306 installs) framework.

File PDF Preview
View File PDF Preview on Drupal.orgFile PDF PreviewCovered by the Drupal security advisory policy (28 installs)
Only 25 users.

PDF to ImageFIeld
View PDF to ImageField on Drupal.orgPDF to ImageFieldCovered by the Drupal security advisory policy (95 installs)
View on GitLab #3498222No D11 compatibility Status: Closed
67 D10 users.

PDF Preview Image
View PDF Preview Image on Drupal.orgPDF Preview ImageCovered by the Drupal security advisory policy (113 installs)
50 users.

Check if the Imagick php extension is enabled: php -i | grep -i imagick.
*php -i gets the info, and grep -i ignores case when matching imagick.

imagick module => enabled
imagick module version => 3.7.0
imagick classes => Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator, ImagickKernel
Imagick compiled with ImageMagick version => ImageMagick 7.1.1-43 Q16-HDRI x86_64 22550 https://imagemagick.org
...

Looks good, running the latest version.

To find the policy file in use, try identify -list policy.

Path: /etc/ImageMagick-6/policy.xml
  Policy: Resource
    name: disk
    value: 1GiB

But this shows the path for Imagick 6, when PHP is using 7.

It turns out, this host is configured differently between the cli and webserver.

To find the path to the policy file in use by PHP, add this snippet to a imagick-info.php file on your server and open it in your browser. The CONFIGURE_PATH should point to the policy.xml location.

[CONFIGURE_PATH] => /opt/alt/alt-ImageMagick/etc/ImageMagick-7/

Now open /opt/alt/alt-ImageMagick/etc/ImageMagick-7/policy.xml to see the config.

If there are any <policy> lines with a pattern including "PDF" and domain="coder", then the rights must be "read|write" and not "none".

If there is no <policy> for PDF, that's ok too. Otherwise, it will throw an error.

Tags