# Set-OfficePdfAnnotation

Updates native annotation contents, styling and actions by identity or target URI.

Cmdlet 

**Module**

`PSWriteOffice`

**Inputs**

`OfficeIMO.Pdf.PdfDocument` `System.Int32` `System.String[]`

**Outputs**

`System.IO.FileInfo` `OfficeIMO.Pdf.PdfDocument` `OfficeIMO.Pdf.PdfAnnotationEditResult`

**Source**

[SetOfficePdfAnnotationCommand.cs:13](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/PowerShell/PSWriteOffice/Sources/PSWriteOffice/Cmdlets/Pdf/SetOfficePdfAnnotationCommand.cs#L13) 

Updates native annotation contents, styling and actions by identity or target URI.

## Syntax

```
Set-OfficePdfAnnotation
[-Color <OfficeColor>]
[-Contents <String>]
[-Document <PdfDocument>]
[-Flags <Int32>]
[-Name <String>]
-ObjectNumber <Int32>
[-Options <PdfAnnotationUpdateOptions>]
[-PassThru]
[-RemoveAction]
[-Title <String>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
```

[#](#method-set-officepdfannotation-officecolor-string-pdfdocument-int32-string-int32-pdfannotationupdateoptions-switchparameter-switchparameter-string-switchparameter-switchparameter)

Parameter set: `Document`

```
Set-OfficePdfAnnotation
[-Color <OfficeColor>]
[-Contents <String>]
[-Flags <Int32>]
[-IgnorePermissionRestrictions]
[-LoadOptions <PdfLoadOptions>]
[-Name <String>]
-ObjectNumber <Int32>
[-Options <PdfAnnotationUpdateOptions>]
-OutputPath <String>
[-PassThru]
[-Password <SecureString>]
[-Path] <String[]>
[-RemoveAction]
[-Title <String>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
```

[#](#member-4acbb1f35dfb06aaf60146c8)

Parameter set: `Path`

```
Set-OfficePdfAnnotation
[-Color <OfficeColor>]
[-Contents <String>]
[-Flags <Int32>]
[-IgnorePermissionRestrictions]
[-LoadOptions <PdfLoadOptions>]
[-Name <String>]
-ObjectNumber <Int32>
[-Options <PdfAnnotationUpdateOptions>]
-OutputDirectory <String>
[-PassThru]
[-Password <SecureString>]
[-Path] <String[]>
[-RemoveAction]
[-Title <String>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
```

[#](#member-fb1adb479adaba92e9ead8ff)

Parameter set: `PathDirectory`

```
Set-OfficePdfAnnotation
[-Color <OfficeColor>]
[-Contents <String>]
[-Flags <Int32>]
[-IgnorePermissionRestrictions]
[-LoadOptions <PdfLoadOptions>]
[-Name <String>]
[-Options <PdfAnnotationUpdateOptions>]
-OutputPath <String>
[-PassThru]
[-Password <SecureString>]
[-Path] <String[]>
[-RemoveAction]
[-Title <String>]
-Uri <String>
[-WhatIf]
[-Confirm]
[<CommonParameters>]
```

[#](#member-b38876a75db3e67180718320)

Parameter set: `PathUri`

```
Set-OfficePdfAnnotation
[-Color <OfficeColor>]
[-Contents <String>]
[-Flags <Int32>]
[-IgnorePermissionRestrictions]
[-LoadOptions <PdfLoadOptions>]
[-Name <String>]
[-Options <PdfAnnotationUpdateOptions>]
-OutputDirectory <String>
[-PassThru]
[-Password <SecureString>]
[-Path] <String[]>
[-RemoveAction]
[-Title <String>]
-Uri <String>
[-WhatIf]
[-Confirm]
[<CommonParameters>]
```

[#](#member-51afac0ed41a06d9a5770d25)

Parameter set: `PathUriDirectory`

```
Set-OfficePdfAnnotation
[-Color <OfficeColor>]
[-Contents <String>]
[-Flags <Int32>]
[-IgnorePermissionRestrictions]
-LiteralPath <String[]>
[-LoadOptions <PdfLoadOptions>]
[-Name <String>]
-ObjectNumber <Int32>
[-Options <PdfAnnotationUpdateOptions>]
-OutputPath <String>
[-PassThru]
[-Password <SecureString>]
[-RemoveAction]
[-Title <String>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
```

[#](#member-0d26fd63504d9385c2aaf176)

Parameter set: `LiteralPath`

```
Set-OfficePdfAnnotation
[-Color <OfficeColor>]
[-Contents <String>]
[-Flags <Int32>]
[-IgnorePermissionRestrictions]
-LiteralPath <String[]>
[-LoadOptions <PdfLoadOptions>]
[-Name <String>]
[-Options <PdfAnnotationUpdateOptions>]
-OutputPath <String>
[-PassThru]
[-Password <SecureString>]
[-RemoveAction]
[-Title <String>]
-Uri <String>
[-WhatIf]
[-Confirm]
[<CommonParameters>]
```

[#](#member-16d0e605a79d0a2c9ea7ca55)

Parameter set: `LiteralPathUri`

```
Set-OfficePdfAnnotation
[-Color <OfficeColor>]
[-Contents <String>]
[-Flags <Int32>]
[-IgnorePermissionRestrictions]
-LiteralPath <String[]>
[-LoadOptions <PdfLoadOptions>]
[-Name <String>]
-ObjectNumber <Int32>
[-Options <PdfAnnotationUpdateOptions>]
-OutputDirectory <String>
[-PassThru]
[-Password <SecureString>]
[-RemoveAction]
[-Title <String>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
```

[#](#member-23f7a536d748664ee45a892f)

Parameter set: `LiteralPathDirectory`

```
Set-OfficePdfAnnotation
[-Color <OfficeColor>]
[-Contents <String>]
[-Flags <Int32>]
[-IgnorePermissionRestrictions]
-LiteralPath <String[]>
[-LoadOptions <PdfLoadOptions>]
[-Name <String>]
[-Options <PdfAnnotationUpdateOptions>]
-OutputDirectory <String>
[-PassThru]
[-Password <SecureString>]
[-RemoveAction]
[-Title <String>]
-Uri <String>
[-WhatIf]
[-Confirm]
[<CommonParameters>]
```

[#](#member-5e233501ec46fcd157a745ce)

Parameter set: `LiteralPathUriDirectory`

```
Set-OfficePdfAnnotation
[-Color <OfficeColor>]
[-Contents <String>]
[-Document <PdfDocument>]
[-Flags <Int32>]
[-Name <String>]
[-Options <PdfAnnotationUpdateOptions>]
[-PassThru]
[-RemoveAction]
[-Title <String>]
-Uri <String>
[-WhatIf]
[-Confirm]
[<CommonParameters>]
```

[#](#method-set-officepdfannotation-officecolor-string-pdfdocument-int32-string-pdfannotationupdateoptions-switchparameter-switchparameter-string-string-switchparameter-switchparameter)

Parameter set: `DocumentUri`

## Description

Native confirmation runs before loading or editing a file. Live inputs stay caller-owned; a replacement document is adopted by the enclosing content block or returned for explicit assignment. PassThru returns native edit reports.

## Guides & Samples

Authored walkthroughs and practical samples linked to this command.

- [Create and Process PDF Forms and Annotations](/docs/pswriteoffice/pdf-forms-annotations/) Guide
  
  Create interactive form fields, inspect and fill existing forms, manage annotations, and flatten only when the delivery policy requires it.

## Examples

### Example 1

```powershell
Set-OfficePdfAnnotation -ObjectNumber 1
```

### Example 2

```powershell
Set-OfficePdfAnnotation -Uri 'https://example.com'
```

### Example 3

```powershell
Set-OfficePdfAnnotation -OutputPath 'C:\Path' -ObjectNumber 1 -LiteralPath @('C:\Path')
```

## Parameters

**-Color OfficeColor optional**

Replacement annotation RGB color.

**-Contents String optional**

Contents setting.

**-Document PdfDocument optionalpipeline: True (ByValue)sets: Document, DocumentUri**

Native caller-owned PDF; omission uses the enclosing content block.

**-Flags Int32 optional**

Raw PDF annotation flags.

**-Name String optional**

Name setting.

**-ObjectNumber Int32 requiredpipeline: True (ByPropertyName)sets: Document, Path, PathDirectory, LiteralPath, LiteralPathDirectory**

ObjectNumber setting.

**-Options PdfAnnotationUpdateOptions optional**

Native annotation edit policy and fields. Explicit parameters override this captured policy; append-only residual data remains opt-in.

**-PassThru SwitchParameter optional**

Return native annotation edit reports.

**-RemoveAction SwitchParameter optional**

RemoveAction setting.

**-Title String optional**

Title setting.

**-WhatIf SwitchParameter optional**

Shows what would happen if the command runs.

**-Confirm SwitchParameter optional**

Prompts for confirmation before running the command.

**-IgnorePermissionRestrictions SwitchParameter optionalsets: Path, PathDirectory, PathUri, PathUriDirectory, LiteralPath, LiteralPathUri, LiteralPathDirectory, LiteralPathUriDirectory**

IgnorePermissionRestrictions setting.

**-LoadOptions PdfLoadOptions optionalsets: Path, PathDirectory, PathUri, PathUriDirectory, LiteralPath, LiteralPathUri, LiteralPathDirectory, LiteralPathUriDirectory**

Native parsing, authentication and resource policy.

**-OutputPath String requiredsets: Path, PathUri, LiteralPath, LiteralPathUri**

Single-file destination.

**-Password SecureString optionalsets: Path, PathDirectory, PathUri, PathUriDirectory, LiteralPath, LiteralPathUri, LiteralPathDirectory, LiteralPathUriDirectory**

Password setting.

**-Path String[] requiredposition: 0sets: Path, PathDirectory, PathUri, PathUriDirectory**

Input PDF paths with wildcard expansion.

**-OutputDirectory String requiredsets: PathDirectory, PathUriDirectory, LiteralPathDirectory, LiteralPathUriDirectory**

Batch destination retaining source names.

**-Uri String requiredsets: PathUri, PathUriDirectory, LiteralPathUri, LiteralPathUriDirectory, DocumentUri**

Exact or wildcard target URI used to select link annotations.

**-LiteralPath String[] requiredpipeline: True (ByPropertyName)aliases: FullName, PSPathsets: LiteralPath, LiteralPathUri, LiteralPathDirectory, LiteralPathUriDirectory**

Literal input PDF paths; accepts FileInfo.FullName.

## 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](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

<!-- PowerForge markdown artifact sha256:1B400D99B5FA86B4F0ED3710B3F3CCECEEE736EBA57A052BB3774409BFDEC370 -->
