# New-OfficeEpub

Creates a live EPUB publication or saves a completed chapter/resource block.

Cmdlet 

**Module**

`PSWriteOffice`

**Inputs**

`None`

**Outputs**

`OfficeIMO.Epub.EpubPublication` `System.IO.FileInfo`

**Source**

[NewOfficeEpubCommand.cs:19](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/PowerShell/PSWriteOffice/Sources/PSWriteOffice/Cmdlets/Epub/NewOfficeEpubCommand.cs#L19) 

Creates a live EPUB publication or saves a completed chapter/resource block.

## Syntax

```
New-OfficeEpub
[-Author <String>]
[-Force]
[-Identifier <String>]
[-Language <String>]
[[-Path] <String>]
-Title <String>
[-Version <Epub2|Epub3>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
```

[#](#method-new-officeepub-string-switchparameter-string-string-string-string-epubversion-switchparameter-switchparameter)

Parameter set: `Live`

```
New-OfficeEpub
[-AllowLoss]
[-Author <String>]
[-Content] <ScriptBlock>
[-Force]
[-Identifier <String>]
[-Language <String>]
[-PassThru]
[-Path] <String>
[-Show]
-Title <String>
[-Version <Epub2|Epub3>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
```

[#](#method-new-officeepub-switchparameter-string-scriptblock-switchparameter-string-string-switchparameter-string-switchparameter-string-epubversion-switchparameter-switchparameter)

Parameter set: `Content`

## Description

Without a block no file is written. A completed block saves atomically and requires Force to replace an existing destination.

## Guides & Samples

Authored walkthroughs and practical samples linked to this command.

- [Project, Access, and EPUB Files](/docs/pswriteoffice/project-access-epub/) Guide
  
  Create and read Microsoft Project schedules, Access databases and EPUB books from PowerShell, without Project or Access installed.
- [Reliable Automation Patterns](/docs/pswriteoffice/automation-patterns/) Guide
  
  Structure document jobs for repeatability, diagnostics, safe mutation, and CI artifacts. Includes examples and cmdlet links.
- [Create and Edit EPUB Files](/docs/epub/create/) Guide
  
  Create EPUB 3 or EPUB 2 e-books in .NET with chapters, styles, images and a table of contents, import an HTML manuscript, and run a preflight check.

## Examples

### Create a handbook and save its completed content.

```powershell
New-OfficeEpub -Path ./Operations.epub -Title Operations -Author Example {
    EpubChapter -Title Opening -Text 'Safety and care'
}
```

### Create a live publication and save it explicitly.

```powershell
$book = New-OfficeEpub -Path ./Operations.epub -Title Operations
$book | Add-OfficeEpubChapter -Title Opening -Text 'Safety and care'
Save-OfficeEpub -Document $book
```

## Parameters

**-Author String optional**

Primary author.

**-Force SwitchParameter optional**

Allow a completed content block to replace an existing destination.

**-Identifier String optional**

Optional stable publication identifier.

**-Language String optional**

BCP 47 language.

**-Path String required in Contentposition: 0aliases: FilePath**

Optional associated destination for a live document; required when a content block saves a file.

**-Title String required**

Publication title.

**-Version EpubVersion optional**

EPUB package generation.

Possible values: `Epub2`, `Epub3`

**-WhatIf SwitchParameter optional**

Shows what would happen if the command runs.

**-Confirm SwitchParameter optional**

Prompts for confirmation before running the command.

**-AllowLoss SwitchParameter optionalsets: Content**

Explicitly accept reductions reported by the content block's native save.

**-Content ScriptBlock requiredposition: 1sets: Content**

Authoring block to complete before the document is atomically saved and closed.

**-PassThru SwitchParameter optionalsets: Content**

Return the saved FileInfo after a completed content block.

**-Show SwitchParameter optionalsets: Content**

Open the saved result in its registered application after the content block succeeds.

## 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).

<!-- PowerForge markdown artifact sha256:A995C2EE434F7E8BAECDB6A174CA8FF80F2274DD1180025B7044333BEBA391E8 -->
