# Add-OfficePdfFormField

Adds a simple AcroForm field to a generated PDF document.

Cmdlet 

Aliases: PdfFormField

**Module**

`PSWriteOffice`

**Aliases**

`PdfFormField`

**Inputs**

`OfficeIMO.Pdf.PdfDocument`

**Outputs**

`OfficeIMO.Pdf.PdfDocument`

**Source**

[AddOfficePdfFormFieldCommand.cs:26](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/PowerShell/PSWriteOffice/Sources/PSWriteOffice/Cmdlets/Pdf/AddOfficePdfFormFieldCommand.cs#L26) 

Adds a simple AcroForm field to a generated PDF document.

## Syntax

```
Add-OfficePdfFormField
[-Alignment <OfficeAlignment>]
[-Checked]
[-CheckedValue <String>]
[-Height <OfficeLength>]
[-ListBox]
[-Name] <String>
[-Option <String[]>]
[-Size <OfficeLength>]
[-Type <Text|CheckBox|Choice|MultiSelectChoice|RadioButton>]
[-Value <String[]>]
[-Width <OfficeLength>]
[<CommonParameters>]
```

[#](#method-add-officepdfformfield-officealignment-switchparameter-string-officelength-switchparameter-string-string-officelength-officepdfformfieldtype-string-officelength)

Parameter set: `Context`

```
Add-OfficePdfFormField
[-Alignment <OfficeAlignment>]
[-Checked]
[-CheckedValue <String>]
-Document <PdfDocument>
[-Height <OfficeLength>]
[-ListBox]
[-Name] <String>
[-Option <String[]>]
[-PassThru]
[-Size <OfficeLength>]
[-Type <Text|CheckBox|Choice|MultiSelectChoice|RadioButton>]
[-Value <String[]>]
[-Width <OfficeLength>]
[<CommonParameters>]
```

[#](#method-add-officepdfformfield-officealignment-switchparameter-string-pdfdocument-officelength-switchparameter-string-string-switchparameter-officelength-officepdfformfieldtype-string-officelength)

Parameter set: `Document`

## Guides & Samples

Authored walkthroughs and practical samples linked to this command.

- [Create and Process PDF Forms and Annotations](/docs/pswriteoffice/pdf-forms-annotations/) Guide
  
  Create interactive form fields, inspect and fill existing forms, manage annotations, and flatten only when the delivery policy requires it.
- [Fill and Flatten PDF Forms](/docs/pdf/forms/) Guide
  
  List AcroForm fields, fill them by name, flatten the result, exchange XFDF data, and add form fields to new PDFs with OfficeIMO.Pdf and PSWriteOffice.

## Examples

### Create a simple PDF form.

```powershell
New-OfficePdf -Path .\Examples\Documents\PdfForm.pdf {
  Add-OfficePdfHeading -Text 'Access request'
  Add-OfficePdfParagraph -Text 'Requester'
  Add-OfficePdfFormField -Name 'Requester' -Type Text -Width 240
  Add-OfficePdfParagraph -Text 'Priority'
  Add-OfficePdfFormField -Name 'Priority' -Type Choice -Option 'Low','Normal','High' -Value 'Normal'
  Add-OfficePdfFormField -Name 'Approved' -Type CheckBox
}
```

Adds text, choice, and checkbox form fields to a generated PDF.

## Parameters

**-Alignment OfficeAlignment optional**

Field alignment.

Possible values: `Left`, `Center`, `Right`, `Justify`, `Start`, `End`

**-Checked SwitchParameter optional**

Initial check-box state.

**-CheckedValue String optional**

Export name of the checked state for a check box.

**-Height OfficeLength optional**

Rendered field height in PDF points.

**-ListBox SwitchParameter optional**

Render scalar choices as a list box rather than a combo box.

**-Name String requiredposition: 0**

Form field name.

**-Option String[] optional**

Choice or radio options.

**-Size OfficeLength optional**

Native field text size or check-box size.

**-Type OfficePdfFormFieldType optional**

Field type to add.

Possible values: `Text`, `CheckBox`, `Choice`, `MultiSelectChoice`, `RadioButton`

**-Value String[] optional**

Initial value; MultiSelectChoice accepts multiple selected values, other fields accept at most one.

**-Width OfficeLength optional**

Rendered field width in PDF points.

**-Document PdfDocument requiredpipeline: True (ByValue)sets: Document**

PDF document to update outside the DSL context.

**-PassThru SwitchParameter optionalsets: Document**

Emit the updated document.

## Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see [about_CommonParameters](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

<!-- PowerForge markdown artifact sha256:F9F2AAF53C3719CDBAD2345A40E4DB93177476A5D6030FA54D1E6EFD8BB756B1 -->
