PHP code example of uiii / processwire-fieldtypepdf

1. Go to this page and download the library: Download uiii/processwire-fieldtypepdf library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

uiii / processwire-fieldtypepdf example snippets


$image = $page->pdfFile->toImage();
$image->size(100, 100);

$options = array(
	'suffix' => array('suffix1', 'suffix2'), // suffixes used in filename
	'forceNew' => false, // if TRUE the image is regenerated if already exists
	'format' => 'JPEG', // image format
	'extension' => 'jpg', // image file extension
	'background' => '#FFFFFF', // background color used when the PDF has transparent background
	'resolution' => '300x300', // resolution used when reading the PDF
	'colorspace' => Imagick::COLORSPACE_RGB, // colorspace used when reading the PDF
	'imagickOptions' => array( // ImageMagick options
		'pdf:use-cropbox=true'
	)
)

$image = $page->pdf->toImage();
$image->size($width, $height);