Generating PDFs in CFMX7
I had a request for a bunch of audit letters to be generated by the application I am working on. Easy enough I thought, i’ll just grab all the data and throw it into a cfdocument and bob’s your uncle! A PDF.
Well to be honest I didn’t really expect it to be that easy, because we have applications that have insane amounts of data that our clients want stuffed into PDFs. Usually running these processes have caused server problems once they’ve gotten to production.
The size of the PDF can vary from week to week, but it potentially can be over a PDFwith over 500 pages. Running the process in one hit on my local development machine was a bit hit and miss. Sometimes it would complete fine, other times it would freeze the Jrun instance, requiring the service to be restarted.
To get around this I broke the PDF into multiple files and then zipped all the PDFs into one zip file for the user to download (size isn’t a huge issue because it’s an intranet application). Once I promoted the request to the test environment I was able to watch what was happening with fusionreactor.
The memory used up was only around 100mb and the CPU would spike up to close to 100% for about a second (call to cfdocument I assume) then recover again while it retreived and prepared the data for the next PDF.
I was using cfflush to keep the user appraised of how many PDFs had been generated, but found that the flush worked fine in two environments, but not in another. Probably a post for later.
I’m pretty happy with the way the server handles the process, it’s not something that is going to be run multiple times per day, or even week, so I don’t think will impact any of our other applications (famous last words I know).
I’m looking forward to getting my hands on CF8 in the development environment so I can see/test the performance gains in cfdocument. The other thing that will be very useful is getting the server monitor up and running so I can see what’s happening locally! Kind of annoying having to deploy to a different environment every time you want to see what happens behind the scenes.
About this entry
You’re currently reading “Generating PDFs in CFMX7,” an entry on ConstantConfusion
- Published:
- 06.30.08 / 6pm
- Category:
- ColdFusion

No comments
Jump to comment form | comments rss [?] | trackback uri [?]