Reputation: 139
I'm working on a php(codeigniter) form that sends data to a PDF file when submitted. I can get value of a text field to populate corresponding field in PDF but don't know how to display checkbox in pdf. Can someone help please?
thanks Ahammed
Upvotes: 1
Views: 7804
Reputation: 667
If you create the pdf with mPDF, the cheched checkbox will be automatically rendered if you use the parameter
checked="checked"
This example works:
<input type="checkbox" name="vehicle" value="Bike">Service 1
<input type="checkbox" name="vehicle" value="Car" checked="checked">Service 2
<input type="checkbox" name="vehicle" value="Bike">Service 3
See http://mpdf1.com/manual/ for details.
Upvotes: 2
Reputation: 82814
You could, for one, include JavaScript in the PDF to generate the checkbox dynamically. Here is the JavaScript API: PDF file. Advantage: You can in the same JS instance add behaviour to the checkbox.
How to do this, however, depends on your used PDF framework.
If it's just for display purpose, go with icio's answer and embed simply a static image.
Upvotes: 0
Reputation: 3138
Just because the form submitted to your application used a checkbox doesn't mean that your PDF has to have one. Afterall, it's just going to be a static representation of what was submitted. You have two immediately obvious options which don't require checkboxes
Upvotes: 1