Reputation: 2781
I am trying to use JavaScript Date Picker in Editable PDF using TCPDF. But I am not getting Date Picker in PDF. Is there another way to include JavaScript/jQuery Date Picker Library?
Date Picker Lib https://github.com/joshsalverda/datepickr
PHP Code
// Set some content to print
$html = <<<EOD
Date <input type="date" value="" name="date" /><br/>
EOD;
// Print text using writeHTMLCell()
$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
$js = 'Here I am including javascript Date picker lib and javascript script';
// set javascript
$pdf->IncludeJS($js);
$pdf->Output('my_info.pdf', 'I');
Upvotes: 1
Views: 984
Reputation: 3615
First and foremost, PDF/Acrobat is NOT using Acrobat JavaScript, which is a specific extension to the JavaScript core (as there are webbrowser-specific extensions to the JavaScript core, and so on). jQuery is such an extension, and is not usable in PDF. Period.
You will have to create your own date picker for PDF. Or look around, there are a few floating around, which are more or less usable (you get what you pay). You may be able to use some of the functions of the jQuery library, but everything "user interface" and "form interface" has to be ported.
Shameless plug: I happen to have developed a Date Picker toolkit using the Dialog object to display the picker, and requiring a minimum footprint in your form. For more information and pricing, feel free to contact me in private.
Upvotes: 1