new FontFileFinder()
.find("/Applications/Microsoft Word.app/Contents/Resources/Fonts/")
.forEach(v -> PhysicalFonts.addPhysicalFont((URL) v));
PhysicalFonts.put("宋体", checkNotNull(PhysicalFonts.get("SimSun")));
PhysicalFonts.put("黑体", checkNotNull(PhysicalFonts.get("SimHei")));
WordprocessingMLPackage wordMLPackage = Docx4J.load(new java.io.File("./test.docx"));
Docx4J.toPDF(wordMLPackage, new FileOutputStream("./test.pdf"));
com.lowagie.text.FontFactory.registerDirectory("/Applications/Microsoft Word.app/Contents/Resources/Fonts/");
Options options = Options.getFrom(DocumentKind.DOCX).to(ConverterTypeTo.PDF).via("ODFOM");
IConverter converter = ConverterRegistry.getRegistry().findConverter(options);
converter.convert(new FileInputStream("./test.docx"), new FileOutputStream("./test.pdf"), options);
XWPFDocument doc = new XWPFDocument(new FileInputStream("./test.docx"));
PdfOptions options = PdfOptions.create();
PdfConverter converter = new PdfConverter();
converter.convert(doc, new FileOutputStream("./test.pdf"), options);