# Automate PDF Workflows

Author, inspect, combine, annotate, sign, preflight, optimize, redact, and extract PDF files. Includes examples and cmdlet links.

The PDF family exports 77 commands over the first-party OfficeIMO.Pdf engine. It includes document composition, metadata, pages, text, images, tables, lists, headings, panels, headers and footers, backgrounds, watermarks, forms, annotations, attachments, bookmarks, signatures, compliance, extraction, merge/split, redaction, optimization, and diagnostics.

## Compose a fixed-layout document

Use `New-OfficePdf` with the `Add-OfficePdf*` commands when the script owns the PDF. Apply page setup and a theme once, then add semantic headings, paragraphs, lists, tables, images, panels, stamps, and page breaks. Canvas and page-overlay commands cover fixed-position drawing, while typed text-run, image, form-field, and check-box table cells keep richer layouts inside the same PDF DSL.

## Copy complete DSL recipes

- [Service invoice](https://github.com/EvotecIT/OfficeIMO/blob/105ae88c45f6be3bb2020384e25ffe61d990451b/PowerShell/PSWriteOffice/Examples/Pdf/Recipe-Pdf-ServiceInvoice.ps1): metadata, invoice lines, totals, payment terms, headers, footers, and contact link.
- [Access audit report](https://github.com/EvotecIT/OfficeIMO/blob/105ae88c45f6be3bb2020384e25ffe61d990451b/PowerShell/PSWriteOffice/Examples/Pdf/Recipe-Pdf-AuditReport.ps1): findings, bookmarks, page breaks, remediation sections, and form fields.
- [Composed service report](https://github.com/EvotecIT/OfficeIMO/blob/105ae88c45f6be3bb2020384e25ffe61d990451b/PowerShell/PSWriteOffice/Examples/Pdf/Example-PdfReportDsl.ps1): themes, backgrounds, borders, rich text, columns, links, bookmarks, tables, and attachments.

## Other PDF workflows

- [Attach supporting evidence](https://github.com/EvotecIT/OfficeIMO/blob/105ae88c45f6be3bb2020384e25ffe61d990451b/PowerShell/PSWriteOffice/Examples/Pdf/Recipe-Pdf-AttachEvidence.ps1): embed a source file in the delivered report.
- [Exchange form data](https://github.com/EvotecIT/OfficeIMO/blob/105ae88c45f6be3bb2020384e25ffe61d990451b/PowerShell/PSWriteOffice/Examples/Pdf/Recipe-Pdf-FormDataExchange.ps1): export and import interactive form values.
- [Extract text](https://github.com/EvotecIT/OfficeIMO/blob/105ae88c45f6be3bb2020384e25ffe61d990451b/PowerShell/PSWriteOffice/Examples/Pdf/Recipe-Pdf-ExtractText.ps1): feed PDF content into search or review workflows.
- [Reorder pages](https://github.com/EvotecIT/OfficeIMO/blob/105ae88c45f6be3bb2020384e25ffe61d990451b/PowerShell/PSWriteOffice/Examples/Pdf/Recipe-Pdf-ReorderPages.ps1): fix the delivery order without recomposing the report.

The [DSL cookbook](/docs/pswriteoffice/dsl-cookbook/) compares fixed-layout PDF composition with the editable Office and Markdown outputs.

## Task guides

- [Read, extract, and preflight](/docs/pswriteoffice/pdf-read-preflight/)
- [Merge, split, and reorder pages](/docs/pswriteoffice/pdf-merge-split-pages/)
- [Position text and graphics](/docs/pswriteoffice/pdf-positioned-content/)
- [Redact, sanitize, and optimize](/docs/pswriteoffice/pdf-redact-sanitize/)
- [Create and process forms and annotations](/docs/pswriteoffice/pdf-forms-annotations/)
- [Inspect signatures and compliance](/docs/pswriteoffice/pdf-signatures-compliance/)

## Inspect before transforming

Read-only commands expose document information, text, images, fonts, attachments, form fields, annotations, signatures, compliance, interactions, optimization data, preflight results, append-only mutation state, redaction plans, and text/layout diagnostics.

Encrypted inputs accept a password through the commands that open an existing PDF. Owner-imposed restrictions remain enforced unless the caller explicitly uses the corresponding `IgnorePermissionRestrictions` switch after successful authentication; the switch does not discover, bypass, or crack a missing password.

This enables a safer pipeline:

1. preflight the source;
2. collect compliance and signature evidence;
3. plan redaction, flattening, optimization, or page changes;
4. write to a new artifact;
5. reopen and test the result.

## Document operations

- combine and separate files with `Merge-OfficeDocument` and `Split-OfficeDocument`;
- copy, move, and remove pages;
- import and export XFDF annotations;
- flatten annotations or forms deliberately;
- sanitize, optimize, or redact with explicit conversion commands;
- add or update metadata, forms, annotations, signatures, compliance, electronic invoice data, page appearance, and themes;
- extract images, text, and layout overlays for downstream review.

PDF features vary by document structure and preservation requirement. Use `Test-OfficePdfRewrite`, diagnostics, and preflight evidence for complex inputs instead of assuming every rewrite is lossless.

See the [PDF examples](https://github.com/EvotecIT/OfficeIMO/tree/105ae88c45f6be3bb2020384e25ffe61d990451b/PowerShell/PSWriteOffice/Examples/Pdf) and search the [command reference](/api/powershell/) for `OfficePdf`.

<!-- PowerForge markdown source sha256:3C368409AA8D5B182D86764353607ED669B31BC0765613B85595A8823341DCAA; title=True -->

<!-- PowerForge markdown artifact sha256:11592B29694289EEFAB0FA48B7837C8D8EE56BB021090358D4DF95949871DA69 -->
