Invoice Generation with Python

Invoice Generation with Python using Pyppeteer

Sample Template :

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Invoice</title>
  <style>
    body {
      font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
      margin: 0;
      padding: 20px;
      background-color: #f8f9fa;
    }

    .invoice-box {
      background: #fff;
      padding: 30px;
      border-radius: 10px;
      box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
      max-width: 800px;
      margin: auto;
    }

    h1 {
      text-align: center;
      color: #333;
    }

    .company-info {
      text-align: right;
      margin-bottom: 20px;
    }

    .company-info h2 {
      margin: 0;
      color: #007bff;
    }

    .invoice-details {
      display: flex;
      justify-content: space-between;
      margin-bottom: 30px;
    }

    .invoice-details div {
      width: 48%;
    }

    table {
      width: 100%;
      border-collapse: collapse;
      margin-bottom: 20px;
    }

    table th, table td {
      border: 1px solid #ddd;
      padding: 10px;
      text-align: left;
    }

    table th {
      background-color: #007bff;
      color: white;
    }

    table tfoot td {
      font-weight: bold;
    }

    .notes {
      margin-top: 20px;
      font-size: 0.9em;
      color: #555;
    }

    .footer {
      text-align: center;
      font-size: 0.85em;
      color: #777;
      margin-top: 30px;
    }
  </style>
</head>
<body>
  <div class="invoice-box">
    <div class="company-info">
      <h2>Your Company Name</h2>
      <p>123 Business Street<br>Dubai, UAE<br>+971 50 123 4567<br>info@yourcompany.com</p>
    </div>

    <h1>INVOICE</h1>

    <div class="invoice-details">
      <div>
        <strong>Billed To:</strong>
        <p>
          John Doe<br>
          45 Palm Avenue<br>
          Dubai, UAE<br>
          johndoe@email.com
        </p>
      </div>
      <div>
        <strong>Invoice #:</strong> INV-2025-001<br>
        <strong>Date:</strong> 27 Oct 2025<br>
        <strong>Due Date:</strong> 3 Nov 2025
      </div>
    </div>

    <table>
      <thead>
        <tr>
          <th>Description</th>
          <th>Qty</th>
          <th>Unit Price</th>
          <th>Total</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>Web Design Services</td>
          <td>1</td>
          <td>AED 2,500</td>
          <td>AED 2,500</td>
        </tr>
        <tr>
          <td>Hosting (12 months)</td>
          <td>1</td>
          <td>AED 600</td>
          <td>AED 600</td>
        </tr>
        <tr>
          <td>Domain Registration</td>
          <td>1</td>
          <td>AED 50</td>
          <td>AED 50</td>
        </tr>
      </tbody>
      <tfoot>
        <tr>
          <td colspan="3" style="text-align:right;">Subtotal</td>
          <td>AED 3,150</td>
        </tr>
        <tr>
          <td colspan="3" style="text-align:right;">VAT (5%)</td>
          <td>AED 157.50</td>
        </tr>
        <tr>
          <td colspan="3" style="text-align:right;">Total</td>
          <td><strong>AED 3,307.50</strong></td>
        </tr>
      </tfoot>
    </table>

    <div class="notes">
      <strong>Notes:</strong><br>
      Thank you for your business! Please make payment by the due date.  
      Bank transfer details: Emirates NBD, IBAN AE00 0000 0000 0000 0000 000
    </div>

    <div class="footer">
      &copy; 2025 Your Company Name. All rights reserved.
    </div>
  </div>
</body>
</html>