如何使用PDFBox创建带有过滤器的PDF文件副本?

huangapple 未分类评论52阅读模式
英文:

How to create a copy of a PDF file with PDFBox with a filter?

问题

我有一个PDF文件(假设为A.pdf),想要创建该文件的副本(B.pdf)。
但是在复制文件时,我想要跳过一些文本。

例如,A.pdf中有文本“Hello World”,我将跳过文本“Hello”,最终B.pdf将只剩下“World”。

编辑:单词“World”将保持在原处,不会发生移动。

我尝试使用PDFTextStripper类解决了这个问题,但文本仍然保持不变。
我对PDFBox相当新,并且正在使用版本2。

谢谢。

英文:

I have a PDF file file (say A.pdf) and would like to create a copy of that file (B.pdf).
But I would like to skip some text when I copy the file.

For example A.pdf has a text of Hello World and I will skip the text Hello and eventually B.pdf will have World only.

Edit: The word World shall stay where it is and it is not going to shift.

I tried to solve that problem using PDFTextStripper class but the text remained same. I'm quite new to the PDFBox and using version 2.

Thanks.

huangapple
  • 本文由 发表于 2020年4月6日 19:51:17
  • 转载请务必保留本文链接:https://java.coder-hub.com/61059160.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定