Skip to content

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

@sanjoyroy

Description

@sanjoyroy

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions