Skip to content

Commit 2db6f6a

Browse files
committed
add customization to README.md
1 parent 0375dd9 commit 2db6f6a

File tree

1 file changed

+51
-14
lines changed

1 file changed

+51
-14
lines changed

README.md

Lines changed: 51 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,81 @@
1-
# Form filling
1+
# PDF Form Filling with FPDM
2+
3+
## Package
4+
25
The FPDM class allows to fill out PDF forms, i.e. populate fields of a PDF file. It is **developed by Olivier Plathey**, author of the [FDPF Library](http://www.fpdf.org/), and has been released as [Skript 93](http://www.fpdf.org/en/script/script93.php).
36

47
I created this repository for the following reasons:
8+
59
- make the current FPDM source available via [composer](https://packagist.org/packages/tmw/fpdm)
610
- fix compatibility issues with PHP 7.x
7-
- bugfixing
11+
- bugfixing (changes to the original codebase are prefixed with `//FIX: change description` and ended with `//ENDFIX`)
12+
- add support for checkboxes (disabled by default, see customization to activate)
813

914
This repository only contains the separate php class written for form filling. If you are looking for a repository containing the main FPDF Library, please head over to [github.com/Setasign/FPDF](https://github.com/Setasign/FPDF).
1015

1116
Once again, all credits to Olivier Plathey for providing an easy to use extension to his FPDF library!
1217

13-
# Version
18+
## Version
19+
1420
Based on version 2.9 (2017-05-11) available from [fpdf.org/en/script/script93.php](http://www.fpdf.org/en/script/script93.php).
1521

1622
Note: If you find that a new version has been hosted on fpdf.org, please do not hesitate to drop me [a short note](https://github.com/codeshell/fpdm/issues) to make sure I do not miss it out.
1723

18-
# Usage
19-
## Composer (autoload)
20-
As this package specifies autoloading information, you can [autoload](https://getcomposer.org/doc/01-basic-usage.md#autoloading) all the dependencies by adding this to your code:
24+
## Usage
25+
26+
### Composer (autoload)
27+
28+
The preferred way of making FPDM available in your app is to install it via composer with
29+
30+
`composer require tmw/fpdm`
31+
32+
and then to [autoload](https://getcomposer.org/doc/01-basic-usage.md#autoloading) it by adding this to your code:
2133

2234
`require 'vendor/autoload.php';`
2335

24-
## Standalone Script
25-
Load the class file by calling
36+
### Standalone Script (legacy)
37+
38+
Load the top level entry point by calling
2639

2740
`require_once '/abolute/path/to/fpdm.php';`
2841

2942
or
3043

3144
`require_once './relative/path/to/fpdm.php';`
3245

46+
## Customization
47+
48+
Added support for checkboxes. The feature is not heavily tested but works for me. Can be enabled with
49+
50+
```php
51+
<?php
52+
$fields = array(
53+
'my_checkbox' => 'anything that evaluates to true.', // checkbox will be checked; Careful, that includes ANY non-empty string (even "no" or "unchecked")
54+
'another_checkbox' => false, // checkbox will be UNchecked; empty string or 0 work as well
55+
);
56+
57+
$pdf = new FPDM('template.pdf');
58+
$pdf->useCheckboxParser = true;
59+
$pdf->Load($fields, false); // second parameter: false if field values are in ISO-8859-1, true if UTF-8
60+
$pdf->Merge();
61+
$pdf->Output();
62+
```
63+
64+
You don't have to figure out the technical names of checkbox states. They are retrieved during the parsing process.
65+
66+
## Original Info Page
67+
68+
### Information
3369

34-
# Original Info Page
35-
## Information
3670
Author: Olivier
3771

3872
License: FPDF
3973

40-
## Description
74+
### Description
75+
4176
This script allows to merge data into a PDF form. Given a template PDF with text fields, it's
4277
possible to inject values in two different ways:
78+
4379
- from a PHP array
4480
- from an <abbr title="Forms Data Format">FDF</abbr> file
4581

@@ -49,10 +85,11 @@ Note: if your template PDF is not compatible with this script, you can process i
4985
[PDFtk](https://www.pdflabs.com/tools/pdftk-server/) this way:
5086

5187
`pdftk modele.pdf output modele2.pdf`
52-
88+
5389
Then try again with modele2.pdf.
5490

55-
## Example
91+
### Example
92+
5693
This example shows how to merge data from an array:
5794

5895
```php
@@ -76,4 +113,4 @@ $pdf->Output();
76113
?>
77114
```
78115

79-
View the result [here](http://www.fpdf.org/en/script/ex93.pdf).
116+
View the result [here](http://www.fpdf.org/en/script/ex93.pdf).

0 commit comments

Comments
 (0)