Ask a Jedi: Making large PDFs with CFDOCUMENT

Curt asks:

I am wondering what you do if you are creating a large pdf. I am using <cfdocument> to create a pdf that ends up being about 1500 pages. The file size is about 150MB and it obviously takes forever to create the document. Is there some other better way to create large pdf files. The application creates statements for the customer on a monthly basis.

Wow, 1500?? As much as I love ColdFusion, I would have assumed that would have brought down the server. If you are only making the PDF once a month, then you probably want to ensure that a web site user isn’t the one making it. By that I mean, don’t punish some poor user and make him wait the many minutes (hours?) it would take to make the PDF. Use something like the ColdFusion Schedular to generate the PDF, and I’d highly recommend doing it during off hours.

Another tip I’d recommend, and something I did at the ColdFusion Cookbook, was to find parts of the PDF that don’t change, like title pages, legal notices, that kind of junk. Generate those pages and save them forever. Generate the rest of the document, and use CFPDF to merge the old PDFs and the new PDFs together into a final PDF.

Is anyone else pushing CFDOCUMENT this far?

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Comments