Skip to content

fawno/QPDF

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

PHP class for access QPDF C Interface

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published