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

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

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.