Renumber pages of a PDF
Here a solution based on LaTeX. It uses the pdfpages
package to include the scanned PDF (here called scan.pdf
). The PDF page labels you want can be set using the hyperref
package with the pdfpagelabels
option enabled. It uses the normal \thepage
macro as a label which can be defined to lower case roman numbers. The page counter is then reset and changed back to normal numbers.
\documentclass[a4paper]{article}% or use 'letterpaper'
\usepackage{pdfpages}
\usepackage[pdfpagelabels]{hyperref}
\begin{document}
% Set lower case roman numbers (\Roman would be upper case):
\renewcommand{\thepage}{\roman{page}}
\includepdf[pages=1-3]{scan.pdf}
% Back to normal (arabic) numbers:
\renewcommand{\thepage}{\arabic{page}}
% Reset page counter to 1:
\setcounter{page}{1}
\includepdf[pages=4-]{scan.pdf}
\end{document}
Place the above code into a file (e.g. scan_mod.tex
) and compile it with pdflatex
:
# pdflatex scan_mod
This will produce scan_mod.pdf
. However any special annotations incl. hyperlinks will disappear. This shouldn't be any problem with scanned PDFs.
If you need this more often you could write a script which accepts the number of roman numbered pages and the file name(s) as arguments and creates a tempfile with the above code where the name and numbers are variables, which is then compiled.
You can do that with a text editor.
- metadata - How to change internal page numbers in the meta data of a PDF? - Super User
As the answer says, open a PDF file with a text editor, search /Catalog
entry, and then append an entry named /PageLabels
like this:
/PageLabels << /Nums [
0 << /P (cover) >> % labels 1st page with the string "cover"
1 << /S /r >> % numbers pages 2-6 in small roman numerals
6 << /S /D >> % numbers pages 7-x in decimal arabic numerals
]
>>
Note that the page indices (physical page numbers) begin with 0
.
Of cource, you can do this automatically using scripting languages.
PDF Standards - Page Labels has detailed specification.
jPDF Tweak is an Open Source graphical utility that offers page numbering (the correct term is "page labeling") and many other beginner to advanced PDF editing features. It runs on Ubuntu and other operating systems.
The Documentation page provides step-by-step instructions.