Skip to main content

nuPDF

CI Python License Docs

nuPDF merges, rotates and reorders PDF and image files.
The module can be used via Python API or aa optional PyQt5 desktop Graphical User Interface (GUI). The GUI is available under Releases on this page, on the right panel.


Features

Feature Description
Merge Combine any number of PDF/image files into a single PDF
Rotate Rotate individual pages or entire documents
Recto-verso Interleave pages for duplex scanner output
Bookmarks Add PDF outline entries named after the source files
Image support Auto-convert JPEG, PNG, GIF and RAW to PDF via Pillow
GUI Optional PyQt5 desktop interface
Executables Pre-built binaries for Windows, Ubuntu and macOS

Installation

# Core library only
pip install nupdf

# With the optional GUI
pip install "nupdf[gui]"

Quick start — Python API

from nupdf.core import read_pdf, rotate_pages, merge_pdfs

# Open a PDF (or convert an image on the fly)
reader = read_pdf("scan.jpg")
print(f"Pages: {len(reader.pages)}")

# Rotate all pages 90° clockwise
rotate_pages("input.pdf", "rotated.pdf", angle=90)

# Rotate only pages 0 and 2 (0-indexed) by 180°
rotate_pages("input.pdf", "rotated.pdf", pages=[0, 2], angle=180)

# Merge two files (with PDF bookmarks)
merge_pdfs(
    ["report.pdf", "appendix.pdf"],
    "combined.pdf",
    recto_verso=False,
    same_file=None,
    bookmark=True,
)

Recto-verso interleaving

Duplex scanners often output fronts and backs as separate files. merge_pdfs can interleave them in the correct reading order:

# Fronts and backs in separate files
merge_pdfs(
    ["fronts.pdf", "backs.pdf"],
    "interleaved.pdf",
    recto_verso=True,
    same_file=True,
)

# All pages in one file (fronts in first half, backs in second half)
merge_pdfs(
    ["both_sides.pdf"],
    "interleaved.pdf",
    recto_verso=True,
    same_file=None,
)

GUI

Launch the graphical interface:

# From source
nupdf

# Or run directly
python -m nupdf.gui
┌─────────────────────────────────────┐
│  nuPDF                              │
│                                     │
│  [Insert files]  [Insert folder]    │
│                                     │
│  ☑ Merge multiple files?            │
│  ☑ Add bookmarks using file title?  │
│  ☐ Recto verso?                     │
│  ☐ Fronts and backs separate?       │
│                                     │
│  Rotation angle (°): [  0  ]        │
│  Pages to rotate:    [     ]        │
│                                     │
│  ┌───────────────────────────────┐  │
│  │ /path/to/file1.pdf            │  │
│  │ /path/to/file2.pdf            │  │
│  └───────────────────────────────┘  │
│  [Up]  [Down]                       │
│                                     │
│  [Clear files list]                 │
│  [Select saving path]               │
│  saving/path/output.pdf             │
│                                     │
│  [          Start          ]        │
│                                     │
│  Status: Ready                      │
└─────────────────────────────────────┘

Page-range syntax

Input Pages selected (1-indexed)
3 Page 3
1-4 Pages 1, 2, 3, 4
1-3;5 Pages 1, 2, 3, 5
2;4-6;9 Pages 2, 4, 5, 6, 9
(empty) All pages

Supported input formats

Extension Notes
.pdf Native; no conversion needed
.jpg / .jpeg Converted to PDF via Pillow
.png Converted to PDF via Pillow
.gif Converted to PDF via Pillow
.raw Converted to PDF via Pillow

Project structure

nupdf/
├── nupdf/
│   ├── __init__.py      # Public API surface
│   ├── core.py          # PDF/image manipulation logic
│   └── gui.py           # PyQt5 desktop interface
├── tests/
│   ├── conftest.py      # pytest fixtures
│   └── test_core.py     # Unit tests for core module
├── docs/
│   └── source/          # Sphinx documentation
├── .github/workflows/
│   ├── ci.yml           # pytest + pylint on push/PR
│   └── release.yml      # PyInstaller binaries on version tag
├── rotatepdf.py         # Backward-compatibility shim
└── pyproject.toml

Development

git clone https://github.com/youruser/nupdf.git
cd nupdf
pip install -e ".[gui,dev]"

# Run tests
pytest

# Lint
pylint nupdf/core.py
pylint nupdf/gui.py --disable=import-error

# Build docs
cd docs && make html

Creating a release

Tag a commit with a version number to trigger the automated release workflow:

git tag v1.2.3
git push origin v1.2.3

GitHub Actions will build standalone executables for Windows, Ubuntu and macOS and attach them to a new GitHub Release automatically.


License

MIT — see LICENSE.

Metadata

Release files for nupdf 1.1

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

Source distribution (sdist)

Source distribution for nupdf 1.1
File Size Uploaded Provenance Actions
nupdf-1.1.tar.gz 21.5 kB Without provenance Details for nupdf-1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nupdf 1.1
File Interpreter ABI Platform Actions
nupdf-1.1-py3-none-any.whl Python 3 none any Details for nupdf-1.1-py3-none-any.whl

Total release size: 40.1 kB

Release files / nupdf-1.1.tar.gz

Download URL nupdf-1.1.tar.gz
Size 21.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5a691c61dc691743c0ca9f630d98fd55e255a07c81b1fae0b7ddb70198a58535
BLAKE2b-256 checksum
How to use checksums
2b12edd1ea7f2faa8ba38a0f8ab358c23ab9eb63137e9c3b1ad85cc5acd0ef62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / nupdf-1.1-py3-none-any.whl

Download URL nupdf-1.1-py3-none-any.whl
Size 18.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c96efc2cd8b1e1a5a58410733e2b333d5ae017c31c0922026b98ae19fede7611
BLAKE2b-256 checksum
How to use checksums
84ab5282a14a26526805cc0f38b3321cda355af46d9833f03ed3dde478a49bb1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for nupdf 1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1 This release

2 release files No provenance

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