Skip to main content

PDF Auto Outline

Automatically generate and embed a table of contents or outline in a PDF.

Install: python -m pip install pdf-auto-outline

Suggestions and contributions are welcome.

Usage

usage: pdfao [-h] [-s] [-o <path>] [-mp <n>] [-e] [-se] [-i <file>] [-t <n>] [--sioyek <path>] [--version] filename

positional arguments:
  filename              input pdf

options:
  -h, --help            show this help message and exit
  -s, --straight        write toc straight to pdf; skip editing
  -o, --out <path>      write changes to new pdf
  -mp, --multiprocess <n>
                        spread job over n processes (faster on Linux)
  -e, --edit            edit pdf toc
  -se, --superedit      edit pdf toc (more attibutes available)
  -i, --infile <file>   write toc from file to pdf
  -t, --tablevel <n>    tab = n toc nesting levels (default 2)
  --sioyek <path>       for users of the Sioyek pdf viewer
  --version             show program's version number and exit

Examples

Generate toc and edit before saving: pdfao paper.pdf

Generate and save to new pdf: pdfao paper.pdf -o new.pdf

Edit exiting pdf toc: pdfao paper.pdf -e

A save toc to new pdf from file: pdfao paper.pdf -o new.pdf -i outline.txt

Editing

The edit command opens the TOC in the OS default editor (result of 'start' command on Windows and 'EDITOR' environment variable on MacOS and Linux). The file schema is something like this:

Title 1  |  1
    Title 2  |  2  |  *
                 ^^^^^^
				 optional		

The essential parts of each line are:

  • Indentation - 4 space characters per nesting level (or use tabs with the -t flag).
  • Title text
  • Delimiter - ' | ' (vertical bar with 2 spaces padding on each side)
  • Page number

The optional part can be one of:

  |  None                  	same as not including it   
  |  241.2					y-ordinate 
  |  {<dictionary>}			dictionary with more attributes for the ToC entry

For Sioyek Users

Example commands; add to prefs_user.config.

new_command _gen_toc pdfao "%{file_path}" --sioyek path/to/sioyek -mp 4
new_command _edit_toc pdfao "%{file_path}" -e

The sioyek library and flag are optional; they allow logging to the status bar. This is more useful for ToC generation where you may want a progress bar.

If you don't wish to install from PyPI, download source and use python3 -m path/to/src/pdf_auto_outline in place of pdfao.

Release files for pdf-auto-outline 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pdf-auto-outline 0.1.7
File Size Uploaded
pdf_auto_outline-0.1.7.tar.gz 5.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pdf-auto-outline 0.1.7
File Interpreter ABI Platform
pdf_auto_outline-0.1.7-py3-none-any.whl Python 3 none any Details

Total release size: 13.4 kB

Release files / pdf_auto_outline-0.1.7.tar.gz

Download URL pdf_auto_outline-0.1.7.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
df01c1bc49e83117f38d20943c43ee0d47eebc2719e54adbc079342c119f4c96
BLAKE2b-256 checksum
How to use checksums
71e468fddde51f87f81006f0a4e4871a1f40da0f2ae42d2a1891607894a60506
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.7

Release files / pdf_auto_outline-0.1.7-py3-none-any.whl

Download URL pdf_auto_outline-0.1.7-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c540474115a456f48fb8767da7a50e9d8ecedb8092c90dae715795852cd5327
BLAKE2b-256 checksum
How to use checksums
668dd8bcb953506e8a7599d4228a81c670584273339710acb8b0cc748ffccde9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.7

Release history Release notifications | RSS feed

This release

0.1.7 This release

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page