Easily implement PDFShift (https://pdfshift.io/) into Craft CMS.
This plugin requires Craft CMS 4.0 or 5.0, and PHP 8.0.2 or later.
For Craft CMS 3, use version 1.x of this plugin.
To install the plugin, follow these instructions (alternatively, install from the Craft Plugin Store).
-
Open your terminal and go to your Craft project:
cd /path/to/project -
Then tell Composer to load the plugin:
composer require graftechnology/pdfshift -
In the Control Panel, go to Settings → Plugins and click the "Install" button for PDFShift.
-
Go to Settings → Plugins → PDFShift → Settings and enter your PDFShift API Key. The setting accepts an environment variable reference (e.g.
$PDFSHIFT_API_KEY), which keeps the key out of project config.
Note: While testing, you can pass sandbox: true in your conversion options for free, watermarked conversions that don't count against your plan.
Read more here https://docs.pdfshift.io/
Stop wasting time implementing and maintaining a third-party software/library.
With PDFShift, rely on an up-to-date, high-fidelity conversion API with no maintenance costs.
Returns a temporary URL to the converted PDF (hosted by PDFShift for two days):
{{ craft.pdfShift.link({
source: 'https://www.google.com/',
filename: 'google.pdf',
format: 'Letter',
sandbox: true
}) }}Streams the converted PDF to the browser as a download:
{{ craft.pdfShift.download({
source: 'https://www.google.com/',
filename: 'google.pdf',
format: 'Letter',
sandbox: true
}) }}source is the only required option. Everything else is optional.
filename is optional and defaults to document.pdf.
All other options are passed straight through to the PDFShift v3 API. The full list is here: https://docs.pdfshift.io/api-reference/convert-to-pdf
Brought to you by Graf Technology, LLC
