Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapping fields in the template with the values in Array #65

Open
sanjoyroy opened this issue Oct 20, 2022 · 0 comments
Open

Mapping fields in the template with the values in Array #65

sanjoyroy opened this issue Oct 20, 2022 · 0 comments

Comments

@sanjoyroy
Copy link

I have a predefined template that was supplied by a client, it uses a lot of checkboxes and radio buttons and based on the records I need to set those fields true or false.
How do we map the field names (like name, address, city, phone etc) used in template.pdf so that can substitute the values in the array?
Does the PDFtk tool helps in doing that, when I installed it, it is command based, please shed some light?

require('fpdm.php');

$fields = array(
'name' => 'My name',
'address' => 'My address',
'city' => 'My city',
'phone' => 'My phone number'
);

$pdf = new FPDM('template.pdf');
$pdf->Load($fields, false); // second parameter: false if field values are in ISO-8859-1, true if UTF-8
$pdf->Merge();
$pdf->Output();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant