Project

PSWriteOffice

PSWriteOffice is an open-source PowerShell and .NET project with packages, release history, and technical documentation.

Stars148
Forks14
Open issues0
PowerShell Gallery downloads158661
Releasev1.0.2
Language: C# Updated: 2026-07-05T16:05:48.0000000+00:00

Curated Examples

Compose a PDF report

Use PSWriteOffice to compose a PDF with headings, tables, metadata, and follow-up operations.

This pattern is useful when a script needs to produce a PDF artifact and then inspect or combine it with other PDF files.

It is adapted from Examples/Pdf/Example-PdfReportDsl.ps1 and Examples/Pdf/Example-PdfOperations.ps1.

Example

Import-Module PSWriteOffice

$outputDirectory = Join-Path $PSScriptRoot 'Output'
New-Item -ItemType Directory -Path $outputDirectory -Force | Out-Null

$coverPath = Join-Path $outputDirectory 'Cover.pdf'
$statusPath = Join-Path $outputDirectory 'Status.pdf'
$finalPath = Join-Path $outputDirectory 'Combined.pdf'

$rows = @(
    [PSCustomObject]@{ Area = 'Word'; Status = 'Ready'; Owner = 'Docs' }
    [PSCustomObject]@{ Area = 'PDF'; Status = 'Review'; Owner = 'Adapters' }
    [PSCustomObject]@{ Area = 'Reader'; Status = 'Ready'; Owner = 'Core' }
)

New-OfficePdf -Path $coverPath {
    PdfHeading -Text 'Documentation Status' -Level 1
    PdfParagraph -Text 'Prepared with PSWriteOffice.'
    PdfMetadata -Title 'Documentation Status' -Author 'PSWriteOffice'
}

New-OfficePdf -Path $statusPath {
    PdfHeading -Text 'Status Detail' -Level 1
    PdfParagraph -Text 'Generated with PSWriteOffice through OfficeIMO.Pdf.'
    PdfTable -InputObject $rows -Property Area,Status,Owner -Header 'Area','Status','Owner'
    PdfBookmark -Name 'Status table'
    PdfMetadata -Title 'Documentation Status' -Author 'PSWriteOffice'
}

Join-OfficePdf -Path $coverPath, $statusPath -OutputPath $finalPath
Get-OfficePdfText -Path $finalPath

What this demonstrates

  • composing a PDF through the PowerShell DSL
  • adding structured data and metadata
  • using the same module for follow-up PDF operations

Source