PDF page labels are a data structure in the /Catalog, e.g.:
/PageLabels <<
/Nums [
0 <<
/P (Title)
>>
1 <<
/S /D
>>
3 <<
/S /A
/St 7
>>
]
>>
This means,
the first page number (page numbers are zero based) contains a prefix /P with string "Title".
The next two pages (2 and 3) are numbered with arabic numbers, starting with 1 (default).
The last page(s), page 4, is numbered with uppercase letters (LaTeX: \Alph) and the numeric values of the page numbers start with seven. Therefore the last page 4 is labeled G.
The documentation for PDF page labels can be found in the PDF specification.
Analyzing an example with hyperref
You can study, how hyperref writes the PDF data structures for PDF page labels.
The example hooks into some internals to expose the written PDF data structures, needed for PDF page labels:
\documentclass{article}
\usepackage[
pdfpagelabels=true,
bookmarks=false,
pageanchor=false,
]{hyperref}
\makeatletter
\newcommand*{\print@arg}[2]{%
\begingroup
\edef\x{#2}%
\@onelevel@sanitize\x
\typeout{==> \string#1{\x}}%
\endgroup
}
% DVI drivers
\@ifdefinable\org@special{%
\let\org@special\special
\renewcommand*{\special}[1]{%
\org@special{#1}%
\print@arg\special{#1}%
}%
}
% pdfTeX
\ltx@IfUndefined{pdfcatalog}{%
}{%
\ifpdf
\@ifdefinable\org@Hy@PutCatalog{%
\let\org@Hy@PutCatalog\Hy@PutCatalog
\def\Hy@PutCatalog#1{%
\org@Hy@PutCatalog{#1}%
\print@arg\pdfcatalog{#1}%
}%
}%
\fi
}
\makeatother
\begin{document}
\null
\thispdfpagelabel{Title}
\newpage
\pagenumbering{arabic}
\null
\newpage
\null
\newpage
\pagenumbering{Alph}
\setcounter{page}{7}
\null
\newpage
\end{document}
Now the console output or the .log file contains the data, that can be used for plain TeX.
pdfTeX/LuaTeX
\pdfcatalog{/PageLabels<</Nums[0<</P(Title)>>1<</S/D>>3<</S/A /St 7>>]>>}
XeTeX/dvipdfm(x)
Two compile runs are needed, because the page labels are known at the end of the document and \specials cannot be written after the last page.
Since many \specials are output, the right one needs to be identified, it contains the string /PageLabels:
\special{pdf:docview <</PageLabels<</Nums[0<</P(Title)>>1<</S/D>>3<</S/A /St 7>>]>>>>}
dvips
Currently two runs are needed. (Perhaps I will reduce it to one in the future, using a common PostScript header file to overcome the \special limitation).
Again, the right special is found via searching for /PageLabels:
\special{ps:SDict begin [ {Catalog} <</PageLabels<</Nums[0<</P(Title)>>1<</S/D>>3<</S/A /St 7>>]>>>> /PUT pdfmark end}
hyperrefsupports plain TeX. Some people have suggested Eplain, but I have zero experience on that one. As you said though, the (n of N) bit is traditionally a reader feature, but I think OP is asking for the string itself to be in the PDF? (I think this needs some more explanation...) – Sean Allred Aug 13 '13 at 12:04\pdfliteralwith pdfTeX (don't know how to do this with dvipdfmx), and some heavy use of that. The relevant sections of the PDF spec are 12.4.2 (Page Labels) and 7.7.2 (Document Catalog, KeyPageLabels). – Martin Schröder Aug 13 '13 at 16:17