Expand my Community achievements bar.

SOLVED

Generate editable pdf for dynamic HTML5 form

Avatar

Level 10

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

Avatar

Correct answer by
Employee Advisor
4 Replies

Avatar

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).

Avatar

Level 10

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? 

 

 

Avatar

Level 10

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

Avatar

Correct answer by
Employee Advisor