API Reference

Cmdlet

Add-OfficePdfText

Aliases: PdfText
Namespace PSWriteOffice
Aliases
PdfText
Inputs
OfficeIMO.Pdf.PdfDocument
Outputs
OfficeIMO.Pdf.PdfDocument

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

Authored help example

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>]
#
Parameter set: Context

Parameters

Align PdfAlign optionalposition: namedpipeline: Falsevalues: 4
Paragraph alignment.
Possible values: Left, Center, Right, Justify
BackgroundColor String optionalposition: namedpipeline: False
Run background color for -Text input. Named colors and hexadecimal colors are accepted.
Baseline PdfTextBaseline optionalposition: namedpipeline: Falsevalues: 3
Baseline for -Text input.
Possible values: Normal, Superscript, Subscript
Bold SwitchParameter optionalposition: namedpipeline: False
Make -Text input bold.
Color String optionalposition: namedpipeline: False
Default paragraph color. Named colors and hexadecimal colors are accepted.
Font Nullable`1 optionalposition: namedpipeline: False
Standard PDF font for -Text input.
FontSize Nullable`1 optionalposition: namedpipeline: False
Font size for -Text input in PDF points.
Italic SwitchParameter optionalposition: namedpipeline: False
Make -Text input italic.
LinkContents String optionalposition: namedpipeline: False
Optional link annotation contents for -Text input.
LinkDestinationName String optionalposition: namedpipeline: False
Named destination link target for -Text input.
LinkUri String optionalposition: namedpipeline: False
Absolute URI link target for -Text input.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the updated document.
Run Object[] optionalposition: namedpipeline: Falsealiases: Runs
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 optionalposition: namedpipeline: False
Strike through -Text input.
Text String[] optionalposition: 0pipeline: False
Plain text values to add as one styled paragraph.
Underline SwitchParameter optionalposition: namedpipeline: False
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>]
#
Parameter set: Document

Parameters

Align PdfAlign optionalposition: namedpipeline: Falsevalues: 4
Paragraph alignment.
Possible values: Left, Center, Right, Justify
BackgroundColor String optionalposition: namedpipeline: False
Run background color for -Text input. Named colors and hexadecimal colors are accepted.
Baseline PdfTextBaseline optionalposition: namedpipeline: Falsevalues: 3
Baseline for -Text input.
Possible values: Normal, Superscript, Subscript
Bold SwitchParameter optionalposition: namedpipeline: False
Make -Text input bold.
Color String optionalposition: namedpipeline: False
Default paragraph color. Named colors and hexadecimal colors are accepted.
Document PdfDocument requiredposition: namedpipeline: True (ByValue)
PDF document to update outside the DSL context.
Font Nullable`1 optionalposition: namedpipeline: False
Standard PDF font for -Text input.
FontSize Nullable`1 optionalposition: namedpipeline: False
Font size for -Text input in PDF points.
Italic SwitchParameter optionalposition: namedpipeline: False
Make -Text input italic.
LinkContents String optionalposition: namedpipeline: False
Optional link annotation contents for -Text input.
LinkDestinationName String optionalposition: namedpipeline: False
Named destination link target for -Text input.
LinkUri String optionalposition: namedpipeline: False
Absolute URI link target for -Text input.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the updated document.
Run Object[] optionalposition: namedpipeline: Falsealiases: Runs
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 optionalposition: namedpipeline: False
Strike through -Text input.
Text String[] optionalposition: 0pipeline: False
Plain text values to add as one styled paragraph.
Underline SwitchParameter optionalposition: namedpipeline: False
Underline -Text input.

Outputs

OfficeIMO.Pdf.PdfDocument