# New-OfficePdf

Creates a PDF document using the OfficeIMO.Pdf composition engine.

Project

PSWriteOffice

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

[View on GitHub](https://github.com/EvotecIT/OfficeIMO/tree/master/PowerShell/PSWriteOffice) [Visit Website](#) [Releases](https://github.com/EvotecIT/PSWriteOffice/releases/tag/v3.0.5) [Changelog](#) [Get package](https://www.powershellgallery.com/packages/PSWriteOffice/0.2.0)

Stars **725**

Forks **84**

Open issues **3**

Total downloads **5,231,343**

Release **OfficeIMO-v3.6.2**

Language: C# Updated: 2026-11-23

Cmdlet 

Aliases: OfficePdf, PdfNew

**Module**

`PSWriteOffice`

**Aliases**

`OfficePdf` `PdfNew`

**Inputs**

`None`

**Outputs**

`OfficeIMO.Pdf.PdfDocument` `System.IO.FileInfo`

**Source**

[NewOfficePdfCommand.cs:47](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Pdf/NewOfficePdfCommand.cs#L47) 

Creates a PDF document using the OfficeIMO.Pdf composition engine.

## Syntax

```
New-OfficePdf
[-BoldFontPath <String>]
[-BoldItalicFontPath <String>]
[-CenterWindow]
[[-Content] <ScriptBlock>]
[-CreateOutlineFromHeadings]
[-DefaultFont <PdfStandardFont>]
[-DefaultFontSize <Double>]
[-DisplayDocTitle]
[-FileVersion <Pdf14|Pdf15|Pdf16|Pdf17|Pdf20>]
[-FitWindow]
[-FlattenVisualAnnotations]
[-FontFamily <String>]
[-HideMenubar]
[-HideToolbar]
[-HideWindowUI]
[-IncludePageLabels]
[-ItalicFontPath <String>]
[-NoSave]
[-Open]
[-OpenActionMode <PdfOpenActionDestinationMode>]
[-OpenActionPage <Int32>]
[-OpenActionTop <Double>]
[-OutlineExpansionLevel <Int32>]
[-OwnerPassword <String>]
[-PageLabelPrefix <String>]
[-PageLayout <PdfCatalogPageLayout>]
[-PageMode <PdfCatalogPageMode>]
[-PassThru]
[-Password <String>]
[[-Path] <String>]
[-Permission <Int32>]
[-RegularFontPath <String>]
[-Theme <WordLike|TechnicalDocument|Compact|Report>]
[<CommonParameters>]
```

[#](#member-cdc2b3191dac65c5bb3565c9)

Parameter set: `Path`

```
New-OfficePdf
[-BoldFontPath <String>]
[-BoldItalicFontPath <String>]
[-CenterWindow]
[[-Content] <ScriptBlock>]
[-CreateOutlineFromHeadings]
[-DefaultFont <PdfStandardFont>]
[-DefaultFontSize <Double>]
[-DisplayDocTitle]
[-FileVersion <Pdf14|Pdf15|Pdf16|Pdf17|Pdf20>]
[-FitWindow]
[-FlattenVisualAnnotations]
[-FontFamily <String>]
[-HideMenubar]
[-HideToolbar]
[-HideWindowUI]
[-IncludePageLabels]
[-ItalicFontPath <String>]
[-NoSave]
[-Open]
[-OpenActionMode <PdfOpenActionDestinationMode>]
[-OpenActionPage <Int32>]
[-OpenActionTop <Double>]
[-OutlineExpansionLevel <Int32>]
[-OwnerPassword <String>]
[-PageLabelPrefix <String>]
[-PageLayout <PdfCatalogPageLayout>]
[-PageMode <PdfCatalogPageMode>]
[-PassThru]
[-Password <String>]
[-Permission <Int32>]
[-RegularFontPath <String>]
[-Theme <WordLike|TechnicalDocument|Compact|Report>]
[<CommonParameters>]
```

[#](#member-434c3fcd5965078cfc27fda1)

Parameter set: `Content`

## Description

New-OfficePdf starts a generated PDF document and optionally executes a PSWriteOffice PDF DSL script block. The DSL commands are thin adapters over OfficeIMO.Pdf and support document metadata, page setup, headers, footers, themes, styled text, tables, panels, row layouts, form fields, attachments, compliance settings, and save/open behavior. Use -NoSave or omit -Path when a document object should be returned for further pipeline operations.

## Examples

### Create a PDF report.

```powershell
New-OfficePdf -Path .\Report.pdf { PdfHeading 'Report'; PdfParagraph 'Generated by PSWriteOffice' } -Open
```

Builds a PDF and opens it after saving.

### Create a polished report with theme, metadata, and layout.

```powershell
New-OfficePdf -Path .\ServiceReview.pdf {
  PdfTheme Report
  PdfMetadata -Title 'Service Review' -Author 'PSWriteOffice'
  PdfPageSetup -PageSize A4 -Margin 42
  PdfHeader 'Service Review'
  PdfFooter 'Page {page}/{pages}'
  PdfHeading 'Service Review'
  PdfText -Run @(
    @{ Text = 'Generated with ' }
    @{ Text = 'rich inline text'; Bold = $true; Color = '#0F766E' }
    @{ Text = ' and OfficeIMO.Pdf layout.' }
  )
  PdfRow -Column @(
    @{ Width = 40; Content = @(@{ Type = 'Panel'; Text = 'Left summary' }) }
    @{ Width = 60; Content = @(@{ Type = 'Paragraph'; Text = 'Right details' }) }
  )
}
```

Shows the preferred high-level PDF report authoring shape.

## Parameters

**-BoldFontPath String optional**

Optional bold TrueType font path used when -FontFamily is provided.

**-BoldItalicFontPath String optional**

Optional bold italic TrueType font path used when -FontFamily is provided.

**-CenterWindow SwitchParameter optional**

Request PDF viewers to center the document window on screen.

**-Content ScriptBlock optionalposition: 0**

DSL script block describing generated PDF content.

**-CreateOutlineFromHeadings SwitchParameter optional**

Create PDF outline/bookmark entries from heading elements.

**-DefaultFont PdfStandardFont optional**

Default standard PDF font for generated text.

Possible values: `Helvetica`, `HelveticaOblique`, `HelveticaBold`, `HelveticaBoldOblique`, `TimesRoman`, `TimesItalic`, `TimesBold`, `TimesBoldItalic`, `Courier`, `CourierOblique`, `CourierBold`, `CourierBoldOblique`

**-DefaultFontSize Double optional**

Default generated text font size in points.

**-DisplayDocTitle SwitchParameter optional**

Request PDF viewers to display the document title instead of the file name.

**-FileVersion PdfFileVersion optional**

PDF file header version emitted by OfficeIMO.Pdf.

Possible values: `Pdf14`, `Pdf15`, `Pdf16`, `Pdf17`, `Pdf20`

**-FitWindow SwitchParameter optional**

Request PDF viewers to fit the document window to the first displayed page.

**-FlattenVisualAnnotations SwitchParameter optional**

Flatten generated FreeText and Highlight annotations into static page content.

**-FontFamily String optional**

Embedded TrueType font family name for generated text.

**-HideMenubar SwitchParameter optional**

Request PDF viewers to hide the menu bar.

**-HideToolbar SwitchParameter optional**

Request PDF viewers to hide the toolbar.

**-HideWindowUI SwitchParameter optional**

Request PDF viewers to hide user-interface elements.

**-IncludePageLabels SwitchParameter optional**

Emit generated catalog page labels.

**-ItalicFontPath String optional**

Optional italic TrueType font path used when -FontFamily is provided.

**-NoSave SwitchParameter optional**

Skip saving even when -Path is provided.

**-Open SwitchParameter optionalaliases: Show**

Open the PDF after saving.

**-OpenActionMode PdfOpenActionDestinationMode optional**

Open-action destination mode.

Possible values: `Xyz`, `Fit`, `FitHorizontal`, `FitVertical`, `FitRectangle`, `FitBoundingBox`, `FitBoundingBoxHorizontal`, `FitBoundingBoxVertical`

**-OpenActionPage Int32 optional**

Initial one-based page shown by PDF viewers that honor open actions.

**-OpenActionTop Double optional**

Optional open-action top coordinate.

**-OutlineExpansionLevel Int32 optional**

Initial outline expansion level when heading outlines are created.

**-OwnerPassword String optional**

Optional owner password for the generated encrypted PDF.

**-PageLabelPrefix String optional**

Optional generated page-label prefix.

**-PageLayout PdfCatalogPageLayout optional**

Catalog page layout hint emitted for generated PDFs.

Possible values: `SinglePage`, `OneColumn`, `TwoColumnLeft`, `TwoColumnRight`, `TwoPageLeft`, `TwoPageRight`

**-PageMode PdfCatalogPageMode optional**

Catalog page mode hint emitted for generated PDFs.

Possible values: `UseNone`, `UseOutlines`, `UseThumbs`, `FullScreen`, `UseOC`, `UseAttachments`

**-PassThru SwitchParameter optional**

Emit the generated document or saved file for chaining.

**-Password String optionalaliases: UserPassword**

Password required to open the generated PDF.

**-Path String optionalposition: 0aliases: FilePathsets: Path**

Optional destination PDF path.

**-Permission Int32 optionalaliases: Permissions**

Raw PDF Standard security permission bit mask. Defaults to allowing all standard operations.

**-RegularFontPath String optionalaliases: FontPath**

Regular TrueType font path used when -FontFamily is provided.

**-Theme OfficePdfThemePreset optional**

Built-in OfficeIMO.Pdf theme applied before the DSL content runs.

Possible values: `WordLike`, `TechnicalDocument`, `Compact`, `Report`

## 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](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

Evotec API Reference Copyright 2026 Evotec Services

<!-- PowerForge markdown artifact sha256:8BB85C09AA15581D9F1BDC735DB5D665171F19BFF18BDB467A28D72679B65366 -->
