mosemadl
asked on
PHP and Form data to PDF
Anyone know how to select checkboxes in PDFs using PHP?
<?php
require('fpdm.php');
$fields = array(
'forname' => 'Jon Dow', // text input: works
'mycheck1' => true, // checkbox: doesn't work! Also tried "true", 1, "1", "yes", "on", ... (with case-sensitive)
);
$pdf = new FPDM('template.pdf');
$pdf->Load($fields, true);
$pdf->Merge();
$pdf->Output();
?>
<?php
require('fpdm.php');
$fields = array(
'forname' => 'Jon Dow', // text input: works
'mycheck1' => true, // checkbox: doesn't work! Also tried "true", 1, "1", "yes", "on", ... (with case-sensitive)
);
$pdf = new FPDM('template.pdf');
$pdf->Load($fields, true);
$pdf->Merge();
$pdf->Output();
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That helps. Unfortunately those notes are 5 years old :-(
Guess I'll have to get creative.
Guess I'll have to get creative.
After a little more research, I found these comments in the most recent download. Since this is dated 2011 and it says that the "to do" list includes checkboxes as a future objective, it's probably not been done. Perhaps you can extend the class to add the form types, but I don't think it has the capability out of the box.
*@todo in the importance order, natively by fpdm *
* -stream inline support (content change,repack,offset/size calculations) *
* -pdf inline protection *
* -flatten support *
* -extends filling to another form fields types (checkboxes,combos..) *
https://www.experts-exchange.com/articles/5450/Common-Sense-Examples-Using-Checkboxes-with-HTML-JavaScript-and-PHP.html