Я конвертирую слово в PDF, в моем затмении нет ошибок, но когда я развертываю свое Java-приложение в Tomcat, я сталкиваюсь с этим
кодом
Код: Выделить всё
private static File convertWordToPdf(MultipartFile wordFile, String originalFilename) {
infoLogger.info("ResponseUtility : convertWordToPdf Start : ");
File pdfFile = null;
try {
pdfFile = File.createTempFile(originalFilename, ".pdf");
IConverter converter = LocalConverter.builder().build();
converter.convert(wordFile.getInputStream()).as(DocumentType.MS_WORD).to(pdfFile).as(DocumentType.PDF)
.execute();
if (converter != null) {
converter.shutDown();
infoLogger.info("ResponseUtility : Converter shut down successfully");
}
infoLogger.info("ResponseUtility : convertWordToPdf End");
} catch (IOException e) {
errorLogger.error("ResponseUtility : Error At convertWordToPdf : multiple arguments : " + e.toString());
}
return pdfFile;
}
Код: Выделить всё
com.documents4j.throwables.ConversionInputException: The input file seems to be corrupt at com.documents4j.util.Reaction$ConversionInputExceptionBuilder.make(Reaction.java:159) at com.documents4j.util.Reaction$ExceptionalReaction.apply(Reaction.java:75) at com.documents4j.conversion.ExternalConverterScriptResult.resolve(ExternalConverterScriptResult.java:70) at com.documents4j.conversion.ProcessFutureWrapper.evaluateExitValue(ProcessFutureWrapper.java:50) at com.documents4j.conversion.ProcessFutureWrapper.get(ProcessFutureWrapper.java:38) at com.documents4j.conversion.ProcessFutureWrapper.get(ProcessFutureWrapper.java:11) at com.documents4j.job.AbstractFutureWrappingPriorityFuture.run(AbstractFutureWrappingPriorityFuture.java:78) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635),
tomcat работает от имени администратора
версии
Tomcat — 10.0.27
Amazon Corretto — jdk — jdk17.0.10_7
MS OFFICE — 2010
ОС — Windows 10 Pro
зависимости
Код: Выделить всё
`
com.documents4j
documents4j-local
1.1.12
com.documents4j
documents4j-api
1.1.12
com.documents4j
documents4j-transformer-msoffice-word
1.1.12
com.documents4j
documents4j-transformer-msoffice-excel
1.1.12
org.zeroturnaround
zt-exec
1.12
com.documents4j
documents4j-server
1.1.12
`
Set wordDocument = wordApplication.Documents.Open(inputFile, False, , False)
but it did not work for me.
in my local system, everything works fine,
please provide some solution,
Источник: https://stackoverflow.com/questions/781 ... oninputexc