参考file-convert-util工具,实现doc,docx,html,md,pdf,png转换

参考 https://gitee.com/zhengqingya/file-convert-util 项目,打包到本地仓库实现doc,docx,html,md,pdf,png转换
https://gitee.com/bestman_456/file-convert-util-ext
1. 安装jar到本地仓库
aspose-words-18.6-jdk16.jar
aspose-cells-8.5.2.jar
Spire.Doc.jar
Spire.Pdf.jar

  <dependency>
            <groupId>com.aspose</groupId>
            <artifactId>aspose-words</artifactId>
            <version>18.6</version>
        </dependency>
        <dependency>
            <groupId>com.aspose</groupId>
            <artifactId>aspose-cells</artifactId>
            <version>8.5.2</version>
        </dependency>
         <dependency>
            <groupId>com.spire</groupId>
            <artifactId>spire.doc</artifactId>
            <version>2.7.3</version>
        </dependency>
        <dependency>
            <groupId>com.spire</groupId>
            <artifactId>spire.pdf</artifactId>
            <version>2.6.3</version>
        </dependency>
命令       
mvn install:install-file -Dfile=D:\workspace\idea_workspace\file-convert-util\lib\Spire.Pdf.jar -DgroupId=com.spire -DartifactId=spire.pdf -Dversion=2.6.3 -Dpackaging=jar
2. 优化代码
保留工具类,去除Application.java,StartAppRunner.java 等

使用FileConvertUtil 工具类API

Word2Html
Word2Pdf
Word2Jpg
Word2Png
Html2Word
Html2Pdf
Html2Jpg
Html2PngBy2
Doc2Docx
Excel2Pdf
Html2Png
Markdown2Html    转换格式不是太完善
Pdf2Word
Pdf2Png
3. 安装

pom.xml添加插件依赖

<!--compiler-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <!-- Source -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.2.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.1</version>
                <configuration>
                    <skipTests>true</skipTests>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.0.2</version>
                <executions>
                    <execution>
                        <id>default-jar</id>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <excludes>
                        <exclude>/logback.xml</exclude>
                    </excludes>
                    <includes>
                        <include>/**</include>
                    </includes>
                </configuration>
            </plugin>

mvn clean install后,其他项目可以添加依赖

<dependency>
    <groupId>com.yl</groupId>
    <artifactId>file-convert-util</artifactId>
    <version>1.0.0</version>
</dependency>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值