Do's and Don't to buy a home

by Natalie Basore - Broker

</div# Create PDF, HTML, and social media images for Natalie's "Do This / Don't Do This" homebuying prep table import base64, io, textwrap, os, math from reportlab.platypus import SimpleDocTemplate, Table, TableStyle, Paragraph, Image, Spacer from reportlab.lib import colors from reportlab.lib.pagesizes import letter from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.lib.units import inch from PIL import Image as PILImage, ImageDraw, ImageFont # Paths logo_path = "/mnt/data/IMG_1742.jpeg" pdf_path = "/mnt/data/Basore_Financial_Readiness_Table.pdf" html_path = "/mnt/data/financial-readiness-table.html" png_square_path = "/mnt/data/financial-readiness-1080x1080.png" png_portrait_path = "/mnt/data/financial-readiness-1080x1350.png" # Data rows = [ ("Credit Score", "Check your credit early and dispute errors. Keep balances under 30% of limit.", "Ignore your credit or open new cards right before you apply."), ("Debt-to-Income Ratio", "Pay down debts and avoid new loans or car payments.", "Add new debt like financing furniture or a car before closing."), ("Savings", "Build an emergency fund. Save for down payment and closing costs.", "Empty your savings on the down payment with no cushion."), ("Job Stability", "Keep steady employment. Delay big job changes until after closing.", "Switch jobs, reduce hours, or jump to self-employment mid-process."), ("Budgeting", "Get pre-approved. Know your comfortable monthly payment.", "Shop for homes before you know what you can afford."), ("Spending Habits", "Track spending. Avoid large or unusual bank transfers.", "Make big purchases that flag your lender."), ("Documentation", "Keep pay stubs, W-2s, tax returns, and bank statements handy.", "Scramble for documents at the last minute."), ("Communication", "Stay in close contact with your lender and Realtor.", "Go silent and assume everything is fine."), ("Financial Planning", "Meet a lender months ahead to spot improvements.", "Wait until you find a home to begin pre-approval."), ] # Brand colors (sample teal accent from logo style) ACCENT = colors.HexColor("#11A8B4") # teal-ish DARK = colors.HexColor("#111111") # ---------- Create PDF ---------- doc = SimpleDocTemplate(pdf_path, pagesize=letter, topMargin=36, bottomMargin=36, leftMargin=36, rightMargin=36) styles = getSampleStyleSheet() title_style = ParagraphStyle( "Title", parent=styles["Heading1"], fontSize=20, leading=24, textColor=DARK, spaceAfter=12 ) subtitle_style = ParagraphStyle( "Sub", parent=styles["Normal"], fontSize=11, leading=14, textColor=colors.HexColor("#555555"), spaceAfter=14 ) header_style = ParagraphStyle( "Header", parent=styles["Heading3"], fontSize=12, leading=14, textColor=colors.white, alignment=1 ) cell_style = ParagraphStyle( "Cell", parent=styles["Normal"], fontSize=10.5, leading=13, ) # Build table data with styled headers pdf_table_data = [] headers = ["Category", "Do This ✅", "Don't Do This 🚫"] pdf_table_data.append([Paragraph(h, header_style) for h in headers]) for cat, do, dont in rows: pdf_table_data.append([Paragraph(cat, cell_style), Paragraph(do, cell_style), Paragraph(dont, cell_style)]) # Create ReportLab table table = Table(pdf_table_data, colWidths=[1.4*inch, 2.9*inch, 2.9*inch]) table_style = TableStyle([ ("BACKGROUND", (0,0), (-1,0), ACCENT), ("TEXTCOLOR", (0,0), (-1,0), colors.white), ("ALIGN", (0,0), (-1,-1), "LEFT"), ("VALIGN", (0,0), (-1,-1), "TOP"), ("FONTNAME", (0,0), (-1,0), "Helvetica-Bold"), ("FONTNAME", (0,1), (-1,-1), "Helvetica"), ("FONTSIZE", (0,1), (-1,-1), 10.5), ("LINEBEFORE", (1,0), (1,-1), 0.25, colors.HexColor("#e6e6e6")), ("LINEBEFORE", (2,0), (2,-1), 0.25, colors.HexColor("#e6e6e6")), ("GRID", (0,0), (-1,-1), 0.25, colors.HexColor("#dddddd")), ("ROWBACKGROUNDS", (0,1), (-1,-1), [colors.white, colors.HexColor("#FAFAFA")]), ("TOPPADDING", (0,0), (-1,-1), 6), ("BOTTOMPADDING", (0,0), (-1,-1), 6), ]) table.setStyle(table_style) # Flowables story = [] # Header with logo try: logo_img = Image(logo_path, width=1.6*inch, height=1.0*inch) # Put title and logo side by side from reportlab.platypus import KeepTogether story.append(Paragraph("Financial Readiness to Buy a Home", title_style)) story.append(Paragraph("Best practices to get mortgage-ready with confidence.", subtitle_style)) story.append(logo_img) story.append(Spacer(1, 6)) except Exception as e: story.append(Paragraph("Financial Readiness to Buy a Home", title_style)) story.append(Paragraph("Best practices to get mortgage-ready with confidence.", subtitle_style)) story.append(table) doc.build(story) # ---------- Create HTML (standalone with embedded logo) ---------- # Encode logo as base64 with open(logo_path, "rb") as f: b64_logo = base64.b64encode(f.read()).decode("ascii") html_css = """
""" def escape_html(s): return (s .replace("&","&") .replace("<","<") .replace(">",">")) html_rows = "\n".join([ f"{escape_html(cat)}{escape_html(do)}{escape_html(dont)}" for cat, do, dont in rows ]) html_content = f""" {html_css}

Financial Readiness to Buy a Home

Best practices to get mortgage-ready with confidence.

{html_rows}
Category Do This ✅ Don't Do This 🚫
""" with open(html_path, "w", encoding="utf-8") as f: f.write(html_content) # ---------- Create Social Media Images (1080x1080 and 1080x1350) ---------- def load_logo_for_pil(target_height): img = PILImage.open(logo_path).convert("RGBA") w, h = img.size scale = target_height / h new_w, new_h = int(w*scale), int(h*scale) return img.resize((new_w, new_h), PILImage.LANCZOS) def draw_table_image(size=(1080,1080), out_path=png_square_path): W, H = size img = PILImage.new("RGB", size, "white") draw = ImageDraw.Draw(img) # Fonts try: title_font = ImageFont.truetype("DejaVuSans-Bold.ttf", 56) header_font = ImageFont.truetype("DejaVuSans-Bold.ttf", 30) cell_font = ImageFont.truetype("DejaVuSans.ttf", 26) small_font = ImageFont.truetype("DejaVuSans.ttf", 22) except: title_font = ImageFont.load_default() header_font = ImageFont.load_default() cell_font = ImageFont.load_default() small_font = ImageFont.load_default() # Margins pad = 48 y = pad # Header and logo logo = load_logo_for_pil(80) img.paste(logo, (W - pad - logo.size[0], y), logo) title = "Financial Readiness to Buy a Home" draw.text((pad, y), title, fill=(17,17,17), font=title_font) y += 80 + 18 # Table headers accent = (17,168,180) col_x = [pad, int(W*0.34), int(W*0.67)] header_h = 48 # Header background rectangles for i, text in enumerate(["Category", "Do This ✅", "Don't Do This 🚫"]): x0 = col_x[i] x1 = col_x[i+1]-8 if i < 2 else W - pad draw.rectangle([x0, y, x1, y+header_h], fill=accent) # Center vertically text_y = y + (header_h - header_font.getbbox("Ag")[3])//2 draw.text((x0+10, text_y), text, fill="white", font=header_font) y += header_h + 10 # Row rendering line_color = (220,220,220) row_h = 120 # approximate, will wrap within for idx, (cat, do, dont) in enumerate(rows): x_bounds = [(col_x[0], col_x[1]-8), (col_x[1], col_x[2]-8), (col_x[2], W-pad)] # background alternating if idx % 2 == 1: draw.rectangle([pad, y-6, W-pad, y + row_h - 6], fill=(250,250,250)) # draw wrapped text def draw_wrapped(text, box, font, fill=(17,17,17), line_height=1.3): x0, x1 = box max_width = x1 - x0 - 14 words = text.split() lines = [] current = "" for w in words: trial = (current + " " + w).strip() if draw.textlength(trial, font=font) <= max_width: current = trial else: lines.append(current) current = w if current: lines.append(current) yy = y for ln in lines[:6]: # limit lines to avoid overflow draw.text((x0+10, yy), ln, fill=fill, font=font) bbox = font.getbbox(ln or "A") line_px = int((bbox[3]) * line_height) yy += line_px draw_wrapped(cat, x_bounds[0], cell_font) draw_wrapped(do, x_bounds[1], cell_font) draw_wrapped(dont,x_bounds[2], cell_font) # horizontal line draw.line([(pad, y + row_h - 8), (W - pad, y + row_h - 8)], fill=line_color, width=1) y += row_h if y > H - 120: break # prevent overflow; the portrait variant will fit more # Footer footer = "© 2025 Basore Real Estate" draw.text((pad, H - 40), footer, fill=(120,120,120), font=small_font) img.save(out_path, format="PNG", quality=95) # Create both images draw_table_image((1080,1080), png_square_path) draw_table_image((1080,1350), png_portrait_path) # Return file paths so the UI can show download links (pdf_path, html_path, png_square_path, png_portrait_path)
GET MORE INFORMATION
Natalie Basore - Broker

Natalie Basore - Broker

Broker | License ID: 9012877

+1(210) 875-8271

Name
Phone*
Message