Overview
One model, two formats
docs_gee is a pure Dart library for generating Microsoft Word (DOCX) and PDF documents. You describe a document once — headings, rich text runs, tables, lists — and render it to either format from the same model. No native bindings, no platform channels: it works everywhere Dart runs.
Pure Dart
No native dependencies — works everywhere Dart runs.
Dual format
Generate both DOCX and PDF from the same document model.
Cross-platform
Android, iOS, Web, macOS, Windows and Linux.
Lightweight
Two pure-Dart dependencies: archive for ZIP, xml for the reader.
Simple API
An intuitive document builder pattern.
Platform support
Heads up
A handful of features are DOCX-only, because Word supports them natively and PDF does not: hyperlinks, internal bookmarks, the automatic table of contents, soft line breaks and emoji. Polish characters render fully in DOCX; in PDF only Ó/ó are native and the rest fall back to ASCII equivalents.
Installation
Add the dependency to your pubspec.yaml, or let the CLI do it for you.
dependencies:
docs_gee: ^1.3.4dart pub add docs_gee
# or
flutter pub add docs_geeVersion
The latest release is 1.3.4. The README currently pins ^1.3.3; ^1.3.4 is the correct constraint to use. docs_gee requires Dart SDK >=3.2.0 <4.0.0 and Flutter >=3.16.0.
Quickstart
Build a document, add a heading, some text and a table, then write both a .docx and a .pdf from the exact same model.
import 'dart:io';
import 'package:docs_gee/docs_gee.dart';
void main() {
// Create document
final doc = Document(title: 'My Report', author: 'John Doe');
// Add content
doc.addParagraph(Paragraph.heading('Quarterly Report', level: 1));
doc.addParagraph(Paragraph.text('This report summarizes Q4 performance.'));
// Add a table
doc.addTable(Table(
rows: [
TableRow(cells: [
TableCell.text('Metric', backgroundColor: 'E0E0E0'),
TableCell.text('Value', backgroundColor: 'E0E0E0'),
]),
TableRow(cells: [
TableCell.text('Revenue'),
TableCell.text('\$1.2M', alignment: Alignment.right),
]),
],
));
// Generate both formats
File('report.docx').writeAsBytesSync(DocxGenerator().generate(doc));
File('report.pdf').writeAsBytesSync(PdfGenerator().generate(doc));
}One generator interface
Both generators implement the same DocumentGenerator interface, so format-agnostic code picks a generator at runtime and calls generate(doc) — returning raw Uint8List bytes that you save, upload or share on any platform, including Web.
final doc = Document();
doc.addParagraph(Paragraph.heading('Title', level: 1));
doc.addParagraph(Paragraph.text('Hello World'));
// Export to any format (works on ALL platforms including Web)
DocumentGenerator generator = PdfGenerator(); // or DocxGenerator()
final bytes = generator.generate(doc);Output compatibility
Generated documents open cleanly in every mainstream editor:
- Microsoft Word 2007+
- Google Docs
- LibreOffice Writer
- Apple Pages
- WPS Office
- Any OOXML-compatible application
