Page break is corrupted when export to pdf

First, search the help docs and this forum. Maybe your question has been answered! The debugging steps can help, too. Still stuck? Delete this line and proceed.

What I’m trying to do

“I’m trying to export the note to a PDF file, but I’m encountering an issue where there is a structural difference between the note and the PDF. The note represents a single continuous page that contains all the data, while the PDF is composed of many, many pages. The problem is that the page break occurs in the middle of a paragraph, which distorts the content. What is the solution?”

You can add

<div style="page-break-after: always; visibility: hidden"> \pagebreak </div>

anywhere in your note to force a page break.

There are also CSS export options you can write, e.g., “Page break before every level 1 and level 2 heading”, etc.

@media print {
  h1, h2 { 
  page-break-before: always;