cfdocument issue with performance

958 Views Asked by At

I am generating a pdf using cfdocument and it is working perfectly with this code:

<cfdocument format="PDF" fontembed="true" saveAsName="file1" mimetype="application/pdf" localUrl="true">
    <cfoutput>
        #response.filecontent# 
        <cfdocumentitem type="footer"> 
           #cfdocument.currentpagenumber# of #cfdocument.totalpagecount#
        </cfdocumentitem>
    </cfoutput>
</cfdocument>

If I include the #session.footer# variable inside it, it takes a lot of time to generate the PDF.

<cfdocument format="PDF" fontembed="true" saveAsName="file1" mimetype="application/pdf" localUrl="true">
    <cfoutput>
        #response.filecontent# 
        #session.footer#
        <cfdocumentitem type="footer"> 
           #cfdocument.currentpagenumber# of #cfdocument.totalpagecount#
        </cfdocumentitem>
    </cfoutput>
</cfdocument>

The footer variable contains a complete footer section which I want to add at the end of the document. I am don't understand why it is this is taking so much longer. I am using ColdFusion 10.

2

There are 2 best solutions below

0
James On

Have you tried creating the PDF using cfdocument, and then applying the footer using cfpdf as a second process? As with the above comments, it could be what is held in the session variable as well.

I would have left this as a comment instead of a solution, but StackOverflow wont let me :(

0
gordon On

Look in your Windows\system32\drivers\etc\hosts file. Someone had changed the IP from 127.0.0.1 to some local intranet IP and the names server from localhost to the DNS server name. I found that just changing the IP back to 127.0.0.1 was enough. Pdfs had gone from very quick to over 3 minutes. With the change, they were back to quick. (found this per a comment in https://forums.adobe.com/thread/1121909)