Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards.
SOLVED

Error on rendering PDF using formService.renderPDF by passing XDP template which has exData

Avatar

Level 2

Hi,

I am using com.adobe.fd.forms.api.FormService.renderPDFForm for rendering dynamic PDF for a use case.

 

Here I am passing like this:

formsService.renderPDFForm("crx://" + xdpPath, xmlDataDocument, renderOptions)

 

The rendered PDF from the above service works for all the cases, except when the XDP template as 

<value>
    <exData contentType="text/html">
        <body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"><p>sample text</p></body>
    </exData>
</value>
 
the exData is not loading on the rendered PDF. Can anyone help me understand the reason. Is it a bug with the service?

 

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi @SmrithiGo,

I have attachted a folder "Personal_info_Original.zip" and inside that zip you will find a couple for files, namely: Personal_info.xdp and Personal_info_Original.xml. The XDP has a field that accepts the value in the <exData> format(Rich Text) from the XML. I used the same XDP and the XML  and passed the files from the Forms Service to get the resultant PDF: FormsPDFOutput.pdf.

 

To summarise the use case is working perfectly on my end and you might need to validate either the XDP or the XML souce.

Thanks

Pranay

View solution in original post

14 Replies

Avatar

Employee

Hi @SmrithiGo,

Thanks
Pranay

XFA <exData> with contentType="text/html" is meant to store rich text (RTF-like content with XHTML tags).The FormsService renderPDFForm API will honor <exData> only if:

 

  • The XDP field is configured as a Rich Text field in Designer (not plain text).

  • The incoming <value><exData ...> is well-formed XHTML, matching Adobe’s expected schema.

  • If the <exData> content isn’t parsed properly, the renderer often just ignores it, leaving the field blank

Alternative binding

  • Instead of passing <exData>, try passing the same rich text under the field’s rawValue in the XML. This should fix the issue on your end. I gave a quick try and was able to generate the PDF correctly.

Example:

 
<fieldName> <value> <richText> <body xmlns="http://www.w3.org/1999/xhtml"> <p>sample text</p> </body> </richText> </value> </fieldName>
Thanks
Pranay

 

Avatar

Level 2

Thank you @Pranay_M for your response.

You mean to say that, the XDP needs to be updated with 

<fieldName> <value> <richText> <bodyxmlns="http://www.w3.org/1999/xhtml"> <p>sample text</p> </body> </richText> </value> </fieldName>

instead of using <exData>

Do you know if this can be achieved using form designer app. Thanks again for your suggestion.

 

Avatar

Employee

Hi @SmrithiGo,

Yes, it is possible via a designer; you have to go to the "XMLSource" to make the changes.

Thanks
Pranay

Avatar

Level 2

HI @Pranay_M , Another question, that I have is, is there any way to parse the <exData> correctly.

 

  • If the <exData> content isn’t parsed properly, the renderer often just ignores it, leaving the field blank

As I have the control when the PDF is rendered, is there any way to parse this tag value and then render PDF.

Avatar

Employee

Hi @SmrithiGo,

As I can understand, you have an XDP/PDF and an XML that you are passing using the Forms service to create a dynamic PDF. Can you please confirm if you are passing the <exData> in the XML or it is part of the XDP. Also can you please share the sample files for which the conversion ois failing.

Thanks
Pranay

Avatar

Level 2

Yes you are right, we are rendering a dynamic PDF using formservice.renderPDF, by passing XDP template and XML data for (user and customer information).

 

exData is not something that we are creating or passing, but it is a part of XDP template, that we are using at the time of rendering PDF. 

Avatar

Level 2

Hi @Pranay_M , Sorry, I dont have sample xdp files to share here. In this case the PDF is rendered , but the text within exData is not rendered on the PDF.  

 

Avatar

Correct answer by
Employee

Hi @SmrithiGo,

I have attachted a folder "Personal_info_Original.zip" and inside that zip you will find a couple for files, namely: Personal_info.xdp and Personal_info_Original.xml. The XDP has a field that accepts the value in the <exData> format(Rich Text) from the XML. I used the same XDP and the XML  and passed the files from the Forms Service to get the resultant PDF: FormsPDFOutput.pdf.

 

To summarise the use case is working perfectly on my end and you might need to validate either the XDP or the XML souce.

Thanks

Pranay

Avatar

Level 2

Thanks a lot @Pranay_M. I will try it out from my end 🙂 

Avatar

Level 2

Hi @Pranay_M, I have one more question here. Can you please clarify.

SmrithiGo_0-1758012208881.png

Is the text "This is a Rich Text Field Is a Text Component Used for Demo inside the XML" passed as XML string at the time of generation of PDF. Thanks

Avatar

Employee

Hi @SmrithiGo,

The value is not passed a XML string, it is passed as a parameter in the XML. If you look at the "Personal_info_Original.xml" file you should see the parameter. Same Way you can use any data in the RichText

Pranay_M_0-1758014034869.png

 

Thanks
Pranay

Avatar

Level 2

HI @Pranay_M , I tried by passing the exData in XML, but I am unable to see the data form XML on PDF, only for exData.

Have you used formservice API for rendering PDF:

Document interactivePDF = null;
try {
interactivePDF = formsService.renderPDFForm("schengen.xdp", xmlData, renderOptions);
} catch (FormsServiceException e) {
 e.printStackTrace();
}

Can you please clarify this. Thanks.

Avatar

Employee

Hi @SmrithiGo,

As I mentioned previously, the use case works perfectly fine. To me it seems to be an issue related to the artifacts that you are using. To Investigate this issue further request you to kindly share the artifacts and raise a support case with Adobe, as it seems to be an issue related to the file.

 

Thanks

Pranay

Avatar

Level 2

Thanks for clarifying this. I tried by passing the exdata value as xml data while rendering PDF; but all other XML data is being populated in PDF; except exData value from XML 🙂 

Sure, I will try it out again, and if required reach you to Adobe support team for help. Appreciate your support on this.