PHP class for access QPDF C Interface
The QPDF libary (dll or so).
php composer.phar require "fawno/qpdf"
<?php
require 'vendor/autoload.php';
use Fawno\QPDF\QPDF;
$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();
}