Snippet to force page breaks in PDFs

For individual article PDFs as well as the standard and custom PDF export options, sometimes a page break comes between two chunks of content you'd like to stay together (such as a numbered step and the screenshot that goes with that numbered step).

If you'd like to be able to enforce a page break before or after certain portions of an article, you can create a snippet that will force a PDF page break.

To do so:

  1. Go to Library > Snippets.
  2. Select the + Create New Snippet button.
  3. This will open a new page where you can define your snippet.
  4. Be sure to give it a Snippet Name. Here, we use "PDF Page Break After."
  5. The merge code will be automatically generated based on the snippet name.
  6. Add a Snippet Description to explain what this snippet does. For example: "Add this snippet anywhere in individual articles where you'd like to force a page break in the PDF exports."
  7. In the Snippet Editor, be sure Code Editor is selected from the dropdown.
    Select Code Editor in the Snippet Content dropdown
  8. Copy the code below and paste it into the Code Editor. This code creates an empty paragraph with CSS to force a page break after it:
    <p style="page-break-after:always;"></p>
  9. Click the Create button. Your completed snippet should look something like this:
  10. Now that your snippet exists, use the Insert Snippet option in the editor to add the snippet into the place in any article where you'd like the page break to occur.
    The Insert Snippet control in the editor