# Save-OfficePdf

Saves a live PDF to its associated path or a new destination without closing it.

Cmdlet 

**Module**

`PSWriteOffice`

**Inputs**

`OfficeIMO.Pdf.PdfDocument`

**Outputs**

`System.IO.FileInfo`

**Source**

[SaveOfficePdfCommand.cs:21](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/PowerShell/PSWriteOffice/Sources/PSWriteOffice/Cmdlets/Pdf/SaveOfficePdfCommand.cs#L21) 

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>]
```

[#](#method-save-officepdf-switchparameter-pdfdocument-securestring-switchparameter-securestring-string-pdfstandardpermissions-switchparameter-switchparameter-switchparameter)

Parameter set: `Document`

## Description

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.

## Guides & Samples

Authored walkthroughs and practical samples linked to this command.

- [PSWriteOffice DSL Cookbook](/docs/pswriteoffice/dsl-cookbook/) Guide
  
  Copy complete PowerShell recipes for Word, Excel, PowerPoint, PDF, Markdown, and multi-format document jobs.
- [Migrate from PSWritePDF to PSWriteOffice](/docs/pswriteoffice/migrate-from-pswritepdf/) Guide
  
  Replace legacy PSWritePDF and iText-based scripts with maintained OfficeIMO PDF commands for authoring, extraction, forms, and merge.

## Examples

### Save to the associated destination and keep editing.

```powershell
$pdf = New-OfficePdf -Path ./Review.pdf
Add-OfficePdfParagraph -Document $pdf -Text 'Reviewed and approved'
$pdf | Save-OfficePdf -PassThru
Close-OfficePdf -Document $pdf
```

### Restrict printing and accessibility without requiring an opening password.

```powershell
$owner = Read-Host -AsSecureString
Save-OfficePdf -Document $pdf -Path ./Restricted.pdf -OwnerPassword $owner -Permission Print,Accessibility
```

## Parameters

**-AllowLoss SwitchParameter optional**

Explicitly accept fidelity loss from native PDF serialization.

**-Document PdfDocument requiredpipeline: True (ByValue)**

Live PDF to save.

**-OwnerPassword SecureString optional**

Owner password; without Password the PDF opens without a password and enforces permissions.

**-PassThru SwitchParameter optional**

Return the saved FileInfo.

**-Password SecureString optional**

Opening password for an unencrypted output; accepts secure input or warned plaintext.

**-Path String optionalposition: 0**

Optional destination; omission uses the native document's associated path.

**-Permission PdfStandardPermissions optional**

Operations allowed to readers, expressed as native PDF permission flags.

Possible values: `Print`, `ModifyContents`, `CopyContents`, `ModifyAnnotations`, `FillForms`, `Accessibility`, `AssembleDocument`, `HighQualityPrint`, `All`

**-Show SwitchParameter optional**

Open the saved file in its registered default application.

**-WhatIf SwitchParameter optional**

Shows what would happen if the command runs.

**-Confirm SwitchParameter optional**

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](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

<!-- PowerForge markdown artifact sha256:D2084E38FDFF8995FB0D584BD96CCA66EAFD415CDD0E262372339281A2A71865 -->
