Invoice Settings

Your Business

Client Information

Invoice Details

Items & Services

Description Qty Unit Price Tax Total
$110.00

Payment Terms

`); printWindow.document.close(); }); // Download PDF document.getElementById('download-btn').addEventListener('click', function() { const element = document.getElementById('invoice-document'); html2canvas(element, { scale: 2, logging: false, useCORS: true, allowTaint: true }).then(canvas => { const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF('p', 'mm', 'a4'); const imgProps = pdf.getImageProperties(imgData); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = (imgProps.height * pdfWidth) / imgProps.width; pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, pdfHeight); pdf.save('invoice-' + document.getElementById('invoice-number').value + '.pdf'); }); }); // Update invoice preview function updateInvoicePreview() { // Business info document.getElementById('preview-biz-name').textContent = document.getElementById('biz-name').value || 'Your Business Name'; document.getElementById('preview-biz-address').textContent = document.getElementById('biz-address').value || 'Business Address'; document.getElementById('preview-biz-contact').textContent = document.getElementById('biz-contact').value || 'Contact Information'; document.getElementById('preview-biz-tax').textContent = 'Tax ID: ' + (document.getElementById('biz-tax-id').value || 'Not Provided'); // Client info document.getElementById('preview-client-name').textContent = document.getElementById('client-name').value || 'Client Name'; document.getElementById('preview-client-address').textContent = document.getElementById('client-address').value || 'Client Address'; document.getElementById('preview-client-contact').textContent = document.getElementById('client-contact').value || 'Client Contact'; // Invoice details document.getElementById('preview-inv-num').textContent = document.getElementById('invoice-number').value || 'INV-0001'; document.getElementById('preview-inv-date').textContent = formatDate(document.getElementById('invoice-date').value) || formatDate(new Date()); document.getElementById('preview-due-date').textContent = formatDate(document.getElementById('due-date').value) || formatDate(new Date(Date.now() + 30 * 24 * 60 * 60 * 1000)); // Items const previewItems = document.getElementById('preview-items'); previewItems.innerHTML = ''; let subtotal = 0; let totalTax = 0; document.querySelectorAll('.item-row').forEach(row => { const desc = row.querySelector('.item-desc').value || 'Service/Product'; const qty = parseFloat(row.querySelector('.item-qty').value) || 0; const price = parseFloat(row.querySelector('.item-price').value) || 0; const taxRate = parseFloat(row.querySelector('.item-tax').value) || 0; const itemSubtotal = qty * price; const itemTax = itemSubtotal * (taxRate / 100); const itemTotal = itemSubtotal + itemTax; subtotal += itemSubtotal; totalTax += itemTax; const itemElement = document.createElement('div'); itemElement.className = 'item-row'; itemElement.innerHTML = ` ${desc} ${qty} ${formatCurrency(price)} ${taxRate}% ${formatCurrency(itemTotal)} `; previewItems.appendChild(itemElement); }); // Totals document.getElementById('preview-subtotal').textContent = formatCurrency(subtotal); document.getElementById('preview-tax').textContent = formatCurrency(totalTax); document.getElementById('preview-total').textContent = formatCurrency(subtotal + totalTax); // Payment terms document.getElementById('preview-payment-terms').textContent = document.getElementById('payment-terms').value || 'Payment terms not specified'; } // Initialize item event listeners document.querySelectorAll('.item-row').forEach(item => { addItemEventListeners(item); }); // Initialize with one item calculated calculateAllItems(); }); // PDF generation functions const html2canvas = html2canvas || function(el) { return Promise.resolve({ toDataURL: () => 'data:image/png;base64,' }); }; const jsPDF = window.jspdf ? window.jspdf.jsPDF : function() { return { addImage: () => {}, save: () => alert('Please include jsPDF library for PDF generation') }; };

The Invoice Generator is a professional and easy-to-use tool designed to help users create and download invoices quickly. Perfect for freelancers, small businesses, or anyone who needs to bill clients, this tool allows you to input details like client information, items, quantities, and prices, and generates a polished invoice in PDF format.

Key Features:

  • Add multiple items with descriptions, quantities, and prices.

  • Automatically calculates subtotal, tax, and total amount.

  • Stylish, modern, and responsive design.

  • Includes a fully functional PDF download button.

  • Fully contained within its own container to avoid interference with the page header and footer.

Use Cases:

  • Freelancers billing clients for services.

  • Small businesses creating invoices for products or services.

  • Individuals managing personal billing or expenses.

How It Works:

  1. Enter client and invoice details (e.g., name, address, invoice number).

  2. Add items, including description, quantity, and price.

  3. The tool automatically calculates the subtotal, tax, and total.

  4. Click the “Generate Invoice” button to preview the invoice.

  5. Download the invoice as a PDF using the “Download PDF” button.

Scroll to Top