Quantcast
Channel: Adobe Community : Unanswered Discussions - ColdFusion
Viewing all articles
Browse latest Browse all 5794

EncodeForHTML & HTMLEditFormat: Formatting is different when exporting to pdf

$
0
0

I am using ColdFusion 11 and have just started using the EncodeForHTML function instead of HTMLEditFormat whenever I need to display text that the user has entered, usually via a textarea.  We need to save the formatting so that information the user has entered remains understandable.  Users have a choice of whether to display the info to the screen or export to a pdf.  We are using EncodeForHTML to make the displayed info safer and we are using <pre> to retain the required formatting.

 

My problem is that when I need to export the data to a pdf, then EncodeForHTML acts differently than HTMLEditFormat does.  For some reason, I get extra lines inserted.

 

Here's some sample code.  Just save to a cfm and run:

-------------------------------------------------------

<cfsavecontent variable="f">This is my sample data.
Value 1  20%
Value 2  30%
Value 3  50%

 

Here's my summary of this data.
</cfsavecontent>

 

<cfhtmltopdf saveasname="MyTest.pdf">
<cfoutput>With EncodeForHTML: <pre>#encodeForHTML(f)#</pre></cfoutput>
<cfoutput>With HTMLEditFormat: <pre>#HTMLEditFormat(f)#</pre></cfoutput>
</cfhtmltopdf>

----------------------------------------------------------

The HTMLEditFormat version shows up correctly.  Any idea how to work around this problem?


Viewing all articles
Browse latest Browse all 5794

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>