Skip to main content

Add Table of Content in scanned German old-style Textbooks

Project description

Oldstyle PDF ToC

Example

Install

pip install oldstyle-pdf-toc

Usage

1. Create the toc.txt

The file must be named toc.txt.

# Lines that begin with # are ignored, empty lines are also ignored.

# Set page number to Uppercase roman number (I, II, III, ...)
\pageLabel{1}{1}{UppercaseRomanNumerals}

# Copy origin ToC of the book

Schrifttum 11

# Change page number from to decimal arabic number, reset it to 1 but physical page numer is now 13
\pageLabel{13}{1}{DecimalArabicNumerals}

# Copy other parts of the ToC of the Book

I. Abbildungsverfahren 1
1. Aufgabe der Darstellenden Geometrie 1
2. Zentralprojektion 4
3. Parallelprojektion 6

II. Parallelprojektion und perspektive Affinität 8
4. Invarianten der Parallelprojektion 8
5. Der Satz von DESARGUES 11
6. Perspektive Affinität 12
7. Analytische Darstellung einer ebenen perspektiven Affinität 14
8. Das Rechtwinkelpaar einer ebenen perspektiven Affinität 17
9. Die Ellipse als affines Bild des Kreises 19
10. Affine Eigenschaften der Ellipse 21
11. Ellipsenkonstruktionen 23

# .... others entries
Namen- und Sachverzeichnis 339

The complete example toc.txt can be found in this project repository. An instruction to write a toc file is here.

2. Call the python script

# for old schema like above
oldstyle-pdf-toc > pdftk.toc.txt
# for schema 1.2.3.
modern-pdf-toc > pdftk.toc.txt

3. Call the pdftk

pdftk Strubecker.pdf update_info_utf8 pdftk.toc.txt output Strubecker-toc.pdf

That's it!

Development

This Project uses uv to manage dependencies and tasks during development and deployment

uv python install               # Install a copy of python to this directory
uv venv                         # Create a virtual python environment
source .venv/bin/activate       # Activate venv
uv pip install -e .             # Install this project as a python package into the virtual environment
uv build

Deploy in PyPi

See: https://packaging.python.org/en/latest/guides/distributing-packages-using-setuptools/#create-an-account

Principal:

rm -rf dist/* ; uv build
twine upload dist/*

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oldstyle_pdf_toc-0.4.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oldstyle_pdf_toc-0.4.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file oldstyle_pdf_toc-0.4.0.tar.gz.

File metadata

  • Download URL: oldstyle_pdf_toc-0.4.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for oldstyle_pdf_toc-0.4.0.tar.gz
Algorithm Hash digest
SHA256 a02373f05cb7f2c750567ab43f9f08774417354434c5e21c162c3e215b5aedfe
MD5 3b09f3eaca2eae2e56d4e9837b7c1e0d
BLAKE2b-256 8da8e279a5cd6a12bc9a5b3c605b174853b1d6ef16b83ac495718199d0e48b57

See more details on using hashes here.

File details

Details for the file oldstyle_pdf_toc-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for oldstyle_pdf_toc-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4f76a2a564032c48dfd020399222a3706ddb9d7ef61e058bba18efef6ed84e93
MD5 6260772a404bcf0deb7a7bb35c03c168
BLAKE2b-256 14f1c0c1a68c0a5a823c0bd1da6e49fe6aa98ad344eb1e94f088feee017aea51

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page