/**
* convert to pdf using document4j
* RTL languages are supported
*/
public static void convertUsingDocument4j(){
File inputWord = new File("E:/1.docx");
File outputFile = new File("E:/Test_out.pdf");
try {
InputStream docxInputStream = new FileInputStream(inputWord);
OutputStream outputStream = new FileOutputStream(outputFile);
IConverter converter = LocalConverter.builder().build();
converter.convert(docxInputStream).as(DocumentType.DOCX).to(outputStream).as(DocumentType.PDF).execute();
outputStream.close();
System.out.println("success");
} catch (Exception e) {
e.printStackTrace();
}
}