Page breaks in PDF export

Available in Start planBeta

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

How it works

Page breaks are fully supported in PDF export. The PDF 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 PDF.

Setting up PageBreak with PDF export

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

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

Learn more