API Reference
Cmdlet
ConvertTo-OfficePdfTextRun
Converts reusable Office text run specifications to native PDF text runs.
Remarks
Use this adapter when an OfficeIMO PDF callback requires a native TextRun, such as a rich generated header or footer. Styling remains owned by New-OfficeTextRun.
Examples
Example 1: Create native styled runs for a generated PDF header.
PS>
$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.
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.
Syntax
ConvertTo-OfficePdfTextRun -Run <Object> [<CommonParameters>]#Parameter set:
All Parameter SetsParameters
- Run Object
- One or more values accepted by New-OfficeTextRun, including run specifications and hashtables.
Outputs
OfficeIMO.Pdf.TextRun