THotPDF Loaded Form Field Editing Methods

THotPDF 已載入表單欄位編輯方法

本參考主題說明 HotPDF 函式庫中公開 API 的行為、參數與使用方式

原生欄位旗標編輯會保留完整的 32 位元遮罩,包括高位元與低位的常見旗標,並遵循既有的載入欄位繼承規則

帶號遮罩值、繼承與原生建構器行為,請參見 AcroForm field flag precision

欄位層級方法

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 視窗或已儲存的選取

Widget 幾何

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

Widget 外觀與可見性

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