修改现有PDF而不创建新的pdf文件

修改现有PDF而不创建新的pdf文件

本文介绍了修改现有PDF而不创建新的pdf文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用iText,我想打开一个PDF文件,添加一些带有文本的页面,然后关闭它。我在这里找到了一些这样的问题,但都需要创建一个新的PDF文件。有没有办法在pdf文件中读取并修改它然后覆盖原始文件?

Using iText, I am wanting to open a PDF file, add some more pages with text to it, and then close it. I have found some questions like this on here, but all require creating a new PDF file. Is there any way to read in the pdf file and modify it and then overwrite the original?

推荐答案

当然你可以创建一个新的pdf文件,然后用新文件覆盖旧文件。

Of course you can create a new pdf file, and afterwards overwriting the old file with the new one.

forceDelete(oldPdf)
moveFile(newPdf, oldPdf)

这篇关于修改现有PDF而不创建新的pdf文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 19:11