visualpdf 1.6.0
visualpdf: ^1.6.0 copied to clipboard
A visual Flutter PDF report designer and runtime for JSON-driven invoices, templates, tables, barcodes, headers, footers, and printing.
example/lib/main.dart
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:visualpdf/visualpdf.dart';
void main() {
final template = ReportTemplate(
name: 'Invoice example',
elements: [
ReportElement(
id: 'title',
type: ElementType.text,
x: 42,
y: 42,
width: 300,
height: 40,
value: 'INVOICE',
fontSize: 26,
bold: true,
band: 'header',
),
ReportElement(
id: 'invoice_number',
type: ElementType.field,
x: 380,
y: 50,
width: 170,
height: 24,
value: 'No. {{invoice.number}}',
textAlign: 'right',
band: 'header',
),
ReportElement(
id: 'customer',
type: ElementType.field,
x: 42,
y: 130,
width: 250,
height: 70,
value: '{{customer.name}}\n{{customer.city}}',
),
ReportElement(
id: 'page',
type: ElementType.field,
x: 420,
y: 810,
width: 130,
height: 18,
value: 'Page {{PageNumber}}/{{PageCount}}',
textAlign: 'right',
fontSize: 9,
band: 'footer',
),
],
);
final reportData = {
'invoice': {'number': 'INV-2026-001'},
'customer': {'name': 'Example GmbH', 'city': 'Munich'},
};
runApp(
MaterialApp(
debugShowCheckedModeBanner: false,
home: VisualPdfRuntime(
initialVps: template.toVps(),
initialJson: jsonEncode(reportData),
),
),
);
}