THotPDF Loaded Form Field Editing Methods
本参考主题说明 HotPDF 库中公开 API 的行为、参数和使用方式
字段级方法
procedure SetLoadedFormFieldFlags(FieldIndex, AFlags: Integer);
procedure SetLoadedFormFieldMaxLength(FieldIndex, AMaxLength: Integer);
procedure SetLoadedFormFieldJustification(FieldIndex: Integer;
AJustification: THPDFFormFieldJustification);
procedure SetLoadedFormFieldTooltip(FieldIndex: Integer; const ATooltip: AnsiString);SetLoadedFormFieldFlags替换完整的 PDF/Ff位掩码SetLoadedFormFieldMaxLength写出/MaxLen;零或负值移除限制THPDFFormFieldJustification含ffjLeft、ffjCenter、ffjRight,对应 PDF/Q值 0 到 2
控件几何
function GetLoadedFormFieldWidgetCount(FieldIndex: Integer): Integer;
function GetLoadedFormFieldWidgetRect(FieldIndex, WidgetIndex: Integer;
out ARect: THPDFRect): boolean;
procedure SetLoadedFormFieldWidgetRect(FieldIndex, WidgetIndex: Integer;
X1, Y1, X2, Y2: Single);- 字段与控件索引从 0 开始
- 控件枚举暴露 radio 组和其他多控件字段的每个
/Kids条目 - 矩形端点使用原始 PDF 用户空间点,写入前归一化
控件外观与可见性
procedure SetLoadedFormFieldRotation(FieldIndex, ADegrees: Integer);
procedure SetLoadedFormFieldBorderColor(FieldIndex: Integer;
ARed, AGreen, ABlue: Single);
procedure SetLoadedFormFieldVisibility(FieldIndex: Integer;
AVisible, APrintable: boolean);
procedure SetLoadedFormFieldBorderWidth(FieldIndex: Integer; AWidth: Single);
procedure SetLoadedFormFieldBackgroundColor(FieldIndex: Integer;
ARed, AGreen, ABlue: Single);- 旋转接受 90 度的正负倍数,存储归一化的
/MK /R值 - 边框与背景 RGB 分量钳制到 PDF DeviceRGB 的 0 到 1 范围
- 外观与可见性 setter 更新所选字段的每个控件
- 可见性在控制 Hidden、NoView 与 Print 的同时保留无关的注释标志
增量更新行为
- 字段、控件、
/MK与/BS字典在各自值存储的层级上标脏 - 视觉变化只使受影响页面的缓存 DPI 变体失效
- 无效的字段或控件索引使文档保持不变
示例
PDF.BeginIncrementalUpdate('input.pdf');
PDF.SetLoadedFormFieldMaxLength(0, 40);
PDF.SetLoadedFormFieldJustification(0, ffjCenter);
PDF.SetLoadedFormFieldRotation(0, 90);
PDF.SetLoadedFormFieldBorderColor(0, 0.1, 0.4, 0.8);
PDF.SetLoadedFormFieldWidgetRect(1, 1, 80, 150, 100, 170);
PDF.SaveIncrementalUpdate('updated.pdf');相关 API
Loaded form field methods · Loaded document toolkit · THotPDF