A watermark should be added to a PDF file.


To add a watermark to a PDF file the Cmdlet Add-WaterMark contained in the attached module can be used.

Module installation:

  • Download the attached ZIP file containing the module
  • Depending on your security policies you may have to unblock (How to unblock files) the archive after downloading it
  • Extract all files and folders from the archive
  • Copy the extracted files and folders to the powerJob's module directory. The default path is "C:\ProgramData\coolOrange\powerJobs\Modules"


Adding a text watermark to a PDF file:

This example adds the word "sampletext" as a watermark to a locally saved PDF file.

    Add-WaterMark -Path "C:\Temp\myPDF.pdf" -WaterMark "sampletext"
catch [System.Exception]

Adding the current state of a file as a watermark to the PDF file:

This example adds the lifecycle state of the file (assuming the file takes part in a lifecycle) as a watermark to the PDF file.

    if ($file._State -ne $null){
        Add-WaterMark -Path "C:\Temp\myPDF.pdf" -WaterMark "$($file._State)"
catch [System.Exception]

The following sample job adds a customized watermark to a PDF file:

The settings where the PDF files should be saved as well as the watermark settings can be found in the "settings" region of the job

#region Settings
$hidePDF = $false 
#change this setting to $true or $false for showing/hiding the PDF
$workingDirectory = "C:\Temp\$($file._Name)"
$waterMark = "sample text"
$Color = "Red"
$Font = "Arial"
$FontSize = 26
$HorizontalAlignment = "Right" #Left, Center or Right
$VerticalAlignment = "Top" #Top, Middle or Bottom
$Opacity = 50 #Between 0 and 100
$OffsetX = -2
$OffsetY = 2
$Angle = 0
Write-Host "Starting job 'Sample.AddWatermarkToPDF' for file '$($file._Name)' ..."
if( @("pdf") -notcontains $file._Extension ) {    
    Write-Host "Files with extension: '$($file._Extension)' are not supported"
$downloadedFiles = Save-VaultFile -File $file._FullPath -DownloadDirectory $workingDirectory -ExcludeChildren:$false -ExcludeLibraryContents:$false
$file = $downloadedFiles | select -First 1
if((Get-ChildItem $file.LocalPath).IsReadonly) {
    Write-Host "Following file is read only: '$($file._Name)'."   
    Set-ItemProperty $file.LocalPath -name IsReadOnly -value $false
    Write-Host "Set read-only flag to false for $($file._Name)."
try {
    Add-WaterMark -Path $file.LocalPath -WaterMark $waterMark -Angle $Angle - 
    HorizontalAlignment $HorizontalAlignment -VerticalAlignment $VerticalAlignment -Color 
    $Color -Opacity $Opacity -Font $Font -FontSize $FontSize -OffSetX $OffsetX -OffSetY 
} catch [System.Exception]{ 
#Clean-Up $workingDirectory 
Write-Host "Job 'Sample.AddWatermarkToPDF' completed"
  • Define the download location and settings for the watermark
  • Check if the current file is a PDF file
  • Download the file from Vault and set the 'isReadOnly' property to false if it is set
  • Add the watermark to the downloaded PDF file


  • The -Path parameter for the Add-WaterMark cmdlet has to be an absolute path to the PDF file.
  • The attached module uses the 1.50beta version of PDFsharp (Project homepage)
  • This was tested with version 1.50beta of PDFsharp (attached)