API Reference

Cmdlet

Add-OfficePdfCanvas

Aliases: PdfCanvasStamp
Namespace PSWriteOffice
Aliases
PdfCanvasStamp
Outputs
System.IO.FileInfo

Draws arbitrary visual canvas content on existing PDF pages.

Remarks

The script receives a PdfPageCanvas and PdfStampPageContext. It can draw text, rich text, images, shapes, drawings, and tables. Interactive annotations, links, form fields, and outlines are separate PDF operations and are rejected by this visual-only surface.

Examples

Authored help example

Example 1: Draw a page-aware review band.

PS>


Add-OfficePdfCanvas -Path .\Report.pdf -OutputPath .\Stamped.pdf -PageRange '1,last' -Content {
                param($canvas, $page)
                $null = $canvas.Text("Review copy $($page.PageNumber)/$($page.PageCount)", 36, 24, $page.Width - 72, 24, 10)
            }
        

The callback runs once for every selected page and may mix any supported visual canvas primitives.

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-OfficePdfCanvas [-BehindContent] [-ConfigureRendering <ScriptBlock>] -Content <ScriptBlock> [-IgnorePermissionRestrictions] [-Opacity <Double>] -OutputPath <String> [-PageRange <String>] [-Password <String>] -Path <String> [<CommonParameters>]
#
Parameter set: All Parameter Sets

Parameters

BehindContent SwitchParameter optionalposition: namedpipeline: False
Place the generated canvas behind existing page content.
ConfigureRendering ScriptBlock optionalposition: namedpipeline: False
Configures native generated-PDF rendering options for canvas content, including embedded fonts and text shaping. The callback receives a PdfOptions instance. Page geometry, margins, and encryption remain controlled by the stamping operation.
Content ScriptBlock requiredposition: 0pipeline: False
Canvas callback. Declare parameters for the canvas and page context.
IgnorePermissionRestrictions SwitchParameter optionalposition: namedpipeline: False
After successful password authentication, explicitly ignore owner-imposed usage restrictions. This does not discover, bypass, or crack a missing password.
Opacity Double optionalposition: namedpipeline: False
Opacity applied to the complete generated canvas.
OutputPath String requiredposition: namedpipeline: False
Output PDF path.
PageRange String optionalposition: namedpipeline: False
Target page selector such as 1-3,odd,last. Omit to stamp every page.
Password String optionalposition: namedpipeline: False
Password used to authenticate an encrypted input PDF.
Path String requiredposition: namedpipeline: Falsealiases: FilePath
Input PDF path.

Outputs

System.IO.FileInfo