Page breaks in DOCX export

Available in Start planBeta

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

How it works

  • pageBreak nodes in the editor are converted to <w:br w:type="page"/> in the DOCX output
  • This produces a standard Word page break that starts a new page
  • No extra configuration is needed — if the PageBreak extension is registered, export works automatically

Setting up PageBreak with DOCX export

Register the PageBreak extension alongside the DOCX 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 { ExportDocx } from '@tiptap-pro/extension-export-docx'
import { PageBreak } from '@tiptap-pro/extension-pagebreak'

const editor = new Editor({
  extensions: [
    StarterKit,
    PageBreak,
    ExportDocx.configure({
      onCompleteExport: (result) => {
        const blob = new Blob([result], {
          type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
        })
        const url = URL.createObjectURL(blob)
        const a = document.createElement('a')
        a.href = url
        a.download = 'export.docx'
        a.click()
        URL.revokeObjectURL(url)
      },
    }),
  ],
})

Standalone usage

For custom export pipelines or server-side usage, you can use the convertPageBreak function directly:

import { convertPageBreak } from '@tiptap-pro/extension-export-docx'

This function converts a pageBreak node into the corresponding DOCX paragraph with a page break element, and can be used when building custom node conversion pipelines.

Learn more