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

Module
PSWriteOffice
Inputs
None
Outputs
System.IO.FileInfo

Sets page-level PDF properties and writes a new PDF.

Syntax

Set-OfficePdfPage
[-Bottom <Double>]
[-BoxName <MediaBox|CropBox|BleedBox|TrimBox|ArtBox>]
[-Height <Double>]
[-IgnorePermissionRestrictions]
[-Landscape]
[-Left <Double>]
-OutputPath <String>
[-PageRange <String>]
[-PageSize <String>]
[-PassThru]
[-Password <String>]
-Path <String>
[-ResizeMargin <Double>]
[-ResizeMode <Fit|Fill|Stretch>]
[-Right <Double>]
[-Rotation <0|90|180|270>]
[-Top <Double>]
[-Width <Double>]
[<CommonParameters>]
#
Parameter set: All Parameter Sets

Examples

Rotate selected PDF pages.

$proof = @(
    Set-OfficePdfPage -Path .\Examples\Documents\Scanned.pdf -PageRange '2,4' -Rotation 90 -OutputPath .\Examples\Documents\Scanned-Rotated.pdf
    Get-OfficePdfInfo -Path .\Examples\Documents\Scanned-Rotated.pdf | Select-Object PageCount
)
$proof

Rotates selected pages and writes a new PDF.

Parameters

-Bottom Double optional
Bottom coordinate for the page boundary box.
-BoxName PdfPageBoundaryBox optional
Page boundary box to set. Supported values are MediaBox, CropBox, BleedBox, TrimBox, and ArtBox.
Possible values: MediaBox, CropBox, BleedBox, TrimBox, ArtBox
-Height Double optional
Custom page height in points when -PageSize Custom is used.
-IgnorePermissionRestrictions SwitchParameter optional
After successful password authentication, explicitly ignore owner-imposed page-modification restrictions.
-Landscape SwitchParameter optional
Use the landscape orientation of the selected page size.
-Left Double optional
Left coordinate for the page boundary box.
-OutputPath String required
Output PDF path.
-PageRange String optional
Page ranges such as 1-3,5. Omit to affect all pages.
-PageSize String optional
Resize selected pages to a known OfficeIMO page size such as A4, Letter, or Custom.
-PassThru SwitchParameter optional
Emit the object created or changed by the command.
-Password String optional
Password used to authenticate an encrypted PDF.
-Path String requiredaliases: FilePath
Input PDF path.
-ResizeMargin Double optional
Margin, in points, reserved around resized page content.
-ResizeMode PdfPageResizeMode optional
How source page content is fitted into the resized output page.
Possible values: Fit, Fill, Stretch
-Right Double optional
Right coordinate for the page boundary box.
-Rotation Int32 optional
Rotation in degrees. Supported values are 0, 90, 180, and 270.
Possible values: 0, 90, 180, 270
-Top Double optional
Top coordinate for the page boundary box.
-Width Double optional
Custom page width in points when -PageSize Custom is used.

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.