# Add-OfficePdfHeading

Adds a heading to a PDF document. Review available syntax, parameters, pipeline guidance, and reference details in PSWriteOffice Cmdlet Reference.

Cmdlet 

Aliases: PdfHeading

**Module**

`PSWriteOffice`

**Aliases**

`PdfHeading`

**Inputs**

`OfficeIMO.Pdf.PdfDocument`

**Outputs**

`OfficeIMO.Pdf.PdfDocument`

**Source**

[AddOfficePdfHeadingCommand.cs:23](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/PowerShell/PSWriteOffice/Sources/PSWriteOffice/Cmdlets/Pdf/AddOfficePdfHeadingCommand.cs#L23) 

Adds a heading to a PDF document.

## Syntax

```
Add-OfficePdfHeading
[-Alignment <OfficeAlignment>]
[-Bookmark <String>]
[-Color <OfficeColor>]
[-Level <Int32>]
[-Text] <String>
[<CommonParameters>]
```

[#](#method-add-officepdfheading-officealignment-string-officecolor-int32-string)

Parameter set: `Context`

```
Add-OfficePdfHeading
[-Alignment <OfficeAlignment>]
[-Bookmark <String>]
[-Color <OfficeColor>]
-Document <PdfDocument>
[-Level <Int32>]
[-PassThru]
[-Text] <String>
[<CommonParameters>]
```

[#](#method-add-officepdfheading-officealignment-string-officecolor-pdfdocument-int32-switchparameter-string)

Parameter set: `Document`

## 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.
- [Fill and Flatten PDF Forms](/docs/pdf/forms/) Guide
  
  List AcroForm fields, fill them by name, flatten the result, exchange XFDF data, and add form fields to new PDFs with OfficeIMO.Pdf and PSWriteOffice.
- [Watermarks, Stamps, and Metadata](/docs/pdf/watermarks-stamps/) Guide
  
  Add text or image watermarks and stamps to new or existing PDFs and set title, author, and keywords with OfficeIMO.Pdf and PSWriteOffice.
- [Convert to PDF/A](/docs/pdf/pdfa/) Guide
  
  Convert existing PDFs to PDF/A-2, PDF/A-3 or PDF/A-4, check readiness, and create archival PDF/A documents with OfficeIMO.Pdf and the CLI.
- [PDF Quick Start](/docs/pdf/quick-start/) Guide
  
  Create a PDF with headings, paragraphs, a table, and an image, then load it and read its text, with OfficeIMO.Pdf, PSWriteOffice, or the officeimo CLI.

## Examples

### Create heading levels in a PDF report.

```powershell
New-OfficePdf -Path .\Examples\Documents\PdfHeadings.pdf {
  Add-OfficePdfHeading -Text 'Service Review' -Level 1 -Color '#1D4ED8'
  Add-OfficePdfHeading -Text 'Open risks' -Level 2
  Add-OfficePdfParagraph -Text 'Heading levels create the report structure.'
}
```

Adds report headings before body content.

## Parameters

**-Alignment OfficeAlignment optional**

Heading alignment.

Possible values: `Left`, `Center`, `Right`, `Justify`, `Start`, `End`

**-Bookmark String optional**

Bookmark destination attached to the heading.

**-Color OfficeColor optional**

Optional heading color. Named colors and hexadecimal values are accepted.

**-Level Int32 optional**

Heading level, 1 through 3.

**-Text String requiredposition: 0**

Heading text.

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

PDF document to update outside the DSL context.

**-PassThru SwitchParameter optionalsets: Document**

Emit the updated document.

## 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:F13D010728F472AE8C0B9FB9F38BDD12442002C9B2ACF549F2753693279AC730 -->
