Skip to content
CAI
Software that uses CAICheck a score

DavBfr/dart_pdf

64.9

Adequate · 17 November 2026

97.7k

lines of production code

Dart

primary language

5

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a Flutter ecosystem comprising a PDF generation library, a cross-platform printing plugin, and a widget wrapper for embedding UI as PDF content. It enables developers to create complex documents with charts, tables, and bidirectional text, while providing native printing, sharing, and rasterization capabilities across Android, iOS, Linux, macOS, Windows, and Web. The project includes a comprehensive demo application that showcases these features on all supported platforms.

How it got here

2018–2019 — Platform implementation and API restructuring

10 changes.

This period focused on implementing native printing capabilities for Android and modernizing the web printing stack with updated dependencies and security fixes. The underlying PDF library underwent significant structural reorganization to expose cleaner public APIs, while comprehensive test suites were added to ensure reliability across both the PDF generation and printing modules.

2020 — multi-platform demo and library modernization

12 changes.

This period focused on expanding platform support by adding native demo applications for Android, iOS, macOS, and Windows, alongside a modernized web demo. The core PDF library underwent significant refactoring to achieve null-safety, improve rendering performance through isolates, and introduce new capabilities such as charting widgets, enhanced SVG support, and Windows-specific printing features.

2021–2026 — Linux desktop support and PDF rendering improvements

13 changes.

This period focused on extending platform support to Linux and Windows, alongside significant enhancements to the PDF generation engine, including Arabic text rendering and font management. The printing plugin received critical stability fixes for macOS and iOS, while the widget wrapper library was introduced to enable rendering Flutter widgets as PDF images.

Features

Add Android demo application for PDF printing

The Android demo project has been added to the repository, providing a complete, bootstrapped example for the Pdf Printing feature on Android devices. This includes the necessary Android manifest configurations, a MainActivity extending FlutterActivity, Gradle wrapper setup (v7.4), and standard Flutter V2 embedding resources, allowing users to run and inspect the printing functionality on Android.

demo/android · high confidence

Add Linux desktop support to the demo app

The demo application now includes a complete Linux build configuration, enabling users to run the printing demo on desktop Linux environments. This change introduces the necessary CMake build files, GTK-based application entry points, and plugin registration logic to support the printing, open file, and URL launcher plugins on the Linux platform.

demo/linux · high confidence

Add Linux platform support to the printing plugin

The printing plugin now supports Linux, enabling users to print PDFs and rasterize documents on Linux desktop applications. This change introduces the Linux-specific implementation files (CMakeLists.txt, printing\_plugin.cc, print\_job.cc/h) which integrate with GTK's printing subsystem (gtk+-unix-print-3.0) and bundle the Pdfium library (version 5200) for PDF rendering. Users can now utilize the same printing API on Linux as on Windows and macOS, with support for listing printers, direct printing, and page rasterization.

printing/linux · high confidence

Add PDF generation example

A new example file (pdf/example/main.dart) demonstrates how to create a PDF document containing a centered "Hello World!" text and save it to a file using the pdf package's widget system.

pdf/example · high confidence

Add WidgetWrapper to render Flutter widgets as PDF images

A new \WidgetWrapper\ class has been added to the library, allowing users to convert Flutter widgets into image providers for embedding directly into PDF documents. This feature supports rendering widgets via a \GlobalKey\ (using a \RepaintBoundary\) or by passing a widget instance with explicit constraints, enabling dynamic PDF content generation from existing Flutter UI components.

_widget\wrapper/lib/src · high confidence

Add Windows desktop demo application

A new Windows desktop demo application has been added to the project, providing a native C++/Win32 runner that hosts the Flutter engine. This includes the necessary CMake build configuration, Win32 window management with DPI awareness, and plugin registration for the printing and url\_launcher\_windows plugins, enabling users to build and run the demo on Windows.

demo/windows · high confidence

Add iOS demo app project scaffolding

The iOS demo application is now available in the \demo/ios\ directory, providing a complete Xcode project structure for testing. This includes the necessary configuration files (such as \Info.plist\ and \xcconfig\ files), asset catalogs for app icons and launch screens, and the \AppDelegate.swift\ implementation which registers plugins via the \FlutterImplicitEngineDelegate\ protocol.

demo/ios · high confidence

Add macOS demo app for PDF printing

A new macOS demo application named "Pdf Printing Demo" has been added to the project, providing a native Swift-based host for the Flutter printing example. The entry includes the full Xcode project structure, including the \Runner\ target, \AppDelegate\, and \MainFlutterWindow\, along with configuration files for build settings, entitlements (such as network and printing permissions), and asset catalogs. This allows users to build and run the printing functionality directly on macOS.

demo/macos · high confidence

Initial Android native implementation for PDF printing and conversion

This change introduces the Android native side of the Flutter Printing plugin, enabling users to print PDFs, share documents via email or other apps, convert HTML to PDF, and rasterize PDF pages to images on Android devices. The implementation uses the AndroidX embedding APIs and includes a FileProvider for secure file sharing, asynchronous print job handling with completion callbacks, and support for dynamic layout and cancellation signals.

printing/android · high confidence

Introduce PDF widget wrapper library

The widget\_wrapper/lib directory now contains a new entry point file (pdf\_widget\_wrapper.dart) that re-exports the core implementation from src/widget\_wrapper.dart, making the PDF widget wrapper functionality available to consumers of this package.

_widget\wrapper/lib · high confidence

Introduce Windows printing support with modern dialog and PDFium integration

This change adds the Windows implementation for the printing plugin, enabling users to print PDFs directly from Flutter applications on Windows. The implementation integrates the PDFium library (version 5200) for PDF rendering and introduces a build system using CMake, which automatically downloads the necessary PDFium binaries. A key behavioral addition is the support for the modern Windows print dialog (PrintDlgEx), which can be enabled via the \windowsModernDialog\ parameter, providing a native user experience. The code also handles proper ownership of the print dialog window, manages PDFium library lifecycle with reference counting to prevent memory leaks, and supports listing available printers and rasterizing PDF pages.

printing/windows · high confidence

Introduce new charting widget library

The PDF library now includes a new set of charting widgets located in \pdf/lib/src/widgets/chart\. This adds support for rendering Bar, Line, Point, and Pie charts, along with a general \Chart\ container, Cartesian and Radial grids, and a \ChartLegend\ for displaying dataset labels. Users can now generate various data visualizations directly within their PDF documents using these new components.

pdf/lib/src/widgets/chart · high confidence

New Flutter PDF demo application with dark mode support

The demo application has been restructured into a new Flutter app located in demo/lib, featuring a tabbed interface to browse various PDF generation examples (Resume, Document, Invoice, Report, Server, Calendar, Certificate). The app now supports dark mode via ThemeData configuration and includes a user prompt to input a name for personalized document generation. It utilizes the PdfPreview widget to render documents and provides actions to save or share the generated PDFs.

demo/lib · high confidence

New PDF generation examples added to the demo app

The demo application now includes several new example files in the \demo/lib/examples\ directory, providing users with ready-to-use templates for generating PDFs. These new examples cover a variety of document types: a Calendar view, a Certificate of Achievement, a standard Document with a table of contents, an Invoice with line items, a Budget Report featuring bar and line charts, a Resume with a two-column layout, and a Server pricing page that fetches live data from an external API.

demo/lib/examples · high confidence

New Printing Demo Application

The printing/example directory now includes a complete demo application (main.dart) that showcases PDF generation and preview capabilities using the PdfPreview widget. The example generates a PDF document with custom fonts (Nunito Extra Light) and layout, providing users with a reference implementation for integrating printing features into their Flutter apps.

printing/example · high confidence

PDF widget library restructured into src/widgets with new layout and annotation capabilities

The PDF generation library's widget layer has been reorganized into the \pdf/lib/src/widgets\ directory, introducing a comprehensive set of layout and content widgets. Users can now build complex documents using structural components like \Flex\, \Container\, \Padding\, and \Transform\, alongside specialized widgets for \TableOfContent\, \Header\, and \BarcodeWidget\. The update also adds support for document annotations (links, URLs, shapes) and introduces directional geometry support, allowing widgets like \Padding\ and \BorderRadius\ to respect text direction (RTL/LTR) for proper layout in right-to-left languages.

pdf/lib/src/widgets · high confidence

PdfPreview widget refactored with custom actions, theming, and scroll controls

The PdfPreview widget has been restructured to offer greater customization and stability. Users can now style the action bar using the new PdfActionBarTheme, which allows control over background color, icon color, height, text style, elevation, spacing, and alignment. Custom actions can be added via the actions property, supporting generic widgets and built-in actions like PdfPrintAction and PdfShareAction (which now supports pre-filling email subject, body, and recipients). The preview itself supports shrink-wrapping, custom scroll physics, and a scrollToPage method for programmatic navigation. Additionally, the widget includes improved lifecycle management to prevent setState errors after disposal, supports custom page builders for full layout control, and exposes an onPageFormatChanged callback.

printing/lib/src/preview · high confidence

Security

Migrate web printing to package:web and update PDF.js to 6.2.108

The web printing implementation has been migrated to use the new \package:web\ and \dart:js\_interop\ APIs, replacing the previous JavaScript interop approach. This change includes an update to the PDF.js library version to 6.2.108, which addresses security vulnerability [CVE redacted] ([GHSA redacted]). Additionally, the web plugin now loads PDF.js via ES module imports to ensure compatibility with modern browser standards and fixes issues with loading PDF.js in debug mode.

printing/lib · high confidence

Architecture

Library source files reorganized into src/ subdirectory

The printing library's Dart source files have been moved from the package root into the \printing/lib/src/\ directory. This structural change groups the internal implementation files (such as \printing.dart\, \cache.dart\, \method\_channel.dart\, and \interface.dart\) into a dedicated source folder, which is a standard convention for organizing library internals in Dart packages.

printing/lib/src · high confidence

Behavioural changes

Consolidated internal API exports via priv.dart

A new priv.dart file has been introduced to centralize and re-export a broad set of internal PDF format and object model components (such as array, dict, stream, catalog, and page\_list). This change reorganizes how internal data types and private APIs are exposed within the library, likely simplifying imports for internal modules and improving the structure of the codebase's private surface area.

pdf/lib/src · medium confidence

Improved Arabic and bidirectional text rendering

The PDF library now applies the bidirectional algorithm (via the bidi package) to correctly render mixed-direction text, and includes a new arabic.dart module with substitution maps to handle Arabic shaping (isolated, final, initial, medial forms) and diacritics. This ensures that Arabic characters and mixed RTL/LTR content appear in the correct visual order and with proper glyph connections in the generated PDF.

pdf/lib/src/pdf/font · high confidence

Improved PDF generation performance on web and VM platforms

PDF generation now runs in a background isolate on VM platforms (non-test environments) and includes an event-loop balancer to prevent UI freezes on web platforms. This change ensures that long-running PDF creation tasks no longer block the main thread, resulting in a more responsive application during document generation.

pdf/lib/src/pdf/io · high confidence

New internal font loading and manifest infrastructure

The library now includes a new \DownloadableFont\ class and an \AssetManifest\ mixin to handle font resolution. This infrastructure allows the system to first check if a font is available as a local asset (via the new manifest) and, if not, download it from a URL with caching support, falling back to Helvetica on failure. This replaces previous ad-hoc font loading logic with a unified, cache-aware mechanism for both bundled and remote fonts.

printing/lib/src/fonts · high confidence

PDF library core restructured with null-safety and new color/graphics APIs

The PDF generation library has been migrated to null-safety and reorganized into a modular structure under \pdf/lib/src/pdf\. This update introduces a new \PdfColor\ class with support for hex parsing, RYB conversion, and immutable color manipulation methods (e.g., \withAlpha\, \withValues\), alongside a \PdfColors\ utility providing Material Design color palettes. Graphics capabilities are enhanced with \PdfGraphicState\ for managing opacity and blend modes, and \PdfGraphics\ for drawing operations. Document handling now uses \PdfSettings\ for configuration, supports secure document ID generation, and includes improved EXIF parsing for JPEG images (handling orientation and CMYK/Adobe APP14 markers). Page formats are standardized with \PdfPageFormat\ (including A6 and logical pixel support), and RTL/bidirectional text support is controlled via compile-time options.

pdf/lib/src/pdf · high confidence

PDF library restructured with new public API entry points

The pdf library has been reorganized to provide cleaner public APIs through new top-level entry files. The main \pdf.dart\ file now exports core document, font, and PDF object classes, while a new \widgets.dart\ file consolidates all UI components including charts, forms, and layout widgets. This change also introduces a new \PdfException\ base class for error handling and adds support for PDF/A-3b compliance, document signatures, and encryption features.

pdf/lib · high confidence

Reorganized PDF format layer with new data types and settings

The PDF generation logic in the format layer has been restructured to improve code clarity and performance. A new \PdfSettings\ class now centralizes configuration options, including a new \simpleTrueTypeFonts\ setting that allows embedding TrueType fonts as simple objects to support print RIPs that reject CID fonts. The core data types (Array, Dict, Stream, etc.) have been refactored into a cleaner hierarchy, and the cross-reference table output has been optimized to reduce freezes on web platforms.

pdf/lib/src/pdf/format · high confidence

SVG rendering engine refactored into modular components

The SVG rendering logic has been restructured from a monolithic implementation into a set of specialized, modular classes (such as SvgBrush, SvgColor, SvgPath, SvgText, and SvgGroup) within the pdf library. This refactoring improves the maintainability and correctness of SVG parsing and drawing, enabling more accurate support for complex SVG features like gradients, masks, and text styling in generated PDFs.

pdf/lib/src/svg · high confidence

Updated web demo to use Flutter 3.22 initialization and modern PWA assets

The web demo now uses the Flutter 3.22 app initialization pattern, replacing the previous script with the \\_flutter.loader.load\ API for engine initialization and app running. Additionally, the demo includes a new \manifest.json\ file to support Progressive Web App (PWA) features, including specific icons and theme colors, and an \index.html\ with a loading progress indicator that updates as the app initializes.

demo/web · high confidence

Fixes

Fix iOS printing crashes and App Store distribution failures

This update resolves critical stability and distribution issues in the iOS printing plugin. It fixes a use-after-free race condition in PDF document handling that caused crashes during page counting and drawing by introducing thread-safe locking. It also corrects a bug where the \pickPrinter\ method crashed if the selected printer had a nil URL. Additionally, the plugin now returns the layout PDF document via the standard method-channel reply instead of using \dlsym\ FFI, which prevents silent failures in App Store distribution builds where exported symbols are stripped. The migration to Swift Package Manager and the addition of the \CustomPrintPaper\ class support these structural improvements.

printing/ios · high confidence

Fix macOS print deadlock and support multiple windows

The macOS printing plugin now uses a method-channel reply to receive the PDF layout document instead of a dlsym-based FFI callback, which previously caused the print dialog to hang indefinitely in App Store distribution builds due to symbol stripping. Additionally, print jobs are now shared across all plugin instances using a thread-safe dictionary, allowing the plugin to correctly handle printing from multiple Flutter windows without conflicts.

printing/macos · high confidence

Test coverage

Added comprehensive test suite for PDF generation features; Added test for PDF document generation in the demo app; Added test utilities for font generation, README extraction, and social preview assets; Initial test suite for printing core functionality.

Dependencies

Update project dependencies and build configurations

This change updates the dependency manifests and build configurations for the demo, pdf, printing, widget\_wrapper, and test packages. Key updates include raising the minimum Dart SDK to 3.12.0, updating the \pdf\ package to version 3.13.1, and upgrading \printing\ to 5.15.1. The \pdf\ package now depends on \barcode\ \>=2.2.3, \xml\ \>=7.0.1, and \vector\_math\ ^2.2.0. The \printing\ plugin now depends on \web\ ^1.0.0 and \pdf\_widget\_wrapper\ \>=1.0.4. Android build files have been updated to use Gradle 7.1.2/7.3.0 and Java 8, while iOS/macOS configurations now include Swift Package Manager manifests targeting iOS 13.0 and macOS 10.15.

(dependencies) · high confidence

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 58.9 → 64.9 (+6.0)
  • Rubric changed (rubric-2026.11.2 → rubric-2026.11.4) — scores are not directly comparable.

Lenses

  • Code Health 88.1 → 87.4 (-0.7)
  • Architecture 95.7 → 95.7 (0.0)
  • Maturity 52.5 → 55.9 (+3.4)
  • Readiness 47.6 → 54.9 (+7.3)
  • Security 86.5 → 86.5 (0.0)
  • Performance 78.3 → 100.0 (+21.7)

Resolved (14)

  • Duplicated block (10 lines × 2) (pdf/lib/src/widgets/chart/pie_chart.dart)
  • Duplicated block (10 lines × 2) (printing/ios/printing/Sources/printing/PrintingPlugin.swift)
  • Duplicated block (14 lines × 2) (pdf/lib/src/widgets/basic.dart)
  • Duplicated block (15 lines × 2) (pdf/lib/src/widgets/table.dart)
  • Duplicated block (16 lines × 2) (pdf/lib/src/widgets/chart/grid_axis.dart)
  • Duplicated block (16 lines × 2) (pdf/lib/src/widgets/shape.dart)
  • Duplicated block (8 lines × 2) (printing/android/src/main/java/net/nfet/flutter/printing/PrintingHandler.java)
  • Duplicated block (8 lines × 3) (pdf/lib/src/svg/brush.dart)
  • Duplicated block (9 lines × 2) (pdf/lib/src/svg/brush.dart)
  • Duplicated block (9 lines × 2) (pdf/lib/src/svg/group.dart)
  • Duplicated block (9–10 lines × 2) (printing/ios/printing/Sources/printing/PrintingPlugin.swift)
  • Near-duplicate member pair (48 shared lines) (printing/ios/printing/Sources/printing/PrintJob.swift)
  • Near-duplicate member pair (51 shared lines) (printing/ios/printing/Sources/printing/PrintingPlugin.swift)
  • Projects may be oversized for their cohesion

New (49)

  • Documentation: no build, run or usage example (widget_wrapper/README.md)
  • Duplicated block (10 lines × 2) (printing/ios/printing/Sources/printing/PrintJob.swift)
  • Duplicated block (11 lines × 2) (pdf/lib/src/widgets/basic.dart)
  • Duplicated block (11 lines × 2) (pdf/lib/src/widgets/chart/pie_chart.dart)
  • Duplicated block (16 lines × 2) (pdf/lib/src/widgets/shape.dart)
  • Duplicated block (9 lines × 2) (pdf/lib/src/svg/group.dart)
  • Duplicated block (9–10 lines × 2) (printing/ios/printing/Sources/printing/PrintingPlugin.swift)
  • Edited copies of one member (3 members, 14+ corresponding lines) (pdf/lib/src/widgets/basic.dart)
  • Edited copies of one member (3 members, 15+ corresponding lines) (pdf/lib/src/widgets/annotations.dart)
  • Edited copies of one member (3 members, 17+ corresponding lines) (pdf/lib/src/svg/path.dart)
  • Edited copies of one member (3 members, 9+ corresponding lines) (printing/ios/printing/Sources/printing/PrintingPlugin.swift)
  • Edited copies of one member (4 members, 14+ corresponding lines) (pdf/lib/src/widgets/basic.dart)
  • Edited copies of one member (4 members, 14+ corresponding lines) (pdf/lib/src/widgets/flex.dart)
  • Edited copy of a member (10 corresponding lines) (pdf/lib/src/pdf/font/ttf_parser.dart)
  • Edited copy of a member (10 corresponding lines) (pdf/lib/src/widgets/geometry.dart)
  • Edited copy of a member (13 corresponding lines) (pdf/lib/src/pdf/color.dart)
  • Edited copy of a member (13 corresponding lines) (pdf/lib/src/svg/gradient.dart)
  • Edited copy of a member (13 corresponding lines) (pdf/lib/src/widgets/geometry.dart)
  • Edited copy of a member (14 corresponding lines) (pdf/lib/src/svg/group.dart)
  • Edited copy of a member (15 corresponding lines) (pdf/lib/src/widgets/box_border.dart)
  • …and 29 more

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

DavBfr/dart_pdf was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 17 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 277b367da3bc1a11bc09d211165e62e33c300897 — the exact code this score is about.
  • Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
  • Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.85+preprod-eba6548ac50f.