fix: support multiline annotation text from CSV
This commit is contained in:
parent
50d88ad09b
commit
9dde623ef2
|
|
@ -25,7 +25,7 @@ def add_textbox(page, row):
|
||||||
h = float(row["h"])
|
h = float(row["h"])
|
||||||
|
|
||||||
rect = fitz.Rect(x, y, x + w, y + 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)
|
border_width = float(row.get("border_width", 1.5) or 1.5)
|
||||||
|
|
||||||
box = page.add_rect_annot(rect)
|
box = page.add_rect_annot(rect)
|
||||||
|
|
@ -100,12 +100,14 @@ def generate_annotations(csv_path):
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description="Generate PDF annotations from CSV data.")
|
parser = argparse.ArgumentParser(description="Generate PDF annotations from CSV data.")
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"csv",
|
"-c",
|
||||||
nargs="?",
|
"--csv",
|
||||||
default=str(DATA_DIR / "annotations.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()
|
args = parser.parse_args()
|
||||||
|
|
||||||
generate_annotations(Path(args.csv))
|
generate_annotations(Path(args.csv))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue