I have a use case wherein, I need to convert many docx files to pdf files by replacing some variables in the docx template. I have used 2 approaches to convert docx to pdf. I have attached to methods that I have used:
Docx4J.toPDF(wordMLPackage, new FileOutputStream(file));
Docx4J.toFO(foSettings, os, Docx4J.FLAG_EXPORT_PREFER_XSL);
Both these approaches become a bottleneck in my process as they consume very high CPU and memory. Can anyone suggest to me a better solution or alternative?
P.S. I am converting all the documents to pdfs in a multithreaded environment.