This project is not covered by Drupal’s security advisory policy.

This module wraps php-pdftk which is a PDF conversion and form utility based on pdftk.

Brings the power of pdftk to Drupal. Fill forms, split PDFs, add backgrounds or overlays, and more.

Requirements

The pdftk command must be installed on your system.

The php-pdftk library and it's dependencies must be installed in the `sites/all/library` directory.

This module requires the following modules:

Installation

Ensure that pdftk is installed on your system.

Download the php-pdftk library. You can download it using drush make --no-core -y <module_path>/phppdftk.make which will install php-pdftk and it's dependencies.

Enable the module.

Usage

The PhpPdftk class contained in this module can be used identically to the Pdf class in the php-pdftk library. There are a lot of great usage examples on the php-pdftk github: https://github.com/mikehaertl/php-pdftk

Example

Add background PDF

Add another PDF file as a background.

if (($library = libraries_load('phppdftk')) && !empty($library['loaded'])) {
  // Set background from another PDF (first page repeated)
  $pdf = new PhpPdftk('/path/my.pdf');
  $pdf->background('/path/back.pdf')
      ->saveAs('/path/watermarked.pdf');

  // Set background from another PDF (one page each)
  $pdf = new PhpPdftk('/path/my.pdf');
  $pdf->multiBackground('/path/back_pages.pdf')
      ->saveAs('/path/watermarked.pdf');
}
Supporting organizations: 
Sponsor

Project information

Releases