1

我正在使用 Documents4j 将 rtf 文件转换为 pdf 文件。我的电脑上没有 MS Word 或任何东西,所以看来我需要使用远程转换器。这里的信息:http ://documents4j.com/#/ 。

我的项目是使用 spring-boot 设置的。根据 GitHub 上的一些问题,我使用 maven-shade-plugin 为 maven 设置了阴影。但是,我无法运行 Documents4j 建议的让服务器运行的命令: java -jar documents4j-server-standalone-shaded.jar http://localhost:9998

我得到: Error: Unable to access jarfile documents4j-server-standalone-shaded.jar

我的 pom.xml 文件引入了 shade 插件。

这是我的 pom.xml 中的插件:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                        </configuration>
                    </execution>
            </executions>
        </plugin>

以下是我使用的关于 Documents4j 的依赖项:(也许缺少一些重要的东西?)

    <dependency>
        <groupId>com.documents4j</groupId>
        <artifactId>documents4j-api</artifactId>
        <version>1.0.3</version>
    </dependency>
    <dependency>
        <groupId>com.documents4j</groupId>
        <artifactId>documents4j-client</artifactId>
        <version>1.0.3</version>
    </dependency>
    <dependency>
        <groupId>com.documents4j</groupId>
        <artifactId>documents4j-server-standalone</artifactId>
        <version>1.0.3</version>
    </dependency>

根据我在 Documents4j 页面上阅读的内容,该命令似乎应该可以正常工作,因此我假设没有创建 jar 文件。

我似乎无法在任何地方找到该 jarfile ......所以我无法使用路径而不是名称来运行 java -jar 命令。

另外,我不确定插件中可能需要什么“配置”。也许有一个技巧可以让 maven 着色工作?也许我误解了 Documents4j 页面在说什么?也许它对 Mac 的工作方式不同?也许 Documents4j 不是一个好的选择?

我非常感谢所有的帮助。

4

1 回答 1

0

请注意,它只能在支持 .NET 并安装了 Office 的 Windows Server 上运行。 https://github.com/documents4j/documents4j/issues/53

于 2019-01-07T22:25:39.353 回答