Skip to main content
Jush1
Known Participant
February 20, 2012
Question

CFdocument for pdf not working when text has special char

  • February 20, 2012
  • 2 replies
  • 1319 views

How should I handle if text contain special characters in cfdocument for pdf? Wwhen text has "*" or "#". It pop a message says the file could not be open because either damaged or corrupted.

(using as email attachment or not properly decoded). 

This is ie 8 in window environment.

Here is the code:

         <cfset pdffile = "test.pdf">

         <CFHEADER NAME="Content-Disposition" VALUE="attachment; filename=#pdffile#">

        <CFCONTENT TYPE="application/pdf">

        <cfdocument

            encryption = "128-bit"

            format = "PDF"

            marginbottom = "1"

            marginleft = "1"

            marginright = "1"

            margintop = "1"

            orientation = "landscape"

            permissions = "AllowPrinting">

            <cfdocumentitem type="header">

            <h5 align="center">Text Header<BR></h5>

            </cfdocumentitem>

            <cfdocumentitem type="footer">

                <cfoutput>#DateFormat(now(),'yyyy-mm-dd')#</cfoutput>

            </h6>

            </cfdocumentitem>

            <cfinclude template="text.cfm">

         </cfdocument>

Thank for your help.

    This topic has been closed for replies.

    2 replies

    Inspiring
    February 20, 2012

    <cfinclude template="text.cfm">

    Can you post a standalone example that demonstrates the problem? ie without any cfincludes?

    BKBK
    Community Expert
    Community Expert
    February 20, 2012

    The code you've shown should work as expected. The only issue I saw is a closing tag </h6> without corresponding start tag  <h6>. But that is irrelevant. Also,  I am assuming the included file contains no disrupting content.