Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Remove-OfficePdfPage

Module
PSWriteOffice
Inputs
OfficeIMO.Pdf.PdfDocument System.String[]
Outputs
System.IO.FileInfo OfficeIMO.Pdf.PdfDocument

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

Syntax

Remove-OfficePdfPage
[-Document <PdfDocument>]
-Page <OfficePageSelector>
[-PassThru]
[<CommonParameters>]
#
Parameter set: Document
Remove-OfficePdfPage
[-IgnorePermissionRestrictions]
[-LoadOptions <PdfLoadOptions>]
-OutputPath <String>
-Page <OfficePageSelector>
[-PassThru]
[-Password <SecureString>]
[-Path] <String[]>
[<CommonParameters>]
#
Parameter set: Path
Remove-OfficePdfPage
[-IgnorePermissionRestrictions]
[-LoadOptions <PdfLoadOptions>]
-OutputDirectory <String>
-Page <OfficePageSelector>
[-PassThru]
[-Password <SecureString>]
[-Path] <String[]>
[<CommonParameters>]
#
Parameter set: PathDirectory
Remove-OfficePdfPage
[-IgnorePermissionRestrictions]
-LiteralPath <String[]>
[-LoadOptions <PdfLoadOptions>]
-OutputPath <String>
-Page <OfficePageSelector>
[-PassThru]
[-Password <SecureString>]
[<CommonParameters>]
#
Parameter set: LiteralPath
Remove-OfficePdfPage
[-IgnorePermissionRestrictions]
-LiteralPath <String[]>
[-LoadOptions <PdfLoadOptions>]
-OutputDirectory <String>
-Page <OfficePageSelector>
[-PassThru]
[-Password <SecureString>]
[<CommonParameters>]
#
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.

Examples

Remove draft pages from an output copy.

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

Remove the last page in an editing block.

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