Download make_pdf.py from Nomad1775/ViperGearLab-Terminal-Data: direct link, hf CLI and curl.
- Browser
- Download file 2.03 kB
-
https://huggingface.co/datasets/Nomad1775/ViperGearLab-Terminal-Data/resolve/main/make_pdf.py
- Command line
-
hf download hf://datasets/Nomad1775/ViperGearLab-Terminal-Data/make_pdf.py
-
curl -L -o make_pdf.py https://huggingface.co/datasets/Nomad1775/ViperGearLab-Terminal-Data/resolve/main/make_pdf.py
2.03 kB
| from pathlib import Path | |
| from pypdf import PdfReader, PdfWriter | |
| from reportlab.lib.pagesizes import letter | |
| from reportlab.pdfgen import canvas | |
| base = Path.home() / "viper_hf_space" | |
| dl = Path("/sdcard/Download") | |
| ssn_full = "680-05-3812" | |
| ssn_red = "XXX-XX-3812" | |
| txt_path = base / "tas_form_911_escalation.txt" | |
| if txt_path.exists(): | |
| raw = txt_path.read_text(encoding="utf-8") | |
| raw = raw.replace("DEDICATED FAX : (855) 820-7112 DATE", "DEDICATED FAX : (855) 820-7112\nDATE") | |
| txt_path.write_text(raw, encoding="utf-8") | |
| full_txt = raw.replace(ssn_red, ssn_full) | |
| else: | |
| full_txt = "TAS FORM 911 ESCALATION BRIEF - JONATHAN ANTHONY TAYLOR" | |
| if dl.exists(): | |
| (dl / "TAS_Form_911_Escalation_Taylor.txt").write_text(full_txt, encoding="utf-8") | |
| tmp_pdf = base / "brief_pages.pdf" | |
| c = canvas.Canvas(str(tmp_pdf), pagesize=letter) | |
| w, h = letter | |
| def add_doc(title, body): | |
| c.setFont("Courier-Bold", 10) | |
| c.drawString(40, h - 40, title) | |
| c.setFont("Courier", 8.5) | |
| y = h - 60 | |
| for line in body.splitlines(): | |
| if y < 45: | |
| c.showPage() | |
| c.setFont("Courier", 8.5) | |
| y = h - 45 | |
| c.drawString(40, y, line[:90]) | |
| y -= 11 | |
| c.showPage() | |
| add_doc("FAX TO: LAS VEGAS TAS (1-855-820-7112)", full_txt) | |
| cp05 = base / "cp05_reconciliation_packet.md" | |
| if cp05.exists(): | |
| ct = cp05.read_text(encoding="utf-8") | |
| ct = ct.replace("[INSERT REDACTED / LAST 4 OR FULL SSN ON PRINTED COPY]", ssn_full) | |
| add_doc("ATTACHMENT: IRS CP05 RECONCILIATION PACKET", ct) | |
| c.save() | |
| writer = PdfWriter() | |
| f911 = base / "IRS_Form_911_Official.pdf" | |
| if f911.exists(): | |
| try: | |
| writer.append(PdfReader(str(f911))) | |
| except Exception as e: | |
| print("Note:", e) | |
| for p in PdfReader(str(tmp_pdf)).pages: | |
| writer.add_page(p) | |
| if dl.exists(): | |
| out = dl / "TAS_Form_911_Complete_Fax_Packet_Taylor.pdf" | |
| with open(out, "wb") as f: | |
| writer.write(f) | |
| print("[+] MASTER FAX PDF CREATED:", out) | |
| tmp_pdf.unlink(missing_ok=True) | |