Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
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

Authored help example

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.