Skip to content
pubscout

htmltopdfwidgets

2.2.0, released 7 weeks ago by alihassan143cool.blogspot.com

Converts HTML and Markdown content into high-quality PDF widgets.

$ flutter pub add htmltopdfwidgets
Source repository

What it does

Parses HTML strings and Markdown text into structured PDF widgets with a layout-first rendering pipeline. It handles CSS box models, tables, math formulas, lists, and images for generating PDF documents.

AI-written summary of version 2.2.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to generate PDFs from HTML strings or templates.
  • You need to convert Markdown documentation into styled PDF pages.

Skip it when

  • You require a full headless browser engine for complex JavaScript-heavy web pages.

Strengths

  • Supports a wide array of HTML elements, CSS box models, and flexbox features.
  • Includes MathML support for rendering mathematical notations.
  • Direct Markdown to PDF conversion.

Weaknesses

  • Relies on the provided package implementation rather than a native headless browser, meaning complex CSS layouts might differ from actual browser rendering.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
5
import 'package:htmltopdfwidgets/htmltopdfwidgets.dart';

void main() async {
  final widgets = await HTMLToPdf().convert(
    '<h1>Hello World</h1>',
    useNewEngine: true,
  );
  final pdf = Document();
  pdf.addPage(MultiPage(build: (context) => widgets));
}

Alternatives

Packages that do the same job and could replace htmltopdfwidgets.

Works with

Packages commonly used together with htmltopdfwidgets: ones it builds on, ones built on it, and its own family.