Professional document generation with configurable theming — PDF, Word, and multi-format export.
Built by Hidden Leaf Networks.
pip install docforge
# With optional format support
pip install docforge[word] # Word (.docx) generation
pip install docforge[excel] # Excel (.xlsx) export
pip install docforge[all] # Everythingfrom docforge import DocumentGenerator, Theme
theme = Theme(
brand_name="Acme Corp",
primary="#3B82F6",
footer_text="Generated by Acme Corp",
)
gen = DocumentGenerator(theme=theme)
gen.create_pdf(
"report.pdf",
title="Q1 Report",
content="## Summary\n\nRevenue increased **15%** year-over-year.",
metadata={
"author": "Jane Doe",
"organization": "Acme Corp",
"client": "Client Name", # Shows on cover as "Prepared for:"
"document_type": "report", # Cover page label
"location": "Detroit, Michigan",
},
)- Configurable themes — Colors, fonts, margins, branding
- Professional PDF generation — Cover pages, headers, footers, page numbers
- Markdown parsing — Headings, bold, italic, code, lists, tables, horizontal rules
- Invoice generation — Branded invoices with line items, totals, payment terms
- Word document generation — Structured sections with metadata tables
- Multi-format chat export — TXT, PDF, CSV, XLSX with styled output
- Component library — Reusable flowables for custom document layouts
Every visual aspect is configurable through the Theme class:
from docforge import Theme
theme = Theme(
name="corporate",
brand_name="Acme Corp",
primary="#1E40AF", # Header and accent color
secondary="#F59E0B", # Secondary accent
text_dark="#1F2937", # Body text
footer_text="Confidential — Acme Corp",
footer_url="acme.com",
font_body="Helvetica",
font_heading="Helvetica-Bold",
)The document_type metadata key controls the cover page label. Supported types:
business_plan, grant_application, marketing_plan, financial_projection,
executive_summary, pitch_deck, report, proposal, whitepaper
The metadata dict controls what appears on the cover page:
| Key | Cover Page Line | Notes |
|---|---|---|
client |
Prepared for: | Client name. Falls back to organization if not set. |
organization |
(fallback for Prepared for) | Your org name. |
author |
Prepared by: | Falls back to theme.brand_name. |
location |
Location: | Optional. |
document_type |
(top label) | See supported types above. |
Generate branded invoices with itemized charges, totals, and payment terms:
from docforge.invoice import InvoiceData, InvoiceLineItem, generate_invoice
from docforge.theme import Theme
theme = Theme(
brand_name="Acme Corp",
primary="#14B8A6",
footer_text="© 2026 Acme Corp",
)
invoice = InvoiceData(
invoice_number="INV-2026-001",
issue_date="June 1, 2026",
due_date="June 14, 2026",
project="Website Redesign",
client_name="Jane Smith",
business_name="Smith & Co",
client_location="Detroit, Michigan",
items=[
InvoiceLineItem(description="Monthly website services", amount=175.00),
InvoiceLineItem(description="Domain management", amount=0, included=True),
],
notes=["Covers June 2026 services."],
payment_methods=["Cash App, PayPal, bank transfer."],
remittance_notes=["Please reference INV-2026-001 with payment."],
)
generate_invoice("invoice.pdf", invoice, theme=theme)For HLN agency use, the generate_care_plan_invoice.py script handles both build
installments and care plan invoices from the command line:
# Build installment
python3 scripts/generate_care_plan_invoice.py \
--client "Client Name" \
--business "Business Name" \
--invoice-number HLN-INV-2026-005 \
--month "June 2026" \
--type build --amount 175 --installment "2 of 4"
# Care plan (essential | growth | authority)
python3 scripts/generate_care_plan_invoice.py \
--client "Client Name" \
--business "Business Name" \
--invoice-number HLN-INV-2026-008 \
--month "September 2026" \
--type care --plan growthCare plan tiers and their rates:
| Plan | Monthly | Includes |
|---|---|---|
| Essential | $75 | Hosting, monitoring, minor edits, form reliability |
| Growth | $150 | + Content updates, Google Business Profile, analytics, priority support |
| Authority | $300 | + Integrations, automation, consulting hours, performance optimization |
The parse_markdown_content renderer handles:
# H1/## H2/### H3— section and subsection headers**bold**/*italic*/***both***— inline formatting- itemor* item— bullet lists1. item— numbered lists---/***/___— horizontal rules (rendered as themed dividers)**Bold Header:**— auto-detected subsection headers- Markdown tables with
| col | col |syntax — rendered as themed tables with headers
Export conversations to multiple formats:
from docforge.export import ChatExportService, ChatMessage, ExportMetadata
messages = [
ChatMessage(role="user", content="What's the status?"),
ChatMessage(role="assistant", content="All systems operational."),
]
metadata = ExportMetadata(title="Support Chat", brand_name="Acme Corp")
ChatExportService.export(messages, metadata, fmt="pdf", export_dir="./exports")
ChatExportService.export(messages, metadata, fmt="xlsx", export_dir="./exports")docforge/
├── src/docforge/
│ ├── generator.py # High-level DocumentGenerator API
│ ├── invoice.py # Invoice generation (InvoiceData + generate_invoice)
│ ├── theme.py # Theme class, styles, table styles
│ ├── pdf/
│ │ ├── components.py # Flowables: cover page, sections, lists, tables, markdown
│ │ └── document.py # ForgeDocument / SimpleForgeDocument wrappers
│ ├── word/ # Word (.docx) generation
│ └── export/ # Chat export (TXT, PDF, CSV, XLSX)
├── scripts/ # HLN agency invoice/proposal generators
├── examples/ # Example usage scripts
└── tests/ # Test suite
MIT License — see LICENSE for details.
Built with intention by Hidden Leaf Networks — an applied AI studio.