当前位置: 首页 > news >正文

使用JAVA pdf转word

使用spire.pdf 非常简单。

查看 https://mvnrepository.com/artifact/e-iceblue/spire.pdf 

注意,这个包在 e-iceblue 下。

下面开始撸代码

先来pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>org.example</groupId><artifactId>pdfToWord</artifactId><version>1.0-SNAPSHOT</version><properties><maven.compiler.source>8</maven.compiler.source><maven.compiler.target>8</maven.compiler.target></properties><dependencies><dependency><groupId>e-iceblue</groupId><artifactId>spire.pdf</artifactId><version>9.10.3</version></dependency></dependencies><repositories><repository><id>com.e-iceblue</id><url>https://repo.e-iceblue.cn/repository/maven-public/</url></repository></repositories><pluginRepositories><pluginRepository><id>public</id><name>aliyun nexus</name><url>http://maven.aliyun.com/nexus/content/groups/public/</url><releases><enabled>true</enabled></releases><snapshots><enabled>false</enabled></snapshots></pluginRepository></pluginRepositories>
</project>

java代码。App.java

import com.spire.pdf.FileFormat;
import com.spire.pdf.PdfDocument;import java.io.*;public class App {public static void main(String[] args) {// 加载pdf文件PdfDocument pdf = new PdfDocument();pdf.loadFromFile("Django基础教程.pdf");//保存为Excel文档pdf.saveToFile("Django基础教程.docx", FileFormat.DOCX);pdf.dispose();}
}

注意: maven的setting.xml要配置

	<mirror><id>aliyunmaven</id><mirrorOf>*,!com.e-iceblue</mirrorOf><name>阿里云公共仓库</name><url>https://maven.aliyun.com/repository/public</url></mirror>

http://www.lryc.cn/news/229060.html

相关文章:

  • 成都瀚网科技有限公司抖音带货的正规
  • windows服务器热备、负载均衡配置
  • samba服务器搭建 挂载远程目录 常用配置参数介绍
  • Ansible命令使用
  • element 周选择器el-date-picker
  • No200.精选前端面试题,享受每天的挑战和学习
  • 前端面试之事件循环
  • sass 封装媒体查询工具
  • 眼科动态图像处理系统使用说明(2023-8-11 ccc)
  • 国际阿里云:提高CDN缓存命中率教程!!!
  • 关于“谈谈你对 ES 的理解”
  • Element-Ui el-table 动态添加行
  • 深度学习 大数据 股票预测系统 - python lstm 计算机竞赛
  • vue v-model
  • springboot整合ELK
  • 线性表->栈
  • linux rsyslog日志采集格式设定一
  • [100天算法】-不同路径 III(day 75)
  • 【学习笔记】[CCO2021] Travelling Merchant
  • 【终端】记录mbedtls库的重新安装
  • ElasticSearch简单操作
  • android studio新版本gradle Tasks找不到assemble
  • uniapp 小程序 身份证 和人脸视频拍摄
  • 飞腾ARM UOS编译Qt 5.15.2源码及Qt Creator
  • Oracle(2-2)Oracle Net Architecture
  • 高速高精运动控制,富唯智能AI边缘控制器助力自动化行业变革
  • GPTS应用怎么创建?GPTS无法创建应用很卡怎么办
  • 目标检测YOLO实战应用案例100讲-基于无人机的运动目标检测
  • 东莞松山湖数据中心|莞服务器托管的优势
  • 时间序列预测实战(十五)PyTorch实现GRU模型长期预测并可视化结果