Project

PSWriteOffice

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

Stars 654
Forks 82
Open issues 1
Total downloads 4,320,051
Release OfficeIMO-v3.5.3
Language: C# Updated: 2026-11-03
Cmdlet

ConvertTo-OfficePdfTextRun

Aliases: PdfNativeTextRun
Module
PSWriteOffice
Aliases
PdfNativeTextRun
Inputs
System.Object
Outputs
OfficeIMO.Pdf.PdfTextRun

Converts reusable Office text run specifications to native PDF text runs.

Syntax

ConvertTo-OfficePdfTextRun
[-Run] <Object>
[<CommonParameters>]
#
Parameter set: All Parameter Sets

Description

Use this adapter when an OfficeIMO PDF callback requires a native PdfTextRun, such as a rich generated header or footer. Styling remains owned by New-OfficeTextRun.

Examples

Create native styled runs for a generated PDF header.

$label = New-OfficeTextRun -Text 'Service report ' -Bold -Color '#B42318' | ConvertTo-OfficePdfTextRun
$pageStyle = New-OfficeTextRun -Italic | ConvertTo-OfficePdfTextRun
Set-OfficePdfHeader -Compose {
    param($header)
    $null = $header.Text({
        param($text)
        $null = $text.Run($label).CurrentPage($pageStyle)
    })
}

The cross-format run specification stays PowerShell-friendly while the callback receives the native PDF run it requires.

Parameters

-Run Object requiredposition: 0pipeline: True (ByValue)
One or more values accepted by New-OfficeTextRun, including run specifications and hashtables.

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.