Skip to content

PDF 生成模板编辑器

开源可视化 PDF 生成引擎,支持自定义模板,并提供面向开发者的 API,灵活构建文档生成流程。

查看 GitHub
Guides

删除表单域

由于表单继承自注释类,所以删除表单域和删除注释的方法一致。

删除表单域的步骤如下:

  1. 从 CPDFDocument 中获取想要删除表单的页面对象。

  2. 删除表单域。

以下是删除指定文档中第一个注释的示例代码:

java
CPDFDocument document = new CPDFDocument(context);
document.open(pdfPath);
CPDFPage page = document.pageAtIndex(0);

List<CPDFAnnotation> annotationList = page.getAnnotations();
annotationList.remove(0);
kotlin
val document = new CPDFDocument(context)
document.open(pdfPath)
val page = document.pageAtIndex(0)

val annotationList = page.getAnnotations()
annotationList.removeAt(0)