完了,新年第一天老婆喊我找个免费的转换软件帮她转一下dpf,我倒是找了些个在线免费转化的,也找了些免费的软件但是不是现在页数就是需要开会员,要么就限制大小,好吧,程序员嘛能省一块钱是一块钱,,能白嫖哎就白嫖下吧。新的一年希望祖国经济好起来,也预祝大家新年快乐,身体健康,万事如意。
免费在线转:https://www.alltoall.net/
pom插件、包引入、测试类,jar包
通过网盘分享的文件:aspose-pdf-21.6.jar
链接: https://pan.baidu.com/s/1XNS-FkWO1ztnRy-0HVMEeQ 提取码: 1deq
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
<executions>
<execution>
<id>install-pdf</id>
<phase>clean</phase>
<configuration>
<file>${pom.basedir}/src/resources/lib/aspose-pdf-21.6.jar</file>
<repositoryLayout>default</repositoryLayout>
<groupId>com.aspose</groupId>
<artifactId>aspose-pdf</artifactId>
<version>21.6</version>
<packaging>jar</packaging>
<generatePom>true</generatePom>
</configuration>
<goals>
<goal>install-file</goal>
</goals>
</execution>
</executions>
</plugin>
<!--pdf转word-->
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-pdf</artifactId>
<version>21.6</version>
</dependency>
import com.aspose.pdf.Document;
import com.aspose.pdf.SaveFormat;
import java.io.*;
/**
* Description PDF转word工具类
*
* @author wsm
* @date 2025.01.01 0:20
*/
public class PDFToWordHelperUtil {
public static void main(String[] args) throws IOException {
pdf2doc("C:\\Users\\wangsm\\Desktop\\目录\\W020120410330232398521.pdf");
}
//pdf转doc
public static void pdf2doc(String pdfPath) {
long old = System.currentTimeMillis();
try {
//新建一个word文档
String wordPath=pdfPath.substring(0,pdfPath.lastIndexOf("."))+".docx";
FileOutputStream os = new FileOutputStream(wordPath);
//doc是将要被转化的word文档
Document doc = new Document(pdfPath);
//全面支持DOC, DOCX, OOXML, RTF HTML, OpenDocument, PDF, EPUB, XPS, SWF 相互转换
doc.save(os, SaveFormat.DocX);
os.close();
//转化用时
long now = System.currentTimeMillis();
System.out.println("Pdf 转 Word 共耗时:" + ((now - old) / 1000.0) + "秒");
} catch (Exception e) {
System.out.println("Pdf 转 Word 失败...");
e.printStackTrace();
}
}
}
来自:https://blog.csdn.net/qq_32419139/article/details/126972014