innoweb / silverstripe-pdf-image-converter
Converts the first page of a PDF file to an image
Installs: 18
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:silverstripe-vendormodule
Requires
- ext-imagick: *
- silverstripe/assets: ^2.3
This package is auto-updated.
Last update: 2024-11-12 21:59:11 UTC
README
Overview
This module converts the first page of a PDF file to an image.
It uses the high level conversion API introduced in Silverstripe 5.3, see the image documentation.
Requirements
- Silverstripe Assets 2.3 (Silverstripe 5.3)
- ext-imagick
Installation
Install the module using composer:
composer require innoweb/silverstripe-pdf-image-converter
Then run dev/build.
Usage
To display a thumbnail of a PDF file in a template you can convertthe PDF to an image in the template:
<img src="$PDFDocument.Convert('jpg').Pad(100,150).URL" height="150" width="100" alt="">
You can use the Quality
method to set a specific image quality for different formats:
<picture>
<source type="image/webp" srcset="$PDFDocument.Convert('webp').Quality(80).Pad(100,150).URL">
<img src="$PDFDocument.Convert('jpg').Pad(100,150).URL" height="150" width="100" alt="">
</picture>
License
BSD 3-Clause License, see License