码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • 使用JAVA pdf转word


    使用spire.pdf 非常简单。

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

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

    下面开始撸代码

    先来pom.xml

    1. "1.0" encoding="UTF-8"?>
    2. <project xmlns="http://maven.apache.org/POM/4.0.0"
    3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    4. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    5. <modelVersion>4.0.0modelVersion>
    6. <groupId>org.examplegroupId>
    7. <artifactId>pdfToWordartifactId>
    8. <version>1.0-SNAPSHOTversion>
    9. <properties>
    10. <maven.compiler.source>8maven.compiler.source>
    11. <maven.compiler.target>8maven.compiler.target>
    12. properties>
    13. <dependencies>
    14. <dependency>
    15. <groupId>e-icebluegroupId>
    16. <artifactId>spire.pdfartifactId>
    17. <version>9.10.3version>
    18. dependency>
    19. dependencies>
    20. <repositories>
    21. <repository>
    22. <id>com.e-iceblueid>
    23. <url>https://repo.e-iceblue.cn/repository/maven-public/url>
    24. repository>
    25. repositories>
    26. <pluginRepositories>
    27. <pluginRepository>
    28. <id>publicid>
    29. <name>aliyun nexusname>
    30. <url>http://maven.aliyun.com/nexus/content/groups/public/url>
    31. <releases>
    32. <enabled>trueenabled>
    33. releases>
    34. <snapshots>
    35. <enabled>falseenabled>
    36. snapshots>
    37. pluginRepository>
    38. pluginRepositories>
    39. project>

    java代码。App.java

    1. import com.spire.pdf.FileFormat;
    2. import com.spire.pdf.PdfDocument;
    3. import java.io.*;
    4. public class App {
    5. public static void main(String[] args) {
    6. // 加载pdf文件
    7. PdfDocument pdf = new PdfDocument();
    8. pdf.loadFromFile("Django基础教程.pdf");
    9. //保存为Excel文档
    10. pdf.saveToFile("Django基础教程.docx", FileFormat.DOCX);
    11. pdf.dispose();
    12. }
    13. }

    注意: maven的setting.xml要配置

    1. <id>aliyunmaven
    2. *,!com.e-iceblue
    3. 阿里云公共仓库
    4. https://maven.aliyun.com/repository/public

  • 相关阅读:
    【Leetcode】152.乘积最大子数组
    Word控件Spire.Doc 【页面设置】教程(1):在C#/VB.NET:在 Word 文档中插入分页符
    RabbitMQ死信队列、延时队列
    k8s存储
    Arthas简介及IDEA插件快速入门
    什么情况下适合使用静态路由?什么情况下适合使用动态路由?
    刷题笔记22——二叉搜索树BST
    C语言拾遗-机制
    PTA 7-81 统计工龄
    【scikit-learn基础】--『监督学习』之 谱聚类
  • 原文地址:https://blog.csdn.net/huantianxidi/article/details/134389579
  • 最新文章
  • 沪漂五周年了:我越来越迷茫了
    Agentic Skill Routing 实战:别再把所有 Skill 塞进 AI Agent 上下文
    MySQL-Seconds_behind_master的精度误差
    [MAF预定义ChatClient中间件-03]CachingChatClient——利用缓存省钱省时间
    AI的至暗历史:从万众期待到被政府撤资,AI的两次死亡徘徊
    Agent OS :五种驯服不确定性的范式
    PortSwigger SQL注入LAB11
    数据库即时编译JIT
    [Begin]AI Learn Data Day 0
    深度学习进阶(二十七)现代 LLM 的核心架构设计其二:SwiGLU
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
小工具 小游戏
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1

京公网安备 11010502049817号