API Reference
Add-OfficePdfText
Adds a rich inline-text paragraph to a generated PDF document.
Remarks
Use Add-OfficePdfText when a paragraph needs mixed emphasis, highlight color, font settings, baseline changes, or links. Plain paragraphs can continue to use Add-OfficePdfParagraph. Rich text runs are translated directly to the OfficeIMO.Pdf paragraph builder. URI links and bookmark links are supported; a single run cannot target both.
Examples
Add styled text with the DSL alias.
PS>
New-OfficePdf -Path .\Report.pdf { PdfText 'Approved for review' -Bold -Color '#0F766E' -BackgroundColor '#ECFDF5' }
Creates a PDF with one styled paragraph.
Add mixed rich runs with URI and bookmark links.
PS>
New-OfficePdf -Path .\Report.pdf {
PdfBookmark 'summary'
PdfText -Run @(
@{ Text = 'Read the ' }
@{ Text = 'website'; LinkUri = 'https://evotec.xyz'; Color = '#2563EB' }
@{ Text = ' or jump to ' }
@{ Text = 'summary'; LinkDestinationName = 'summary'; Color = '#7C3AED' }
@{ Text = '.' }
)
}
Creates one paragraph with an external link and an internal named-destination link.
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
Add-OfficePdfText [-Align <Left|Center|Right|Justify>] [-BackgroundColor <String>] [-Baseline <Normal|Superscript|Subscript>] [-Bold] [-Color <String>] [-Font <Nullable`1>] [-FontSize <Nullable`1>] [-Italic] [-LinkContents <String>] [-LinkDestinationName <String>] [-LinkUri <String>] [-PassThru] [-Run <Object[]>] [-Strike] [-Text <String[]>] [-Underline] [<CommonParameters>]#ContextParameters
- Align PdfAlign
- Paragraph alignment.
- Possible values:
Left,Center,Right,Justify - BackgroundColor String
- Run background color for -Text input. Named colors and hexadecimal colors are accepted.
- Baseline PdfTextBaseline
- Baseline for -Text input.
- Possible values:
Normal,Superscript,Subscript - Bold SwitchParameter
- Make -Text input bold.
- Color String
- Default paragraph color. Named colors and hexadecimal colors are accepted.
- Font Nullable`1
- Standard PDF font for -Text input.
- FontSize Nullable`1
- Font size for -Text input in PDF points.
- Italic SwitchParameter
- Make -Text input italic.
- LinkContents String
- Optional link annotation contents for -Text input.
- LinkDestinationName String
- Named destination link target for -Text input.
- LinkUri String
- Absolute URI link target for -Text input.
- PassThru SwitchParameter
- Emit the updated document.
- Run Object[]
- Rich run specifications. Each run may define Text, Bold, Italic, Underline, Strike, Color, BackgroundColor, FontSize, Font, Baseline, LinkUri, LinkDestinationName, LinkContents, Type, or Kind.
- Strike SwitchParameter
- Strike through -Text input.
- Text String[]
- Plain text values to add as one styled paragraph.
- Underline SwitchParameter
- Underline -Text input.
Outputs
OfficeIMO.Pdf.PdfDocument
Add-OfficePdfText [-Align <Left|Center|Right|Justify>] [-BackgroundColor <String>] [-Baseline <Normal|Superscript|Subscript>] [-Bold] [-Color <String>] -Document <PdfDocument> [-Font <Nullable`1>] [-FontSize <Nullable`1>] [-Italic] [-LinkContents <String>] [-LinkDestinationName <String>] [-LinkUri <String>] [-PassThru] [-Run <Object[]>] [-Strike] [-Text <String[]>] [-Underline] [<CommonParameters>]#DocumentParameters
- Align PdfAlign
- Paragraph alignment.
- Possible values:
Left,Center,Right,Justify - BackgroundColor String
- Run background color for -Text input. Named colors and hexadecimal colors are accepted.
- Baseline PdfTextBaseline
- Baseline for -Text input.
- Possible values:
Normal,Superscript,Subscript - Bold SwitchParameter
- Make -Text input bold.
- Color String
- Default paragraph color. Named colors and hexadecimal colors are accepted.
- Document PdfDocument
- PDF document to update outside the DSL context.
- Font Nullable`1
- Standard PDF font for -Text input.
- FontSize Nullable`1
- Font size for -Text input in PDF points.
- Italic SwitchParameter
- Make -Text input italic.
- LinkContents String
- Optional link annotation contents for -Text input.
- LinkDestinationName String
- Named destination link target for -Text input.
- LinkUri String
- Absolute URI link target for -Text input.
- PassThru SwitchParameter
- Emit the updated document.
- Run Object[]
- Rich run specifications. Each run may define Text, Bold, Italic, Underline, Strike, Color, BackgroundColor, FontSize, Font, Baseline, LinkUri, LinkDestinationName, LinkContents, Type, or Kind.
- Strike SwitchParameter
- Strike through -Text input.
- Text String[]
- Plain text values to add as one styled paragraph.
- Underline SwitchParameter
- Underline -Text input.
Outputs
OfficeIMO.Pdf.PdfDocument