fawno / qpdf
PHP class for access QPDF C Interface
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Language:C
Requires
- php: >=7.4.0
- ext-ffi: *
This package is auto-updated.
Last update: 2024-12-05 22:57:01 UTC
README
QPDF
PHP class for access QPDF C Interface
Requirements
The QPDF libary (dll or so).
Instalation
php composer.phar require "fawno/qpdf"
<?php require 'vendor/autoload.php'; use Fawno\QPDF\QPDF;
Example
$lib_path = __DIR__ . '/qpdf28.dll'; $qpdf = new QPDF($lib_path); $filename = __DIR__ . '/encrypted_document.pdf'; $password = 'secret_password'; $qpdf->readFile($filename, $password); if ($qpdf->hasError()) { $error = $qpdf->getError(); print_r($error); die(); } if ($qpdf->hasWarning()) { $warning = $qpdf->getWarning(); print_r($warning); } $filename = __DIR__ . '/document_without_encrypt.pdf'; $qpdf->initWrite($filename); if ($qpdf->hasError()) { $error = $qpdf->getError(); print_r($error); die(); } $qpdf->preserveEncryption(false); $qpdf->write(); if ($qpdf->hasError()) { $error = $qpdf->getError(); print_r($error); die(); }