Tools - python - US Tax return labels

30 July 2025 - Written by ML

Highlights

  • Python script to generate a hard coded two column list of labels and save in txt and html formats.

Script

1. Generate file list

import os

# Hardcoded labels - defined once to avoid duplication
LABELS = {
    1: "Federal tax summary",
    2: "Arizona tax summary", 
    3: "California tax summary",
    4: "Georgia tax summary",
    5: "North Carolina tax summary",
    6: "Agency Disclosures",
    7: "Form 114A authorization",
    8: "Form 8879 efile signature",
    9: "Form 4868",
    10: "Form 1040 tax return",
    11: "Schedule 1 Form 1040",
    12: "Schedule B Form 1040",
    13: "Schedule C Form 1040",
    14: "Schedule D Form 1040",
    15: "Schedule D Form 1040 8949",
    16: "Schedule E Form 1040",
    17: "Form 461",
    18: "Form 1116",
    19: "Schedule B Form 1116",
    20: "Form 3800",
    21: "Form 4797",
    22: "Form 8995 - qualified business income",
    23: "Schedule B - Form 8995",
    24: "Form 8582-CR - passive activity credits",
    25: "Form 4562 - depreciation",
    26: "Form 7203 - S Corporation stock",
    27: "Form 8582 - Passive activity losses",
    28: "Form 8938 - Statement of foreign financial assets",
    29: "Form 8990 - limitation on business interest",
    30: "Federal Statements",
    31: "Federal Supplemental",
    32: "Fincen Form 114",
    33: "Arizona A28879; 140 NR",
    34: "California cover - tax return",
    35: "CA Form 8453-LLC",
    36: "CA Form 8879 - e file signature",
    37: "CA Form 540 - tax return",
    38: "CA Schedule Form",
    39: "CA Schedule D Form",
    40: "CA Schedule D1 - state",
    41: "CA Form 3461 - limitation",
    42: "CA Form 3801 - passive",
    43: "CA Form 3805 V - net operating loss",
    44: "Schedule A Form 1040 CA only",
    45: "CA Statements",
    46: "CA Form 568 - limited liability company",
    47: "CA 8453 LLC - e file",
    48: "Georgia cover",
    49: "Georgia - Form 500",
    50: "North Carolina D400",
    51: "California Depreciation",
    52: "",  # Blank entry
    53: "",  # Blank entry
    54: "",  # Blank entry
}

def create_simple_text_document():
    """
    Create a simple text document that can be printed.
    """
    
    # Create formatted text
    output_lines = []
    
    # Title
    output_lines.append("2023 TAX DOCUMENT LABELS")
    output_lines.append("=" * 80)
    output_lines.append("")
    
    # Left column (1-27)
    left_entries = []
    for i in range(1, 28):
        left_entries.append(f"{i:2d} - {LABELS.get(i, '')}")
    
    # Right column (28-54)
    right_entries = []
    for i in range(28, 55):
        right_entries.append(f"{i:2d} - {LABELS.get(i, '')}")
    
    # Calculate spacing for proper alignment
    max_left_length = max(len(line) for line in left_entries)
    
    # Format as two columns with proper spacing
    for i in range(len(left_entries)):
        left_line = left_entries[i]
        right_line = right_entries[i] if i < len(right_entries) else ""
        
        # Pad left column to align properly
        padded_left = left_line.ljust(max_left_length + 10)
        output_lines.append(f"{padded_left}{right_line}")
    
    # Save to file
    with open("printable_tax_labels.txt", 'w', encoding='utf-8') as f:
        f.write('\n'.join(output_lines))
    
    print("Text document created: printable_tax_labels.txt")
    print("\nDocument content:")
    print("-" * 80)
    print('\n'.join(output_lines))
    print("-" * 80)

def create_html_document():
    """
    Create an HTML document that can be printed.
    """
    
    # Create HTML content
    html_content = """
<!DOCTYPE html>
<html>
<head>
    <title>2023 Tax Document Labels</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 20px;
            margin-left: 70px; /* 3 cm = approximately 70px */
            font-size: 12px;
        }
        .title {
            text-align: center;
            font-size: 18px;
            font-weight: bold;
            margin-bottom: 20px;
        }
        .container {
            display: flex;
            justify-content: space-between;
        }
        .column {
            width: 48%;
        }
        .label {
            margin-bottom: 8px;
            line-height: 1.2;
        }
        @media print {
            body {
                margin: 10px;
                margin-left: 70px; /* Maintain left margin for printing */
            }
            .container {
                page-break-inside: avoid;
            }
        }
    </style>
</head>
<body>
    <div class="title">2023 TAX DOCUMENT LABELS</div>
    <div class="container">
        <div class="column">
            <div class="label"><strong> </strong></div>
"""
    
    # Add left column labels
    for i in range(1, 28):
        html_content += f'            <div class="label">{i:2d} - {LABELS.get(i, "")}</div>\n'
    
    html_content += """        </div>
        <div class="column">
            <div class="label"><strong> </strong></div>
"""
    
    # Add right column labels
    for i in range(28, 55):
        html_content += f'            <div class="label">{i:2d} - {LABELS.get(i, "")}</div>\n'
    
    html_content += """        </div>
    </div>
</body>
</html>"""
    
    # Save HTML file
    with open("tax_labels_document.html", 'w', encoding='utf-8') as f:
        f.write(html_content)
    
    print("HTML document created: tax_labels_document.html")
    print("You can open this file in a web browser and print it.")

if __name__ == "__main__":
    # Create both text and HTML documents
    create_simple_text_document()
    create_html_document()
    
    print("\n" + "="*60)
    print("DOCUMENT CREATION COMPLETE")
    print("="*60)
    print("Files created:")
    print("- printable_tax_labels.txt (text format)")
    print("- tax_labels_document.html (HTML format)")
    print("\nYou can:")
    print("1. Print the text file directly")
    print("2. Open the HTML file in a browser and print it")
    print("3. Both files contain the same tax document labels")