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

New-OfficePdfSignature

Module
PSWriteOffice
Inputs
System.String
Outputs
System.IO.FileInfo OfficeIMO.Pdf.PdfExternalSignaturePreparation

Prepares an existing PDF for external digital signing by appending a signature field, /ByteRange, and reserved /Contents placeholder.

Syntax

New-OfficePdfSignature
[-ContactInfo <String>]
[-FieldName <String>]
[-Filter <String>]
[-IgnorePermissionRestrictions]
[-Location <String>]
[-Name <String>]
[-OutputPath] <String>
[-PassThruReport]
[-Password <String>]
[-Path] <String>
[-Reason <String>]
[-ReservedBytes <Int32>]
[-SubFilter <DetachedCms|CadesDetached|DocumentTimestamp>]
[<CommonParameters>]
#
Parameter set: All Parameter Sets

Description

The command does not create CMS, CAdES, timestamp, certificate-chain, or revocation data. Use the returned byte range or digest with an external signing service, then inject the produced signature bytes with Set-OfficePdfSignature.

Examples

Prepare a PDF for detached CMS signing.

$plan = New-OfficePdfSignature -Path .\Input.pdf -OutputPath .\Prepared.pdf -FieldName Approval -Name 'Alice' -Reason Approval -PassThruReport
$plan.ByteRangeValues
$plan.ComputeSha256Digest()

Writes a prepared PDF and returns the OfficeIMO.Pdf external signing preparation report.

Parameters

-ContactInfo String optional
Signer contact information stored in the signature dictionary.
-FieldName String optional
Signature field name to append.
-Filter String optional
Signature handler filter name. The default is Adobe.PPKLite.
-IgnorePermissionRestrictions SwitchParameter optional
After successful password authentication, explicitly ignore owner-imposed signature-field restrictions.
-Location String optional
Signing location stored in the signature dictionary.
-Name String optional
Display signer name stored in the signature dictionary.
-OutputPath String requiredposition: 1
Output prepared PDF path.
-PassThruReport SwitchParameter optional
Return the OfficeIMO.Pdf preparation report instead of only the output file.
-Password String optional
Password used to authenticate an encrypted PDF.
-Path String requiredposition: 0pipeline: True (ByValue)aliases: FilePath
Input PDF path.
-Reason String optional
Signing reason stored in the signature dictionary.
-ReservedBytes Int32 optional
Raw signature bytes to reserve in /Contents before hex encoding.
-SubFilter PdfExternalSignatureSubFilter optional
Signature subfilter that describes the external signature bytes to inject later.
Possible values: DetachedCms, CadesDetached, DocumentTimestamp

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.