如何使用Apache POI将包含UTF-8字符的MS Word文档转换为PDF?

Tra*_*zed 5 java linux pdf utf-8 apache-poi

由于某些原因,我无法从Apache POI获得PdfConverter来在Linux机器上正确转换MS Word文档。在Windows和MacOS上似乎可以正常工作,但是每当我在Linux机器上尝试时,它基本上都不会转换UTF-8字符。我还尝试配置fontEncoding选项,该选项可以传递给PdfConverter,但这似乎无济于事。

final InputStream in = new FileInputStream(new File("src/test/resources/SOMEDOC.docx"));
final XWPFDocument document = new XWPFDocument(in);
final OutputStream out = new FileOutputStream(new File("target/test.pdf"));
final PdfOptions options = PdfOptions.getDefault();
// This actually breaks the whole conversion. No text will be displayed if you set this font encoding option to UTF-8
options.fontEncoding("UTF-8");
PdfConverter.getInstance().convert(document, out, options);
Run Code Online (Sandbox Code Playgroud)

有人知道我在这里做错了吗?