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
Solved! Go to Solution.
Views
Replies
Total Likes
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
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>
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.
Views
Replies
Total Likes
Hi @SmrithiGo,
Yes, it is possible via a designer; you have to go to the "XMLSource" to make the changes.
Thanks
Pranay
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.
Views
Replies
Total Likes
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
Views
Replies
Total Likes
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.
Views
Replies
Total Likes
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.
Views
Replies
Total Likes
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
Thanks a lot @Pranay_M. I will try it out from my end 🙂
Views
Replies
Total Likes
Hi @Pranay_M, I have one more question here. Can you please clarify.
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
Views
Replies
Total Likes
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
Thanks
Pranay
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.
Views
Replies
Total Likes
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
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.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies