# Set-OfficePdfBackground

Sets or clears the generated PDF page background color.

Project

PSWriteOffice

PowerShell document automation across OfficeIMO's document, spreadsheet, presentation, PDF, Project, Access, EPUB, invoicing, and conversion engines.

[View on GitHub](https://github.com/EvotecIT/OfficeIMO/tree/master/PowerShell/PSWriteOffice) [Visit Website](#) [Releases](https://github.com/EvotecIT/PSWriteOffice/releases/tag/v3.0.5) [Changelog](#) [Get package](https://www.powershellgallery.com/packages/PSWriteOffice/0.2.0)

Stars **725**

Forks **84**

Open issues **3**

Total downloads **5,231,343**

Release **OfficeIMO-v3.6.2**

Language: C# Updated: 2026-11-23

Cmdlet 

Aliases: PdfBackground

**Module**

`PSWriteOffice`

**Aliases**

`PdfBackground`

**Inputs**

`OfficeIMO.Pdf.PdfDocument`

**Outputs**

`OfficeIMO.Pdf.PdfDocument`

**Source**

[SetOfficePdfBackgroundCommand.cs:21](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Pdf/SetOfficePdfBackgroundCommand.cs#L21) 

Sets or clears the generated PDF page background color.

## Syntax

```
Set-OfficePdfBackground
[-Clear]
[-Color <String>]
[-PassThru]
[<CommonParameters>]
```

[#](#method-set-officepdfbackground-switchparameter-string-switchparameter)

Parameter set: `Context`

```
Set-OfficePdfBackground
[-Clear]
[-Color <String>]
-Document <PdfDocument>
[-PassThru]
[<CommonParameters>]
```

[#](#method-set-officepdfbackground-switchparameter-string-pdfdocument-switchparameter)

Parameter set: `Document`

## Examples

### Set a generated PDF page background.

```powershell
New-OfficePdf -Path .\Examples\Documents\PdfBackground.pdf {
    Set-OfficePdfBackground -Color '#F8FAFC'
    Add-OfficePdfHeading -Text 'Report on a soft background'
    Add-OfficePdfParagraph -Text 'The background color applies to generated pages.'
}
```

Applies a page background color before adding content.

## Parameters

**-Clear SwitchParameter optional**

Clear the generated PDF page background color.

**-Color String optional**

Background color. Named colors and hexadecimal values are accepted.

**-PassThru SwitchParameter optional**

Emit the updated document.

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

Compatibility parameter. Page composition is supported only inside New-OfficePdf.

## 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).

Evotec API Reference Copyright 2026 Evotec Services

<!-- PowerForge markdown artifact sha256:1B3ABEBA739F03D09FAABB7E0787FAD09E95B87931A12675E7FDEEFD04393628 -->
