Skip to content
This repository has been archived by the owner on Apr 22, 2020. It is now read-only.
/ PDFFormsFiller Public archive

Fill Acrobat forms easily using pure PHP ! 💪

Notifications You must be signed in to change notification settings

m1m1s1ku/PDFFormsFiller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PDFFormsFiller

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. ;)