How to insert page numbers into PDF?

I am formatting and compiling a large book. I need page numbers in the bottom or top corners of each page, mirrored (so that pages on right page are on right side, left page left side). I’ve been struggling to get this to work, formatted how I wish, in a simple odt, never mind the large book which I am compiling.

Due to limitations in LO Writer endnote functionality (unable to separate endnotes per section AND list them all at end of document under appropriate headings), I have no choice but to export each chapter as a PDF separately, and then bring it all together it in a PDF arranger, extracting the endnote pages from each chapter to be inserted at the end of the book, with headings added via Libre Draw.

Therefore it seems my best option for page numbers is to apply it after the macro PDF is compiled. Three possible methods include:

  1. Insert page numbers in odt files which correspond to page counts in macro PDF. Then re-export and re-compile.
  2. Open macro PDF in Libre Draw and insert page numbers.
  3. Insert numbers in a more suitable software.
  • Issues:
  1. I don’t know how to insert the page numbers (a) starting at values I want (b) presented in mirror form (c) with completely separate number for endnote page (d) formatted in the font/size I wish.

  2. Same as 1., plus Libre Draw breaks the formatting of my book - in particular my text loses it’s justified alignment.

  3. Seems like a far better method, but I don’t know any software which can help me?

Provide a better description of what you want to achieve. Mention number of chapters (to determine the number of sections needed).
What do you mean by “endnotes per section AND list them all at end of document under appropriate headings” ? Do you want the endnotes twice, once at end of chapters and once at end of book?

Or is your problem a difficulty to insert note headings? This is easy to do by creating a fake unnumbered endnote attached to the chapter heading.

Inserting page numbers on outer edge of sheet is handled by built-in means.

With a better specification of your goal, it is likely a fourth method will do the job bully automatic inside Writer.

The main goal I want to achieve which I don’t think is achievable through Libre Writer is resetting the endnote numbering per chapter, and placing the list of all endnotes at the end of the book.

Effectively, you can’t restart endnote number per chapter. It is perhaps a consequence of the fact that developers didn’t imagine how to insert non-note text among the notes to be used as separators (your “note headings”) and notes are listed continuously, thus not clearly showing the limits of chapters. Though, this can be done as I mentioned: you create an unnumbered note attached to the chapter heading (e.g. using a field to repeat heading contents). You apply to this note a paragraph style of your choice to format it like a heading (instead of default Endnote) and you’re done. The only impossible thing is to insert a page break among the notes.

Here is an example: EndnotesWithHeadings.odt (33.5 KB)

Unfortunately I need page breaks in my book and reset numbering otherwise endnotes will be in triple figures. I didn’t mean to divert the discussion to the endnote issue which I already researched in-depth. There are further reasons why I’m compiling my book in this way (avoiding one single large doc and use of macro docs).

I’m hoping to find a solution to my page numbering issue.

Acrobat is the only PDF editor that I have used that doesn’t break some functionality of an exported pdf.

Better I think to do the complete document in Writer and export the finished document from there.

There are two ways to do this, assume we want the number in the footers and we are starting with a blank document:

  1. Different Footer/Header
    Unless you have set a default template you will have Default Page Style. Right click on the page style in the page styles pane and select Edit style (Modify for older versions). Click the Footer tab, tick the box Footer on and untick Same content for left and right pages, OK.
    1. You want the page number to be on the outside edge so click in the footer and press Tab twice to bring the cursor to the right edge. Click Insert > Field > Page number
    2. Click in the body of the document and press Ctrl+Enter to create a new page or add enough text to create a new page. Click in the footer of that page. The cursor will be on the left which is the outside edge so click Insert > Field > Page number
  2. Right page/Left Page
    With a blank document open, in the styles pane double click Right Page to apply the style to your page.
    1. Right click Right Page style and select Edit style. In the Footer tab tick Footer on, OK. Click in the footer and press Tab twice to bring the cursor to the right edge. Click Insert > Field > Page number
    2. Right click Left Page style and select Edit style. In the Footer tab tick Footer on, OK. Click in the body of the document and press Ctrl+Enter to insert a new page or add enough text to create a new page. Click in the footer, the cursor will be on the left which is the outside edge so click Insert > Field > Page number

See this question, Page numbers starting at page 5. No page numbers for Title, Copywrite, etc - #2 by EarnestAl

Change the font size in Paragraph styles, either Header and Footer or just Footer if you have other plans for Header.

Thank you.

However, I’ve already set a default template for my book. With that in mind, I’m struggling to make sense of how to implement the steps you outlined.

To be clear, I currently have a book comprised of over 10 chapters, each in their own odt document.

Each document is based on the same default template (Custom Template for Book), which has its own custom default template page (Custom Page for Print).

I want page numbers on the top outer corners of each page AND the title of each chapter in the center.

Within Custom Template for Book ott file, should I create new a separate page for each chapter, inserting a header for each with the chapter name in the center? I could also insert the page numbers, but again, I don’t know how to make them on the outer side of the page for both odd/even (left/right) pages.

So a Master document might be the way to go. If all documents use the same styles, the master document should handle it OK. You should probably make changes to the template to suit before creating the master document although you can change it later, see the last paragraph of Writer Master Docs: Which has priority - Master Doc or 1st Doc inserted? - #2 by ajlittoz

I have included a sample, originally made for another question, of two different ways to have page numbers on the outside of the page

  1. Right Page style and Left Page style
  2. Mirrored page with different headers (Endnote pages)

I have a page numbering restart after Introduction by inserting a Manual Break and setting page number to 1.
You could restart numbering at every chapter but you would want Heading Numbering turned on so you could precede the page number with the chapter number.

You could have the book title on a right page header and the chapter title on a left page header if you wanted.

I did not address the endnote layout that you want because that layout isn’t built-in to Writer. ajlittoz is the expert on endnotes
BookWithLayout121093.odt (15.4 KB)

Thank you.

So my understanding is that I must have a different page style for any variation in a header’s content, excluding variation which naturally flows from a field variable such as page number [1,2,3…]. Correct?

And so to have different page number positioning between left and right pages, I must alternate their page styles. Correct?

However, I don’t know how to change the page style of all odd pages in a document to Style X and all even pages to style Y. (again, I will not be using the default Left Page and Right Page styles. It’s a little confusing when you refer to them).

Let’s please forget macro documents because I don’t want to complicate things for the moment. Also, because I won’t be using macro documents for irrelevant reasons (I don’t want to divert the discussion).

Let’s say I have a 100 page document which includes:
Title page (no header)
Introduction (header w/ “introduction” title and roman numeral page numbers)
Essay (header w/ “essay” title and standard page numbers)
Endnotes (header w/ “endnotes” title and standard page numbers)

Is the right course of action to create 7 page styles? Title page, introduction left, introduction right, essay left, essay right, endnotes left, and endnotes right. Correct?

Then how do I apply the appropriate page style to each page in an efficient manner? (i.e., not having to click on each page individually which would lead to errors in case of large documents)

If your left and right pages share a common “geometry”, you need no separate styles. I.e. they differ only in header or footer contents, you simply configure the Header and Footer tabs to untick Same contents on left and right pages. You can then enter separate data in left and right headers (footers).


when you have uneven left and right margins, choose Mirrored layout so that you now have Outer and Inner margins instead of right and left.


If you really need different styles for right and left (because of different top and bottom margins or similar “fundamental” settings), create the styles first and configure them for alternation in the Next style parameter in the General tab. Then apply the “right” style on the first page of the chapter and the automatic alternation will do the rest. Best way: configure a page break with forced switch to the page style in the Text Flow tab of the paragraph style for your chapter heading (usually Heading 1).

Not necessarily.

As I mentioned above, you can configure styles for introduction and essay for multiple headers/footers (when your page share the same “geometry”).

There is presently a limitation with endnotes where you can’t request page style alternation. End notes can have only a single page style, no matter what you try.

In the end, you can make do with 4 page styles. Depending on the layout sophistication, this number can grow up to 6.

probably need a bit of automation (i.e scrpiting) → PDFtk - The PDF Toolkit