pdf-tools/scripts/pdf-notes-to-md.sh
Eric Furst e464871b69 Initial public release of pdf-tools
Command-line tools for marked-up PDFs and scanned handwritten notes:
pdf-scrub, pdf-notes-md, scan-notes-md (Ollama by default, Claude on
request), scan-notes-index (per-page search metadata), and
scan-notes-stats.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011ZSvbNaLhgFuTm7wmkgbWs
2026-11-03 07:25:51 -05:00

18 lines
448 B
Bash
Executable file

#!/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 <pdf> [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