#!/usr/bin/env bash # pdf-notes-to-md.sh — extract PDF annotations to Markdown next to the PDF. set -euo pipefail if [[ $# -lt 1 ]]; then echo "usage: $0 [output.md]" >&2 exit 64 fi IN="$1" OUT="${2:-${IN%.pdf}.md}" if command -v pdf-notes-md >/dev/null 2>&1; then pdf-notes-md "$IN" -o "$OUT" else : "${PDF_TOOLS_DIR:?set PDF_TOOLS_DIR or install pdf-notes-md}" (cd "$PDF_TOOLS_DIR" && uv run pdf-notes-md "$IN" -o "$OUT") fi