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
This commit is contained in:
commit
e464871b69
29 changed files with 5296 additions and 0 deletions
21
src/pdf_tools/common.py
Normal file
21
src/pdf_tools/common.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
"""Shared helpers across the three tools."""
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def err(msg: str) -> None:
|
||||
print(msg, file=sys.stderr)
|
||||
|
||||
|
||||
def must_exist(p: Path) -> Path:
|
||||
if not p.exists():
|
||||
err(f"error: not found: {p}")
|
||||
sys.exit(2)
|
||||
return p
|
||||
|
||||
|
||||
def with_suffix_before_ext(p: Path, marker: str) -> Path:
|
||||
"""foo.pdf + '_clean' -> foo_clean.pdf"""
|
||||
return p.with_name(f"{p.stem}{marker}{p.suffix}")
|
||||
Loading…
Add table
Add a link
Reference in a new issue