Skip to main content
Participant
Feb 25, 2021 1:55 PM UTC
Question

Large request - Error occurred while generating PDF. Reason: Error occurred while handling request.

The following error is generated when trying to use cfhtmltopdf function on the page:

 

Error Occurred While Processing Request
Error occurred while generating PDF.
Reason: Error occurred while handling request.

 

- the page gets successfully generated if the <cfhtmltopdf> tags are removed

- the request generated a lot of data, which is roughly 1200 A4 pages

 

Is there a limit on the file size/number of pages when using the <cfhtmltopdf> tag?

    This topic is closed to new replies. Start a new post to keep the conversation going.

    3 replies

    BKBK
    Community Expert
    Community Expert
    Feb 25, 2021 8:05 PM UTC

    There might be something else bothering your application.

     

    I did some tests to generate a 1400-page PDF. The execution times were as follows:

     

    119 seconds

    <cfdocument format="PDF" filename="C:\Users\BKBK\Desktop\largeDoc.pdf">	
    	<cfset i=1>
        <cfloop condition="i lte 1400">
    	    <cfset i=i+1>
    		
    		<cfdocumentitem type = "footer"> Footer text <cfoutput>#cfdocument.currentpagenumber#</cfoutput></cfdocumentitem> 
    		<cfdocumentitem type = "pagebreak" /> 
        </cfloop>
    </cfdocument>

     

    12 seconds

    <cfhtmltopdf destination="C:\Users\BKBK\Desktop\largeDoc.pdf" overwrite="true">
    <cfset i=1>
        <cfloop condition="i lte 1400">
    	    <cfset i=i+1>
    	    <cfhtmltopdfitem type="header">Page: _PAGENUMBER of _LASTPAGENUMBER</cfhtmltopdfitem>		
    		<cfhtmltopdfitem type = "footer"> Footer text _PAGENUMBER</cfhtmltopdfitem> 
    		<cfhtmltopdfitem type = "pagebreak" /> 
    	 </cfloop>
    </cfhtmltopdf>

     

    Translate
    Participant
    Feb 26, 2021 8:48 AM UTC

    Thank you for the replies. I will try to change the way that the pdf is produced by adding the destination parameter and see if that works.

    Translate
    Community Expert
    Feb 25, 2021 4:13 PM UTC

    Wow, that's a lot of pages! I don't know if there's a strict file size limit, but you may simply be exceeding the available memory you need. I suggest trying a smaller number of pages per request, then merging them together after you've got them all.

     

    Dave Watts, Eidolon LLC

    Translate
    Dave Watts, Eidolon LLC