Skip to content

sunrisever/pdf-4in1

Repository files navigation

English | 简体中文

PDF 4-in-1

Print Layout Converter for Lecture Handouts

Convert lecture slides (PDF / PPT / PPTX) into 4-slides-per-sheet A4 landscape PDF for double-sided printing. Save 75% paper.

4-in-1 layout demo

Features

  • PDF → 4-in-1 PDF: Pure Python, cross-platform (Windows / macOS / Linux)
  • PPT/PPTX → 4-in-1 PDF: Windows only, requires Microsoft PowerPoint
  • Z-pattern layout (top-left → top-right → bottom-left → bottom-right)
  • Maintains aspect ratio with auto-centering
  • Page numbers on each sheet
  • Batch processing
  • AI coding assistant support: includes CLAUDE.md and AGENTS.md for Claude Code, Codex, OpenCode, and OpenClaw

Quick Start

Install

pip install -r requirements.txt

PDF 4-in-1

# Put PDF files in input_pdfs/ directory
python pdf_4in1.py
# Output in output_pdfs/

PPT/PPTX 4-in-1 (Windows Only)

# Put PPT/PPTX files in input_ppts/ directory
python ppt_4in1.py
# Output in output_pdfs/

⚠️ PPT conversion requires Microsoft PowerPoint installed. Do not operate PowerPoint while the script is running.

Layout

┌─────────────┬─────────────┐
│             │             │
│   Slide 1   │   Slide 2   │
│             │             │
├─────────────┼─────────────┤
│             │             │
│   Slide 3   │   Slide 4   │
│             │             │
└─────────────┴──────── 1/n ┘
  • Output: A4 Landscape
  • Layout: Z-pattern (left-to-right, top-to-bottom)
  • Scaling: Fit to cell while maintaining aspect ratio
  • Margin: 10pt (PDF) / 50px (PPT)

Requirements

Tool Python Packages Platform Extra
pdf_4in1.py pypdf, reportlab All None
ppt_4in1.py pywin32, Pillow Windows Microsoft PowerPoint

Use Cases

  • Print lecture slides for class (save 75% paper)
  • Read slides on iPad/tablet without swiping through hundreds of pages
  • Create handout PDFs for study notes
  • Prepare exam review materials

License

MIT

Releases

No releases published

Packages

 
 
 

Contributors

Languages