0

I have the following code working for page number

\documentclass[18pt,letterpaper]{letter}
\usepackage{multido}
\begin{document}
\multido{}{ 2 }{\vphantom{x}\newpage}
\end{document}

This provides my the page numbers at the bottom of page. I would to just have page x of y at the bottom of the pages. I am working with existing pdf files with no page numbers. I merge this file with pdftk and its multistamp feature to the existing pdf file with the created pdf file.

  • this can be achieved with the packages lastpage and fancyhdr, see for example here: https://tex.stackexchange.com/a/265861/110842 – Mike May 15 '18 at 22:01
  • How do I make it loop and create a blank page? The multido loop allows me to loop for the number of pages I need. – Bobby Whitley May 15 '18 at 23:35
  • You just need to set it up in the preamble as shown in the linked answer. This sets a new pagestyle, which is then used automatically for all pages. – Mike May 16 '18 at 00:13
  • I am still not sure how to loop to create say 10 pages with just Just "Page 1 of 10", "Page 2 of 10" etc. I am using this to apply page numbers to existing pdf files. – Bobby Whitley May 16 '18 at 02:16

1 Answers1

2

I figured it out.

This is the code that work for what I am doing

\documentclass{article}
\setlength{\parskip}{\baselineskip}
\setlength{\parindent}{0pt}
\usepackage{ifthen}
\usepackage{pgf}
\usepackage{pgffor}
\usepackage{lastpage}
\usepackage{graphicx}
\usepackage[left=2cm,right=2cm,top=-2cm,bottom=2cm]{geometry}
\usepackage{fancyhdr}
\usepackage{lastpage}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\fancyhead{}
\cfoot{Page \thepage\ of \pageref{LastPage}}
\begin{document}

\foreach \x in {1,...,20}
{\ \newpage}   
\end{document}