Flash112/ADS_HUB
0
1import json2import fitz # PyMuPDF3 4pdf_path = "projects.pdf"5json_path = "projects.json"6 7with fitz.open(pdf_path) as doc:8 text = "\n".join(page.get_text() for page in doc)9 10projects = []11for section in text.split("\n\n"):12 if ". " in section:13 lines = section.strip().split("\n")14 if len(lines) >= 2:15 title = lines[0].split(". ", 1)[-1].strip()16 summary = lines[1].strip()17 projects.append({"name": title, "summary": summary})18 19with open(json_path, "w") as f:20 json.dump(projects, f, indent=2)21 22print(f"Extracted {len(projects)} projects to {json_path}")