PHP to PDF tick checkboxes

500 Views Asked by At

Why isn't my "PHP to PDF" code not ticking checkboxes?
What am I doing wrong?

My pdf fields

FieldType: Button  
FieldName: aaaa  
FieldFlags: 0  
FieldValue: Off  
FieldJustification: Left  
FieldStateOption: Off  
FieldStateOption: Yes  

Here is my PHP code:

require('fpdm.php');

$fields = array(
  'POPMLSAddress' => $_POST['Text3'],
  'aaaa'=> 'Yes'
);

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

ob_end_flush(); 

In PDF file, checkbox have to be checked with tick.

1

There are 1 best solutions below

1
waqasss On

i try to filling out PDF forms using PHP and PDFtk Server instead FPDM. there are many methods and php libraries to do pdfForm filling ... for button controls editing with php to pdf form this method is life saving.dragon kiss

$data = [
    'first_name' => 'John',
    'last_name'  => 'Smith',
    'occupation' => 'Teacher',
    'age'        => '45',
    'gender'     => 'male'
];

$pdf = new PdfForm('form.pdf', $data);

$pdf->flatten()
    ->save('output.pdf')
    ->download();