Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Set-OfficePdfForm

Module PSWriteOffice
Inputs
None
Outputs
System.IO.FileInfo

Fills and optionally flattens simple AcroForm fields in an existing PDF.

Syntax

Set-OfficePdfForm [-AppearanceFontFamilyName <String>] [-AppearanceFontPath <String>] [-Field <Hashtable>] [-Flatten] [-IgnorePermissionRestrictions] [-Incremental] [-KeepNeedAppearances] -OutputPath <String> [-PassThru] [-Password <String>] -Path <String> [<CommonParameters>]
#
Parameter set: All Parameter Sets

Examples

Authored help example

Fill and flatten a PDF form.

$fields = @{
    Requester = 'Ada Lovelace'
    Priority = 'High'
    Approved = $true
}
Set-OfficePdfForm -Path .\Examples\Documents\Request.pdf -OutputPath .\Examples\Documents\Request-FilledFlat.pdf -Field $fields -Flatten

Fills simple AcroForm fields and writes a flattened PDF.

Parameters

-AppearanceFontFamilyName String optional
PDF font family name used for the supplied appearance font.
-AppearanceFontPath String optional
TrueType or OpenType/CFF font file used to synthesize Unicode form field appearances.
-Field Hashtable optional
Field values keyed by form field name.
-Flatten SwitchParameter optional
Flatten simple form fields after filling, or flatten without filling when -Field is omitted.
-IgnorePermissionRestrictions SwitchParameter optional
After successful password authentication, explicitly ignore owner-imposed form-modification restrictions.
-Incremental SwitchParameter optional
Append simple form field values as an incremental PDF revision instead of rewriting the existing PDF.
-KeepNeedAppearances SwitchParameter optional
True to keep /NeedAppearances enabled for legacy PDF viewers after filling fields.
-OutputPath String required
Output PDF path.
-PassThru SwitchParameter optional
Emit the object created or changed by the command.
-Password String optional
Password used to authenticate an encrypted PDF.
-Path String requiredaliases: FilePath
Input PDF path.

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.