Я пытаюсь преобразовать файл docx в PDF, но этот файл содержит только вставленный текст, который не распознается в процессе преобразования (docx или document4j).
Может кто-нибудь помочь мне найти библиотеку или какую-либо другуюсоветы, как это сделать?
Заранее спасибо.
try {
InputStream in = testXdocReportDoc.class.getResourceAsStream("testXdocReportDoc.docx");
IXDocReport report = XDocReportRegistry.getRegistry().loadReport(in, TemplateEngineKind.Velocity);
IContext context = report.createContext();
Project project = new Project("test1", "test2", "test3", "test4", "test5");
context.put("project", project);
File tempFile = new File(f.getAbsolutePath().replace("pdf", "docx"));
OutputStream out = new FileOutputStream(tempFile);
report.process(context, out);
try {
String inputFile = tempFile.getAbsolutePath();
FileInputStream in2 = new FileInputStream(inputFile);
XWPFDocument document = new XWPFDocument(in2);
OutputStream out2 = new FileOutputStream(f);
PdfOptions options = null;
PdfConverter.getInstance().convert(document, out2, options);
} catch (Exception e) {
e.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
}
}