SpringBoot集成jodconverter使用openoffice将word转为pdf

首先添加依赖

<dependency>
   <groupId>org.jodconverter</groupId>
    <artifactId>jodconverter-core</artifactId>
    <version>4.2.2</version>
</dependency>
<dependency>
    <groupId>org.jodconverter</groupId>
    <artifactId>jodconverter-spring-boot-starter</artifactId>
    <version>4.2.2</version>
</dependency>
<dependency>
    <groupId>org.jodconverter</groupId>
    <artifactId>jodconverter-local</artifactId>
    <version>4.2.2</version>
</dependency>

添加配置

jodconverter.local.enabled=true
jodconverter.local.office-home: C:\\Program Files (x86)\\OpenOffice 4
jodconverter.local.max-tasks-per-process: 10
jodconverter.local.port-numbers: 8100

注入类

@Autowired
private DocumentConverter converter;

使用

converter.convert(inputFile).to(outputFile).execute();

你可能感兴趣的:(SpringBoot集成jodconverter使用openoffice将word转为pdf)