Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
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
[-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>]
#
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>]
#
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 -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.