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-OfficePdfMetadata

Aliases: PdfMetadata
Module
PSWriteOffice
Aliases
PdfMetadata
Inputs
OfficeIMO.Pdf.PdfDocument
Outputs
OfficeIMO.Pdf.PdfDocument System.IO.FileInfo

Sets PDF document metadata on generated documents or existing PDF files.

Syntax

Set-OfficePdfMetadata
[-Author <String>]
[-Keywords <String>]
[-PassThru]
[-Subject <String>]
[-Title <String>]
[<CommonParameters>]
#
Parameter set: Context
Set-OfficePdfMetadata
[-Author <String>]
-Document <PdfDocument>
[-Keywords <String>]
[-PassThru]
[-Subject <String>]
[-Title <String>]
[<CommonParameters>]
#
Parameter set: Document
Set-OfficePdfMetadata
[-Author <String>]
[-IgnorePermissionRestrictions]
[-Incremental]
[-Keywords <String>]
-OutputPath <String>
[-PassThru]
[-Password <String>]
-Path <String>
[-Subject <String>]
[-Title <String>]
[<CommonParameters>]
#
Parameter set: File

Description

In a New-OfficePdf script block this command updates the generated document metadata. With -Path and -OutputPath, it rewrites an existing PDF with updated metadata unless -Incremental is used.

Examples

Set metadata while generating a PDF.

New-OfficePdf -Path .\Report.pdf {
  PdfMetadata -Title 'Service Review' -Author 'PSWriteOffice' -Subject 'Operations'
  PdfHeading 'Service Review'
}

Stores metadata on a newly generated PDF.

Rewrite metadata on an existing PDF.

Set-OfficePdfMetadata -Path .\Input.pdf -OutputPath .\Output.pdf -Title 'Reviewed package' -Author 'Operations'

Writes a new PDF with updated metadata.

Parameters

-Author String optional
Document author.
-Keywords String optional
Document keywords.
-PassThru SwitchParameter optional
Emit the updated document.
-Subject String optional
Document subject.
-Title String optional
Document title.
-Document PdfDocument requiredpipeline: True (ByValue)sets: Document
PDF document to update outside the DSL context.
-IgnorePermissionRestrictions SwitchParameter optionalsets: File
After successful password authentication, explicitly ignore owner-imposed metadata-modification restrictions.
-Incremental SwitchParameter optionalsets: File
Append a metadata-only incremental PDF revision instead of rewriting the existing PDF bytes.
-OutputPath String requiredsets: File
Output PDF path when rewriting an existing PDF.
-Password String optionalsets: File
Password used to authenticate an encrypted PDF.
-Path String requiredaliases: FilePathsets: File
Existing PDF path to rewrite with updated metadata.

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.