Skip to content

Conversation

@nedanwr
Copy link
Owner

@nedanwr nedanwr commented Jan 1, 2026

Description

Implements all v0.0.4 deliverables for PDF Advanced Operations, including new commands for compression, linearization, page reordering, and page extraction. Adds Ghostscript as the primary tool for PDF compression (replacing pdfcpu), and introduces a YAML-based preset system for compression configuration.

New Commands

  • pdf compress - Compress PDFs with 4 preset levels (light, standard, high, xhigh)
  • pdf linearize - Optimize PDFs for fast web viewing
  • pdf reorder - Reorder pages in a PDF
  • pdf extract - Extract pages to PDF, PNG, or JPEG formats

Compression Results (14MB test file)

Level Output Size Reduction
light 4.2MB 70%
standard 3.4MB 76%
high 2.7MB 81%
xhigh 744KB 95%

Type of Change

  • feat: New feature

Scope

  • cli - CLI commands and interface
  • core - Core library functionality
  • tools - Tool integrations (qpdf, ghostscript, etc.)
  • pdf - PDF-specific operations
  • packaging - Package configurations

Related Issues

None

Checklist

  • I have read the commit convention
  • My commits follow the conventional format: type(scope): description
  • I have added/updated tests as appropriate
  • All tests pass locally (cargo test)
  • Code passes lint checks (cargo clippy and cargo fmt)
  • I have updated documentation if needed

Breaking Changes

  • This PR contains breaking changes

Migration Guide

  • Ghostscript replaces pdfcpu: Users must install ghostscript instead of pdfcpu for PDF compression. Update your dependencies:
    • macOS: brew install ghostscript
    • Ubuntu: sudo apt install ghostscript
    • Windows: choco install ghostscript

Summary of Changes

Features

  • PDF compress, linearize, reorder, and extract commands
  • Ghostscript tool adapter with probe/version detection
  • YAML-based preset system with embedded defaults
  • Image extraction from PDFs (PNG/JPEG at 300 DPI)
  • xhigh compression preset for sub-1MB output
  • qpdf --show-npages integration for accurate page counts

Infrastructure

  • GitHub Actions CI workflow (Ubuntu, macOS, Windows)
  • PR template for standardized contributions

Tests

  • 63 total tests (48 unit + 10 integration + 5 doc tests)
  • Direct tests for preset loader, model, and qpdf page count

Screenshots / Output

$ forgekit pdf compress input.pdf -o output.pdf -l xhigh
Successfully compressed PDF to output.pdf

$ forgekit pdf extract input.pdf -d ./images -p 1-3 --format png
Successfully extracted images to directory ./images

$ forgekit check-deps
✓ qpdf: found at /opt/homebrew/bin/qpdf
✓ gs: found at /opt/homebrew/bin/gs
✓ All dependencies are installed!

…nstallation instructions for multiple platforms
… usability, including enhanced help descriptions and removal of deprecated flags
…extraction and improve command generation for various formats
…ew output formats (png, jpeg) for PDF extraction
…PresetDefinition` deserialization and cloning
@nedanwr nedanwr self-assigned this Jan 1, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 1, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

…v::temp_dir` for better clarity and cleanup
@nedanwr nedanwr merged commit 4148aa7 into develop Jan 1, 2026
5 checks passed
@nedanwr nedanwr deleted the feat/pdf-advanced-operations branch January 1, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants