Project

PSWriteOffice

PowerShell document automation across OfficeIMO's document, spreadsheet, presentation, PDF, Project, Access, EPUB, invoicing, and conversion engines.

Stars 654
Forks 82
Open issues 1
Total downloads 4,320,051
Release OfficeIMO-v3.5.3
Language: C# Updated: 2026-11-03
Cmdlet

Add-OfficePdfFormField

Aliases: PdfFormField
Module
PSWriteOffice
Aliases
PdfFormField
Inputs
OfficeIMO.Pdf.PdfDocument
Outputs
OfficeIMO.Pdf.PdfDocument

Adds a simple AcroForm field to a generated PDF document.

Syntax

Add-OfficePdfFormField
[-Align <Left|Center|Right|Justify>]
[-Checked]
[-Height <Double>]
[-Name] <String>
[-Options <String[]>]
[-PassThru]
[-Type <Text|CheckBox|Choice|MultiSelectChoice|RadioButton>]
[-Value <String>]
[-Values <String[]>]
[-Width <Double>]
[<CommonParameters>]
#
Parameter set: Context
Add-OfficePdfFormField
[-Align <Left|Center|Right|Justify>]
[-Checked]
-Document <PdfDocument>
[-Height <Double>]
[-Name] <String>
[-Options <String[]>]
[-PassThru]
[-Type <Text|CheckBox|Choice|MultiSelectChoice|RadioButton>]
[-Value <String>]
[-Values <String[]>]
[-Width <Double>]
[<CommonParameters>]
#
Parameter set: Document

Examples

Create a simple PDF form.

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 -Options 'Low','Normal','High' -Value 'Normal'
  Add-OfficePdfFormField -Name 'Approved' -Type CheckBox
}

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

Parameters

-Align PdfAlign optional
Field alignment.
Possible values: Left, Center, Right, Justify
-Checked SwitchParameter optional
Initial check-box state.
-Height Double optional
Rendered field height in PDF points.
-Name String requiredposition: 0
Form field name.
-Options String[] optional
Choice or radio options.
-PassThru SwitchParameter optional
Emit the updated document.
-Type OfficePdfFormFieldType optional
Field type to add.
Possible values: Text, CheckBox, Choice, MultiSelectChoice, RadioButton
-Value String optional
Initial text, selected choice, or selected radio value.
-Values String[] optional
Initial selected values for multi-select choice fields.
-Width Double optional
Rendered field width in PDF points.
-Document PdfDocument requiredpipeline: True (ByValue)sets: Document
PDF document to update outside the DSL context.

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.