I am working on a report and I want a border on all pages. I have managed to have a border by using the solution provided here: https://tex.stackexchange.com/a/808/205277
But it won't work on all pages. Any ideas on how to do it? I so wanted to comment on the question itself for help but since I am new here I don't have enough reputation to do that so I had to post this as a separate question
LaTeX preamble:
\usepackage[T1]{fontenc}
%\usepackage[latin9]{inputenc}
\usepackage{geometry}
\usepackage{pgf}
\usepackage{pgfpages}
\usepackage{fontspec}
\setmainfont[Mapping=tex-text]{Times New Roman}
\setsansfont[Scale=0.95,Mapping=tex-text]{Times New Roman}
\usepackage{xcolor}
\usepackage{babel}
\geometry{verbose,tmargin=1.6cm,bmargin=1.6cm,lmargin=10pt,rmargin=10pt}
\usepackage{fancyhdr}
\pagestyle{fancy}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\usepackage{babel}
\usepackage{lipsum} %Just a package for generating garbage text which is not otherwise required
\pgfpagesdeclarelayout{boxed}
{
\edef\pgfpageoptionborder{0pt}
}
{
\pgfpagesphysicalpageoptions
{%
logical pages=1,%
}
\pgfpageslogicalpageoptions{1}
{
border code=\pgfsetlinewidth{0.5pt}\pgfstroke,%
border shrink=\pgfpageoptionborder,%
resized width=.95\pgfphysicalwidth,%
resized height=.95\pgfphysicalheight,%
center=\pgfpoint{.5\pgfphysicalwidth}{.5\pgfphysicalheight}%
}%
}
\pgfpagesuselayout{boxed}
\usepackage[margin=3cm]{geometry}
\pgfpagesuseslayout{boxed}
. It worked for the first page but not on others.