Skip to main content
OfficeIMO Docs Search documentation/

Migrate from PSWritePDF to PSWriteOffice

Edit on GitHub

Replace legacy PSWritePDF and iText-based scripts with maintained OfficeIMO PDF commands for authoring, extraction, forms, and merge.

PSWritePDF is superseded by the OfficePdf command family in PSWriteOffice. New development should use PSWriteOffice and the first-party OfficeIMO.Pdf engine.

This migration changes both the command surface and the PDF engine. Do not assume byte-for-byte output or identical handling of fonts, forms, signatures, annotations, tagged content, encryption, or malformed inputs. Preserve known-good fixtures and compare the rendered and structural result before replacing a production workflow.

Common command replacements

PSWritePDFPSWriteOfficeMigration note
New-PDF, New-PDFDocumentNew-OfficePdfCompose content with Add-OfficePdf* commands inside the document block.
Merge-PDFJoin-OfficePdfWrite the combined result to a new path and reopen it for verification.
Split-PDFSplit-OfficePdfConfirm page ranges and output naming for the caller.
Convert-PDFToTextGet-OfficePdfTextPDF text extraction follows document content, not visual OCR; use an OCR workflow for scanned pages.
Get-PDFDetailsGet-OfficePdfInfoAdditional inspection commands expose fonts, images, forms, signatures, compliance, and diagnostics.
Set-PDFFormSet-OfficePdfFormValidate field names, appearances, flattening, and permission restrictions.
Convert-HTMLToPDFConvertFrom-OfficePdfHtmlReview the supported HTML/CSS profile and supply trusted-resource settings deliberately.
legacy save helpersSave-OfficePdfUse explicit output paths and preserve the source during migration.

Create a PDF with PSWriteOffice

$rows = @(
    [pscustomobject]@{ Service = 'API'; Status = 'Healthy' }
    [pscustomobject]@{ Service = 'Worker'; Status = 'Healthy' }
)

New-OfficePdf -Path '.\Output\Status.pdf' {
    Add-OfficePdfHeading -Text 'Service status' -Level 1
    Add-OfficePdfParagraph -Text 'Generated by PSWriteOffice.'
    Add-OfficePdfTable -InputObject $rows
}

Replace standalone operations

Join-OfficePdf -Path '.\Cover.pdf', '.\Body.pdf' -OutputPath '.\Combined.pdf'
Split-OfficePdf -Path '.\Combined.pdf' -OutputDirectory '.\Pages'

$info = Get-OfficePdfInfo -Path '.\Combined.pdf'
$text = Get-OfficePdfText -Path '.\Combined.pdf'

Use the generated command reference to confirm the current parameter sets; the legacy command names and parameter semantics are not retained as compatibility aliases.

Validate before replacing the old job

  • render representative pages and compare fonts, wrapping, spacing, images, tables, and page breaks;
  • inspect forms, annotations, attachments, bookmarks, signatures, encryption, and permission restrictions;
  • run Get-OfficePdfPreflight, Get-OfficePdfDiagnostic, or Test-OfficePdfRewrite for complex inputs;
  • distinguish native text extraction from OCR for image-only pages;
  • verify HTML and CSS resources in the actual deployment environment;
  • retain the original PDF and write migration output to a new artifact until acceptance.

See PDF automation and the generated PowerShell command reference for current syntax.