# ConvertTo-OfficeRtf

Converts Word, HTML, PDF, or Markdown input to RTF.

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: ConvertTo-Rtf

**Module**

`PSWriteOffice`

**Aliases**

`ConvertTo-Rtf`

**Inputs**

`OfficeIMO.Word.WordDocument`

**Outputs**

`System.String` `System.IO.FileInfo`

**Source**

[ConvertToOfficeRtfCommand.cs:48](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Rtf/ConvertToOfficeRtfCommand.cs#L48) 

Converts Word, HTML, PDF, or Markdown input to RTF.

## Syntax

```
ConvertTo-OfficeRtf
[-OutputPath <String>]
[-PassThru]
-WordPath <String>
[<CommonParameters>]
```

[#](#method-convertto-officertf-string-switchparameter-string)

Parameter set: `WordPath`

```
ConvertTo-OfficeRtf
[-OutputPath <String>]
[-PassThru]
-WordDocument <WordDocument>
[<CommonParameters>]
```

[#](#method-convertto-officertf-string-switchparameter-worddocument)

Parameter set: `WordDocument`

```
ConvertTo-OfficeRtf
[-BasePath <String>]
[-FontFamily <String>]
-Html <String>
[-OutputPath <String>]
[-PassThru]
[-StylesheetContent <String[]>]
[-StylesheetPath <String[]>]
[<CommonParameters>]
```

[#](#method-convertto-officertf-string-string-string-string-switchparameter-string-string)

Parameter set: `Html`

```
ConvertTo-OfficeRtf
[-BasePath <String>]
[-FontFamily <String>]
-HtmlPath <String>
[-OutputPath <String>]
[-PassThru]
[-StylesheetContent <String[]>]
[-StylesheetPath <String[]>]
[<CommonParameters>]
```

[#](#method-convertto-officertf-string-string-string-string-switchparameter-string-string-2)

Parameter set: `HtmlPath`

```
ConvertTo-OfficeRtf
[-OutputPath <String>]
[-PassThru]
-PdfPath <String>
[<CommonParameters>]
```

[#](#method-convertto-officertf-string-switchparameter-string-2)

Parameter set: `PdfPath`

```
ConvertTo-OfficeRtf
-Markdown <String>
[-OutputPath <String>]
[-PassThru]
[-PreserveRawHtmlAsText]
[<CommonParameters>]
```

[#](#method-convertto-officertf-string-string-switchparameter-switchparameter)

Parameter set: `Markdown`

```
ConvertTo-OfficeRtf
-MarkdownPath <String>
[-OutputPath <String>]
[-PassThru]
[-PreserveRawHtmlAsText]
[<CommonParameters>]
```

[#](#method-convertto-officertf-string-string-switchparameter-switchparameter-2)

Parameter set: `MarkdownPath`

## Examples

### Convert Word to RTF.

```powershell
New-OfficeWord -Path .\Report.docx { WordParagraph -Text 'Summary' }
ConvertTo-OfficeRtf -WordPath .\Report.docx -OutputPath .\Report.rtf -PassThru
```

Loads the Word document and saves an RTF file using OfficeIMO.Word.Rtf.

### Convert HTML to RTF.

```powershell
ConvertTo-OfficeRtf -Html '<h1>Report</h1>' -OutputPath .\Report.rtf
```

Creates a Word document from HTML and serializes it to RTF.

### Convert PDF to RTF.

```powershell
ConvertTo-OfficeRtf -PdfPath .\Report.pdf -OutputPath .\Report.rtf
```

Uses OfficeIMO.Rtf.Pdf's semantic PDF reader to write RTF output.

### Convert Markdown to RTF.

```powershell
ConvertTo-OfficeRtf -MarkdownPath .\Report.md -OutputPath .\Report.rtf -PassThru
```

Parses Markdown and writes RTF using OfficeIMO.Rtf.Markdown.

## Parameters

**-OutputPath String optionalaliases: OutPath**

Optional destination RTF path. When omitted, raw RTF text is returned.

**-PassThru SwitchParameter optional**

Emit a FileInfo when saving to disk.

**-WordPath String requiredsets: WordPath**

Path to a .docx file to convert to RTF.

**-WordDocument WordDocument requiredpipeline: True (ByValue)sets: WordDocument**

Word document instance to convert to RTF.

**-BasePath String optionalsets: Html, HtmlPath**

Base path used to resolve relative HTML resources.

**-FontFamily String optionalsets: Html, HtmlPath**

Optional font family for HTML to Word conversion before RTF serialization.

**-Html String requiredsets: Html**

HTML markup to convert to RTF through the Word HTML converter.

**-StylesheetContent String[] optionalsets: Html, HtmlPath**

Inline CSS stylesheets to apply during HTML conversion.

**-StylesheetPath String[] optionalsets: Html, HtmlPath**

Paths to CSS stylesheets to apply during HTML conversion.

**-HtmlPath String requiredsets: HtmlPath**

Path to an HTML file to convert to RTF.

**-PdfPath String requiredsets: PdfPath**

Path to a PDF file to convert to semantic RTF.

**-Markdown String requiredsets: Markdown**

Markdown text to convert to RTF.

**-PreserveRawHtmlAsText SwitchParameter optionalsets: Markdown, MarkdownPath**

Preserve raw HTML Markdown blocks as plain text in the RTF output.

**-MarkdownPath String requiredsets: MarkdownPath**

Path to a Markdown file to convert to RTF.

## 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:20CD220EC1B65A426E07F8EAB45A0C7CFECBB7DD0ED359982765F4BB871157D6 -->
