Endpoint /documentprocessing/pdf/acroforms/fields

POST https://example.com/documentprocessing/pdf/acroforms/fields

POST

Returns all AcroForm fields of a given PDF document.

Examples

The following example returns a contained fields in a given PDF document.

# Request:
curl --location --request POST 'https://trial.dsserver.io/documentprocessing/pdf/acroforms/fields' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer fePFHv8OtIyRSCAdOnn7USc9kKdYB2rg' \
    --data-raw '"JVBERi0xLjY[..]="'

# Result:
[
    {
        "value": "",
        "fieldName": "TextField1",
        "alternateFieldName": "",
        "fieldType": "FormTextField",
        "bounds": {
            "x": 2498,
            "y": 13138,
            "width": 7996,
            "height": 440
        }
    },
    {
        "isChecked": false,
        "fieldName": "Check Box2",
        "alternateFieldName": "",
        "fieldType": "FormCheckBox",
        "bounds": {
            "x": 3519,
            "y": 12567,
            "width": 7398,
            "height": 360
        }
    }
]

Authorization

This endpoint supports the OAuth authorization method:

OAuth

DS Server implements OAuth as the authorization method. Two flows are supported:

  • Authorization Code
  • Client Credentials

In order to use the Client Credentials flow, this method must be explicitly enabled in the admin portal of DS Server.

In both cases, a valid access token returned from the OAuth endpoints must be passed in a Bearer Authorization Header or as a Query Parameter.

Authorization Header

Header Field Description
Authorization

A Bearer authorization header (also called token authentication) contains the OAuth access token. The authorization method and a space i.e. "Bearer " is then put before your valid access token. For example:

Authorization: Bearer 4796E23054E64BC773CACBCAF24AD179DE9A3

Query Parameter

Query Parameter Description
access_token

The access token is passed directly in the endpoint URL as a query string. For example:

?access_token=4796E23054E64BC773CACBCAF24AD179DE9A3

Request Payload

Type Value
string The PDF document encoded as a Base64 string.

Success Response

Status Type Description
200 FormField On success, the HTTP status code in the response header is 200 (OK). The response body contains an array of FormField objects.

FormField

Name Type Value Optional
alternateFieldName String The alternate field name. yes
fieldName String The field name. yes
fieldType String The field type. yes
bounds Rectangle The rectangle bounds of the field in the document in points. yes
FormCheckBox Inherited object. See description below. yes
FormButton Inherited object. See description below. yes
FormChoiceField Inherited object. See description below. yes
FormComboBox Inherited object. See description below. yes
FormListBox Inherited object. See description below. yes
FormRadioButton Inherited object. See description below. yes

Rectangle

Name Type Value Optional
x Integer The horizontal position of the rectangle. no
y Integer The vertical position of the rectangle. no
width Integer The width of the rectangle. no
height Integer The height of the rectangle. no

FormCheckBox

Name Type Value Optional
isChecked Boolean Specifies whether the check box is checked or not. yes

FormChoiceField

Name Type Value Optional
options String[] Gets or sets the option elements of a choice field. yes
canEdit Boolean Specifies whether a field can be edited. yes
sort Boolean Specifies whether the list can be sorted. yes
multiSelect Boolean Specifies whether multiple options can be selected. yes
doNotSpellCheck Boolean Specifies whether spell checking is enabled or not. yes
commitOnSelChange Boolean Specifies whether the form is submitted when the selected is changed. yes
value String Gets or sets the selected value of a choice list. yes

FormComboBox

Name Type Value Optional
options String[] Gets or sets the option elements of a choice field. yes
canEdit Boolean Specifies whether a field can be edited. yes
sort Boolean Specifies whether the list can be sorted. yes
multiSelect Boolean Specifies whether multiple options can be selected. yes
doNotSpellCheck Boolean Specifies whether spell checking is enabled or not. yes
commitOnSelChange Boolean Specifies whether the form is submitted when the selected is changed. yes
value String Gets or sets the selected value of a choice list. yes

FormListBox

Name Type Value Optional
options String[] Gets or sets the option elements of a choice field. yes
canEdit Boolean Specifies whether a field can be edited. yes
sort Boolean Specifies whether the list can be sorted. yes
multiSelect Boolean Specifies whether multiple options can be selected. yes
doNotSpellCheck Boolean Specifies whether spell checking is enabled or not. yes
commitOnSelChange Boolean Specifies whether the form is submitted when the selected is changed. yes
value String Gets or sets the selected value of a choice list. yes

FormRadioButton

Name Type Value Optional
isChecked Boolean Specifies whether the check box is checked or not. yes

Error Response

Status Description
401 A 401 (Unauthorized) is returned, if the user is not authorized.
400 A 400 (Bad Request) is returned, if DS Server is not licensed or the license is invalid.
400 A 400 (Bad Request) is returned, if no fields are found in the PDF document.
400 A 400 (Bad Request) is returned, if the uploaded document is not valid.