Skip to main content

A tool to merge appendices into a main PDF.

Project description

📑 pdf-appendix

PyPI version

pdf-appendix is a lightweight command-line tool for merging appendix PDFs into a main document.

It is designed for reports where the main document contains title pages for each appendix, and the appendices need to be inserted at the right spots.


✨ Features

  • 📂 Merge multiple appendices into a main PDF
  • 🔀 Interleave appendices with main document title pages, or append as a block
  • 📑 Preserve the last N pages of the main document at the end (--end-pages)
  • 📁 Use appendices from a custom folder (--appendix-folder)
  • 📂 Save the merged PDF in a custom folder (--output-folder)
  • 📝 Set a custom output filename (--filename)
  • 🔍 Regex-based appendix file matching (--pattern)
  • 📊 Verbose logging for debugging (--verbose)

⚙️ Installation

Install from PyPI with pip:

pip install pdf-appendix

📖 Usage

Run from the command line:

pdf-appendix main.pdf

🔍 Options

  • --pattern: Regex for appendix filenames (default: "_\d+")

  • --no-interleave: Append all appendices as one block instead of interleaving

  • --end-pages N: Preserve the last N pages of the main document at the very end

  • --appendix-folder PATH: Folder where appendix PDFs are stored (default: same as main file)

  • --output-folder PATH: Folder where the merged PDF will be saved (default: same as main file)

  • --filename NAME: Custom output filename (default: <main>_with_appendix.pdf)

  • --verbose: Show detailed debug output

Examples

# Append appendix files like report_1.pdf, report_2.pdf ...
pdf-appendix report.pdf

# Match files appendix_1.pdf, appendix_2.pdf ...
pdf-appendix report.pdf --pattern "appendix_\d+"

# Append all appendices at the end (no interleaving)
pdf-appendix report.pdf --no-interleave

# Preserve last 2 pages of main document
pdf-appendix report.pdf --end-pages 2

# Use appendices from a different folder
pdf-appendix report.pdf --appendix-folder ./appendices

# Save output in a different folder
pdf-appendix report.pdf --output-folder ./output

# Save output with a custom filename
pdf-appendix report.pdf --filename merged.pdf

# Verbose output (DEBUG level)
pdf-appendix report.pdf --verbose

📑 About Interleaving

The --interleave option is intended for cases where your main document already includes placeholder title pages for each appendix (e.g. a page that says “Appendix 1”, “Appendix 2”, …).

When --interleave is enabled (default):

The tool inserts each appendix directly after its corresponding title page in the main document.

When --no-interleave:

All appendices are simply appended at the end of the main document in order.

This allows you to prepare a clean report with dedicated appendix cover pages and let the tool place the actual appendix content in the right spots automatically.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Third-Party Licenses

This project makes use of the following third-party library:

  • pypdf — licensed under the BSD-3-Clause License

Build tools and development dependencies (such as black and pytest) are licensed under permissive licenses (MIT or similar) and are only used during development and packaging.

See THIRD_PARTY_LICENSES for details.

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

pdf_appendix-1.0.0.tar.gz (20.1 kB view details)

Uploaded Source

Built Distribution

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

pdf_appendix-1.0.0-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file pdf_appendix-1.0.0.tar.gz.

File metadata

  • Download URL: pdf_appendix-1.0.0.tar.gz
  • Upload date:
  • Size: 20.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for pdf_appendix-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3fe1186adf2b8c27e9248843285bbb3ef9f30e94df7713f7d52d47078923a950
MD5 6a40cbe5b626ad94d257825c6c877ba7
BLAKE2b-256 d538f80cb0daa392436a4cc1af7e2a6c1f9050984b52952de74bc922cf165954

See more details on using hashes here.

File details

Details for the file pdf_appendix-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pdf_appendix-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 18.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for pdf_appendix-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aa5b7d46ee8389a0190dc534501d1faa3b066d4e12ffe17f47c429e4fab5e42a
MD5 4524d4502e1e962df3b18531db49f313
BLAKE2b-256 d89b53a7016a07697c26662d95b7f68a8dc0a2035226aefc44febae24c13204a

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