# Remove-OfficePdfPage

Removes selected pages from a live PDF or writes edited file copies.

Cmdlet 

**Module**

`PSWriteOffice`

**Inputs**

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

**Outputs**

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

**Source**

[RemoveOfficePdfPageCommand.cs:16](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/PowerShell/PSWriteOffice/Sources/PSWriteOffice/Cmdlets/Pdf/RemoveOfficePdfPageCommand.cs#L16) 

Removes selected pages from a live PDF or writes edited file copies.

## Syntax

```
Remove-OfficePdfPage
[-Document <PdfDocument>]
-Page <OfficePageSelector>
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
```

[#](#method-remove-officepdfpage-pdfdocument-officepageselector-switchparameter-switchparameter-switchparameter)

Parameter set: `Document`

```
Remove-OfficePdfPage
[-IgnorePermissionRestrictions]
[-LoadOptions <PdfLoadOptions>]
-OutputPath <String>
-Page <OfficePageSelector>
[-PassThru]
[-Password <SecureString>]
[-Path] <String[]>
[-WhatIf]
[-Confirm]
[<CommonParameters>]
```

[#](#method-remove-officepdfpage-switchparameter-pdfloadoptions-string-officepageselector-switchparameter-securestring-string-switchparameter-switchparameter)

Parameter set: `Path`

```
Remove-OfficePdfPage
[-IgnorePermissionRestrictions]
[-LoadOptions <PdfLoadOptions>]
-OutputDirectory <String>
-Page <OfficePageSelector>
[-PassThru]
[-Password <SecureString>]
[-Path] <String[]>
[-WhatIf]
[-Confirm]
[<CommonParameters>]
```

[#](#method-remove-officepdfpage-switchparameter-pdfloadoptions-string-officepageselector-switchparameter-securestring-string-switchparameter-switchparameter-2)

Parameter set: `PathDirectory`

```
Remove-OfficePdfPage
[-IgnorePermissionRestrictions]
-LiteralPath <String[]>
[-LoadOptions <PdfLoadOptions>]
-OutputPath <String>
-Page <OfficePageSelector>
[-PassThru]
[-Password <SecureString>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
```

[#](#method-remove-officepdfpage-switchparameter-string-pdfloadoptions-string-officepageselector-switchparameter-securestring-switchparameter-switchparameter)

Parameter set: `LiteralPath`

```
Remove-OfficePdfPage
[-IgnorePermissionRestrictions]
-LiteralPath <String[]>
[-LoadOptions <PdfLoadOptions>]
-OutputDirectory <String>
-Page <OfficePageSelector>
[-PassThru]
[-Password <SecureString>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
```

[#](#method-remove-officepdfpage-switchparameter-string-pdfloadoptions-string-officepageselector-switchparameter-securestring-switchparameter-switchparameter-2)

Parameter set: `LiteralPathDirectory`

## Description

Inside Open-OfficePdf, omission of Document updates the current document. Outside a block, PassThru returns the native edit for assignment or further piping. File outputs are published atomically.

## Guides & Samples

Authored walkthroughs and practical samples linked to this command.

- [Merge, Split, and Reorder PDF Pages](/docs/pswriteoffice/pdf-merge-split-pages/) Guide
  
  Combine PDF files, normalize page sizes, split by page count, range, or bookmarks, and copy, move, or remove selected pages.
- [Merge, Split, and Select PDF Pages](/docs/pdf/merge-split/) Guide
  
  Merge PDFs, split a PDF into parts, and extract, delete, reorder, rotate, or duplicate pages with OfficeIMO.Pdf, PSWriteOffice, and the officeimo CLI.

## Examples

### Remove draft pages from an output copy.

```powershell
Remove-OfficePdfPage -Path ./Report.pdf -Page '4-5' -OutputPath ./Report-Clean.pdf -PassThru
```

### Remove the last page in an editing block.

```powershell
Open-OfficePdf ./Report.pdf { Remove-OfficePdfPage -Page last }
```

## Parameters

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

Explicit native input; omission uses the enclosing New-/Open- content block.

**-Page OfficePageSelector required**

Native selector, one-based page or range expression, including last, odd and even.

**-PassThru SwitchParameter optional**

Emit the updated native document or each saved FileInfo.

**-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, LiteralPath, LiteralPathDirectory**

After authentication, explicitly ignore owner-imposed usage restrictions.

**-LoadOptions PdfLoadOptions optionalsets: Path, PathDirectory, LiteralPath, LiteralPathDirectory**

Native source parsing, authentication and resource settings.

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

Single-file destination.

**-Password SecureString optionalsets: Path, PathDirectory, LiteralPath, LiteralPathDirectory**

Source password.

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

Input files with FileSystem wildcard expansion.

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

Destination folder retaining input file names.

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

Literal input files, including 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:6BAE77CE534A4A603DA1EF49C6898FF5F5346415E22B0540E34AA91D1D7ABBFE -->
