Interface PdfForm
public interface PdfForm
PDF Interactive Form (AcroForm)
PDF 交互表单
Represents the interactive form in a PDF document.
表示 PDF 文档中的交互表单。
Features | 主要功能:
- Field access by name and type - 按名称和类型访问字段
- Batch field value setting - 批量设置字段值
- Form flattening (making non-editable) - 表单扁平化(使其不可编辑)
- Appearance generation - 外观生成
Usage Examples | 使用示例:
PdfForm form = document.getForm();
form.setFieldValues(Map.of("name", "John", "age", "30"));
form.flatten();
Security | 安全性:
- Thread-safe: Depends on implementation - 线程安全: 取决于实现
- Null-safe: Depends on implementation - 空值安全: 取决于实现
- Since:
- JDK 25, opencode-base-pdf V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidClears all field values 清除所有字段值voidflatten()Flattens the form (makes fields non-editable) 扁平化表单(使字段不可编辑)voidFlattens specific fields 扁平化指定字段voidGenerates field appearances 生成字段外观Gets a field by name 根据名称获取字段Gets all field names 获取所有字段名Gets all fields 获取所有字段Gets fields by type 根据类型获取字段getFieldValue(String name) Gets field value 获取字段值Gets all field values 获取所有字段值booleanChecks if form needs appearances 检查表单是否需要外观voidsetFieldValue(String name, String value) Sets field value 设置字段值voidsetFieldValues(Map<String, String> values) Sets multiple field values 设置多个字段值
-
Method Details
-
getFieldNames
-
getField
-
getFields
-
getFields
-
setFieldValue
-
setFieldValues
-
getFieldValue
-
getFieldValues
-
flatten
void flatten()Flattens the form (makes fields non-editable) 扁平化表单(使字段不可编辑) -
flatten
Flattens specific fields 扁平化指定字段- Parameters:
fieldNames- fields to flatten | 要扁平化的字段
-
clearValues
void clearValues()Clears all field values 清除所有字段值 -
needsAppearances
boolean needsAppearances()Checks if form needs appearances 检查表单是否需要外观- Returns:
- true if needs appearances | 如果需要外观返回 true
-
generateAppearances
void generateAppearances()Generates field appearances 生成字段外观
-