API Reference
Cmdlet
Add-OfficePdfCanvas
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
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 SetsParameters
- BehindContent SwitchParameter
- Place the generated canvas behind existing page content.
- ConfigureRendering ScriptBlock
- 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
- Canvas callback. Declare parameters for the canvas and page context.
- IgnorePermissionRestrictions SwitchParameter
- After successful password authentication, explicitly ignore owner-imposed usage restrictions. This does not discover, bypass, or crack a missing password.
- Opacity Double
- Opacity applied to the complete generated canvas.
- OutputPath String
- Output PDF path.
- PageRange String
- Target page selector such as 1-3,odd,last. Omit to stamp every page.
- Password String
- Password used to authenticate an encrypted input PDF.
- Path String
- Input PDF path.
Outputs
System.IO.FileInfo