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
https://www.drupal.org/project/media_pdf_thumbnail
Works with media thumbnail field.
Docs

PDF Preview
https://www.drupal.org/project/pdfpreview
Works on file fields, thumbnail of first page.
README

Media Thumbnails PDF
https://www.drupal.org/project/media_thumbnails_pdf
Uses Media Thumbnails framework.

File PDF Preview
https://www.drupal.org/project/file_pdf_preview
Only 25 users.

PDF to ImageFIeld
https://www.drupal.org/project/pdf_to_imagefield
No D11 compatibility
67 D10 users.

PDF Preview Image
https://www.drupal.org/project/pdf_preview_image
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