Hi Jason,
I am using docx4j jar for converting variables in a docx document and then converting it to pdf.
Below is the code public File generateDocument(InputStream inputStream, Map<String, String> params, String fileName, String tempDir) {
OutputStream os = null;
byte[] bytes = null;
File file;
Map<String, String> fields;
try {
tempDir = correctDirectoryPath(tempDir);
bytes = IOUtils.toByteArray(inputStream);
file = new File(tempDir + fileName + this.formatter.format(new Date()) + ".pdf");
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(new ByteArrayInputStream(bytes));
VariablePrepare.prepare(wordMLPackage); ...