Cmdlet
Save-OfficePdf
Saves a live PDF to its associated path or a new destination without closing it.
Syntax
Save-OfficePdf
[-AllowLoss]
-Document <PdfDocument>
[-OwnerPassword <SecureString>]
[-PassThru]
[-Password <SecureString>]
[[-Path] <String>]
[-Permission <PdfStandardPermissions>]
[-Show]
[-WhatIf]
[-Confirm]
[<CommonParameters>]#Parameter set:
DocumentDescription
Native serialization rejects content loss unless AllowLoss is supplied. Password and OwnerPassword accept shared secure input. Security options encrypt an unencrypted output; use Protect-OfficeDocument for security changes to an already protected file.
Examples
Save to the associated destination and keep editing.
$pdf = New-OfficePdf -Path ./Review.pdf
Add-OfficePdfParagraph -Document $pdf -Text 'Reviewed and approved'
$pdf | Save-OfficePdf -PassThru
Close-OfficePdf -Document $pdfRestrict printing and accessibility without requiring an opening password.
$owner = Read-Host -AsSecureString
Save-OfficePdf -Document $pdf -Path ./Restricted.pdf -OwnerPassword $owner -Permission Print,AccessibilityParameters
- -AllowLoss SwitchParameter
- Explicitly accept fidelity loss from native PDF serialization.
- -Document PdfDocument
- Live PDF to save.
- -OwnerPassword SecureString
- Owner password; without Password the PDF opens without a password and enforces permissions.
- -PassThru SwitchParameter
- Return the saved FileInfo.
- -Password SecureString
- Opening password for an unencrypted output; accepts secure input or warned plaintext.
- -Path String
- Optional destination; omission uses the native document's associated path.
- -Permission PdfStandardPermissions
- Operations allowed to readers, expressed as native PDF permission flags.
- Possible values:
Print,ModifyContents,CopyContents,ModifyAnnotations,FillForms,Accessibility,AssembleDocument,HighQualityPrint,All - -Show SwitchParameter
- Open the saved file in its registered default application.
- -WhatIf SwitchParameter
- Shows what would happen if the command runs.
- -Confirm SwitchParameter
- Prompts for confirmation before running the command.
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.