File size: 2,030 Bytes
9320cd3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | 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)
|