-1

this guy says enscript worked 'like a charm': http://www.dry-lab.org/blog/2018/numbering-pages-of-a-pdf but it wiped my pdf - producing page numbers on blank pages

id rather use something like pdfsam: https://userguide.pdfsam.org/Public/Default.aspx? "With the Page Number function, you can insert page numbers in the document" - but that is for pdfsam 'enhanced' and only 'basic' and 'visual versions are available for linux

when i search the web for a solution most answers relate to 'adding pages to pdf' and not 'adding page numbers', thus i can't find good info. The Q was asked mostly 10 years ago it seems, implying that it has recently become straightforward?

1
  • I'm sure this can be done in LibreOffice Draw. Inserting page numbers definitely works but I'm not sure how to automate it in a simple way for every page. It has some sort of master page template system and it could also be scripted I'm sure.
    – CR.
    Mar 17, 2022 at 18:04

1 Answer 1

1

This was the best answer i found:

https://forums.linuxmint.com/viewtopic.php?t=227297

Use the LaTeX code given at the bottom and run pdflatex numbered.tex.

I modified the code slightly to end up with:

\documentclass[twoside, a4paper, 12pt]{article}
\usepackage{pdfpages}
\usepackage{changepage}
\usepackage{fancyhdr}

\setlength\topmargin{-0.675in}
\setlength\textheight{7.0in}
\setlength\textwidth{7.0in}
\setlength\oddsidemargin{-0.25in}
\setlength\evensidemargin{-0.25in}

\strictpagecheck

\fancypagestyle{mystyle}{%
\fancyhf{}
\fancyhead[LO,RE]{\small\thepage}
}

\begin{document}
    \includepdf[pages=-,pagecommand={\thispagestyle{mystyle}}]{i-need-numbers.pdf}
\end{document}

Eg, I position the page number at the top, in the left and right for even and odd pages respectively, following this advice:

Using LaTeX in this way seems simpler and gives more control over the output compared with enscript.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .