Any limits there for <cfpdf> merge?

431 views Asked by At

I am experiencing performance issues while writing and merging thousands of PDF files into single PDF file. Each PDF file is about 1.76MB. My JVM heap size is default of 512 only. I've increased the JAVA heap size to 2048 MB. The following code write the pdf form fields for 1000 pdfs and merge the 1000 pdfs as single. More than 1000 pdfs it throws the following error log in coldfusion-out.log file.

Dec 30, 2016 18:43:12 PM Information [scheduler-1] - Run Client Storage Purge

How can I resolve this?

I am using the following code to write some pdf fields and merge as single pdf:

<cfset outputFilePath = "PDF_#dateformat(now(),"dd_mm_yyyy")#">
<cfloop from="1" to="1500" index="i">
    <cfset RandToken = createUUID()>
    <cfset inputFileName = "Test-cert.pdf">
    <cfif directoryExists("C:\ColdFusion10\cfusion\wwwroot\outputPDF\#outputFilePath#") EQ false>       
        <cfdirectory action="create" directory="C:\ColdFusion10\cfusion\wwwroot\outputPDF\#outputFilePath#">   
    </cfif>
    <cfset OutputFile = "outputPDF/#outputFilePath#/#RandToken#_outputPDF.pdf">
    <cfpdfform source="#inputFileName#" destination="#OutputFile#" action="populate">
        <cfloop from="1" to="10" index="CurrentField">
            <cfset FormField = "BirthDate">
            <cfset FormValue = "12/24/1987">
            <cfpdfformparam name="#FormField#" value="#FormValue#" />   
        </cfloop>   
        <cfloop from="1" to="3" index="Fieldvalue">
            <cfset FormField = "fullName">
            <cfset WorkingText = "Sathish#Fieldvalue#">
            <cfpdfformparam name="#FormField#" value="#WorkingText#" />
        </cfloop>
    </cfpdfform>
    <cfpdf action="write" flatten="yes" overwrite="yes" source="#OutputFile#" destination="#OutputFile#">   
</cfloop>

<cfpdf action="merge"  directory="C:\ColdFusion10\cfusion\wwwroot\outputPDF\#outputFilePath#" order="name" ascending="yes" stoponerror="false" overwrite="yes" destination="mergedPDf.pdf" />

<cfdirectory action="list" directory="C:\ColdFusion10\cfusion\wwwroot\outputPDF\#outputFilePath#" recurse="yes" name="resultOfZip"/>
<cfloop query="resultOfZip">
    <cffile action="delete" file="C:\ColdFusion10\cfusion\wwwroot\outputPDF\#outputFilePath#\#resultOfZip.NAME#">
</cfloop>
<cfheader name="Content-Disposition" value='inline;filename="mergedPDf.pdf"'>
<cfcontent type="application/pdf" file="mergedPDf.pdf" deleteFile="yes">

I am running this above code on the following configuration machine: windows 10, RAM 6 GB, CF10 Can anyone suggest how I might merge all the files into a single pdf?

0

There are 0 answers