Hi all,
I am trying to prefill an XFA form (XDP based) through data that is submitted through an Adaptive form.
My Adaptive form is based off a JSON (Schema.json) attached. I bound each of the adaptive form field to this JSON. On the other side, I bound my XDP to a XSD file (attached).
when i submit my Adaptive form, the form gives out the JSON (response.json), I am using a servlet to convert this to an XML (response.xml) and then use Render Service to stitch together a prefilled PDF form. But this is not working, i always get a blank form without any prefilled data.
But when i use same XML and try previewing through AEM Forms designer, the PDF gets prefilled. Not sure what i am missing. I am attaching all the files that i used here. Would be really helpful if someone from the community can assist.
response.json (data submitted as JSON from Adaptive form)
{"moneylink-trans-amount":1000,"financial-inst-name":"Sample Bank","acc_number":1.2312312E7,"checkbox-journal-amt":"1","total-journal-amt":1000,"from-acc-number":1.2312312E7,"from-acc-reg":"Sample Savings","employer-business-name":"Sample Corp","Emp-Fed-Tax-Num":"12312312","bus-street-addr":"123 Main St","City":"Sample City","zip":"12345","telephone":" 11232212321","IRA-Acc-Number":"123456789","checkbox_deposit":"1","checkbox-transfer":"0","employer-sign":"John Doe","applicant-print-name":"Jane Smith","current-date":"2025-08-19"}
response.xml (JSON converted to XML AEMFD by custom AEM Servlet)
<?xml version="1.0" encoding="UTF-8" standalone="no"?><root><acc_number>12312312</acc_number>
<from-acc-reg>Sample Savings</from-acc-reg>
<employer-business-name>Sample Corp</employer-business-name>
<zip>12345</zip>
<Emp-Fed-Tax-Num>12312312</Emp-Fed-Tax-Num>
<checkbox_deposit>1</checkbox_deposit>
<applicant-print-name>Jane Smith</applicant-print-name>
<IRA-Acc-Number>123456789</IRA-Acc-Number>
<current-date>2025-08-19</current-date>
<employer-sign>John Doe</employer-sign>
<total-journal-amt>1000</total-journal-amt>
<telephone> 15126693203</telephone>
<City>Sample City</City>
<checkbox-journal-amt>1</checkbox-journal-amt>
<checkbox-transfer>0</checkbox-transfer>
<moneylink-trans-amount>1000</moneylink-trans-amount>
<financial-inst-name>Sample Bank</financial-inst-name>
<bus-street-addr>123 Main St</bus-street-addr>
<from-acc-number>12312312</from-acc-number>
</root>
XML used in Preview of AEM forms designer, which works and prefills. I am converting this XML to AEM FD XML document to send it to Render service
<?xml version="1.0" encoding="UTF-8"?>
<root>
<moneylink-trans-amount>2.98</moneylink-trans-amount>
<financial-inst-name>Ad retia sedebam</financial-inst-name>
<acc_number>Vale</acc_number>
<checkbox-journal-amt/>
<total-journal-amt>4.19</total-journal-amt>
<from-acc-number>Ego ille</from-acc-number>
<from-acc-reg>Si manu vacuas</from-acc-reg>
<employer-business-name>Ego ille</employer-business-name>
<Emp-Fed-Tax-Num>Si manu vacuas</Emp-Fed-Tax-Num>
<bus-street-addr>Apros tres et quidem</bus-street-addr>
<City>Mirum est</City>
<zip>Liceb</zip>
<telephone>Proinde</telephone>
<IRA-Acc-Number>Am undique</IRA-Acc-Number>
<checkbox_deposit>0</checkbox_deposit>
<checkbox-transfer>0</checkbox-transfer>
<employer-sign/>
<applicant-print-name>Apros tres et quidem</applicant-print-name>
<current-date/>
<formid/>
</root>
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @workflowuser - I was using the Render pdf from forms service as I need to generate an interactive PDF. I was able to resolve this last night, there were three problems, my schema I used to bind my XDP had <XS:sequence> seems with this tag, the order of nodes matters. This schema order and my sample XML order wasn't matching. I had to reorder my XML.
I was passing a space in one of my XML node, not sure how it got in there, I used some patterns probably for +1. I have to investigate this.
I was using some invalid XSD types in my schema, I had to change them to XS:decimal and XS:integer.
After making the above changes and running the code, I was able to prefill my PDF form with data submitted from Adaptive.
Thanks,
Abhishek
How are you creating the pdf?
are you using output or formsservice to merge the data?
send us the code snippet
Views
Replies
Total Likes
Hi @workflowuser - I was using the Render pdf from forms service as I need to generate an interactive PDF. I was able to resolve this last night, there were three problems, my schema I used to bind my XDP had <XS:sequence> seems with this tag, the order of nodes matters. This schema order and my sample XML order wasn't matching. I had to reorder my XML.
I was passing a space in one of my XML node, not sure how it got in there, I used some patterns probably for +1. I have to investigate this.
I was using some invalid XSD types in my schema, I had to change them to XS:decimal and XS:integer.
After making the above changes and running the code, I was able to prefill my PDF form with data submitted from Adaptive.
Thanks,
Abhishek
Great article! If you’re looking for tools to calculate various important aspects, here are a few that might help: For LIC policy calculations, check out the LIC Calculator.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies