这是一个非常重要的问题,我非常有兴趣得到你的帮助.
我使用PDFBox创建一个简单的PDF文档.我试图做的是阅读现有文档,然后将相同的文本重新写入其中,并处于相同的位置.
1)首先,我创建一个名为"Musique.pdf"的PDF.
2)阅读此现有文件.
3)使用PDFTextStripper将文本提取到文档中.
3)找到文档中每个字符的位置(x,y,宽度,fs等).
4)创建一个必须包含每个字符的x和y的表,例如tabel1 [0] = x1 tabel1 [1] = y1,table1 [2] = x2,table1 [3] = y2等.
5)然后创建一个PDFContentStream的boucle来重写每个字符在正确的位置.
问题是:
第一行是完全写的,但问题是第二行.
"I notice that if we have for example a text formed of 3 lines and if we assume that it contains 225 characters,,so if we get the length of this text, we will put a length equal to 231,,so we can notice that it adds 2 spaces of the end of each line,, but when we search …
Run Code Online (Sandbox Code Playgroud)