HTML Rich Text Rendering in Adobe Forms
There is a requirement that we need to render rich text of html in our adobe form. As we all know that adobe doesn’t know HTML but we may need to render HTML tags, for the same requirement follow below steps.
Step 1). Passing HTML to our form and set DOCPRAM-DYNAMIC = ‘X’.
I created one Exporting parameter to pass my HTML rich text. You can get your HTML from SO10 also, and assign to Exporting parameter of your adobe FM.
Step 2). Create field in adobe form and set Field formate as Rich Text and bind with R_HTML.
Step 3). Then Test.
Not expected output.
Step 4). Now add below javascript on docClose event of field.
var envelope = "<?xml version='1.0' encoding='UTF-8'?>" +
"<exData contentType='text/html' xmlns='http://www.xfa.org/schema/xfa-template/2.8/'" +
"><body xmlns='http://www.w3.org/1999/xhtml' xmlns:xfa='http://www.xfa.org/schema/xfa-data/1.0/' " +
"xfa:APIVersion='Acroform:2.7.0.0' xfa:spec='2.1'>" +
"<p>"+ this.rawValue +"</p></body></exData>";
this.value.exData.loadXML(envelope,1,1);
Step 5). Now Test.
Hope this helps.
We are trying to do something similar and I'm guessing we followed the same blog you did:
https://livecyclekarma.wordpress.com/2009/05/20/richtext-tricks-for-textfield-in-designer/
However, we are facing an issue when we have tags like <strong> or <blockquote> where things get ignored and even the text between those tags are eliminated. Have you done anything using these semantic tags and have it functioning?
Hi Roger,
As per my understanding you have to use XSLT transformation to convert <STRONG> and <BLOCKQUOTE> tags to be compatible with ADOBE.
BlockQuote
<xsl:template match=”blockquote”>
<p/>
<span style=”xfa-tab-count:1″/>
<xsl:for-each select=”ancestor::blockquote”>
<xsl:text>; </xsl:text>
</xsl:for-each>
<xsl:value-of select=”.”/>
<p/>
</xsl:template>
Strong
<xsl:template match=”strong”>
<b>
<xsl:apply-templates/>
</b>
</xsl:template>
Regards,
Harish
Hi Prajesh Desai I did the same that you recommended and this is not work for me.. maybe You can help me?
I have text like this:
Thanks. But how do we achieve this in the ZCI layout?
Brilliant, works perfectly! Thanks
Edit: it worked on our internal system, but when I tried the same on a customer system it didn't. Moving the Javascript from the "docClose" to the "Initialise" event corrected it.