THotPDF Loaded Form Field Editing Methods

THotPDF 已加载表单字段编辑方法

在既有 AcroForm 中更新字段约束与 widget 外观字典,同时保持增量保存与渲染缓存正确

原生字段标志编辑保留完整的 32 位掩码,包括高位和低位常用标志,并沿用既有的已加载字段继承规则

有符号掩码值、继承与原生构建器行为见AcroForm 字段标志精度

字段级方法

procedure SetLoadedFormFieldFlags(FieldIndex, AFlags: Integer);
procedure SetLoadedFormFieldMaxLength(FieldIndex, AMaxLength: Integer);
procedure SetLoadedFormFieldJustification(FieldIndex: Integer;
  AJustification: THPDFFormFieldJustification);
procedure SetLoadedFormFieldTooltip(FieldIndex: Integer; const ATooltip: AnsiString);

用 SetLoadedFormFieldJustification 设置字段对齐,再用 EnsureLoadedFieldAppearanceStream 重新生成外观;已加载 listbox 标签遵循生效的 /Q 值,而不改变 /TI 窗口或已存储的选中项

控件几何

function GetLoadedFormFieldWidgetCount(FieldIndex: Integer): Integer;
function GetLoadedFormFieldWidgetRect(FieldIndex, WidgetIndex: Integer;
  out ARect: THPDFRect): boolean;
procedure SetLoadedFormFieldWidgetRect(FieldIndex, WidgetIndex: Integer;
  X1, Y1, X2, Y2: Single);

控件外观与可见性

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);

增量更新行为

示例

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

已加载表单字段方法 · 已加载文档工具包 · THotPDF