Page breaks in EPUB export

Available in Start planBeta

The PageBreak extension lets users insert explicit page breaks in the editor. When combined with the EPUB export extension, these page breaks are included in the exported document.

How it works

Page breaks are fully supported in EPUB export. The EPUB export uses DOCX conversion under the hood, where pageBreak nodes are converted to <w:br w:type="page"/>, producing standard page breaks in the resulting EPUB file.

Setting up PageBreak with EPUB export

Register the PageBreak extension alongside the EPUB export extension. Page breaks in your editor content will be automatically converted when exporting.

import { Editor } from '@tiptap/core'
import StarterKit from '@tiptap/starter-kit'
import { ExportEpub } from '@tiptap-pro/extension-export-epub'
import { PageBreak } from '@tiptap-pro/extension-pagebreak'

const editor = new Editor({
  extensions: [
    StarterKit,
    PageBreak,
    ExportEpub.configure({
      appId: 'your-app-id',
      token: 'your-jwt',
      onCompleteExport: (result) => {
        const blob = new Blob([result], { type: 'application/epub+zip' })
        const url = URL.createObjectURL(blob)
        const a = document.createElement('a')
        a.href = url
        a.download = 'export.epub'
        a.click()
        URL.revokeObjectURL(url)
      },
    }),
  ],
})

Learn more