THPDFPage.AddPushButton

THPDFPage

 

Methods  AcroForm Support

Adds an AcroForm push button widget to the current page

 

Delphi syntax:

procedure AddPushButton(const FieldName, Caption: AnsiString; Rectangle: TRect; Flags: THPDFFormFieldFlags = []);

 

Description

When native appearance generation is enabled, standard Helvetica captions support the 218-character canonical printable WinAnsi profile supplied as valid UTF-8 text and are centred horizontally using the same characters' glyph advances before PDF literal escaping. Euro, Latin accents and defined Windows-1252 punctuation use their canonical WinAnsi bytes. A caption wider than the widget retains the existing left-edge clamp, whilst font size, vertical placement, stored caption and action metadata keep their existing behaviour

For the extended multibyte UTF-8 caption path, any unsupported scalar or malformed sequence retains the existing whole-caption empty-appearance fallback without changing the stored caption; the original ASCII path is unchanged. General Unicode, automatic font fallback and complex shaping are outside this finite standard-font profile. See AutoFormAppearances for the unchanged appearance-generation gates, including PDF 2.0 output

The method creates a /Btn field with the Pushbutton flag and writes the caption through the widget appearance characteristics. Use AddPushButtonWithAction when the button should submit a form, reset the form, run JavaScript, open a URI, trigger a named viewer command, or hide another field

 

THPDFButtonAction values

   baNone — no /A action
   baSubmitURL — /S /SubmitForm with /FS /URL filespec (PDF 1.2 §12.7.5.2). Param is the destination URL
   baResetForm — /S /ResetForm resets every form field (PDF 1.2 §12.7.5.3)
   baJavaScript — /S /JavaScript /JS (Param) (PDF 1.3 §12.6.4.16)
   baURI — /S /URI /URI (Param) (PDF 1.1 §12.6.4.7). Opens the URL in a browser
   baNamed (HotPDF v2.119.18) — /S /Named /N <Param> (PDF 1.1 §12.6.4.11). Param is the spec name token: NextPage / PrevPage / FirstPage / LastPage (the four standard navigation commands all PDF readers honour). Acrobat extensions like Print and SaveAs are also accepted by compatible viewers
   baHide (HotPDF v2.119.18) — /S /Hide /T (Param) /H true (PDF 1.2 §12.6.4.10). Param is the name of the form field or annotation to hide when the button is clicked

 

Compliance

PDF/A (any level) rejects baJavaScript and baResetForm per ISO 19005-1 §6.6.1 / ISO 19005-2 §6.5.1 / ISO 19005-3 §6.5.1. PDF/X (any level) additionally rejects baSubmitURL. baNamed and baHide are spec-allowed under both PDF/A and PDF/X

 

See also: AcroForm Support, LastAnnotation