0
votes
<cffunction name="print" output="no" access="private">
    <cfset filenameb = "mysite.com\print\test.pdf">     
    <cfdocument filename="#filenameb#" overwrite="yes" format="PDF" pagetype="A4" orientation="portrait"> 
        <cfdocumentitem type="header"> 
            Print
        </cfdocumentitem> 
        <cfdocumentitem type="footer"> 
            blah
        </cfdocumentitem>

        <cfoutput>
            aaaaaaaaa
        </cfoutput>
    </cfdocument> 
</cffunction>

Does anyone have any ideas what is causing this error?

"an exception occurred when document processing"

1
And that's the entirety of the error message? Usually (if you have robust exception handling switched on, which you should do in dev), it'll give you a lot more detail than that. Including the line of code which caused the exception. Did you look in various log files to see if anything had been logged? - Adam Cameron
The code above works fine in my environment. Without other information, I would check your CF user to makes sure it has permission to write the files. - snackboy
Probably, this is a path resolution issue. use this <cfset filenameb = expandPath("/VoulnteersUploadExcel/test.pdf")> if the path you are refering is based on the application root. - rrk

1 Answers

0
votes

Try specifying font for all the text elements (in header, footer and body).

For eg: replace

<cfoutput>
    aaaaaaaaa
</cfoutput>

with

<cfoutput>
    <div style="font-family: monospace"> aaaaaaaaa </div>
</cfoutput>