Unofficial Content

Query all form fields (GetFields)

Objective

Get the names and values of all form fields present in a PDF document.

Parameters

Parameter Required Description
Source path Yes PDF file from which the fields are queried.

Result

A collection of PDFToolsFormField items, one per field found in the document, in the same order in which the fields appear in the document (visual/tab order of the form). Each item exposes three properties: field name, value, and possible values (same rule as in GetField).

Functional details

  • The returned order respects the actual visual/tab order of the form, not an arbitrary order.

  • This collection uses the same data structure expected by SetFields, so the obtained result can be directly edited and reused to write the form back (the possible-values property is ignored when filling fields; it is informational only).

  • Iterating the result: since the form's field names are not known in advance, the result is a standard (iterable) collection of name/value items. To query the value of a single field known in advance, without needing to obtain or iterate the whole collection, use GetField directly.

  • There is no native "date" type: the PDF forms standard only defines four field types: text, checkbox/radio button, list/combo, and signature. What often looks like a "date field" with a calendar picker in tools like Adobe Acrobat is actually a plain text field with JavaScript embedded in the document itself; this component treats any field of this kind as plain text, without validating or interpreting date formats.

  • The source file cannot be password-protected.

Usage example

&PDFFileSource = "C:\Documents\form.pdf"

&PDFToolsStatus = &PdfToolsUtils.GetFields(&PDFFileSource,&PDFToolsFields)

// Possible result (in order of appearance in the form):

//| Key    | Value        | Options          |
//|--------|--------------|------------------|
//| Name   |  John Doe    |                  |
//| Country|  AR          | "AR,BR,UY,CL"    |
//| Accepts|  Yes         | "Off,Yes"        |

Error and warning messages

Situation Type Message / behavior
The document has no form fields Success (not an error) An empty collection is returned.
The source file does not exist, is corrupted, or is protected Error Message describing the problem reading the file.
Last update: 2026 | © GeneXus. All rights reserved. GeneXus Powered by Globant