扁平化现有 PDF 文件中的所有字段 (facades)
Contents
[
Hide
]
Form 类的 flattenAllFields(..) 方法允许您扁平化 PDF 表单的所有字段。您首先需要创建 Form 对象,绑定源 PDF 文件,然后调用 flattenAllFields(…) 方法,最后使用 save(..) 方法保存更新后的 PDF。
以下代码片段向您展示如何扁平化 PDF 文件的所有字段。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Java | |
// open document | |
Form pdfForm = new Form(); | |
// bind source PDF file | |
pdfForm.bindPdf("input.pdf"); | |
// flatten fields | |
pdfForm.flattenAllFields(); | |
// save output | |
pdfForm.save("output.pdf"); |