docs_gee library
Pure Dart library for generating DOCX and PDF files.
This library allows you to create Word documents (.docx) and PDF files
without external dependencies beyond the archive package for DOCX ZIP creation.
PDF generation is completely dependency-free.
Platform Support:
- Android, iOS, macOS, Windows, Linux: Full support
- Web: Full support (use browser APIs for file saving)
Example using generic aliases:
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);
// Saving files (non-Web platforms only):
// import 'package:docs_gee/src/file_saver_io.dart';
// await bytes.saveToFile('output.pdf');
Classes
- DocumentGenerator
- Abstract interface for document generators.
- DocxBorder
- Individual border definition.
- DocxCellBorders
- Border configuration for individual table cells.
- DocxCellPadding
- Padding inside a table cell, in twips (twentieths of a point).
- DocxDocument
- Represents a complete DOCX document.
- DocxGenerator
- Generator for creating DOCX files.
- Content repeated at the top or bottom of every page.
- DocxImage
- An image embedded in a DOCX document.
- DocxParagraph
- Represents a paragraph in a DOCX document.
- DocxReader
- Reads and parses DOCX files into DocxDocument objects.
- DocxRun
- Represents a run of text with formatting.
- DocxTable
- Represents a table in a DOCX document.
- DocxTableBorders
- Border configuration for tables.
- DocxTableCell
- Represents a cell in a table row.
- DocxTableRow
- Represents a row in a table.
- PdfGenerator
- Generates PDF files from DocxDocument without external dependencies.
Enums
- DocxAlignment
- Text alignment options for paragraphs.
- DocxBorderStyle
- Border style options for table borders.
- DocxField
- A Word field: a placeholder the word processor recomputes when the document is opened or refreshed.
- DocxImageFormat
- Raster image formats that can be embedded in a DOCX document.
- DocxParagraphStyle
- Paragraph style types.
- DocxScript
- Vertical script position of a text run.
- DocxVerticalAlignment
- Vertical alignment options for table cells.
Typedefs
- Alignment = DocxAlignment
- Alias for DocxAlignment - use for format-agnostic code.
- Border = DocxBorder
- Alias for DocxBorder - use for format-agnostic code.
- BorderStyle = DocxBorderStyle
- Alias for DocxBorderStyle - use for format-agnostic code.
- CellBorders = DocxCellBorders
- Alias for DocxCellBorders - use for format-agnostic code.
- Document = DocxDocument
- Alias for DocxDocument - use for format-agnostic code.
- DocumentReader = DocxReader
- Alias for DocxReader - use for format-agnostic code.
- Paragraph = DocxParagraph
- Alias for DocxParagraph - use for format-agnostic code.
- ParagraphStyle = DocxParagraphStyle
- Alias for DocxParagraphStyle - use for format-agnostic code.
- Script = DocxScript
- Alias for DocxScript - use for format-agnostic code.
- Table = DocxTable
- Alias for DocxTable - use for format-agnostic code.
- TableBorders = DocxTableBorders
- Alias for DocxTableBorders - use for format-agnostic code.
- TableCell = DocxTableCell
- Alias for DocxTableCell - use for format-agnostic code.
- TableRow = DocxTableRow
- Alias for DocxTableRow - use for format-agnostic code.
- TextRun = DocxRun
- Alias for DocxRun - use for format-agnostic code.
- VerticalAlignment = DocxVerticalAlignment
- Alias for DocxVerticalAlignment - use for format-agnostic code.
Exceptions / Errors
- DocxImageException
- Thrown when image bytes cannot be embedded.
- DocxReaderException
- Base exception for DOCX reading errors.
- InvalidDocxArchiveException
- Thrown when the input bytes are not a valid ZIP archive.
- InvalidDocxXmlException
- Thrown when XML content inside the DOCX is malformed.
- MissingDocxPartException
- Thrown when a required DOCX part (e.g. word/document.xml) is missing.