java:pdfbox 3.0 去除扫描版PDF中文本水印

官网下载 https://pdfbox.apache.org/download.html
下载 pdfbox-app-3.0.3.jar

cd D:\pdfbox

运行 java -jar pdfbox-app-3.0.3.jar

复制代码
java -jar pdfbox-app-3.0.3.jar
Usage: pdfbox [COMMAND] [OPTIONS]
Commands:
  debug          Analyzes and inspects the internal structure of a PDF document
  decrypt        Decrypts a PDF document
  encrypt        Encrypts a PDF document
  decode         Writes a PDF document with all streams decoded
  export:images  Extracts the images from a PDF document
  export:xmp     Extracts the xmp stream from a PDF document
  export:text    Extracts the text from a PDF document
  export:fdf     Exports AcroForm form data to FDF
  export:xfdf    Exports AcroForm form data to XFDF
  import:fdf     Imports AcroForm form data from FDF
  import:xfdf    Imports AcroForm form data from XFDF
  overlay        Adds an overlay to a PDF document
  print          Prints a PDF document
  render         Converts a PDF document to image(s)
  merge          Merges multiple PDF d*.ocuments into one
  split          Splits a PDF document into number of new documents
  fromimage      Creates a PDF document from images
  fromtext       Creates a PDF document from text
  version        Gets the version of PDFBox
  help           Display help information about the specified command.
See 'pdfbox help <command>' to read about a specific subcommand

运行 java -jar pdfbox-app-3.0.3.jar debug

导出扫描版PDF文件中每页的图片文件

java -jar pdfbox-app-3.0.3.jar export:images -prefix=test -i your_book.pdf

导出

Writing image: test-1.jpg

Writing image: test-2.jpg

Writing image: test-3.png

......

from 多个 image 合并生成 pdf

java -jar pdfbox-app-3.0.3.jar fromimage -o=book1.pdf -i=test-1.jpg -i=test-2.jpg -i=test-3.png -i=test-4.jpg

生成 book1.pdf 视觉效果太差,而且命令行长度限制了图片文件数(一般扫描书都有几百页)。

还是要自己编程搞定。

相关推荐
喜欢踢足球的老罗3 分钟前
在Spring Boot 3.3中使用Druid数据源及其监控功能
java·spring boot·后端·druid
Winn~20 分钟前
JVM垃圾回收器-ZGC
java·jvm·算法
bytebeats27 分钟前
深入探索 Java 21 的核心特性
java
程序员小假40 分钟前
说一说 SpringBoot 中 CommandLineRunner
java·后端
sky_ph1 小时前
JAVA-GC浅析(一)
java·后端
爱coding的橙子1 小时前
每日算法刷题Day24 6.6:leetcode二分答案2道题,用时1h(下次计时20min没写出来直接看题解,节省时间)
java·算法·leetcode
岁忧1 小时前
(nice!!!)(LeetCode每日一题)2434. 使用机器人打印字典序最小的字符串(贪心+栈)
java·c++·算法·leetcode·职场和发展·go
天天摸鱼的java工程师1 小时前
@Autowired 注入失效?
java·后端
sss191s1 小时前
校招 Java 面试基础题目解析学习指南含新技术实操要点
java·python·面试
编程毕设1 小时前
【含文档+PPT+源码】基于微信小程序的旅游论坛系统的设计与实现
java·tomcat·旅游