#!/usr/bin/env python3 """Generate a demo business letter as a fax-ready TIFF.""" from PIL import Image, ImageDraw, ImageFont import sys, os W, H = 1728, 2291 # A4 at 204x196 dpi def create_demo_document(output_path): img = Image.new('L', (W, H), 255) draw = ImageDraw.Draw(img) # Try to load fonts — fall back to default try: title_font = ImageFont.truetype('/System/Library/Fonts/Helvetica.ttc', 72) h1_font = ImageFont.truetype('/System/Library/Fonts/Helvetica.ttc', 48) body_font = ImageFont.truetype('/System/Library/Fonts/Helvetica.ttc', 36) small_font = ImageFont.truetype('/System/Library/Fonts/Helvetica.ttc', 28) except: title_font = h1_font = body_font = small_font = ImageFont.load_default() # ── Letterhead ── draw.rectangle([0, 0, W, 180], fill=0) draw.text((80, 40), "TELFAX CORPORATION", fill=255, font=title_font) draw.text((80, 130), "Digital Fax Solutions", fill=200, font=small_font) # horizontal rule draw.line([80, 200, W-80, 200], fill=100, width=4) # ── Date & Reference ── draw.text((80, 240), "Date: July 21, 2026", fill=0, font=body_font) draw.text((80, 290), "Reference: TFX-2026-07-21-001", fill=0, font=body_font) draw.text((80, 340), "To: ACME Corporation", fill=0, font=body_font) draw.text((80, 390), " Attn: Mr. John Smith", fill=0, font=body_font) draw.text((80, 440), " Fax: +1-555-0199", fill=0, font=body_font) draw.text((80, 490), "From: Jane Doe, CTO", fill=0, font=body_font) draw.text((80, 540), " Telfax Corp", fill=0, font=body_font) draw.text((80, 590), " Fax: +886-2-2748-6656", fill=0, font=body_font) draw.line([80, 640, W-80, 640], fill=0, width=2) # ── Subject ── draw.text((80, 680), "Subject: Business Proposal for Enterprise Fax Solution", fill=0, font=h1_font) # ── Body ── body_text = [ "Dear Mr. Smith,", "", "We are pleased to submit our proposal for an enterprise-grade digital", "fax solution to replace ACME Corporation's legacy fax infrastructure.", "", "Our solution offers the following key benefits:", "", " 1. Cost reduction of up to 80% on international fax transmissions", " 2. Complete audit trail with encrypted storage for compliance", " 3. Seamless integration with existing PBX and email systems", " 4. Support for T.38 IP fax and traditional PSTN (Class 1/2)", " 5. Multi-language cover pages with OCR verification", "", "This document was transmitted via real POTS lines using the telfax", "open-source fax system running on macOS at V.27ter 4800 bps.", "", "We look forward to discussing this opportunity with you.", "", "Best regards,", "", "Jane Doe", "Chief Technology Officer", "Telfax Corporation", ] y = 780 for line in body_text: draw.text((80, y), line, fill=0, font=body_font) y += 52 # ── Footer ── draw.line([80, y+40, W-80, y+40], fill=180, width=2) draw.text((80, y+60), "Page 1 of 1 | This fax was transmitted via telfax (opencode.ai) | 204x196 dpi Fine", fill=120, font=small_font) img.save(output_path, dpi=(204, 196)) print(f"Demo document created: {output_path} ({W}x{H} px)") if __name__ == '__main__': out = sys.argv[1] if len(sys.argv) > 1 else "/tmp/demo_document.tif" create_demo_document(out)