How to add page borders when exporting to pdf?

I want page borders in my pdf export

Things I have tried

I have tried the following code in @media print

@page {
    border: 3px solid black;
    border-radius: 5px;


body {
    border: 3px solid black;
    border-radius: 5px;

But the problem is that the border starts from the start of the document and breaks after each page and completes at the end of the content in the document. I want one border on each page. See the below images:

The start of the document (top of the first page):

The bottom of the first page:

The page where the content of the document ends (the border ends there irrespective of the content ending):

I’d look into some design and/or page layout software for something like this. Perhaps Pandoc could do a simple border?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.