Skip to content

jacobgraf/pdfshift

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PDFShift plugin for Craft CMS

Easily implement PDFShift (https://pdfshift.io/) into Craft CMS.

Screenshot

Requirements

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.

Installation

To install the plugin, follow these instructions (alternatively, install from the Craft Plugin Store).

  1. Open your terminal and go to your Craft project:

     cd /path/to/project
    
  2. Then tell Composer to load the plugin:

     composer require graftechnology/pdfshift
    
  3. In the Control Panel, go to Settings → Plugins and click the "Install" button for PDFShift.

  4. 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/

PDFShift Overview

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.

https://pdfshift.io/

Using PDFShift

Return URL to PDF Document

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
}) }}
Download PDF Document

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
}) }}

Options

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

About

PdfShift plugin for Craft CMS 3.x

Resources

License

Stars

1 star

Watchers

1 watching

Forks

Packages

 
 
 

Contributors