widget_to_pdf_kit 1.0.1 copy "widget_to_pdf_kit: ^1.0.1" to clipboard
widget_to_pdf_kit: ^1.0.1 copied to clipboard

High-performance Flutter widget to PDF generator. Rasterizes onscreen or offscreen widgets into crisp, paginated PDF documents with custom formats and scaling.

widget_to_pdf_kit #

High-performance Flutter widget-to-PDF generator. Effortlessly rasterize onscreen or offscreen Flutter widgets into crisp, paginated PDF documents with custom page formats and DPI scaling.

pub package License: MIT


✨ Features #

  • πŸ“‘ True Flutter Widget Support: Export your existing Flutter UI (invoices, receipts, charts, cards) directly to PDF without rewriting them in proprietary PDF drawing APIs.
  • πŸ”„ Multi-Page Synthesis: Supply a list of widgets (List<Widget> pages) to generate paginated, multi-page documents offscreen.
  • πŸ“ Standard Paper Formats: Built-in support for ISO A4, US Letter, US Legal, and 80mm POS Thermal Receipts (with portrait & landscape modes).
  • πŸ” High-DPI Retina Scaling: Configurable pixelRatio (e.g. 2.0, 3.0) ensures razor-sharp text and graphics for print.
  • ⚑ Cross-Platform: Works smoothly on iOS, Android, macOS, Windows, Linux, and Web.

πŸš€ Getting Started #

Add widget_to_pdf_kit to your pubspec.yaml:

dependencies:
  widget_to_pdf_kit: ^1.0.1

Import the package:

import 'package:widget_to_pdf_kit/widget_to_pdf_kit.dart';

πŸ’‘ Quick Examples #

1. Export an Onscreen Widget #

Wrap your widget with a RepaintBoundary and supply its GlobalKey:

final repaintKey = GlobalKey();

// In your build method:
RepaintBoundary(
  key: repaintKey,
  child: InvoiceCard(...),
);

// When user taps "Export":
final Uint8List pdfBytes = await WidgetToPdfKit.fromKey(
  repaintKey,
  format: PdfPageFormat.a4,
  pixelRatio: 2.5,
);

2. Generate a Multi-Page PDF Offscreen #

Synthesize report pages offscreen without displaying them on the user's screen:

final Uint8List pdfBytes = await WidgetToPdfKit.fromWidgets(
  context,
  pages: [
    ReportSummaryPage(),
    FinancialBreakdownPage(),
    AuditLogPage(),
  ],
  format: PdfPageFormat.a4,
  pixelRatio: 2.0,
);

πŸ› οΈ Page Formats #

Format Dimensions (pt) Typical Use
PdfPageFormat.a4 595.28 x 841.89 Standard international invoices & contracts
PdfPageFormat.letter 612.00 x 792.00 North American business reports
PdfPageFormat.legal 612.00 x 1008.00 Legal notices
PdfPageFormat.receipt80 226.77 x 500.00 80mm POS thermal receipts

Toggle orientation easily:

PdfPageFormat.a4.landscape
PdfPageFormat.letter.portrait

πŸ“„ License #

This project is licensed under the MIT License - see the LICENSE file for details. Copyright Β© 2026 Shahzain Baloch.

0
likes
160
points
91
downloads

Documentation

API reference

Publisher

verified publisherbalochcodes.com

Weekly Downloads

High-performance Flutter widget to PDF generator. Rasterizes onscreen or offscreen widgets into crisp, paginated PDF documents with custom formats and scaling.

Repository (GitHub)
View/report issues

Topics

#pdf #printing #export #document #widget

License

MIT (license)

Dependencies

flutter, pdf

More

Packages that depend on widget_to_pdf_kit