This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
CLU PDF Rotate is a command-line utility that rotates a single page of a PDF
using the Adobe PDF Library (APDFL 18.0.5+). Rotation is additive — the
supplied value is added to the page's existing /Rotate value, then
normalized into [0, 360).
Requires Python 3.8+ and Git 2.3+. Always activate the virtualenv before running invoke tasks.
# Setup (first time or after dependency changes)
./mkenv.py
. ./python-env-$(hostname)/bin/activate
# Bootstrap Conan profiles and dependencies
invoke -e bootstrap --update --config=Release
# Build
invoke -e build --config=Release
# Run tests (CTest)
invoke -e test --config=Release
# Clean everything
invoke -e distclean
# Generate Linux installer
invoke -e make-installers --config=ReleaseWhen running binaries directly, source the Conan environment first:
source build/Release/generators/conanrun.sh
build/Release/bin/pdfrotate --helpsrc/clu_pdf_rotate/- CLI entry point (main_func.cpp,rotatorlib.h)src/RotatorLib/- Core rotation implementation:clu_pdf_rotate.cpp-Rotator_Main()+RotatePage()(APDFL calls)clu_pdf_rotate_utility.cpp-ProcessCmdArgs(),NormalizeRotation(),DeriveOutputPath()ErrorCodes.h- Return codes (0 success, 101-108 errors)
build/<CONFIG>/bin/pdfrotate- Main executablebuild/<CONFIG>/bin/UnitTest- Catch2 test harnessbuild/<CONFIG>/lib/rotatorlib- Static library containing core logic
RotateRec- Input doc path, output doc path, page number (1-based), rotation in degreesCLUError- Exception class withReturnCodefor error propagation
pdfrotate <input.pdf> <page> <rotation> [-o <output.pdf>]
Output defaults to <input>-rotated.<ext> next to the input.
Managed via Conan 2 with dl_val_toolkit invoke tasks:
- Adobe PDF Library (APDFL) - PDF manipulation
- Boost (program_options, filesystem)
- Catch2 - Unit testing
- common-utils - Datalogics internal utilities
Unit tests live in unit_tests/UnitTests.cpp (Catch2). They cover the pure
helpers (NormalizeRotation, DeriveOutputPath); integration tests that
exercise APDFL belong in unit_tests/test_input/ with sample PDFs.
# Run all tests
invoke -e test --config=Release
# Run tests directly (after sourcing conanrun.sh)
build/Release/bin/UnitTestPre-commit hooks are configured. Run before committing:
pre-commit install # One-time setup
pre-commit run -a # Run all hooks- macOS (Intel x86_64, ARM64)
- Linux (Rocky 8 x86_64, ARM64)
- Windows (x64 MSVC)
Platform-specific Conan profiles are defined in dlproject.yaml.