PHP code example of shuble / slurpy

1. Go to this page and download the library: Download shuble/slurpy 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/ */

    

shuble / slurpy example snippets










// Create a new factory instance, give it your path to pdftk binary
$factory = new \Shuble\Slurpy\Factory('/path/to/pdftk');

$slurpy = $factory->generateFdf('path/to/input.pdf', 'path/to/output.fdf');

$slurpy->generate();



use Shuble\Slurpy\Operation\OperationArgument\PageRange;

$inputs = array(
    '/path/to/file1.pdf',
    '/path/to/file2.pdf',
    array(
        'filepath'   => '/path/to/file3.pdf',
        'password'   => 'pa$$word',
        'start_page' => 1,
        'end_page'   => 'end',
        'qualifier'  => PageRange::QUALIFIER_ODD,
        'rotation'   => PageRange::ROTATION_EAST,
    )
);

$output = '/path/to/output.pdf';

$slurpy = $factory->cat($inputs, $output);



use Shuble\Slurpy\Operation\OperationArgument\PageRange;

$inputs = array(
    '/path/to/file1.pdf',
    '/path/to/file2.pdf',
    array(
        'filepath'   => '/path/to/file3.pdf',
        'password'   => 'pa$$word',
        'start_page' => 1,
        'end_page'   => 'end',
        'qualifier'  => PageRange::QUALIFIER_ODD,
        'rotation'   => PageRange::ROTATION_EAST,
    )
);

$output = '/path/to/output.pdf';

// Creates a Slurpy instance
$slurpy = $factory->shuffle($inputs, $output);



$input = '/path/to/input.pdf'; // or array('filepath' => '/path/to/input.pdf', 'password' => 'S3cr3t');
$background = '/path/to/background.pdf';
$output = '/path/to/output.pdf';
$multi = false // [Default], Or true for multibackground operation

// Creates a Slurpy instance
$slurpy = $factory->background($input, $background, $output, $multi);



$input = '/path/to/input.pdf'; // or array('filepath' => '/path/to/input.pdf', 'password' => 'S3cr3t');
$output = '/path/to/folder/pg_%02d.pdf';

$slurpy = $factory->burst($input, $output);



$input = '/path/to/input.pdf'; // or array('filepath' => '/path/to/input.pdf', 'password' => 'S3cr3t');
$output = '/path/to/folder/output.fdf';

$slurpy = $factory->generateFdf($input, $output);



$input = '/path/to/input.pdf'; // or array('filepath' => '/path/to/input.pdf', 'password' => 'S3cr3t');
$data = '/path/to/data.fdf'; // or data.xfdf
$output = '/path/to/folder/output.fdf';

$slurpy = $factory->fillForm($input, $data, $output);

// Or to flatten the resulting pdf.
$slurpy = $factory->fillForm($input, $data, $output, true);

wget http://getcomposer.org/composer.phar
php composer.phar install