PDFPipe

Finding your way through a long document / Back cover

A back cover that ends the document rather than trailing off

A final page carrying contact details, a document reference and nothing else, so a reader can tell the document has ended.

Why this block is harder than it looks

Most generated documents simply stop, which on a printed stack is ambiguous: a reader holding the last page has no way to know whether a page is missing. A back cover solves that and introduces the same parity question the section divider has, because on a double-sided document the back cover should be the last physical side, and whether that is a left or a right page depends on the total page count. It also wants a different page rule, and it must not carry a folio that continues the body numbering into what is effectively a cover.

The decisions that make it work

Reasons rather than a description of the code. Each of these is a choice that has a wrong answer, and the wrong answer is usually the default.

  • Force it to the left side with break-before: left on a double-sided document, so it lands on the back of the final leaf rather than starting a new one.
  • Give it a named page with empty margin boxes, so the folio and any running header stop before it.
  • Say the document has ended, either with an explicit end-of-document line or by carrying only closing information and nothing that reads as content.
  • Repeat the document reference and revision so a detached back cover can still be matched to its document.
  • Keep it genuinely sparse. A back cover with three sections on it is another content page and does not signal an ending.
  • Do not put anything essential on it. It is the page most likely to be dropped when a document is scanned or stapled.

The fragment

Markup and the CSS it needs, and nothing else. It expects a document that already has a page rule and a base stylesheet, so paste it into one rather than opening it on its own.

html
<section class="back-cover">
  <p class="end">End of document</p>
  <div class="meta">
    <p>QMS-PR-014, revision C, issued 14 March 2026</p>
    <p>Wynne and Hall Ltd, Unit 4 Callow Works, Sheffield S3 8NP</p>
  </div>
</section>

<style>
  @page back {
    size: A4;
    margin: 30mm 25mm;
    @top-center { content: ""; }
    @bottom-left { content: ""; }
    @bottom-right { content: ""; }
  }

  .back-cover {
    page: back;
    break-before: left;              /* the back of the final leaf */
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
  .back-cover .end {
    margin: 0;
    font-size: 9pt;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #666;
  }
  .back-cover .meta { font-size: 8.5pt; color: #555; }
  .back-cover .meta p { margin: 0 0 2pt; }
</style>

What breaks when it is built the obvious way

Using break-before: page instead of break-before: left. On a document with an odd body page count the back cover then starts a fresh leaf and the reverse of it is blank, so the physical last side of the document is an unmarked blank page rather than the cover.

How to prove it survived pagination

Render a document with an odd body page count and one with an even count. In both, the back cover should be the last printed side, with no folio and no running header, and no blank page after it.

Where it sits in a finished document

This page is one block. The document it belongs to has a page rule, a base stylesheet, a header and everything else around it, and repeating all of that here would make thirty pages that say the same thing. The multi-page report template is a complete file with this block already in it, so take that and change the fragment rather than assembling one from parts. The property doing most of the work here is covered on its own page, with the support caveats that belong there rather than here.

Frequently asked

Will this fragment work on its own?

Not as a whole document. It has no page rule, no margins and no base type, because those belong to the document rather than to the block, and duplicating them in every fragment would mean thirty copies to keep in step. Paste it into a template that already has them.

Why does it look right in a browser and wrong in the PDF?

Because a browser window is one continuous surface and a document is a stack of fixed rectangles. Nothing in a scrolling view exercises a page boundary, so every break rule in the fragment is inert until the content is paginated. Render the real thing with enough content to cross two or three boundaries, then look.

Do I need a special option on the render request for this?

No. Everything on this page is CSS and markup, which is your side of the boundary. What the render has to give you is a real page size with real margins, and after that the layout is decided by the stylesheet.

Other parts of a document

The blocks that sit next to this one, and one from the next group along so you are not sealed inside a single kind of problem.

Paste the fragment into the playground inside a page rule and see what it does at a real page size. That is the only way any of this gets confirmed.