Skip to main content
Participant
July 7, 2015
Answered

<cfdocument> PDF limit

  • July 7, 2015
  • 1 reply
  • 1292 views

     Hi guys,I'm trying to create multiple pdfs with <cfdocument> tag inside a loop.When I say multiple pdf files , the counter could reach up to 1500 files.The result should be a zip with all the files .

    The problem is that after a while the request crashes because of : java.lang.OutofMemoryError : java heap space .

    My question is : has coldfusion a limit in generating <cfdocument> pdf files? I tried also , to break all this action into multiple threads , putting only 100 pdf files on a thread, but even so some of the threads ended with java heap space error.

     Have anyone of you encountered this problem before ? Any tips or help it will be gratefully apreciated.

     Best Regards,

      George T.

This topic has been closed for replies.
Correct answer sdsinc_pmascari

There's no limit, that I know of, for the number of PDFs you can create.  However, the Java heap space error means your server is running out of memory.  This could be a multitude of issues.  Are you saving all the PDFs in memory or saving them to your RAM drive in the loop?  If the documents are of considerable size this will eat up your memory real quick.

Can you allocate more memory to CF?  How about writing the PDFs to disk in the loop?  A "last resort" option I've used before in similar situations is setting up a META refresh to reload the page while processing only a few items at a time (this doesn't work if using scheduled tasks, of course).

1 reply

sdsinc_pmascariCorrect answer
Legend
July 7, 2015

There's no limit, that I know of, for the number of PDFs you can create.  However, the Java heap space error means your server is running out of memory.  This could be a multitude of issues.  Are you saving all the PDFs in memory or saving them to your RAM drive in the loop?  If the documents are of considerable size this will eat up your memory real quick.

Can you allocate more memory to CF?  How about writing the PDFs to disk in the loop?  A "last resort" option I've used before in similar situations is setting up a META refresh to reload the page while processing only a few items at a time (this doesn't work if using scheduled tasks, of course).

geroo19Author
Participant
July 8, 2015

Thank you for your quick response. I managed to fix the problem by increasing the heap memory  on my Coldfusion server(how you suggest) ,also I optimized the loop(which is a query) and the size of the documents(only 100 KB for a pdf file).

BKBK
Community Expert
Community Expert
July 11, 2015

Great! Please mark your answer as the correct one.