flutter_native_html_to_pdf 2.0.2
flutter_native_html_to_pdf: ^2.0.2 copied to clipboard
A pure Dart package to convert HTML string to PDF file. Works on all platforms without native code.
2.0.2 #
- Add support for border-radius, width, height, and min-height CSS properties#
2.0.1 #
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.0 BREAKING CHANGE #
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.6 #
- 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.5 #
- Refactor code for improved readability by removing unnecessary blank lines and formatting adjustments across multiple files
1.1.4 #
- Refactor PDF generation code by removing debug print statements and improving file path construction
1.1.3 #
- Fix PDF generation null return by adding early return after failure callback
1.1.2 #
- 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.1 #
- 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.1.0 #
- Add
convertHtmlToPdfBytesmethod to convert HTML to PDF as Uint8List without saving to a file - Improved performance for use cases that don't require saving PDF to disk
- Added support for direct PDF bytes manipulation in Android and iOS native implementations
- Updated example app to demonstrate both file-based and bytes-based conversion
1.0.0 #
- Initial release.