Page Numbers

Asciidoctor PDF automatically keeps track of page numbers. These page numbers determine the folio placement of each page.

Default page number assignment

The pagenums document attribute is set by default when Asciidoctor PDF runs. In turn, pagenums implicitly sets the page-number attribute in running content. To complement the current page number, the virtual page count is assigned to the page-count attribute.

The converter assigns the page number 1 to the first body page of the document and then increments the page number for each page thereafter. All front matter pages, including the cover page, title page, and TOC pages, that precede the first body page when the doctype is book or when the title-page attribute is set are numbered using roman numerals (e.g., i, ii, iii). These computed page numbers can differ from the physical page numbers, therefore, we refer to them as virtual page numbers. The default theme shows the virtual page number in the footer of all body pages.

The folio placement — whether the page is recto or verso — is derived from the virtual page number. When using the built-in themes with the default page numbering and running content settings, odd page numbers (e.g., 1, 3, 5) designate recto pages and even page numbers (e.g., 2, 4, 6) designate verso pages. The page number is displayed in the right corner of the footer on recto pages and in the left corner of the footer on verso pages.

It’s possible to influence the virtual page numbering, the folio placement, and where page numbers are displayed using a combination of theme keys and document attributes. See Configure the Page Numbers to learn more.

Printing page ranges

The print dialog doesn’t understand the page numbers that are displayed in the running content. The print dialog only considers physical pages. Therefore, to print a range of pages as they are labeled in the document, you need to add the number of front matter pages (i.e., the non-numbered pages) to the page number range in the print dialog.

For example, if you only want to print the first 5 pages labeled with a page number (e.g., 1-5), and there are 2 pages before the page labeled as page 1, you need to add 2 to both numbers in the range, giving you a physical page range of 3-7. That’s the range you need to enter into the print dialog.