ACORD pdf forms are editable. We can not only fill data in existing input elements but also add more elements (like new buttons and fields) in the forms and invoke actions to submit data from pdf to an external URL.
In the example below we have an ACORD PDF in which “Save Entered Data” button is present. On click of this button, we want to send input values to a PHP program which will receive the information submitted, save it into a new ACORD pdf and finally write this information as text into a file.
Solution :
On Button “Save Entered Data” Acord PDF data is posted to PHP file with this code in the pdf:
var webURI = "YourUrl/post.php”; this.submitForm({cURL: encodeURI(webURI), cSubmitAs:"PDF", cCharSet:"utf-8"})})()
Here is the PHP code :
//receive submitted values $AcordConttent = file_get_contents("php://input"); $NewAcordPDF = 'C:\\Acord\\NewAcordPDF.pdf'; //save into a new acord pdf file_put_contents($AcordConttent , $NewAcordPDF); //dump data into a text file $str1 = '"C:\\Program Files (x86)\\PDFtk\\bin\\pdftk" "C:\\Acord\\NewAcordPDF.pdf" dump_data_fields_utf8 > "Sample.txt"'; // Command to dump form fields with values in text. exec($str1,$output,$return_val);
Output in Text File :
--- FieldType: Text FieldName: Form_EditionIdentifier_A FieldNameAlt: The edition identifier of the form including the form number and edition (the date is typically formatted YYYY/MM). FieldFlags: 1 FieldValue: FieldValueDefault: ACORD xxxxx xxxxxx Acroform FieldJustification: Left --- FieldType: Text FieldName: Form_CompletionDate_A FieldNameAlt: Enter date: The date on which the form is completed. (MM/DD/YYYY) FieldFlags: 8442322 FieldValue: 03/16/2016 FieldJustification: Center FieldMaxLength: 10 --- FieldType: Text FieldName: Producer_FullName_A FieldNameAlt: Enter text: The full name of the producer / agency. FieldFlags: 8442322 FieldValue: Test Company FieldJustification: Left --- FieldType: Text FieldName: Producer_MailingAddress_LineOne_A FieldNameAlt: Enter text: The mailing address line one of the producer / agency. FieldFlags: 8442322 FieldValue: 6652 N Bayshine Road Suite B55612 FieldJustification: Left ---
Webner Solutions is a Software Development company focused on developing CRM apps (Salesforce, Zoho), LMS Apps (Moodle/Totara), Websites and Mobile apps. If you need Web development or any other software development assistance please contact us at webdevelopment@webners.com