Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Open-OfficePdf

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

Opens native PDF documents or atomically saves a completed editing block.

Syntax

Open-OfficePdf
[-AllowLoss]
[[-Content] <ScriptBlock>]
[-IgnorePermissionRestrictions]
[-LoadOptions <PdfLoadOptions>]
[-OutputPath <String>]
[-PassThru]
[-Password <SecureString>]
[-Path] <String[]>
[-Show]
[<CommonParameters>]
#
Parameter set: Path
Open-OfficePdf
[-AllowLoss]
[[-Content] <ScriptBlock>]
[-IgnorePermissionRestrictions]
-LiteralPath <String[]>
[-LoadOptions <PdfLoadOptions>]
[-OutputPath <String>]
[-PassThru]
[-Password <SecureString>]
[-Show]
[<CommonParameters>]
#
Parameter set: LiteralPath

Description

Without Content returns live documents without writing files. A block takes one input and saves its final edits to OutputPath or back to the source. Opening preserves the existing theme and security contract.

Examples

Edit a literal file and save a copy.

Get-Item -LiteralPath './Review[final].pdf' | Open-OfficePdf -OutputPath ./Reviewed.pdf -PassThru -Content {
    Remove-OfficePdfPage -Page last
    PdfMetadata -Title 'Reviewed report'
}

Open matching documents for inspection.

$documents = Open-OfficePdf -Path './Reports/*.pdf'
try { $documents | ForEach-Object { $_.Read().Text } }
finally { $documents | Close-OfficePdf }

Parameters

-AllowLoss SwitchParameter optional
Gets or sets whether native-save loss is explicitly accepted.
-Content ScriptBlock optionalposition: 1
Gets or sets a content block; omission returns the live document.
-IgnorePermissionRestrictions SwitchParameter optional
After authentication, explicitly ignore owner-imposed usage restrictions.
-LoadOptions PdfLoadOptions optional
Native PDF parsing, resource-limit and authentication settings.
-OutputPath String optional
Optional destination for a content block; omission saves back to the input.
-PassThru SwitchParameter optional
Gets or sets whether a completed content block returns the saved FileInfo.
-Password SecureString optional
Source password as a SecureString, credential, or warned plaintext value.
-Path String[] requiredposition: 0pipeline: True (ByValue)sets: Path
One or more PDF input paths, with FileSystem wildcard expansion.
-Show SwitchParameter optional
Gets or sets whether the saved file opens in the system default application.
-LiteralPath String[] requiredpipeline: True (ByPropertyName)aliases: FullName, PSPathsets: LiteralPath
Literal PDF paths; accepts FileInfo.FullName and provider PSPath.

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.