AEM Forms - How to dynamically embed pdfs in XFA based xdp template at runtime. | Community
Skip to main content
nitin_seth
New Participant
December 15, 2022

AEM Forms - How to dynamically embed pdfs in XFA based xdp template at runtime.

  • December 15, 2022
  • 1 reply
  • 623 views

EnvAEM Forms 6.5 SP-12, On Prem

 

XML Payload for outputservice:

<RootElement>

<FirstName>FirstName</FirstName>

<FirstName>LastName</FirstName>.

.

.

<DocSource1>sampleContent1.pdf</DocSource1>

<DocSource2>sampleContent2.pdf</DocSource2>

<DocSource3>sampleContent3.pdf</DocSource3>

<DocSource4>sampleContent4.pdf</DocSource4>

</RootElement>

 

The above is the xml structure I am receiving as dynamic data to input XDP template. The Original SampleContent1,2,3,4.pdf exists in the file system. (Please note in XDP template these pdf will not be pre-built, We will get it like pdf files only).

I am using live cycle Designer to create XDP template and are using Document services (OutputService/ FormsService) of AEM 6.5 to generate the final pdf.

Document doc = outputService.generatePDFOutput(xdpTemplate, xmlDocument, outputOptions);

 

Here question is 

  • How can I embed these pdfs (provided in xml input as above) in xdp template at run time.
  • Have anyone worked in the similar scenario and what are the possibilities for such use cases to be executed
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

Vijay_Katoch
New Participant
December 16, 2022

For this use case, I propose the below solution:

 

As your final document will be a pdf file, so you can first render your xdp to pdf and then retrieve your pdf's files as mentioned in your XML file.

You need to create a ddx and pass the ddx to the assembler service.

New Participant
December 16, 2022

How will you manage at which place to assemble certain pdf files coming dynamically in xml? Xml payload only have info about section after which pdf will be inserted. 

 

Ddx and assembler logic works best when we know actual pdf pages.