fix: support multiline annotation text from CSV

This commit is contained in:
Sean McElwain 2026-05-01 21:43:46 -05:00
parent 50d88ad09b
commit 9dde623ef2
1 changed files with 6 additions and 4 deletions

View File

@ -25,7 +25,7 @@ def add_textbox(page, row):
h = float(row["h"])
rect = fitz.Rect(x, y, x + w, y + h)
text = str(row["note_text"])
text = str(row["note_text"]).replace("\\n", "\n")
border_width = float(row.get("border_width", 1.5) or 1.5)
box = page.add_rect_annot(rect)
@ -100,12 +100,14 @@ def generate_annotations(csv_path):
def main():
parser = argparse.ArgumentParser(description="Generate PDF annotations from CSV data.")
parser.add_argument(
"csv",
nargs="?",
"-c",
"--csv",
default=str(DATA_DIR / "annotations.csv"),
help="Path to annotations CSV file",
help="Path to annotations CSV file. Default: data/annotations.csv",
)
args = parser.parse_args()
generate_annotations(Path(args.csv))