# Add-OfficePdfHorizontalRule

Adds a horizontal rule divider to a generated PDF document.

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: PdfHorizontalRule, PdfHr

**Module**

`PSWriteOffice`

**Aliases**

`PdfHorizontalRule` `PdfHr`

**Inputs**

`OfficeIMO.Pdf.PdfDocument`

**Outputs**

`OfficeIMO.Pdf.PdfDocument`

**Source**

[AddOfficePdfHorizontalRuleCommand.cs:22](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Pdf/AddOfficePdfHorizontalRuleCommand.cs#L22) 

Adds a horizontal rule divider to a generated PDF document.

## Syntax

```
Add-OfficePdfHorizontalRule
[-Color <String>]
[-PassThru]
[-SpacingAfter <Double>]
[-SpacingBefore <Double>]
[-Thickness <Double>]
[<CommonParameters>]
```

[#](#method-add-officepdfhorizontalrule-string-switchparameter-double-double-double)

Parameter set: `Context`

```
Add-OfficePdfHorizontalRule
[-Color <String>]
-Document <PdfDocument>
[-PassThru]
[-SpacingAfter <Double>]
[-SpacingBefore <Double>]
[-Thickness <Double>]
[<CommonParameters>]
```

[#](#method-add-officepdfhorizontalrule-string-pdfdocument-switchparameter-double-double-double)

Parameter set: `Document`

## Examples

### Separate report sections with a divider.

```powershell
New-OfficePdf -Path .\Examples\Documents\PdfDivider.pdf {
  Add-OfficePdfHeading -Text 'Executive summary'
  Add-OfficePdfParagraph -Text 'The service is healthy.'
  Add-OfficePdfHorizontalRule -Color '#CBD5E1' -Thickness 0.75 -SpacingBefore 10 -SpacingAfter 10
  Add-OfficePdfHeading -Text 'Signals' -Level 2
}
```

Adds a visual divider between generated PDF sections.

## Parameters

**-Color String optional**

Rule color. Named colors and hexadecimal values are accepted.

**-PassThru SwitchParameter optional**

Emit the updated document.

**-SpacingAfter Double optional**

Spacing after the rule in PDF points.

**-SpacingBefore Double optional**

Spacing before the rule in PDF points.

**-Thickness Double optional**

Rule thickness in PDF points.

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

PDF document to update outside the DSL context.

## 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:3C6AD1B8FCDAAA632FD339FEC0920ED9CD7932BE81EFFBE1636E3568D27F9C0B -->
