# Pdfunite Processor

## Purpose

Merges PDF files from subdirectories into single combined PDFs using [pdfunite](https://poppler.freedesktop.org/).

## How It Works

Scans subdirectories of the configured source directory for files matching the
configured extension. For each subdirectory, it locates the corresponding PDFs
(generated by an upstream processor such as marp) and merges them into a single
output PDF.

This processor is designed for course/module workflows where slide decks in
subdirectories are combined into course bundles.

## Source Files

- Input: PDFs from upstream processor (e.g., `out/marp/pdf/{subdir}/*.pdf`)
- Output: `out/courses/{subdir}.pdf`

## Configuration

```toml
[processor.pdfunite]
pdfunite_bin = "pdfunite"              # The pdfunite command to run
source_dir = "marp/courses"           # Base directory containing course subdirectories
source_ext = ".md"                     # Extension of source files in subdirectories
source_output_dir = "out/marp/pdf"     # Where the upstream processor puts PDFs
args = []                              # Additional arguments to pass to pdfunite
output_dir = "out/courses"             # Output directory for merged PDFs
extra_inputs = []                      # Additional files that trigger rebuilds when changed
```

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| `pdfunite_bin` | string | `"pdfunite"` | The pdfunite executable to run |
| `source_dir` | string | `"marp/courses"` | Directory containing course subdirectories |
| `source_ext` | string | `".md"` | Extension of source files to look for |
| `source_output_dir` | string | `"out/marp/pdf"` | Directory where the upstream processor outputs PDFs |
| `args` | string[] | `[]` | Extra arguments passed to pdfunite |
| `output_dir` | string | `"out/courses"` | Output directory for merged PDFs |
| `extra_inputs` | string[] | `[]` | Extra files whose changes trigger rebuilds |

## Batch support

Each input file is processed individually, producing its own output file.
