Cmdlet
Open-OfficePdf
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:
PathOpen-OfficePdf
[-AllowLoss]
[[-Content] <ScriptBlock>]
[-IgnorePermissionRestrictions]
-LiteralPath <String[]>
[-LoadOptions <PdfLoadOptions>]
[-OutputPath <String>]
[-PassThru]
[-Password <SecureString>]
[-Show]
[<CommonParameters>]#Parameter set:
LiteralPathDescription
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
- Gets or sets whether native-save loss is explicitly accepted.
- -Content ScriptBlock
- Gets or sets a content block; omission returns the live document.
- -IgnorePermissionRestrictions SwitchParameter
- After authentication, explicitly ignore owner-imposed usage restrictions.
- -LoadOptions PdfLoadOptions
- Native PDF parsing, resource-limit and authentication settings.
- -OutputPath String
- Optional destination for a content block; omission saves back to the input.
- -PassThru SwitchParameter
- Gets or sets whether a completed content block returns the saved FileInfo.
- -Password SecureString
- Source password as a SecureString, credential, or warned plaintext value.
- -Path String[]
- One or more PDF input paths, with FileSystem wildcard expansion.
- -Show SwitchParameter
- Gets or sets whether the saved file opens in the system default application.
- -LiteralPath String[]
- 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.