How to automatically generate a table of contents with page numbers for PDF? Four steps to create a table of contents page with page numbers

Explain clearly how to generate a table of contents with page numbers from titles or bookmarks, then insert the table of contents pages into the PDF and check the page number correspondence. Suitable for longer PDF documents such as papers, reports, contracts, and book manuscripts.

Key points of this article

  • The table of contents should be generated from the title style of the source file, hard-copying the table of contents directly on the scan or untitled PDF, where page numbers are difficult to align.
  • After the table of contents page is inserted, the page order of the text will be moved backward as a whole, and the page numbers in the table of contents should be filled in according to the actual page order after insertion.
  • Use the PDF editor to insert and adjust the table of contents page, and check whether the title and page number are consistent page by page before exporting.
  • When the scanned PDF does not have bookmarks, you can first use OCR to identify the text, and then manually check the title level.

Many people have a PDF with dozens of pages, such as a paper, project report, contract attachment, or book manuscript. They want to add a page of table of contents in front of it and the corresponding page number after each item. People who search for "how to make a PDF table of contents" are usually stuck in two places: they don't know where the table of contents should come from, and they are not sure how to correct the page numbers after inserting them.

This article talks about a set of methods that can be followed. The core idea is: the table of contents should be generated from the title or bookmark of the document, then the table of contents page should be inserted into the PDF, and finally the page number should be checked. It does not rely on a specific tool, any desktop software that can edit PDF pages can do the same.

After reading, you can judge whether your file is suitable for automatically generating a table of contents, know which step to create the table of contents page, and find out where the page numbers are misplaced before exporting.

How to generate a table of contents for PDF? One sentence conclusion

Strictly speaking, the PDF itself does not necessarily have a directory structure. Whether it can be automatically generated depends on whether there are title styles or bookmarks in the source file. The table below can help you choose a route.

your situationRecommended practicesreason
The original document is an editable file such as Word or Markdown, and the title uses a title style.Use the table of contents function to generate a table of contents in the source file, export it to PDF and then insert it before the text.The title level and page number are determined by the source file, making it less error-prone
Only PDF, and PDF comes with bookmarksFirst look at the bookmark structure, organize the directory items in bookmark order, and generate the directory manually or with the help of source file rearrangement.Bookmarks record chapter names and jump locations, and can be used as the basis for directory entries.
Scanned PDF, no bookmarks or selectable textFirst use OCR to identify the text, then manually confirm the title level, and then organize the table of contents according to the actual page number of the text.Without text and structural information, the directory can only rely on recognition results and manual verification.
Short documents of only a few pagesManually write the table of contents page directly in the PDF editor and check item by itemThere are few directory entries, manual operation is faster, and it is not easy to miss

Before you start: Confirm these points first

1. Does the document have a title level? The prerequisite for automatically generating a table of contents is that there are unified chapter titles in the text, such as "1 Introduction" and "1.1 Research Background". If the title is just ordinary bold words, the generated table of contents will be messy, and you need to uniformly change the title style in the source file first.

2. On which page should the table of contents be placed? A common practice is to place it between the cover and the main text, or in front of the main text. Once the position is determined, it will affect all subsequent page numbers, so decide it first before doing it.

3. Which set of page numbers are they? The physical page numbers of PDFs start from page 1, and the page numbers printed inside the document may start from page 1 of the main text, or skip the cover. Which set of page numbers should be written in the table of contents needs to be consistent with the readers' reading habits and the requirements of the unit or journal.

4. Is the source file a new version? Many errors come from changing the text but not re-exporting the PDF. The page numbers and titles in the table of contents are still old. Make sure the source document is finalized before you begin.

5. Whether text can be selected in the file. Drag the mouse over a section of text. If it can be selected and copied, it means it is a text PDF; if it cannot be selected, it is usually a scanned document and requires OCR first.

Steps to insert a table of contents page in OmniDoc and check the page numbers

The following takes "the source file has generated a table of contents, and the table of contents page needs to be inserted before the PDF body" as an example. The PDF editor of the OmniDoc desktop client (download address: download.omnidoc.top) supports inserting, deleting, rotating, rearranging, merging and splitting pages, which can do just that.

  1. Generate a table of contents in the source file and export the table of contents page. In desktop office software such as Word, use the title style to generate the table of contents, keep only the table of contents page, and save it as PDF. If you have the full text PDF, the contents page can also be exported separately.
  2. Open the text PDF. Open the main text file in OmniDoc's PDF editor. First, look at the first few pages to confirm the boundary between the cover and the main text.
  3. Insert a table of contents page. Use the insert or merge function in the page operation to insert the newly exported table of contents page after the cover or before the first page of the text.
  4. Adjust page order. If the table of contents page is placed in the wrong position, use the rearrange function to drag the page until the cover, table of contents, and text are in the correct order.
  5. Correct the page numbers in the table of contents. After insertion, the entire text will move backward. Assume that the table of contents occupies 1 page. The chapter originally written as "Page 3" is now actually on page 4. The number in the table of contents should be changed to 4 accordingly. If necessary, you can change the page numbers in the source file, re-export the table of contents page, and then replace it.
  6. Process the scanned document (if necessary). If the original document is a scanned version and there is no selectable text, first use the OCR function to identify the text, and then follow the steps above. The identification results need to be checked manually, especially the titles and numbers.
  7. Export the final file. After confirming that the page order and page number are correct, export it as a new PDF. Do not overwrite the original file and keep a version that can be rolled back.

Check each item after completion

After exporting, don’t rush to send it to others. Check it against the table below first.

Check itemsHow to seeWhat to do if there is a problem
Contents page locationTurn from the cover to the table of contents and then to the text. Is the order correct?Use the rearrange function to adjust the page order and check again.
Catalog page number correspondenceRandomly select 3 to 5 table of contents items, open or flip to the corresponding page, and check if the titles matchThe difference in page number by one page is usually caused by not moving back after insertion. Modify the table of contents according to the actual page order.
Title levelAre the indentations and font sizes of first-level and second-level titles clear?Go back to the source file and check whether the title style is consistent
First and last chaptersAre the last chapter and appendices in the table of contents?Most of the missing items are because some titles do not use the title style. Fill them in and regenerate them.
textual accuracyRead each entry in the table of contents, checking for typos, punctuation, and chapter numbersChange paragraph text directly in the PDF editor, or go back to the source file and modify it before replacing it.
OCR resultsCheck whether the title and numbers on the scanned copy match the original pageManually correct it against the original page, especially numbers, which need to be carefully checked

Both machine recognition and automatic generation can cause errors. Important documents (papers, contracts, external reports) must be checked item by item and not submitted after just a glance.

📊 Core comparison

The main differences among the three common approaches lie in speed, accuracy, and reliance on source files.

practicesuitable documentadvantageshortcoming
Insert after source file is generatedWord, Markdown, etc. with heading stylesTitles and page numbers are accurate, and changes can be regeneratedNeed to be able to go back to the source file and modify it
Organized by PDF bookmarksPDF with bookmarksNo source files required, the structure already existsIf the bookmark is incomplete, it must be filled in manually, and the page number still needs to be checked.
Manually write directory pageShort documents with few chaptersFlexible and independent of structureIt is easy to miss and make mistakes when there are many projects

🎯 Which method is suitable for you?

If you are a paper author or report writer, the original file is usually still there. It is easy to go back to the source file to generate the table of contents, and then export the table of contents page and insert it into PDF.

If you get a PDF sent by someone else, you can only modify the PDF itself and see if it has bookmarks. If there are bookmarks, organize the directory according to the bookmarks; if there are no bookmarks, first check whether the text can be selected, and then decide to use OCR or manual processing.

If you are giving a few pages of description or resume and there are very few table of contents items, it will be faster to manually write a page of table of contents and check the page numbers item by item than to generate it automatically.

❓ Frequently Asked Questions (FAQ)

1. The PDF does not have a title style, can it automatically generate a table of contents?

It cannot be fully automated. Without title styles or bookmarks, the software has no way of telling which text is a chapter title. In this case, it is recommended to first add the title style in the source file, or manually organize the table of contents items.

2. After inserting the table of contents, the page numbers are all wrong. What is the reason?

The common reason is that after inserting the table of contents page, the entire text is moved back, but the page numbers in the table of contents are still old. Just change the page numbers according to the actual page order. If the contents page occupies two pages, the following page numbers should be increased by 2 as a whole.

3. How to make a table of contents for the scanned PDF?

First use OCR to recognize the text, and then manually confirm the title and chapter number. The page number of the directory item is filled in according to the actual page sequence after insertion, and the recognition result must be checked against the original page.

4. Can the directory page be made into a separate file?

Can. Export the table of contents page PDF in the source file, and then use the merge function to merge it with the main text. Pay attention to the page order before merging, and check the page numbers after merging.

5. Can the font and style of the generated directory be changed?

You can adjust the style of the table of contents in the source file and then re-export the PDF. The PDF editor can change paragraph text, but for directories with complex layouts and formats, it is recommended to go back to the source file and modify it before replacing it.

📝 Summary

The key to adding page numbers to the PDF table of contents is to first make the title structure clear, and then align the table of contents pages with the page numbers of the text. By following the sequence of "confirm the title, generate the table of contents, insert the table of contents page, and check the page numbers", most problems can be discovered before exporting. For important documents, check them one by one after exporting, which can save a lot of rework.

Open OmniDoc and use the PDF editor to work with your document

Updated 2026-11-11