flutter_native_html_to_pdf
A Flutter plugin that uses native WebView (Android WebView / iOS WKWebView) to render HTML and convert it to a high-quality PDF file.
3.1.0
7.0K downloads/mo
#3416 most downloaded on pub.dev
Pisey-Nguon/flutter_native_html_to_pdf
What this package is like to depend on
Last release 3 months ago
24 May 2026
Ships unpredictably
gaps range from 1 weeks to 2.0 years
Nearly every release is documented
notes for 14 of 15 stable releases
Nothing withdrawn
no release was ever pulled
3 years old
15 releases · first in 2023
14 releases in the last 12 months
see the full history below
Release timeline
15 releases · Nov 2023 to May 2026Releases
latest 15-
3.1.024 May 2026Release notes
Open source →What's Changed
- feat: Update iOS and macOS integration for flutter_native_html_to_pdf by @Pisey-Nguon in #48
Full Changelog: 3.0.2...3.1.0
Release notes
Open source →- Add iOS Swift Package Manager support by introducing an SPM package at
ios/flutter_native_html_to_pdf - Move iOS plugin Swift sources from
ios/Classestoios/flutter_native_html_to_pdf/Sources/flutter_native_html_to_pdf - Keep CocoaPods support by updating podspec source paths to the new location
-
3.0.209 Apr 2026Release notes
Open source →What's Changed
- Fix iOS PDF background colors stripped by WebKit print mode by @Copilot in #43
- feat: Enable clickable hyperlinks in generated PDFs for iOS and updat… by @Pisey-Nguon in #46
Full Changelog: 3.0.0...3.0.2
Release notes
Open source →- Fix iOS: hyperlinks in generated PDFs are now clickable and open the URL in the browser
- Supports all anchor types — plain text links, image links, and links wrapping any HTML element
-
3.0.104 Apr 2026Release notes
Open source →- Update macOS and iOS configurations, remove unused dependencies, and add generated files
- Fix iOS PDF background color rendering by injecting print-color-adjust CSS
-
3.0.001 Mar 2026Release notes
Open source →What's Changed
- 40 pdf formate issue after migration by @Pisey-Nguon in #41
Full Changelog: 2.0.3...3.0.0
Release notes
Open source →Major Changes
- Migrated to Native WebView Rendering: The package now uses native platform WebView (Android WebView / iOS WKWebView) for HTML rendering and PDF generation
- Architecture Change: Reverted from pure Dart implementation (v2.x) back to native code for improved rendering quality and CSS support
- Removed Dependencies: No longer depends on
pdfandhtmlpackages - Enhanced Platform Support: Better leverages native capabilities for more accurate HTML-to-PDF conversion
Implementation Details
- Added native Android implementation using Android WebView
- Added native iOS implementation using WKWebView
- Updated
HtmlToPdfConverterto use platform channels for native PDF generation - Removed custom HTML parser (
html_parser.dart) in favor of native WebView rendering
Tests
- Updated unit tests to mock native method calls
- Maintained test coverage for PDF generation functionality
Migration Notes
Version 3.0.0 returns to using native platform code, which provides better rendering quality and CSS support compared to the pure Dart implementation in v2.x. The API remains largely the same, but the underlying implementation now requires Android and iOS platforms.
-
2.0.306 Feb 2026Release notes
Open source →What's Changed
- Fix incorrect percentage value conversion in CSS dimension parsing by @Copilot in #37
Full Changelog: 2.0.2...2.0.3
Release notes
Open source →- Fixed incorrect percentage value parsing in
_parseDimensionmethod - Percentage values (e.g.,
width: 70%,border-radius: 50%) were being converted to incorrect fixed pixel values - Now returns
nullfor percentage values since they require layout context that's not available at parse time - Prevents incorrect rendering of elements with percentage-based styling
-
2.0.205 Feb 2026Release notes
Open source →What's Changed
- Add support for border-radius, width, height, and min-height CSS properties by @Copilot in #35
Full Changelog: 2.0.1...2.0.2
Release notes
Open source →- Add support for border-radius, width, height, and min-height CSS properties
Bug Fix (2.0.2 Patch):
-
2.0.105 Feb 2026Release notes
Open source →What's Changed
- Fix: Block elements with backgrounds/borders now span full page width in PDFs by @Copilot in #33
Full Changelog: 2.0.0...2.0.1
Release notes
Open source →Bug Fixes
- Fixed PDF rendering width: Block-level elements (
<div>and<p>) with background colors or borders now span the full page width in generated PDFs, matching browser behavior- Previously, elements with
background-colorCSS property only wrapped their content width - Now containers expand to full available width when background colors or borders are present
- Fixes issue where yellow highlighted sections and bordered elements appeared narrow in PDFs
- Previously, elements with
Tests
- Added comprehensive test coverage for full-width background and border rendering
-
2.0.014 Jan 2026Release notes
Open source →What's Changed
- feat: Implement pure Dart HTML to PDF conversion by @Pisey-Nguon in #31
Full Changelog: 1.1.6...2.0.0
Release notes
Open source →Major Changes
- Migrated to Pure Dart: The package no longer uses native code (iOS, Android, etc.) and is now 100% Dart
- New Main Class: Use
HtmlToPdfConverterinstead ofFlutterNativeHtmlToPdf - No Flutter Dependency: Package can now be used in pure Dart applications
- Cross-platform: Now supports all platforms including macOS and web
New Features
- Added
PdfPageSize.fromMillimeters()factory for creating page sizes from millimeter values - Added
PdfPageSize.fromInches()factory for creating page sizes from inch values - Added
PdfPageSize.landscapeandPdfPageSize.portraitgetters for orientation conversion - Added
PdfPageSize.b5andPdfPageSize.executivepredefined page sizes - Return types are now non-nullable (
FileandUint8Listinstead ofFile?andUint8List?)
Migration Guide
// Old (v1.x) final plugin = FlutterNativeHtmlToPdf(); final pdfFile = await plugin.convertHtmlToPdf(...); // New (v2.x) final converter = HtmlToPdfConverter(); final pdfFile = await converter.convertHtmlToPdf(...);Deprecated
FlutterNativeHtmlToPdfclass is deprecated. UseHtmlToPdfConverterinstead.
-
1.1.614 Jan 2026Release notes
Open source →What's Changed
- Add convertHtmlToPdfBytes to return PDF as Uint8List without file I/O by @Copilot in #6
- Fix iOS color and font rendering in HTML to PDF conversion by @Copilot in #9
- Add configurable PDF page sizes for iOS and Android by @Copilot in #10
- Fix iOS 26 crash: Add required WKNavigationDelegate policy methods by @Copilot in #12
- Fix iOS share dialog error and migrate to share_plus 12.0.1 by @Copilot in #14
- Fix PDF generation null return by adding early return after failure callback by @Copilot in #18
- Fix missing error callback in generatePdfFile when root view controller unavailable by @Copilot in #25
- Refactor iOS code to support scene-based root view controller retriev… by @Pisey-Nguon in #24
- Enhance PDF sharing functionality with improved metadata and file handling by @Pisey-Nguon in #28
New Contributors
- @Copilot made their first contribution in #6
- @Pisey-Nguon made their first contribution in #24
Full Changelog: 1.0.0...1.1.6
Release notes
Open source →- Refactor iOS code to support scene-based root view controller retrieval and update Info.plist for scene configuration
- Enhance PDF sharing functionality with improved metadata and file handling
-
1.1.509 Dec 2025Release notes
Open source →- Refactor code for improved readability by removing unnecessary blank lines and formatting adjustments across multiple files
-
1.1.406 Dec 2025Release notes
Open source →- Refactor PDF generation code by removing debug print statements and improving file path construction
-
1.1.306 Dec 2025Release notes
Open source →- Fix PDF generation null return by adding early return after failure callback
-
1.1.220 Nov 2025Release notes
Open source →- Fix iOS 26 compatibility: Fixed crash on iOS 26 caused by missing WKNavigationDelegate policy methods
- Added
decidePolicyForNavigationActionanddecidePolicyForNavigationResponsedelegate methods - These methods are now required by WebKit in iOS 26 to properly load HTML
- Fixed issue sharing file cannot share in example project (Found in iOS 26)
-
1.1.110 Nov 2025Release notes
Open source →- Fix iOS color and font rendering: HTML to PDF conversion on iOS now properly renders CSS colors and custom fonts
- Changed base URL in iOS from
Bundle.main.bundleURLto"https://"to match Android behavior - Added PDF context attributes for better color rendering in iOS
- Configured WKWebView with
isOpaque = falseand clear background for improved CSS support - Updated example app with enhanced HTML demonstrating colors and font styles
-
1.0.108 Nov 2023Nothing published for this version