fawno/qpdf

PHP class for access QPDF C Interface

Maintainers

Details

github.com/fawno/QPDF

Source

Issues

Installs: 6

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Language:C

0.0.4 2022-06-05 17:08 UTC

This package is auto-updated.

Last update: 2024-12-05 22:57:01 UTC


README

GitHub license GitHub tag (latest SemVer) Packagist Packagist Downloads GitHub issues GitHub forks GitHub stars

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();
	}