flutter_pdf_invoice_widgets
A comprehensive Flutter package providing 10 highly customizable PDF invoice and document templates. Generate professional invoices, quotes, receipts, credit notes, delivery notes and more with full control over styling, branding, and layout.
Features
- π¨ 10 Unique Templates β Classic, Modern, Professional, Minimalist, Creative, Receipt, Proforma, Quote/Estimate, Delivery Note, Credit Note
- π§ Fully Customizable β Colors, fonts, spacing, columns, labels, logos, watermarks, signatures
- π i18n Ready β Override any label for localization
- π Configurable Table Columns β Choose which columns to display, custom formatters, flexible widths
- π° Smart Calculations β Automatic subtotal, tax, discount, and grand total
- π Multi-Page Support β Long invoices automatically flow across pages
- πΌοΈ Logo & Branding β Embed company logos, watermarks, and signature images
- π³ Payment Info β Bank details, QR codes, payment terms
- π¦ Pure Dart β No Flutter UI dependency, works on server-side Dart too
Installation
Add to your pubspec.yaml:
dependencies:
flutter_pdf_invoice_widgets: ^0.0.1
Then run:
flutter pub get
Quick Start
import 'package:flutter_pdf_invoice_widgets/flutter_pdf_invoice_widgets.dart';
// Minimal usage β beautiful defaults
final pdfBytes = await ClassicInvoice(
company: CompanyInfo(name: 'Flutter Xperts', website: 'flutterxperts.com'),
customer: CustomerInfo(name: 'Acme Corporation'),
info: InvoiceInfo(
invoiceNumber: 'INV-2026-001',
invoiceDate: DateTime.now(),
),
items: [
InvoiceItem(description: 'Web Development', quantity: 40, unitPrice: 75.0),
InvoiceItem(description: 'UI Design', quantity: 20, unitPrice: 90.0),
],
).generate();
Templates
| Template | Class | Description |
|---|---|---|
| Classic | ClassicInvoice |
Traditional bordered business invoice |
| Modern | ModernInvoice |
Clean contemporary design with accent bars |
| Professional | ProfessionalInvoice |
Corporate/enterprise grade with branding strip |
| Minimalist | MinimalistInvoice |
Ultra-clean, typography-driven, no borders |
| Creative | CreativeInvoice |
Bold, colorful with vibrant accents |
| Receipt | ReceiptTemplate |
Compact POS/retail receipt format |
| Proforma | ProformaInvoice |
Pre-sale invoice with PROFORMA watermark |
| Quote | QuoteEstimate |
Quotation with acceptance signature area |
| Delivery Note | DeliveryNote |
Packing slip with checkboxes, no pricing |
| Credit Note | CreditNote |
Refund document with original invoice reference |
Customization
Full Example
final pdfBytes = await ModernInvoice(
company: CompanyInfo(
name: 'UJ Global',
tagline: 'Digital Innovation',
address: '123 Tech Street',
city: 'San Francisco',
state: 'CA',
zipCode: '94102',
country: 'USA',
phone: '+1 (555) 123-4567',
email: 'hello@ujglobal.tech',
website: 'https://ujglobal.tech',
taxId: 'VAT-123456',
logo: logoBytes, // Uint8List of PNG/JPEG
logoWidth: 80,
),
customer: CustomerInfo(
name: 'Tech Solutions Inc',
company: 'Tech Solutions Inc',
address: '456 Business Ave',
city: 'New York',
state: 'NY',
email: 'billing@techsolutions.com',
taxId: 'EIN-789012',
),
info: InvoiceInfo(
invoiceNumber: 'INV-2026-001',
invoiceDate: DateTime.now(),
dueDate: DateTime.now().add(Duration(days: 30)),
currency: 'USD',
currencySymbol: '\$',
status: 'UNPAID',
notes: 'Thank you for your business!',
terms: 'Payment due within 30 days of invoice date.',
),
items: [
InvoiceItem(
description: 'Frontend Development',
quantity: 40,
unitPrice: 150.0,
unit: 'hrs',
taxRate: 10.0,
),
InvoiceItem(
description: 'Backend API Development',
quantity: 60,
unitPrice: 175.0,
unit: 'hrs',
taxRate: 10.0,
discount: 5.0,
),
InvoiceItem(
description: 'Cloud Hosting (Annual)',
quantity: 1,
unitPrice: 2400.0,
unit: 'year',
),
],
payment: PaymentInfo(
bankName: 'First National Bank',
accountName: 'UJ Global LLC',
accountNumber: '****1234',
iban: 'US12 3456 7890 1234',
swiftCode: 'FNBUS33',
paymentTerms: 'Net 30',
paymentMethods: ['Bank Transfer', 'Credit Card'],
),
style: InvoiceStyle(
primaryColor: PdfColors.indigo,
accentColor: PdfColors.amber,
tableStyle: TableStyle(
columns: [
InvoiceColumn.description(),
InvoiceColumn.quantity(),
InvoiceColumn.unitPrice(),
InvoiceColumn.tax(),
InvoiceColumn.total(),
],
),
watermarkText: 'DRAFT',
watermarkOpacity: 0.08,
signatureLabel: 'Authorized Signature',
),
).generate();
Custom Styling
// Use predefined themes
final style = InvoiceStyle.modern();
final style = InvoiceStyle.dark();
final style = InvoiceStyle.colorful();
// Or customize everything
final style = InvoiceStyle(
primaryColor: PdfColor.fromHex('#1E88E5'),
secondaryColor: PdfColors.blueGrey800,
accentColor: PdfColors.amber,
titleFontSize: 28,
bodyFontSize: 11,
pageFormat: PdfPageFormat.letter, // or PdfPageFormat.a4
pageMargin: pw.EdgeInsets.all(50),
headerStyle: HeaderStyle(
showLogo: true,
backgroundColor: PdfColors.blue800,
textColor: PdfColors.white,
),
tableStyle: TableStyle(
headerBackgroundColor: PdfColors.blue800,
headerTextColor: PdfColors.white,
alternateRowColor: PdfColors.grey100,
showRowBorders: true,
),
footerStyle: FooterStyle(
showPageNumbers: true,
customText: 'Β© 2026 Flutter Xperts. All rights reserved.',
),
);
Custom Table Columns
final style = InvoiceStyle(
tableStyle: TableStyle(
columns: [
InvoiceColumn(id: 'index', header: '#', flex: 0.5),
InvoiceColumn(id: 'description', header: 'Service', flex: 4),
InvoiceColumn(id: 'quantity', header: 'Hours', flex: 1),
InvoiceColumn(id: 'unitPrice', header: 'Rate', flex: 1.5),
InvoiceColumn(id: 'total', header: 'Amount', flex: 1.5),
],
),
);
Label Customization (i18n)
final style = InvoiceStyle(
labels: {
'invoice': 'FACTURA',
'billFrom': 'De',
'billTo': 'Para',
'subtotal': 'Subtotal',
'tax': 'Impuesto',
'discount': 'Descuento',
'total': 'Total',
'paymentInfo': 'InformaciΓ³n de Pago',
},
);
Custom Fonts
import 'package:pdf/widgets.dart' as pw;
// Load your TTF fonts
final regularFont = pw.Font.ttf(await rootBundle.load('assets/fonts/Roboto-Regular.ttf'));
final boldFont = pw.Font.ttf(await rootBundle.load('assets/fonts/Roboto-Bold.ttf'));
final style = InvoiceStyle(
primaryFont: regularFont,
boldFont: boldFont,
);
Data Models
| Model | Purpose | Required Fields |
|---|---|---|
CompanyInfo |
Seller/company details + logo | name |
CustomerInfo |
Buyer/client details | name |
InvoiceInfo |
Invoice metadata (number, dates, status) | invoiceNumber, invoiceDate |
InvoiceItem |
Line items with pricing | description, quantity, unitPrice |
PaymentInfo |
Bank details and payment terms | (none) |
ShippingInfo |
Shipping/delivery details | (none) |
All models support a customFields map for extensibility and provide copyWith methods for immutable updates.
Saving & Printing
The generate() method returns Uint8List (raw PDF bytes). Use the printing package to preview, print, or share:
import 'package:printing/printing.dart';
// Preview
await Printing.layoutPdf(onLayout: (_) async => pdfBytes);
// Share
await Printing.sharePdf(bytes: pdfBytes, filename: 'invoice.pdf');
// Save to file
final file = File('invoice.pdf');
await file.writeAsBytes(pdfBytes);
Author
Amir Saleem Ahmad β amirsaleemahmad
License
MIT License. See LICENSE for details.