ghostfly/pdf-forms-filler

This package is abandoned and no longer maintained. No replacement package was suggested.

Fill Acrobat forms easily using pure PHP ! 💪

1.2.0 2017-12-11 20:38 UTC

This package is not auto-updated.

Last update: 2023-06-27 13:20:17 UTC


README

forthebadge forthebadge

Build Status Coverage Status Total Downloads License composer.lock

Fill Acrobat forms easily using pure PHP ! 💪

Requirements

  • PHP >= 7.1.0

Install :

$ composer require ghostfly/pdf-forms-filler

Example :

  • clone repository
  • go to example folder
  • composer install
  • run index.php

Usage :

You need to do a PDF Form with Acrobat, and the string to convert is given by this page :

Find Form Field coordinates

Use Converter who gives you a JSON Array containing fields with locations / page, in a form usable by the Generator

$converter = new Converter($string);
$converter->getPagesWithFieldsCount();
$json = $converter->formatFieldsAsJson($pages);

echo json;

Use PDF Generator with one array containing every field with id -> value And one array containing every field with id -> llx, lly, urx, ury, page

$pdfGenerator = new PDFGenerator($coords, $data, 'P', 'pt', 'A4');
$pdfGenerator->start($original, $dest);

If your original PDF is not handled by fpdf, you can convert it using this service :

Convert PDF with "Acrobat 4.0 (PDF 1.3)"

Don't care about form fields on file to send to generator, the locations are determined using the latest PDF format.

If you need a full example : index.php.

Tests

$ ./vendor/bin/phpunit tests

Code coverage

$ ./vendor/bin/phpunit tests --coverage-text --coverage-clover build/logs/clover.xml

Done. ;)