API Reference

Cmdlet

Add-OfficePdfCanvasText

Aliases: PdfCanvasText
Namespace PSWriteOffice
Aliases
PdfCanvasText
Inputs
None

Adds PowerShell-friendly text or rich text runs to the active fixed-position PDF canvas.

Remarks

Use this command inside Add-OfficePdfCanvas -Content. Coordinates are PDF points measured from the visual top-left of the page. Rich runs accept TextRun output, hashtables, and objects; callers do not need to construct native PdfTextRun arrays. Fixed-position canvas runs are visual text and do not support link targets. Width and height default to the remaining page area from the supplied coordinates.

Examples

Authored help example

Place mixed-format text on each selected page.

PS>


Add-OfficePdfCanvas -Path .\Report.pdf -OutputPath .\Stamped.pdf -Content {
                PdfCanvasText -Run @(
                  TextRun 'Owner: ' -Bold
                  TextRun 'Platform' -Color '#0F766E'
                ) -X 36 -Y 24 -FontSize 10
            }
        

The enclosing callback supplies the active page, while the run collection remains an ordinary PowerShell array.

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-OfficePdfCanvasText [-Align <Left|Center|Right|Justify>] [-BackgroundColor <String>] [-Baseline <Normal|Superscript|Subscript>] [-Bold] [-Color <String>] [-Font <Helvetica>] [-FontSize <Double>] [-Height <Double>] [-Italic] [-LineHeight <Double>] [-Strike] -Text <String[]> [-Underline] [-Width <Double>] -X <Double> -Y <Double> [<CommonParameters>]
#
Parameter set: Text

Parameters

Align PdfAlign optionalposition: namedpipeline: Falsevalues: 4
Text alignment within the positioned rectangle.
Possible values: Left, Center, Right, Justify
BackgroundColor String optionalposition: namedpipeline: False
Background color for plain -Text input.
Baseline PdfTextBaseline optionalposition: namedpipeline: Falsevalues: 3
Baseline for plain -Text input.
Possible values: Normal, Superscript, Subscript
Bold SwitchParameter optionalposition: namedpipeline: False
Make plain -Text input bold.
Color String optionalposition: namedpipeline: False
Default text color. Named and hexadecimal colors are accepted.
Font PdfStandardFont optionalposition: namedpipeline: Falsevalues: 12
Standard PDF font for plain -Text input.
Possible values: Helvetica, HelveticaOblique, HelveticaBold, HelveticaBoldOblique, TimesRoman, TimesItalic, TimesBold, TimesBoldItalic, Courier, CourierOblique, CourierBold, CourierBoldOblique
FontSize Double optionalposition: namedpipeline: False
Default font size in PDF points.
Height Double optionalposition: namedpipeline: False
Available text height in PDF points. Defaults to the remaining page height.
Italic SwitchParameter optionalposition: namedpipeline: False
Make plain -Text input italic.
LineHeight Double optionalposition: namedpipeline: False
Optional line height in PDF points.
Strike SwitchParameter optionalposition: namedpipeline: False
Strike through plain -Text input.
Text String[] requiredposition: 0pipeline: False
Plain text values to concatenate into one positioned text block.
Underline SwitchParameter optionalposition: namedpipeline: False
Underline plain -Text input.
Width Double optionalposition: namedpipeline: False
Available text width in PDF points. Defaults to the remaining page width.
X Double requiredposition: namedpipeline: Falsealiases: Left
Horizontal position in PDF points from the visual left edge.
Y Double requiredposition: namedpipeline: Falsealiases: Top
Vertical position in PDF points from the visual top edge.
Add-OfficePdfCanvasText [-Align <Left|Center|Right|Justify>] [-Color <String>] [-FontSize <Double>] [-Height <Double>] [-LineHeight <Double>] -Run <Object[]> [-Width <Double>] -X <Double> -Y <Double> [<CommonParameters>]
#
Parameter set: Run

Parameters

Align PdfAlign optionalposition: namedpipeline: Falsevalues: 4
Text alignment within the positioned rectangle.
Possible values: Left, Center, Right, Justify
Color String optionalposition: namedpipeline: False
Default text color. Named and hexadecimal colors are accepted.
FontSize Double optionalposition: namedpipeline: False
Default font size in PDF points.
Height Double optionalposition: namedpipeline: False
Available text height in PDF points. Defaults to the remaining page height.
LineHeight Double optionalposition: namedpipeline: False
Optional line height in PDF points.
Run Object[] requiredposition: namedpipeline: Falsealiases: Runs
Rich run specifications created with TextRun or supplied as hashtables or objects. Link targets are not supported.
Width Double optionalposition: namedpipeline: False
Available text width in PDF points. Defaults to the remaining page width.
X Double requiredposition: namedpipeline: Falsealiases: Left
Horizontal position in PDF points from the visual left edge.
Y Double requiredposition: namedpipeline: Falsealiases: Top
Vertical position in PDF points from the visual top edge.