Seamlessly create PDF thumbnails using Craft's built in image transformer.
For now this plugin is for internal use at Sitemill, feel free to use if it fits your purpose but no support is guaranteed.
This plugin requires Craft CMS 3.6 or later, Imagick, and Ghostscript.
To install the plugin, follow these instructions.
-
Open your terminal and go to your Craft project:
cd /path/to/project
-
Then tell Composer to load the plugin:
composer require sitemill/craft-auto-pdf
-
In the Control Panel, go to Settings → Plugins and click the “Install” button for Auto PDF.
Auto PDF will allow you to perform standard Craft transforms on any PDF file, as well as generating PDF thumbnails in the control panel.
Flattening a PDF can be pretty stressful for your server, so to help it out Auto PDF creates and stores a hi-res flattened version of your uploaded PDF and creates subsequent transforms from this.
Auto PDF requires you to set up a separate volume to store the hi-res image files. It's recommended that you hide this volume from your users to avoid confusion.
The compression quality, 'High' is recommended.
The resolution in DPI (dots per inch) that the PDF will be opened as, the higher the number the higher the quality before compression.
Auto PDF converts your PDFs when an asset is saved, therefore you can run ./craft resave/assets
to resave all your assets and generate the flattened counterparts.
Some things to do, and ideas for potential features:
- Delete counterpart on PDF deletion
- Look at pushing conversion to the job queue
Brought to you by Sitemill