Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Generate editable pdf for dynamic HTML5 form

Gaurav-Behl
Community Advisor
Community Advisor

I’ve a use case to generate editable pdf from a HTML5 form and I’m able to achieve it statically using com.adobe.fd.forms.api.FormsService.renderPDFForm(..). No issues here.

 

For another use case, I’ve a dynamic form where I’ve combined two static forms and put a dialog with radio buttons as front screen. It has some business logic written in both client side js & server side js. Now when I try to generate editable PDF using renderPDFForm(..), it doesn’t work as expected. The xml markup with data that is sent from the browser doesn’t merge correctly with the xdp. I think that is because of visibility rules set on each form in the designer. I tried to change the visibility rules and I could see the correlation between the xml data and server side properties set in the designer. 

 

I can think of custom hacks to make it work but would like to understand if I’m doing something wrong fundamentally & if there is a better way to achieve this use case.

 

Thanks,

Gaurav

1 Accepted Solution
workflowuser
Correct answer by
Employee
Employee
4 Replies
Kosta_Prokopiu1
Employee
Employee

Hi @Gaurav-Behl 

it should be possible but I think we need more information about your use case. These are HTML renditions of XDP layouts, not Adaptive Forms?

1) you say you create a static PDF from a HTML form which is editable? Do HTML form and PDF come from the same XDP?

2) What exactly do you mean with dynamic form? My understanding is a form that dynamically adds or removes sections depending on user input or data. How do you combine 2 static forms into the "dynamic" form?

3) What exactly is not "working as expected"? When the XML does not match it could mean that HTML and PDF renditions of an XDP are based on different layouts or your "combining" somehow changes things (SOM paths for example).

Gaurav-Behl
Community Advisor
Community Advisor

Hi @Kosta_Prokopiu1 

  • Yes, these are HTML5 renditions of xdp forms (not adaptive forms)
  • Yes, HTML5 rendition & PDF is created from same xdp and works fine meaning I get perfectly fine editable pdf generated
  • Dynamic form is a slight misnomer here. I've just combined two xdps and created a third xdp & generated its combined HTML5 rendition. After that, I'm simply showing/hiding couple sections at runtime in HMTL5 rendition in the browser using js. First step is to configure the sections/fields in designer. Then compile HTML5 form out of it. Then using js, add another layer of business logic/validations/show or hide sections in the browser. Hope this makes sense.
  • Since, the combined xdp has a complex schema, it doesn't match and follow the business rules coded in script. When I trigger generate editable pdf call from the browser, I have the flexibility to send either combined schema or any format of schema+data from the xdp rendition in browser. But the combined xdp in CRX is static, it doesn't know the business rules. I can't parse the combined xdp to Document in-memory and pass it to renderPDFForm() to match the relevant schema passed from the browser in order to generate an editable pdf. 

To simplify, lets take an example:

  • xdp1 creates HTML5 rendition html1 and creates editable pdf1 w/o any issues
  • xdp2 creates HTML5 rendition html2 and creates editable pdf2 w/o any issues
  • xdp3 = xdp1 + xdp2 + some business logic in both client & server side script
  • xdp3 creates HTML5 rendition html3. Now I want this xdp3 to create editable pdf1 or pdf2 or pdf3 or pdfn dynamically w/o any issue but using the same xdp3 from CRX rather than me creating/uploading all individual xdp in CRX and write the logic to pick the relevant xdp using a parameter or something

 

Does this make sense? 

 

 

Gaurav-Behl
Community Advisor
Community Advisor

Will explore Formset per recommendation from @workflowuser and share update.

workflowuser
Correct answer by
Employee
Employee