PHP code example of msmahon / laravel-qpdf-php-wrapper
1. Go to this page and download the library: Download msmahon/laravel-qpdf-php-wrapper 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/ */
msmahon / laravel-qpdf-php-wrapper example snippets
// Get qpdf version
Qpdf::getQpdfVersion();
// Check if file is pdf
Qpdf::fileIsPdf($pathToFile);
// Get number of pages in a pdf
Qpdf::getNumberOfPages($pathToFile);
// Rotate range of files in a pdf
Qpdf::rotate($pathToFile, Msmahon\QpdfPhpWrapper\ENUMS\Rotation::RIGHT, '2-4');
// Trim pdf to page range
Qpdf::trimToRange($pathToFile, '4-z'); // "z" indicates end of file
// Copy range from pdf into a new pdf
Qpdf::copyPages($pathToFile, $pathToOutput, '1,3,5');
// Remove pages from a pdf
Qpdf::removePages($pathToFile, '2,4');
// Overlay a pdf on a range of pages
Qpdf::applyStamp($pathToFile, $fileToOverlay);
// Combine ranges from multiple files into a single pdf
$files = [
[$pathOne, '1'],
[$pathTwo, '4-7'],
[$pathThree, '9-z'],
// ...
];
Qpdf::combineRangesFromFiles($files, $pathToOutput);