html_to_pdf
0.8.1, released 2 years ago by greenrobot.me
Flutter plugin for generating PDF documents from HTML code templates.
What it does
Generates PDF documents from HTML strings, HTML files, or HTML file paths on Android and iOS. Supports styling via standard HTML/CSS markers and image embedding.
AI-written summary of version 0.8.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to generate PDF documents directly from HTML templates or strings.
- You want to convert local or remote HTML files into downloadable PDFs.
Skip it when
- You need complex layout customization using programmatic canvas drawing instead of HTML/CSS.
- You are targeting platforms other than Android and iOS.
Strengths
- Supports HTML content, local HTML files, and file paths.
- Handles custom CSS styling and images.
- Configurable print size and orientation.
Weaknesses
- Limited platform support (only Android and iOS).
- Large amounts of images can significantly affect the final file size.
Setup
- Kind
- Plugin (native code)
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
Requires Android minSdkVersion 19 or higher, and iOS 12.0 or higher.
final generatedPdfFile = await HtmlToPdf.convertFromHtmlContent(
htmlContent: "<h1>Hello World</h1>",
printPdfConfiguration: PrintPdfConfiguration(
targetDirectory: "/your/sample/path",
targetName: "example_pdf_file",
printSize: PrintSize.A4,
printOrientation: PrintOrientation.Portrait,
),
);Alternatives
Packages that do the same job and could replace html_to_pdf.
- flutter_html_to_pdf_plus
Flutter plugin for generating PDF documents from HTML code templates.
65Compare - html_to_pdf_plus
Generate PDF documents from HTML code templates in Flutter.
49Compare - flutter_html_to_pdf
Generate PDF documents from HTML code templates in Flutter
48Compare - htmltopdfwidgets
Converts HTML and Markdown content into high-quality PDF widgets.
81Compare