PDF Page Border with css snippet

You could give this a try

@media print {
  .print > .markdown-preview-view {
    width: 100%;
    text-align: justify !important;
    padding: 20px;
    border: 2px solid lightgrey !important;
  }
}

But you are going to end up with a gap in the border for page breaks.

Screenshot 2023-10-23 072835

You could play around with some options here https://forum.obsidian.md/t/page-break-is-corrupted-when-export-to-pdf/69666/2 to force page breaks and maybe get a border per-page adding some more CSS rules.

I would personally use another app for this type of layout and export.