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 视觉效果太差,而且命令行长度限制了图片文件数(一般扫描书都有几百页)。

还是要自己编程搞定。

相关推荐
爱编程的鱼14 分钟前
C# 变量详解:从基础概念到高级应用
java·算法·c#
ptc学习者16 分钟前
OGG 安装注意事项
java·开发语言·数据库
Camel卡蒙18 分钟前
DDD架构——充血模型、领域模型
java·设计模式·架构
n8n31 分钟前
RabbitMQ全面详解:从核心概念到企业级应用
java·rocketmq
用户7851278147032 分钟前
实战代码:获取淘宝商品详情数据接口
java
Chan1634 分钟前
流量安全优化:基于 Sentinel 实现网站流量控制和熔断
java·spring boot·安全·sentinel·intellij-idea·进程
源码7可1 小时前
Java高手速成--吃透源码+手写组件+定制开发
java
zjjuejin1 小时前
Maven 云原生时代面临的八大挑战
java·后端·maven
ZhengEnCi2 小时前
@RequestParam 注解完全指南-从参数绑定到接口调用的Web开发利器
java·spring boot
=>>漫反射=>>2 小时前
单元测试 vs Main方法调试:何时使用哪种方式?
java·spring boot·单元测试