My ColdFusion CFDocument Advice wasĀ āMarked as Spamā. Lame.
In response to:
CFDocument Processing SpeedTest / Results and Inquiry
https://community.adobe.com/t5/ColdFusion/CFDocument-Processing-SpeedTest-Results-and-Inquiry/td-p/10700365
We want to improve the performance of the CFDocument tag. Ā We are generating 6000 pdf pages using cfdocument by looping through a text file, formatting it and creating it using cfdocument tag. We are on CF 2018 Update 5.
Regardless of how much RAM and CPU we are throwing at CF, we cannot seem to convice CF that that RAM/CPU is eligible for use for this process. Whether the server has 16 GB RAM or 256 GB, the PMT shows that there is no differnce in the perfomance, and the amount of time it takes to finish processing doesn't seem to depend on either RAM or CPU. Should we be looking elsewhere (I/O) to speed this up, or is CFDocument simply the "little engine that could"?
We have been updating JVM heap sizes for minim and maximum and increased MaxMetaSpaceSize. At this time, there are no competing threads on this test server - just the CFDocument process.
Please let us know if there are any other settings or resources or other things to look for to increase the performance and generate the pdf faster. If not, we have found an alternative solution, but would prefer to learn more as to whether CFDocument processing can be improved. Thanks in advance.
I responded with advice that I both use & recommend as a ColdFusion Developer and it was immediately āmarked as spam and removed.āĀ Hereās my response on 10/30/2019 06:45 Pacific.
As an alternative, you could save a single HTML to the file system and then try using the opensource WKHTMLTOPDF executable to generate the HTML.Ā (You can add page breaks & "keep sections together" using CSS.Ā A global header & footer requires 2 separate HTML templates.Ā "Page X of Y" can also be added using javascript.)Ā I shared a basicĀ CFTag if you'd like to integrate within your project.Ā (Someone wrote a CFC, but I can't find it online anymore.)
We quit using CFDocument back in CF8.Ā Occasionally we'll compare the CFDocument output against WKHTMLTOPDF and we're still very glad that we're using WKHTMLTOPDF.Ā (I believe CFDocument uses outdated libraries and hasn't been updated in a very long time.)Ā WKHTMLTOPDF generates PDFs faster, requires less RAM, generates smaller PDF files and is compatible with CSS3/HTML5.Ā We've also got absolute-positioned scaled SVG images to work, whereas we weren't able to reliably generate 1px borders using CFDocument.Ā We were also able to integrate FontAwesome into our reports. Using WKHTMLTOPDF means that we can easily perform the HTML-to-PDF conversion in the background or separate server without using a single-threaded, long-timeout CFThread. (We use ajax orĀ EventSource to determine completion status.)
10/31/2019 UPDATE: I noticed that my post was undeleted.Ā I didnāt receive any notification or alert, it just simply appeared and then I noticed that the original poster marked it as the answer. (Thanks Andy.)