Cmdlet
Add-OfficePdfFormField
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:
ContextAdd-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:
DocumentExamples
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
- Field alignment.
- Possible values:
Left,Center,Right,Justify - -Checked SwitchParameter
- Initial check-box state.
- -Height Double
- Rendered field height in PDF points.
- -Name String
- Form field name.
- -Options String[]
- Choice or radio options.
- -PassThru SwitchParameter
- Emit the updated document.
- -Type OfficePdfFormFieldType
- Field type to add.
- Possible values:
Text,CheckBox,Choice,MultiSelectChoice,RadioButton - -Value String
- Initial text, selected choice, or selected radio value.
- -Values String[]
- Initial selected values for multi-select choice fields.
- -Width Double
- Rendered field width in PDF points.
- -Document PdfDocument
- 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.