Project

PSWriteOffice

PowerShell document automation across OfficeIMO's document, spreadsheet, presentation, PDF, Project, Access, EPUB, invoicing, and conversion engines.

Stars 654
Forks 82
Open issues 1
Total downloads 4,320,051
Release OfficeIMO-v3.5.3
Language: C# Updated: 2026-11-03
Cmdlet

Add-OfficePdfCanvas

Aliases: PdfCanvasStamp
Module
PSWriteOffice
Aliases
PdfCanvasStamp
Inputs
None
Outputs
System.IO.FileInfo

Draws arbitrary visual canvas content on existing PDF pages.

Syntax

Add-OfficePdfCanvas
[-BehindContent]
[-ConfigureRendering <ScriptBlock>]
[-Content] <ScriptBlock>
[-IgnorePermissionRestrictions]
[-Opacity <Double>]
-OutputPath <String>
[-PageRange <String>]
[-PassThru]
[-Password <String>]
-Path <String>
[<CommonParameters>]
#
Parameter set: All Parameter Sets

Description

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

Draw a page-aware review band.

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.

Parameters

-BehindContent SwitchParameter optional
Place the generated canvas behind existing page content.
-ConfigureRendering ScriptBlock optional
The callback receives a PdfOptions instance. Page geometry, margins, and encryption remain controlled by the stamping operation.
-Content ScriptBlock requiredposition: 0
Canvas callback. Declare parameters for the canvas and page context.
-IgnorePermissionRestrictions SwitchParameter optional
After successful password authentication, explicitly ignore owner-imposed usage restrictions. This does not discover, bypass, or crack a missing password.
-Opacity Double optional
Opacity applied to the complete generated canvas.
-OutputPath String required
Output PDF path.
-PageRange String optional
Target page selector such as 1-3,odd,last. Omit to stamp every page.
-PassThru SwitchParameter optional
Emit the object created or changed by the command.
-Password String optional
Password used to authenticate an encrypted input PDF.
-Path String requiredaliases: FilePath
Input PDF path.

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.