Skip to content

Instantly share code, notes, and snippets.

@tparton42
Last active December 18, 2015 14:59
Show Gist options
  • Save tparton42/5800750 to your computer and use it in GitHub Desktop.
Save tparton42/5800750 to your computer and use it in GitHub Desktop.
This gist demonstrates replacing multiple HTML BR tags in generated content that will be flushed to a PDF via CFDOCUMENT. This helps prevent a known error in ColdFusion 8 when multiple BRs encountered next to one another as well as when there are mixed formats of the BR tag.
<!--- Create a regular expression pattern to find BR tags --->
<cfset variables.patternHTMLBreak = "(<br[^>]*>\s*)" />
<!--- Replace all forms of the BR tag, To handle a wierd IO issue in CF8 using CFDoc with two consecutive BR's --->
<cfset variables.PDFPage = trim(reReplaceNoCase(variables.PDFPage, variables.patternHTMLBreak, "<br/>&nbsp;", "ALL")) />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment