Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Set-OfficePdfBackground

Aliases: PdfBackground
Module PSWriteOffice
Aliases
PdfBackground
Inputs
OfficeIMO.Pdf.PdfDocument
Outputs
OfficeIMO.Pdf.PdfDocument

Sets or clears the generated PDF page background color.

Syntax

Set-OfficePdfBackground [-Clear] [-Color <String>] [-PassThru] [<CommonParameters>]
#
Parameter set: Context
Set-OfficePdfBackground [-Clear] [-Color <String>] -Document <PdfDocument> [-PassThru] [<CommonParameters>]
#
Parameter set: Document

Examples

Authored help example

Set a generated PDF page background.

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.